package com.dxhy.common.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.DispatcherType;

/**
 * @description
 * @author  Allen
 * @date    2023/6/28 17:22
*/
@Configuration
public class FilterConfig {
    
    @Bean
    public FilterRegistrationBean<XssFilter> xssFilterRegistration() {
        FilterRegistrationBean<XssFilter> registration = new FilterRegistrationBean<>();
        registration.setDispatcherTypes(DispatcherType.REQUEST);
        registration.setFilter(new XssFilter());
        registration.addUrlPatterns("/*");
        registration.setName("xssFilter");
        registration.setOrder(Integer.MAX_VALUE);
        return registration;
    }
//    @Bean
//    public SentinelResourceAspect sentinelResourceAspect() {
//        return new SentinelResourceAspect();
//    }
//
//    @Bean
//    public FilterRegistrationBean<UserCenterAuthenticationFilter> authenticationFilterRegistration() {
//        FilterRegistrationBean<UserCenterAuthenticationFilter> registration = new FilterRegistrationBean<>();
//        registration.setName("UserCenterAuthenticationFilter");
//        registration.setOrder(1);
//        registration.addUrlPatterns("/*");
//        registration.setFilter(new UserCenterAuthenticationFilter());
//        return registration;
//    }
}
