package com.td.boss.config.token;

import com.td.boss.filter.gameFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.DelegatingFilterProxy;

import javax.servlet.Filter;

/**
 * @author:slambb
 * @date:2021/03/27
 */
@Configuration
public class WebConfig {

    @Bean
    public Filter gameFilter() {
        return new gameFilter();
    }


    @Bean
    public FilterRegistrationBean authorizeFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new DelegatingFilterProxy("gameFilter"));
        registration.addUrlPatterns("/*");
        registration.setName("gameFilter");
        registration.setOrder(1);
        return registration;
    }

}
