From 23a003787e86ef2d09aba183792cb137649f4c3c Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 3 Jun 2021 14:18:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3token=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E5=AF=BC=E8=87=B4=E7=99=BB=E5=BD=95=E8=B6=85=E6=97=B6?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/io/dataease/auth/filter/JWTFilter.java | 2 +- backend/src/main/java/io/dataease/auth/util/JWTUtils.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java index 768acc42dd..48376db8c6 100644 --- a/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java +++ b/backend/src/main/java/io/dataease/auth/filter/JWTFilter.java @@ -111,7 +111,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter { // JWTUtils.removeTokenExpire(token); String newToken = JWTUtils.sign(tokenInfo, password); // 记录新token操作时间 - // JWTUtils.addTokenExpire(newToken); + JWTUtils.addTokenExpire(newToken); JWTToken jwtToken = new JWTToken(newToken); this.getSubject(request, response).login(jwtToken); diff --git a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java index e71b2ab696..7b25d06748 100644 --- a/backend/src/main/java/io/dataease/auth/util/JWTUtils.java +++ b/backend/src/main/java/io/dataease/auth/util/JWTUtils.java @@ -158,10 +158,12 @@ public class JWTUtils { CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class); Cache tokens_expire = cacheManager.getCache("tokens_expire"); Long expTime = tokens_expire.get(token, Long.class); + // System.out.println("get-------"+token+" :"+expTime); return expTime; } public static void removeTokenExpire(String token){ + // System.out.println("remove----"+token); CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class); Cache tokens_expire = cacheManager.getCache("tokens_expire"); tokens_expire.evict(token); @@ -171,6 +173,7 @@ public class JWTUtils { CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class); Cache tokens_expire = cacheManager.getCache("tokens_expire"); long now = System.currentTimeMillis(); + // System.out.println("add-------"+token+" :"+now); tokens_expire.put(token, now); }