|
@@ -1,6 +1,7 @@
|
|
|
package com.bx.implatform.config;
|
|
package com.bx.implatform.config;
|
|
|
|
|
|
|
|
import com.bx.implatform.interceptor.AuthInterceptor;
|
|
import com.bx.implatform.interceptor.AuthInterceptor;
|
|
|
|
|
+import com.bx.implatform.interceptor.XssInterceptor;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
@@ -15,18 +16,25 @@ public class MvcConfig implements WebMvcConfigurer {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
|
|
|
+ registry.addInterceptor(XssInterceptor())
|
|
|
|
|
+ .addPathPatterns("/**");
|
|
|
registry.addInterceptor(authInterceptor())
|
|
registry.addInterceptor(authInterceptor())
|
|
|
.addPathPatterns("/**")
|
|
.addPathPatterns("/**")
|
|
|
.excludePathPatterns("/login","/logout","/register","/refreshToken",
|
|
.excludePathPatterns("/login","/logout","/register","/refreshToken",
|
|
|
"/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
|
"/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@Bean
|
|
@Bean
|
|
|
public AuthInterceptor authInterceptor() {
|
|
public AuthInterceptor authInterceptor() {
|
|
|
return new AuthInterceptor();
|
|
return new AuthInterceptor();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Bean
|
|
|
|
|
+ public XssInterceptor XssInterceptor() {
|
|
|
|
|
+ return new XssInterceptor();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Bean
|
|
@Bean
|
|
|
public PasswordEncoder passwordEncoder(){
|
|
public PasswordEncoder passwordEncoder(){
|
|
|
// 使用BCrypt加密密码
|
|
// 使用BCrypt加密密码
|