- 一、cas server单点登录服务器修改
cas server4.1.5修改,含义是退出时允许重定向:
<bean id="logoutAction" class="org.jasig.cas.web.flow.LogoutAction"
p:servicesManager-ref="servicesManager"
p:followServiceRedirects="${cas.logout.followServiceRedirects:true}"/>
早期版本修改:
- <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"
- />
- 二、客户端修改
- 1、客户端web.xml中添加
<!-- 填写退出的URL -->
<context-param>
<param-name>casServerLogoutUrl</param-name>
<param-value>https://www.cas.com:8443/cas/logout?locale=zh_CN</param-value>
</context-param>
<!-- 客户服务器地址 -->
<context-param>
<param-name>serverName</param-name>
<param-value>http://www.client.com:8180/CasDemo/</param-value>
</context-param>
- 2、添加一个退出页logout.jsp,内容如下:
<body>
<%
String casServerLogoutUrl=application.getInitParameter("casServerLogoutUrl");
String serverName=application.getInitParameter("serverName");
if(casServerLogoutUrl!=null&&casServerLogoutUrl.indexOf("?")>-1){
casServerLogoutUrl+="&service="+ serverName;
}else{
casServerLogoutUrl+="?service="+ serverName;
}
session.invalidate();
response.sendRedirect(casServerLogoutUrl);
%>
</body>
3、退出操作,如下
<a href="javascript:window.open('<%=basePath%>logout.jsp','_self')">退出</a>

本文介绍了如何配置CAS服务器以实现用户退出时跳转到登录页面或指定页面。首先,展示了CAS server 4.1.5版本的`LogoutAction` bean配置,允许在退出时重定向。接着,讲解了客户端的修改步骤,包括在web.xml中添加casServerLogoutUrl和serverName参数,创建logout.jsp页面以处理退出逻辑,并提供了退出操作的示例代码。通过这些设置,实现了CAS单点登录系统退出后的定制化跳转。
3847

被折叠的 条评论
为什么被折叠?



