Two SSO CAS Framework single point exit, custom Exit interface.

Source: Internet
Author: User

With CAs exit, can only use its own that exit interface, if there is such a requirement, ask to exit automatically jump to the login interface, how to do it? The following article implements a custom jump interface after exiting. Use of CAs, found out is really a trouble, quit after jumping to the CAS logout page, and do not close the browser, in fact, there is no real exit, the input address is still logged in the state. In order to achieve the exit after landing to the jump page, made the following configuration: 1.server modify Src\main\webapp\web-inf\cas-servlet.xml in the Logoutcontroller increase p:followserviceredirects= "true"Make the support logout enter the service parameter as a jump path.
 <  bean  id  = "Logoutcontroller"   class  = "Org.jasig.cas.web.LogoutController"   P:centralauthenticationservice-ref  = "Centralauthenticationservice"   P:logoutview  = "Caslogoutview"   P:warncookiegenerator-ref  = "Warncookiegenerator"   P:ticketgrantingticketcookiegenerator-ref  = "Ticketgrantingticketcookiegenerator"   P:followserviceredirects   = "true"  />  

2. Client

Added in Web. XML before login filter
<!--fill out the exit URL -    <Context-param>      <Param-name>Casserverlogouturl</Param-name>      <Param-value>Http://10.1.83.34:8080/cas/logout</Param-value>    </Context-param>     <!--Single-point exit configuration -      <Listener>      <Listener-class>Org.jasig.cas.client.session.SingleSignOutHttpSessionListener</Listener-class>  </Listener>   <Filter>     <Filter-name>CAS Single Sign Out Filter</Filter-name>     <Filter-class>Org.jasig.cas.client.session.SingleSignOutFilter</Filter-class>  </Filter>  <filter-mapping>     <Filter-name>CAS Single Sign Out Filter</Filter-name>     <Url-pattern>/*</Url-pattern>  </filter-mapping>  

In the JSP, if the exit directly to the Cas/logout, will jump to the CAS logout page, in this case, if you click the browser's Fallback button, the discovery can still normal operation, that is, the session is not written off, Perhaps the CAs logout just removed the TGT.

In order to solve this problem, I have to re-write a JSP, exit button to jump to this JSP, this JSP first logoff session, and then jump to the CAS exit, and add service parameters, so jump to the landing page.
< a       href = "${pagecontext.request.contextpath}/web-root/include/logout.jsp" ></ a >  <  ID= "Box_t5"  class= "TOPTAPS5"> Exit Login < /div>  

Logout.jsp content:

<Body>  <%session.invalidate (); Response.sendredirect (Application. Getinitparameter ("Casserverlogouturl")  + "? service="  +Application.getinitparameter ("ServerName") + "/myweb"); %>  </Body>  

Note: "/myweb" is the default to go to the interface after you exit, Application.getinitparameter, you need to add the Context-parameter configuration in Web. Xml. This will successfully jump to the interface you want to jump to when you sign out.

After testing, you can achieve the desired function.

Two SSO CAS Framework single point exit, custom Exit interface.

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.