优化
This commit is contained in:
@ -54,9 +54,9 @@ public class TokenService {
|
||||
public LoginUser getLoginUser(HttpServletRequest request) {
|
||||
// 获取请求携带的令牌
|
||||
|
||||
String clientIP = ServletUtils.getClientIP();
|
||||
|
||||
String token = getToken(request);
|
||||
// log.info("用户当前token:{}", token);
|
||||
String token = getToken(request);
|
||||
if (Validator.isNotEmpty(token)) {
|
||||
Claims claims = parseToken(token);
|
||||
// 解析对应的权限以及用户信息
|
||||
@ -66,8 +66,8 @@ public class TokenService {
|
||||
String userId = (String) claims.get(Constants.LOGIN_USER_ID);
|
||||
String userKey = getTokenKey(type, userId);
|
||||
LoginUser user = redisCache.getCacheObject(userKey);
|
||||
// log.info("用户当前类型:{}", claims);
|
||||
if(user==null || !uuid.equals(user.getToken())){
|
||||
log.info("用户ip:{},用户ID:{},用户类型:{},用户当前token:{}",clientIP,userId,type,token);
|
||||
throw new BaseException("999","您的账号在其他设备登录");
|
||||
}
|
||||
return user;
|
||||
|
Reference in New Issue
Block a user