elunez / eladmin-mp

eladmin mybatis-plus版本:项目基于 Spring Boot 2.6.4 、MyBatis-Plus、Spring Security、Redis、Vue的前后端分离的后台管理系统, 权限控制采用 RBAC,支持数据字典与数据权限管理,支持一键生成前后端代码,支持动态路由
https://eladmin.vip/demo
Apache License 2.0
458 stars 174 forks source link

token续期传的不是key #29

Closed YING-HX closed 10 months ago

YING-HX commented 11 months ago

这个package me.zhengjie.modules.security.security; public void checkRenewal(String token) { // 判断是否续期token,计算token的过期时间 long time = redisUtils.getExpire(properties.getOnlineKey() + token) * 1000; Date expireDate = DateUtil.offset(new Date(), DateField.MILLISECOND, (int) time); // 判断当前时间与过期时间的时间差 long differ = expireDate.getTime() - System.currentTimeMillis(); // 如果在续期检查的范围内,则续期 if (differ <= properties.getDetect()) { long renew = time + properties.getRenew(); redisUtils.expire(properties.getOnlineKey() + token, renew, TimeUnit.MILLISECONDS); } }

YING-HX commented 11 months ago

redisUtils.getExpire(properties.getOnlineKey() + token) ,这里是不是传错了,导致differ <= properties.getDetect()这里超时了一直在续token