mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-04 04:45:28 +08:00
在线切换部门,用户缓存信息更新 issues/I1X4DT
This commit is contained in:
@ -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";
|
||||
|
||||
/**
|
||||
* 字典信息缓存
|
||||
*/
|
||||
|
||||
@ -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("用户不存在!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user