单点登出.docx

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/henanchina/article/details/3400997

一、配置<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

在每个项目的web.xml里面配置一下过滤器:

<!--start  -->

    <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>

    <!-- end -->

放在以下配置文件的前面:

<filter>

       <filter-name>CAS Filter</filter-name>

       <filter-class>

           edu.yale.its.tp.cas.client.filter.CASFilter

       </filter-class>

       <init-param>

           <param-name>

              edu.yale.its.tp.cas.client.filter.loginUrl

           </param-name>

           <param-value>https://cn12995:8443/cas/login</param-value>

       </init-param>

       <init-param>

           <param-name>

              edu.yale.its.tp.cas.client.filter.validateUrl

           </param-name>

           <param-value>

              https://cn12995:8443/cas/serviceValidate

           </param-value>

       </init-param>

       <init-param>

           <param-name>

              edu.yale.its.tp.cas.client.filter.serverName

           </param-name>

           <param-value>cn12995:8080</param-value>

       </init-param>

    </filter>

 

    <filter-mapping>

       <filter-name>CAS Filter</filter-name>

       <url-pattern>/servlet/*</url-pattern>

 

    </filter-mapping>

二、logout页面

logout页面或者处理的servlet或者action加上一下:

jsp页面加:

<%

session.invalidate();

response.sendRedirect("https://cn12995:8443/cas/logout");

 

%>

处理的servlet或者action加:

HttpSession session = request.getSession();

       session.invalidate();

       response.sendRedirect("https://cn12995:8443/cas/logout");

这样就完成登出了。

展开阅读全文

没有更多推荐了,返回首页