CAS Combat のclient Custom Filters

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.