package com.YuyeTech.HeartRate.config.token;

import com.YuyeTech.HeartRate.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;

/**
 * 配置gameFilter过滤器
 * @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(
                "/app/*",
                "/bluetooth/*",
                "/client_game/*",
                "/device/*",
                "/favorites/*",
                "/FC/*",
                "/fitness_program/*",
                "/game/*",
                "/level/*",
                "/program/*",//登录相关
                "/manager/*",
                "/navigation/*",
                "/OTA/*",
                "/ranking/*",
                "/recently_playing/*",
                "/reward/*",
                "/oss/*",
                "/user_info/*",
                "/wxlogin/*",
                "/tPlat/*",
                "/websocket/APPLog/*");
        registration.setName("gameFilter");
        registration.setOrder(1);
        return registration;
    }

}
