单点登出.docx

一、配置

在每个项目的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");

这样就完成登出了。

你可能感兴趣的:(jsp,servlet,session,filter,action)