package com.njcn.web.config;

import com.njcn.web.filter.XssFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hongawen
 * @version 1.0.0
 * @createTime 2021年05月20日 17:00
 */
@Configuration
public class AntiSamyConfig {

    /**
     * 配置xss过滤器
     */
    @Bean
    public FilterRegistrationBean create() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new XssFilter());
        filterRegistrationBean.addUrlPatterns("/*");
        filterRegistrationBean.setOrder(1);
        return filterRegistrationBean;
    }

}