access_token 缓存时间变更

This commit is contained in:
zhangchenbiao
2023-10-09 15:48:55 +08:00
parent 0ff7fc974c
commit 9277413d89
2 changed files with 1 additions and 3 deletions

View File

@@ -20,8 +20,6 @@ public class CommonConstants {
public static final int ACCESS_TOKEN_EXPIRE = 14400; public static final int ACCESS_TOKEN_EXPIRE = 14400;
public static final int REFRESH_TOKEN_EXPIRE = 60*60*24*30;
public static final int THREE_DAY_SECONDS = 60*60*24*3; public static final int THREE_DAY_SECONDS = 60*60*24*3;
public static final int NORMAL_LOCK_TIMES = 60 * 1000; public static final int NORMAL_LOCK_TIMES = 60 * 1000;

View File

@@ -74,7 +74,7 @@ public class LoginServiceImpl implements LoginService {
String token = randomNumberGenerator.nextBytes().toHex(); String token = randomNumberGenerator.nextBytes().toHex();
currentUser.setName(enterpriseUser.getName()); currentUser.setName(enterpriseUser.getName());
currentUser.setAccessToken(token); currentUser.setAccessToken(token);
redisUtilPool.setString(MessageFormat.format(CommonConstants.ACCESS_TOKEN_KEY, token), JSON.toJSONString(currentUser), CommonConstants.ACCESS_TOKEN_EXPIRE); redisUtilPool.setString(MessageFormat.format(CommonConstants.ACCESS_TOKEN_KEY, token), JSON.toJSONString(currentUser), CommonConstants.THREE_DAY_SECONDS);
redisUtilPool.setString(currentUser.getUserId(), token); redisUtilPool.setString(currentUser.getUserId(), token);
log.info("[" + enterpriseUser.getName() + "; action_token"+ token + "; userId" + currentUser.getUserId() +"]登入系统成功"); log.info("[" + enterpriseUser.getName() + "; action_token"+ token + "; userId" + currentUser.getUserId() +"]登入系统成功");
return currentUser; return currentUser;