From 200b28e9a1a3f56dc1617d35b6a4ed42b4e55c5d Mon Sep 17 00:00:00 2001 From: "sungjin.choi" Date: Mon, 20 Jul 2026 15:09:45 +0900 Subject: [PATCH] =?UTF-8?q?feat=20-=20=EC=9D=B8=EA=B0=80=20url=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../specialsource/config/WebMvcConfig.java | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/main/java/company/specialsource/config/WebMvcConfig.java b/src/main/java/company/specialsource/config/WebMvcConfig.java index f9d0a2f..d098188 100644 --- a/src/main/java/company/specialsource/config/WebMvcConfig.java +++ b/src/main/java/company/specialsource/config/WebMvcConfig.java @@ -1,28 +1,20 @@ package company.specialsource.config; -import org.springframework.context.annotation.Bean; +import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.web.SecurityFilterChain; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration -@EnableWebSecurity -public class WebMvcConfig { +@RequiredArgsConstructor +public class WebMvcConfig implements WebMvcConfigurer { - @Bean - public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - http - // 1. ๐ŸŸข ์™ธ๋ถ€ ๋งคํฌ๋กœ์˜ POST ์š”์ฒญ์ด ํ†ต๊ณผํ•  ์ˆ˜ ์žˆ๋„๋ก CSRF ๋ณดํ˜ธ ๋Œ€์ƒ์—์„œ ์—…๋กœ๋“œ API๋ฅผ ์ œ์™ธํ•ฉ๋‹ˆ๋‹ค. - .csrf(csrf -> csrf - .ignoringRequestMatchers("/api/sync/upload") - ) - // 2. ๐ŸŸข ๋กœ๊ทธ์ธ์ด๋‚˜ ๋ณ„๋„์˜ ์ธ์ฆ ํ† ํฐ ์—†์ด๋„ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋„๋ก ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค. - .authorizeHttpRequests(auth -> auth - .requestMatchers("/api/sync/upload").permitAll() - .anyRequest().authenticated() - ); + private final VisitorInterceptor visitorInterceptor; - return http.build(); + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(visitorInterceptor) +// .addPathPatterns("/api/**") // ๐ŸŸข ๋ชจ๋“  API ์ฃผ์†Œ๋กœ ๋“ค์–ด์˜ค๋Š” ๊ธธ๋ชฉ์„ ์ฐจ๋‹จํ•˜์—ฌ ๊ฐ์‹œ + .excludePathPatterns("/api/analytics/**", "/static/**", "/favicon.ico"); // ํ†ต๊ณ„ ์กฐํšŒ API ์ž์ฒด๋Š” ์ค‘๋ณต ์นด์šดํŒ… ์ฐจ๋‹จ } } \ No newline at end of file