From 9e7141f97cb13d8762d8a9cd126511708884a4d9 Mon Sep 17 00:00:00 2001 From: zlyx <1242874891@qq.com> Date: Thu, 22 Sep 2022 11:36:58 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20Sa-Token=20?= =?UTF-8?q?=E6=8B=A6=E6=88=AA=E5=99=A8=E6=B3=A8=E5=86=8C=20SaTokenConfig#a?= =?UTF-8?q?ddInterceptors=20=E6=8E=92=E9=99=A4=E6=8B=A6=E6=88=AA=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=85=8D=E7=BD=AE,=20=E4=BC=98=E5=8C=96=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=20;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/framework/config/SaTokenConfig.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java index f53dc0678..a7c51fa69 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java @@ -34,13 +34,13 @@ public class SaTokenConfig implements WebMvcConfigurer { public void addInterceptors(InterceptorRegistry registry) { // 注册路由拦截器,自定义验证规则 registry.addInterceptor(new SaInterceptor(handler -> { + // 自定义注解 @Anonymous 匿名访问配置,后续版本将删除 ExcludeUrlProperties excludeUrlProperties = SpringUtils.getBean(ExcludeUrlProperties.class); // 登录验证 -- 排除多个路径 SaRouter // 获取所有的 .match("/**") - // 排除下不需要拦截的 - .notMatch(securityProperties.getExcludes()) + // 排除下不需要拦截的(每次匹配) .notMatch(excludeUrlProperties.getExcludes()) // 对未排除的路径进行检查 .check(() -> { @@ -54,7 +54,9 @@ public class SaTokenConfig implements WebMvcConfigurer { // } }); - })).addPathPatterns("/**"); + })).addPathPatterns("/**") + // 排除不需要拦截的路径 + .excludePathPatterns(securityProperties.getExcludes()); } @Bean