From 51c33d21182817d0497615b813900a4b4889ee5f Mon Sep 17 00:00:00 2001 From: zer0Black <694429613@qq.com> Date: Sun, 17 Apr 2022 23:18:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=B7=BB=E5=8A=A0=E3=80=91=E5=A4=84?= =?UTF-8?q?=E7=90=86redis=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/jero/common/util/TokenUtils.java | 2 +- .../src/main/java/com/jero/config/shiro/ShiroRealm.java | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/TokenUtils.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/TokenUtils.java index 810f8e95..277c37ab 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/TokenUtils.java +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/util/TokenUtils.java @@ -81,7 +81,7 @@ public class TokenUtils { String newAuthorization = JwtUtil.sign(userName, passWord); // 设置Toekn缓存有效时间 redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, newAuthorization); - redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000); + redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000); } //update-begin--Author:scott Date:20191005 for:解决每次请求,都重写redis中 token缓存问题 // else { diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/config/shiro/ShiroRealm.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/config/shiro/ShiroRealm.java index 5e2f6522..ce003abc 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/config/shiro/ShiroRealm.java +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/config/shiro/ShiroRealm.java @@ -162,16 +162,9 @@ public class ShiroRealm extends AuthorizingRealm { String newAuthorization = JwtUtil.sign(userName, passWord); // 设置超时时间 redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, newAuthorization); - redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME *2 / 1000); + redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000); log.debug("——————————用户在线操作,更新token保证不掉线—————————jwtTokenRefresh——————— "+ token); } - //update-begin--Author:scott Date:20191005 for:解决每次请求,都重写redis中 token缓存问题 -// else { -// // 设置超时时间 -// redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, cacheToken); -// redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000); -// } - //update-end--Author:scott Date:20191005 for:解决每次请求,都重写redis中 token缓存问题 return true; } return false;