From 4ea389dbf8c59c24d5294fc2083eb3a1eaa767bc Mon Sep 17 00:00:00 2001 From: sonsumin Date: Fri, 22 Nov 2024 15:43:41 +0900 Subject: [PATCH] =?UTF-8?q?[#2]=F0=9F=90=9BFix:=20CORS=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/auth/config/SecurityConfig.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/univ/yesummit/global/auth/config/SecurityConfig.java b/src/main/java/univ/yesummit/global/auth/config/SecurityConfig.java index ea9a55d..1504265 100644 --- a/src/main/java/univ/yesummit/global/auth/config/SecurityConfig.java +++ b/src/main/java/univ/yesummit/global/auth/config/SecurityConfig.java @@ -57,7 +57,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti .csrf(AbstractHttpConfigurer::disable) // cors 설정 - .cors(cors -> cors.configurationSource(corsConfigurationSource())) +// .cors(cors -> cors.configurationSource(corsConfigurationSource())) // 시큐리티 기본 로그인 비활성화 .formLogin(AbstractHttpConfigurer::disable) @@ -102,18 +102,18 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti // @Value("${cors.allowed-origins") // private List allowOriginList; - @Bean - public CorsConfigurationSource corsConfigurationSource() { - CorsConfiguration configuration = new CorsConfiguration(); - configuration.addAllowedOrigin("http://localhost:3000"); // 클라이언트 주소 - configuration.addAllowedMethod("*"); - configuration.addAllowedHeader("*"); - configuration.setAllowCredentials(true); - configuration.addExposedHeader("Authorization"); - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - source.registerCorsConfiguration("/**", configuration); - return source; - } +// @Bean +// public CorsConfigurationSource corsConfigurationSource() { +// CorsConfiguration configuration = new CorsConfiguration(); +// configuration.addAllowedOrigin("http://localhost:3000"); // 클라이언트 주소 +// configuration.addAllowedMethod("*"); +// configuration.addAllowedHeader("*"); +// configuration.setAllowCredentials(true); +// configuration.addExposedHeader("Authorization"); +// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); +// source.registerCorsConfiguration("/**", configuration); +// return source; +// } public class JwtAuthenticationFilter extends OncePerRequestFilter { private final JwtUtils jwtUtils;