提交 6aa2ee60 authored 作者: wangjiahao's avatar wangjiahao

Merge remote-tracking branch 'origin/main' into main

...@@ -111,7 +111,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { ...@@ -111,7 +111,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
// JWTUtils.removeTokenExpire(token); // JWTUtils.removeTokenExpire(token);
String newToken = JWTUtils.sign(tokenInfo, password); String newToken = JWTUtils.sign(tokenInfo, password);
// 记录新token操作时间 // 记录新token操作时间
// JWTUtils.addTokenExpire(newToken); JWTUtils.addTokenExpire(newToken);
JWTToken jwtToken = new JWTToken(newToken); JWTToken jwtToken = new JWTToken(newToken);
this.getSubject(request, response).login(jwtToken); this.getSubject(request, response).login(jwtToken);
......
...@@ -158,10 +158,12 @@ public class JWTUtils { ...@@ -158,10 +158,12 @@ public class JWTUtils {
CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class); CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class);
Cache tokens_expire = cacheManager.getCache("tokens_expire"); Cache tokens_expire = cacheManager.getCache("tokens_expire");
Long expTime = tokens_expire.get(token, Long.class); Long expTime = tokens_expire.get(token, Long.class);
// System.out.println("get-------"+token+" :"+expTime);
return expTime; return expTime;
} }
public static void removeTokenExpire(String token){ public static void removeTokenExpire(String token){
// System.out.println("remove----"+token);
CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class); CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class);
Cache tokens_expire = cacheManager.getCache("tokens_expire"); Cache tokens_expire = cacheManager.getCache("tokens_expire");
tokens_expire.evict(token); tokens_expire.evict(token);
...@@ -171,6 +173,7 @@ public class JWTUtils { ...@@ -171,6 +173,7 @@ public class JWTUtils {
CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class); CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class);
Cache tokens_expire = cacheManager.getCache("tokens_expire"); Cache tokens_expire = cacheManager.getCache("tokens_expire");
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
// System.out.println("add-------"+token+" :"+now);
tokens_expire.put(token, now); tokens_expire.put(token, now);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论