34 lines
1.0 KiB
Java
34 lines
1.0 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("/v2/**");
|
|
paths.add("/swagger-ui.html/**");
|
|
paths.add("/doc.html/**");
|
|
paths.add("/error");
|
|
paths.add("/favicon.ico");
|
|
paths.add("/user/login");
|
|
return paths;
|
|
}
|
|
}
|