diff --git a/src/main/java/com/jeju/nanaland/global/config/SecurityConfig.java b/src/main/java/com/jeju/nanaland/global/config/SecurityConfig.java index d70b33b1..4f4542b8 100644 --- a/src/main/java/com/jeju/nanaland/global/config/SecurityConfig.java +++ b/src/main/java/com/jeju/nanaland/global/config/SecurityConfig.java @@ -19,9 +19,6 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.CorsConfigurationSource; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; @Configuration @EnableWebSecurity @@ -40,7 +37,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http, .httpBasic(AbstractHttpConfigurer::disable) .formLogin(AbstractHttpConfigurer::disable) .logout(AbstractHttpConfigurer::disable) - .cors(cors -> cors.configurationSource(corsConfigurationSource())) + .cors(AbstractHttpConfigurer::disable) .headers(c -> c.frameOptions( FrameOptionsConfig::disable).disable()) .sessionManagement(c -> @@ -83,21 +80,4 @@ public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } - @Bean - public CorsConfigurationSource corsConfigurationSource() { - CorsConfiguration configuration = new CorsConfiguration(); - - configuration.addAllowedOrigin("http://13.125.110.80:8083"); - configuration.addAllowedOrigin("https://nanaland.site"); - - configuration.setAllowCredentials(true); - configuration.addAllowedHeader("*"); - configuration.addAllowedMethod("*"); - configuration.setMaxAge(3600L); - - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - source.registerCorsConfiguration("/**", configuration); - - return source; - } } diff --git a/src/main/java/com/jeju/nanaland/global/config/SwaggerConfig.java b/src/main/java/com/jeju/nanaland/global/config/SwaggerConfig.java index 1184e77b..6d27ebf8 100644 --- a/src/main/java/com/jeju/nanaland/global/config/SwaggerConfig.java +++ b/src/main/java/com/jeju/nanaland/global/config/SwaggerConfig.java @@ -1,5 +1,7 @@ package com.jeju.nanaland.global.config; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.servers.Server; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; @@ -9,6 +11,13 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +@OpenAPIDefinition( + servers = { + @Server(url = "http://13.125.110.80:8083", description = "DEV"), + @Server(url = "https://nanaland.site", description = "PROD"), + @Server(url = "http://localhost:8080", description = "LOCAL") + } +) @Configuration public class SwaggerConfig {