优化退出登录

This commit is contained in:
shuzheng 2017-03-05 22:05:12 +08:00
parent 1446ac77ba
commit 4cd1e27b2c
2 changed files with 2 additions and 20 deletions

View File

@ -187,24 +187,6 @@ public class SSOController extends BaseController {
public String logout(HttpServletRequest request, HttpServletResponse response) {
// shiro退出登录
SecurityUtils.getSubject().logout();
Subject subject = SecurityUtils.getSubject();
String serverSessionId = subject.getSession().getId().toString();
// 当前全局会话token
String token = RedisUtil.get(ZHENG_UPMS_SERVER_SESSION_ID + "_" + serverSessionId);
// 清除全局会话
RedisUtil.remove(ZHENG_UPMS_SERVER_SESSION_ID + "_" + serverSessionId);
// 清除token校验值
RedisUtil.remove(ZHENG_UPMS_SERVER_TOKEN + "_" + token);
// 清除所有局部会话
Jedis jedis = RedisUtil.getJedis();
Set<String> clientSessionIds = jedis.smembers(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + token);
for (String clientSessionId : clientSessionIds) {
jedis.del(ZHENG_UPMS_CLIENT_SESSION_ID + "_" + clientSessionId);
jedis.srem(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + token, clientSessionId);
}
_log.debug("当前token={},对应的注册系统个数:{}个", token, jedis.scard(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + token));
jedis.close();
// 跳回原地址
String redirectUrl = request.getHeader("Referer");
if (null == redirectUrl) {

View File

@ -77,7 +77,7 @@ public class UpmsSessionDao extends EnterpriseCacheSessionDAO {
// 当前全局会话token
String token = RedisUtil.get(ZHENG_UPMS_SERVER_SESSION_ID + "_" + serverSessionId);
// 清除全局会话
RedisUtil.remove(ZHENG_UPMS_SERVER_SESSION_ID + "_" + serverSessionId);
// RedisUtil.remove(ZHENG_UPMS_SERVER_SESSION_ID + "_" + serverSessionId);
// 清除token校验值
RedisUtil.remove(ZHENG_UPMS_SERVER_TOKEN + "_" + token);
// 清除所有局部会话
@ -140,7 +140,7 @@ public class UpmsSessionDao extends EnterpriseCacheSessionDAO {
// 当前全局会话token
String token = RedisUtil.get(ZHENG_UPMS_SERVER_SESSION_ID + "_" + serverSessionId);
// 清除全局会话
RedisUtil.remove(ZHENG_UPMS_SERVER_SESSION_ID + "_" + serverSessionId);
// RedisUtil.remove(ZHENG_UPMS_SERVER_SESSION_ID + "_" + serverSessionId);
// 清除token校验值
RedisUtil.remove(ZHENG_UPMS_SERVER_TOKEN + "_" + token);
// 清除所有局部会话