解决Satoken(1.29.0+)组件关于token过期时间续期问题(续签问题)

pull/243/head
wangxu 2024-12-15 23:38:55 +08:00
parent 62e74bed77
commit 2b503850bf
2 changed files with 9 additions and 2 deletions

View File

@ -12,6 +12,7 @@
*/
package vip.xiaonuo.core.config;
import cn.dev33.satoken.config.SaTokenConfig;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaResponse;
import cn.dev33.satoken.filter.SaServletFilter;
@ -95,6 +96,9 @@ import java.util.Map;
@MapperScan(basePackages = {"vip.xiaonuo.**.mapper"})
public class GlobalConfigure implements WebMvcConfigurer {
@Autowired
private SaTokenConfig saTokenConfig;
private static final String COMMON_REPEAT_SUBMIT_CACHE_KEY = "common-repeatSubmit:";
/**
@ -213,7 +217,11 @@ public class GlobalConfigure implements WebMvcConfigurer {
// 排除C端认证接口
.notMatch(CollectionUtil.newArrayList(CLIENT_USER_PERMISSION_PATH_ARR))
// 校验B端登录
.check(r1 -> StpUtil.checkLogin());
.check(r1 -> {
StpUtil.checkLogin();
// 更新过期时间
StpUtil.renewTimeout(saTokenConfig.getTimeout());
});
// C端的接口校验C端登录
SaRouter.match("/**")

View File

@ -138,7 +138,6 @@ easy-trans.is-enable-cloud=false
sa-token.token-name=token
sa-token.timeout=2592000
sa-token.active-timeout=-1
sa-token.dynamic-active-timeout=true
sa-token.is-concurrent=true
sa-token.is-share=false
sa-token.max-login-count=-1