package com.judong.chuanyiserver.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    //注册自己的拦截器,并设置拦截的请求路径
    //addPathPatterns为拦截此请求路径的请求
    //excludePathPatterns为不拦截此路径的请求
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new Interceptors())
                .addPathPatterns("/**")
                .excludePathPatterns("/user/getCodeImage")
                .excludePathPatterns("/user/getPublicKey")
                .excludePathPatterns("/user/frontUserLogin")
                .excludePathPatterns("/user/backUserLogin")
                .excludePathPatterns("/connect/testConnect")
        ;
    }
}
