You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.4 KiB
Java
42 lines
1.4 KiB
Java
package com.supervision.config;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
@Configuration
|
|
public class WebConfig implements WebMvcConfigurer {
|
|
|
|
|
|
@Override
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
// 添加权限拦截器
|
|
registry.addInterceptor(new JwtInterceptor())
|
|
.addPathPatterns("/**")
|
|
.excludePathPatterns(ignorePathPatterns());
|
|
}
|
|
|
|
public List<String> ignorePathPatterns() {
|
|
List<String> paths = new ArrayList<>();
|
|
paths.add("/swagger-resources/**");
|
|
paths.add("/webjars/**");
|
|
paths.add("/v3/**");
|
|
paths.add("/swagger-ui.html/**");
|
|
paths.add("/swagger-ui/**");
|
|
paths.add("/webjars/");
|
|
paths.add("/doc.html/**");
|
|
paths.add("/error");
|
|
paths.add("/favicon.ico");
|
|
paths.add("/user/login");
|
|
paths.add("/minio/downloadFile");
|
|
paths.add("/minio/uploadFile");
|
|
paths.add("/user/changePassWord");
|
|
paths.add("/fileManage/downloadFile");
|
|
// 开发环境,放开不校验token.每次修改这里需要重启(热部署不行)
|
|
// paths.add("/**");
|
|
return paths;
|
|
}
|
|
}
|