content: package kr.allcll.backend.config;
  
  import kr.allcll.backend.support.web.AuthInterceptor;
  import lombok.RequiredArgsConstructor;
  import lombok.extern.slf4j.Slf4j;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.servlet.config.annotation.CorsRegistry;
  import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  
  @Slf4j
  @Configuration
  @RequiredArgsConstructor
  public class WebMvcConfig implements WebMvcConfigurer {
  
      private final AuthInterceptor authInterceptor;
  
      @Value("${cors.dev}")
      private String devUrl;
  
      @Value("${cors.admin}")
      private String adminUrl;
  
      @Override
      public void addInterceptors(InterceptorRegistry registry) {
          registry.addInterceptor(authInterceptor)
              .excludePathPatterns("/api/subject/upload");
      }
  
      @Override
      public void addCorsMappings(CorsRegistry registry) {
          registry.addMapping("/**")
              .allowedOrigins(
                  devUrl,
                  adminUrl,
                  "https://allcll.kr",
                  "https://www.allcll.kr",
                  "https://localhost:5173",
                  "http://localhost:5173",
                  "https://admin.allcll.kr",
                  "https://dev-admin.allcll.kr"
              )
              .allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
              .allowCredentials(true);
      }
  }
  