/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.base.config;

import com.codvision.base.filter.LoginFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

/**
 * 文件存储配置
 *
 * @author lingee
 * @date 2023/8/14
 */
@Configuration
@ComponentScan(basePackages = "com.codvision.base")
public class BaseConfig {

    @Bean
    public FilterRegistrationBean<LoginFilter> staticResourceLoginFilter() {
        FilterRegistrationBean<LoginFilter> registration = new FilterRegistrationBean<>();
        registration.setName("loginCheckFilter");
        registration.setFilter(new LoginFilter());
        registration.addUrlPatterns("/backend/*");
        // 指定优先级
        registration.setOrder(-1);
        return registration;
    }
}
