feat: 配置Sa-Token拦截器排除静态资源和API文档路径
- 添加静态资源路径排除配置(/picture/**、/static/**等) - 添加API文档路径排除配置(/swagger-ui/**、/v3/api-docs/**等) - 优化拦截器配置以提高性能和用户体验
This commit is contained in:
parent
0804bdf14e
commit
065c9884ad
@ -17,7 +17,23 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
// 注册 Sa-Token 拦截器,打开注解式鉴权功能
|
// 注册 Sa-Token 拦截器,打开注解式鉴权功能
|
||||||
registry.addInterceptor(new SaInterceptor()).addPathPatterns("/**");
|
registry.addInterceptor(new SaInterceptor())
|
||||||
|
.addPathPatterns("/**")
|
||||||
|
.excludePathPatterns(
|
||||||
|
// 排除静态资源
|
||||||
|
"/picture/**",
|
||||||
|
// 排除其他静态资源
|
||||||
|
"/favicon.ico",
|
||||||
|
"/static/**",
|
||||||
|
"/css/**",
|
||||||
|
"/js/**",
|
||||||
|
"/img/**",
|
||||||
|
// 排除API文档
|
||||||
|
"/swagger-ui/**",
|
||||||
|
"/v3/api-docs/**",
|
||||||
|
"/swagger-ui.html",
|
||||||
|
"/webjars/**"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user