Shiro-cas single-point exit and shiro-cas single-point exit

Source: Internet
Author: User

Shiro-cas single-point exit and shiro-cas single-point exit

Single-point exit after shiro and CAS are integrated

After exiting any application, all applications must log on again.

 

Implementation idea shiro redirects to cas again after exiting the system

1. reconfigure the logout jump of shiro

Go to cas exit after shiro exits

After cas exits, it uses the service parameter to jump to the response page

Xml Code
  • <Bean id = "logout" class = "org. apache. shiro. web. filter. authc. LogoutFilter">
  • <Property name = "redirectUrl"
  • Value = "http: // localhost: 7070/cas/logout? Service = http: // localhost: 8088/pwenter/cas-login "/>
  • </Bean>
  • <bean id="logout" class="org.apache.shiro.web.filter.authc.LogoutFilter">          <property name="redirectUrl"        value="http://localhost:7070/cas/logout?service=http://localhost:8088/pwenter/cas-login"/></bean>

     

    2. Override shiro's default exit implementation

    Overwrite the configured logout with shiro's default logout.

    Xml Code
  • <Property name = "filters">
  • <Util: map>
  • <Entry key = "authc" value-ref = "formAuthenticationFilter"/>
  • <Entry key = "cas" value-ref = "casFilter"/>
  • <Entry key = "logout" value-ref = "logout"/>
  • </Util: map>
  • </Property>
  • <property name="filters"><util:map><entry key="authc" value-ref="formAuthenticationFilter" /><entry key="cas" value-ref="casFilter" /><entry key="logout" value-ref="logout" /></util:map></property>

     

    3. Open cas's exit redirection switch to modify the cas-servlet.xml file in cas

    Change the cas. logout. followServiceRedirects: false attribute to cas. logout. followServiceRedirects: true.

    Xml Code
  • <Bean id = "logoutAction" class = "org. jasig. cas. web. flow. LogoutAction"
  • P: servicesManager-ref = "servicesManager"
  • P: followServiceRedirects = "$ {cas. logout. followServiceRedirects: true}"/>
  • <bean id="logoutAction" class="org.jasig.cas.web.flow.LogoutAction"        p:servicesManager-ref="servicesManager"        p:followServiceRedirects="${cas.logout.followServiceRedirects:true}"/>

     

    Java enterprise-level general permission security framework source code SpringMVC mybatis or hibernate + ehcache shiro druid bootstrap HTML5

    [Download java framework source code]

    Related Article

    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.