依赖sa-token升级:1.35.0.RC => 1.36.0

This commit is contained in:
dataprince 2023-09-28 22:08:54 +08:00
parent 6b2bb7fcbe
commit d413baeb98
2 changed files with 5 additions and 28 deletions

View File

@ -19,7 +19,7 @@
<java.version>17</java.version>
<spring-boot.version>3.1.4</spring-boot.version>
<mybatis-flex.version>1.6.7</mybatis-flex.version>
<satoken.version>1.35.0.RC</satoken.version>
<satoken.version>1.36.0</satoken.version>
<mysql.version>8.0.33</mysql.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<HikariCP.version>5.0.1</HikariCP.version>

View File

@ -40,33 +40,11 @@ public class SecurityConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) {
// 注册路由拦截器自定义验证规则
registry.addInterceptor(new SaInterceptor(handler -> {
//AllUrlHandler allUrlHandler = SpringUtils.getBean(AllUrlHandler.class);
AllUrlHandler allUrlHandler = SpringUtils.getBean(AllUrlHandler.class);
// 登录验证 -- 排除多个路径
SaRouter
// 获取所有的
//.match(allUrlHandler.getUrls()) // 拦截的 path 列表
.match("/**")
.notMatch(
Arrays.asList(
"/*.html",
"/**/*.html",
"/**/*.css",
"/**/*.js",
"/**/*.css",
"/**/*.js",
"/profile/**",
"/favicon.ico",
"/error",
"/*/api-docs",
"/*/api-docs/**",
"/swagger-ui/index.html",
"/actuator",
"/actuator/**",
"/login",
"/register",
"/captchaImage",
"/captcha/get",
"/captcha/check"))
.match(allUrlHandler.getUrls()) // 拦截的 path 列表
.check(() -> {
// 检查是否登录 是否有token
StpUtil.checkLogin();
@ -74,9 +52,8 @@ public class SecurityConfig implements WebMvcConfigurer {
//TODO :以后完善多平台登录校验clientID功能
});
})).addPathPatterns("/**");
})).addPathPatterns("/**")
// 排除不需要拦截的路径
//.excludePathPatterns(securityProperties.getExcludes());
.excludePathPatterns(securityProperties.getExcludes());
}
}