package com.app.filter;

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

/**
 * 功能描述：
 *
 * @Author 梁展鹏
 * @Date 2021/1/27 14:06
 */
@Configuration
public class FilterRegistrationConfig {

    @Autowired
    private GuardianJwtAuthenticationFilter guardianJwtAuthenticationFilter;

    @Bean
    public FilterRegistrationBean registerLoginCheckFilter() {
        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        registrationBean.setFilter(guardianJwtAuthenticationFilter);
        registrationBean.addUrlPatterns("/api/*");
        registrationBean.setName("guardianJwtAuthenticationFilter");
        registrationBean.setOrder(1);
        return registrationBean;
    }

}
