package com.inspect.common.security.config;

import com.inspect.common.security.interceptor.HeaderInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

public class WebMvcConfig implements WebMvcConfigurer {
    public static final String[] excludeUrls = new String[]{"/login", "/logout", "/refresh"};

    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(this.getHeaderInterceptor()).addPathPatterns("/**").excludePathPatterns(excludeUrls).order(-10);
    }

    @Bean
    public HeaderInterceptor getHeaderInterceptor() {
        return new HeaderInterceptor();
    }
}
