在线切换部门,用户缓存信息更新 issues/I1X4DT

This commit is contained in:
zhangdaiscott
2020-10-12 16:23:45 +08:00
parent b92bec3eed
commit 89f4d122dd
5 changed files with 2 additions and 47 deletions

View File

@ -7,11 +7,6 @@ package org.jeecg.common.constant;
*/
public interface CacheConstant {
/**
* 缓存用户jwt
*/
public static final String SYS_USERS_CACHE_JWT = "sys:cache:user:jwt";
/**
* 字典信息缓存
*/

View File

@ -114,14 +114,7 @@ public class ShiroRealm extends AuthorizingRealm {
// 查询用户信息
log.debug("———校验token是否有效————checkUserTokenIsEffect——————— "+ token);
LoginUser loginUser = (LoginUser) redisUtil.get(CacheConstant.SYS_USERS_CACHE_JWT+":"+token);
//TODO 当前写法导致两个小时操作中token过期
//如果redis缓存用户信息为空则通过接口获取用户信息,避免超过两个小时操作中token过期
if(loginUser==null){
loginUser = commonAPI.getUserByName(username);
//密码二次加密因为存于redis会泄露
loginUser.setPassword(SecureUtil.md5(loginUser.getPassword()));
}
LoginUser loginUser = commonAPI.getUserByName(username);
if (loginUser == null) {
throw new AuthenticationException("用户不存在!");
}