We have definitely written the following code in configuring CAS client:
<Filter> <Filter-name>Casfilter</Filter-name> <Filter-class>Org.jasig.cas.client.authentication.AuthenticationFilter</Filter-class> <Filter-class>Com.founder.ec.sso.filter.CASFilter</Filter-class> <Init-param> <Param-name>Casserverloginurl</Param-name> <Param-value>Http://localhost:8082/cas/login</Param-value> </Init-param> <Init-param> <Param-name>ServerName</Param-name> <Param-value>http://localhost:8008/</Param-value> </Init-param> </Filter> <filter-mapping> <Filter-name>Casfilter</Filter-name> <Url-pattern>/*</Url-pattern> </filter-mapping>
When customizing a filter, you only need to change the default Casfilter class path to a custom filter class.
Casfilter must inherit Abstractcasfilter, overwriting all methods inside except isrequesturlexcluded, and overriding the Isrequesturlexcluded method.
Private BooleanIsrequesturlexcluded (FinalHttpServletRequest request,Finalhttpservletresponse Response) { BooleanFlag =false; String PathInfo= ""; String Servletpath=Request.getservletpath (); if(Request.getpathinfo ()! =NULL) PathInfo =Request.getpathinfo (); if( servletpath.equals ( "/testsend.jsp") | | Pathinfo.equals ("/ds/getdataxmlinstr") | |) {flag=true; }Else if(Servletpath.indexof ("login.jsp") >-1) {flag=false; } returnFlag; }
Set the request for release to the condition that flag is true.
CAS Combat のclient Custom Filters