CAS Logout 通知所有登录客户端销毁Session
具体通知由org.jasig.cas.authentication.principal.AbstractWebApplicationService发出。logOutOfService方法生成发送消息,然后由org.jasig.cas.util.HttpClient的sendMessageToEndPoint方法发出。
public boolean sendMessageToEndPoint(final String url, final String message) {
HttpURLConnection connection = null;
BufferedReader in = null;
try {
if (log.isDebugEnabled()) {
log.debug("Attempting to access " + url);
}
final URL logoutUrl = new URL(url);
final String output = "logoutRequest=" + URLEncoder.encode(message, "UTF-8");
connection = (HttpURLConnection) logoutUrl.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setReadTimeout(this.readTimeout);
connection.setConnectTimeout(this.connectionTimeout);
connection.setRequestProperty("Content-Length", ""
+ Integer.toString(output.getBytes().length));
connection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
final DataOutputStream printout = new DataOutputStream(connection
.getOutputStream());
printout.writeBytes(output);
printout.flush();
printout.close();
in = new BufferedReader(new InputStreamReader(connection
.getInputStream()));
while (in.readLine() != null) {
// nothing to do
}
if (log.isDebugEnabled()) {
log.debug("Finished sending message to" + url);
}
return true;
} catch (final Exception e) {
log.error(e,e);
return false;
} finally {
if (in != null) {
try {
in.close();
} catch (final IOException e) {
// can't do anything
}
}
if (connection != null) {
connection.disconnect();
}
}
}
http://blog.csdn.net/redstarofsleep/article/details/51190407
http://blog.csdn.net/lovesummerforever/article/details/36386207
http://zhenkm0507.iteye.com/blog/546785
http://www.cnblogs.com/wangyang108/p/5842275.html
http://dinguangx.iteye.com/blog/1845119
http://libinchinabj.iteye.com/blog/2178155
CAS4.2单点登录如何配置多个系统登录一次和退出到登录页问题 200
对于cas4.0在cas-server.xml中搜索logoutAction,将${cas.logout.followServiceRedirects:false}中的false改成true,如下:
<bean id="logoutAction" class="org.jasig.cas.web.flow.LogoutAction"
p:servicesManager-ref="servicesManager"
p:followServiceRedirects="${cas.logout.followServiceRedirects:true}"/>
至于cas4.2,cas-server.xml中少了很多东西,把这三行放到最后试试