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.
34 lines
1.0 KiB
Java
34 lines
1.0 KiB
Java
2 years ago
|
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;
|
||
|
}
|
||
|
}
|