update 优化处理过期方法 采用新写法

This commit is contained in:
疯狂的狮子li 2021-10-21 15:59:34 +08:00
parent c9274307f2
commit 6ab575cd49

View File

@ -37,12 +37,12 @@ public class ResourcesConfig implements WebMvcConfigurer {
// 注册路由拦截器自定义验证规则 // 注册路由拦截器自定义验证规则
registry.addInterceptor(new SaRouteInterceptor((request, response, handler) -> { registry.addInterceptor(new SaRouteInterceptor((request, response, handler) -> {
// 登录验证 -- 排除多个路径 // 登录验证 -- 排除多个路径
SaRouter.match( SaRouter
//获取所有的 // 获取所有的
Collections.singletonList("/**"), .match(Collections.singletonList("/**"))
//排除下不需要拦截的 // 排除下不需要拦截的
Arrays.asList(securityProperties.getExcludes()), .notMatch(Arrays.asList(securityProperties.getExcludes()))
() -> { .check(() -> {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
if(StringUtils.isNotNull(userId) ) { if(StringUtils.isNotNull(userId) ) {
long tokenTimeout = StpUtil.getTokenTimeout(); long tokenTimeout = StpUtil.getTokenTimeout();