1 changed files with 26 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||||
|
package cn.chjyj.szwh.configure; |
||||
|
|
||||
|
import cn.chjyj.szwh.xss.XssFilter; |
||||
|
import org.springframework.boot.web.servlet.FilterRegistrationBean; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
import javax.servlet.DispatcherType; |
||||
|
|
||||
|
/** |
||||
|
* Filter配置 |
||||
|
* |
||||
|
*/ |
||||
|
@Configuration |
||||
|
public class FilterConfig { |
||||
|
@Bean |
||||
|
public FilterRegistrationBean xssFilterRegistration() { |
||||
|
FilterRegistrationBean registration = new FilterRegistrationBean(); |
||||
|
registration.setDispatcherTypes(DispatcherType.REQUEST); |
||||
|
registration.setFilter(new XssFilter()); |
||||
|
registration.addUrlPatterns("/*"); |
||||
|
registration.setName("xssFilter"); |
||||
|
registration.setOrder(Integer.MAX_VALUE); |
||||
|
return registration; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue