标签:
<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.客户端
<!-- 填写退出的URL --> <context-param> <param-name>casServerLogoutUrl</param-name> <param-value>http://10.1.83.34:8080/cas/logout</param-value> </context-param> <!--单点退出配置--> <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>
在JSP中,如果直接把退出转到cas/logout之后,会跳转到CAS的注销页面,这个情况下,如果直接点击浏览器的回退按钮,发现仍然可以正常操作,也就是session并没有被注销掉,可能CAS的logout只是去掉了TGT吧。
<a href="${pageContext.request.contextPath}/web-root/include/logout.jsp" ></a> <div id="box_T5" class="toptaps5">退出登录</div>
logout.jsp内容:
<body> <% session.invalidate(); response.sendRedirect(application .getInitParameter("casServerLogoutUrl") + "?service=" + application.getInitParameter("serverName") + "/myweb"); %> </body>
说明:"/myweb"就是你退出后默认转到的界面, application.getInitParameter,需要自己在web.xml中加入context-parameter的配置. 这样才能成功跳转到你退出登录后想要跳转到的界面.
标签:
原文地址:http://www.cnblogs.com/yangmengdx3/p/4565318.html