This commit is contained in:
zt
2025-05-13 16:35:09 +08:00
parent 88cd11228b
commit ee9fd26068
8 changed files with 149 additions and 4 deletions

View File

@ -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;