package com.winsun.intercept;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chengfengluo
 * @date 2022-03-15 14:58
 */
@Slf4j
@Configuration
public class AuthConfigurationSupport extends WebMvcConfigurationSupport {

    @Autowired
    private AuthIntercept authIntercept;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        log.info("配置拦截中");
        List<String> s = new ArrayList<>();
        s.add("/login");
        s.add("/getPhoneCode");
        registry.addInterceptor(authIntercept).excludePathPatterns(s);
        super.addInterceptors(registry);
    }
}
