|
@@ -21,6 +21,7 @@ import eu.bitwalker.useragentutils.UserAgent;
|
|
|
import io.jsonwebtoken.Claims;
|
|
|
import io.jsonwebtoken.Jwts;
|
|
|
import io.jsonwebtoken.SignatureAlgorithm;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
/**
|
|
|
* token验证处理
|
|
@@ -74,6 +75,10 @@ public class TokenService
|
|
|
if(StringUtils.isEmpty(uuid)){
|
|
|
uuid = (String) claims.get(Constants.LOGIN_USER_KEY_APP);
|
|
|
}
|
|
|
+
|
|
|
+// if (token.equals(redisCache.getCacheObject(token))) {
|
|
|
+// redisCache.setCacheObject(userKey, loginUser.getToken());
|
|
|
+// }
|
|
|
String userKey = getTokenKey(uuid);
|
|
|
LoginUser user = redisCache.getCacheObject(userKey);
|
|
|
return user;
|
|
@@ -124,6 +129,7 @@ public class TokenService
|
|
|
|
|
|
Map<String, Object> claims = new HashMap<>();
|
|
|
claims.put(Constants.LOGIN_USER_KEY, token);
|
|
|
+ claims.put(loginUser.getToken(), loginUser.getToken());
|
|
|
return createToken(claims);
|
|
|
}
|
|
|
/**
|
|
@@ -172,6 +178,7 @@ public class TokenService
|
|
|
loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
|
|
|
// 根据uuid将loginUser缓存
|
|
|
String userKey = getTokenKey(loginUser.getToken());
|
|
|
+ redisCache.setCacheObject(loginUser.getToken(), loginUser.getToken());
|
|
|
redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
|
|
|
}
|
|
|
/**
|