diff --git a/src/main/java/com/onebyone/kindergarten/global/config/SecurityConfig.java b/src/main/java/com/onebyone/kindergarten/global/config/SecurityConfig.java index e3961f5..a6077ae 100644 --- a/src/main/java/com/onebyone/kindergarten/global/config/SecurityConfig.java +++ b/src/main/java/com/onebyone/kindergarten/global/config/SecurityConfig.java @@ -35,24 +35,24 @@ public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } - @Bean - public CorsConfigurationSource corsConfigurationSource() { - CorsConfiguration configuration = new CorsConfiguration(); - configuration.setAllowedOrigins(List.of("http://localhost:3000", "https://one-by-one-fe-git-main-purplenibs-projects.vercel.app")); - configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS")); - configuration.setAllowedHeaders(List.of("*")); - configuration.setAllowCredentials(true); +// @Bean +// public CorsConfigurationSource corsConfigurationSource() { +// CorsConfiguration configuration = new CorsConfiguration(); +// configuration.setAllowedOrigins(List.of("http://localhost:3000", "https://one-by-one-fe-git-main-purplenibs-projects.vercel.app")); +// configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS")); +// configuration.setAllowedHeaders(List.of("*")); +// configuration.setAllowCredentials(true); - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - source.registerCorsConfiguration("/**", configuration); - return source; - } +// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); +// source.registerCorsConfiguration("/**", configuration); +// return source; +// } @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http - .cors(Customizer.withDefaults()) + // .cors(Customizer.withDefaults()) .csrf(csrf -> csrf.disable()) // Non-Browser Clients만을 위한 API 서버이므로, CSRF 보호 기능 해제 .headers(headers -> headers.frameOptions(frame -> frame.sameOrigin())) // h2-console 사용을 위한 설정 diff --git a/src/main/java/com/onebyone/kindergarten/global/config/WebConfig.java b/src/main/java/com/onebyone/kindergarten/global/config/WebConfig.java index e286ddf..07a84bf 100644 --- a/src/main/java/com/onebyone/kindergarten/global/config/WebConfig.java +++ b/src/main/java/com/onebyone/kindergarten/global/config/WebConfig.java @@ -1,19 +1,19 @@ -package com.onebyone.kindergarten.global.config; +// package com.onebyone.kindergarten.global.config; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +// import org.springframework.context.annotation.Configuration; +// import org.springframework.web.servlet.config.annotation.CorsRegistry; +// import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -@Configuration -public class WebConfig implements WebMvcConfigurer { +// @Configuration +// public class WebConfig implements WebMvcConfigurer { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**") - .allowedOrigins("https://one-by-one-fe-git-main-purplenibs-projects.vercel.app", - "http://localhost:3000") - .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") - .allowedHeaders("*") - .allowCredentials(true); - } -} +// @Override +// public void addCorsMappings(CorsRegistry registry) { +// registry.addMapping("/**") +// .allowedOrigins("https://one-by-one-fe-git-main-purplenibs-projects.vercel.app", +// "http://localhost:3000") +// .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") +// .allowedHeaders("*") +// .allowCredentials(true); +// } +// }