Skip to content

Commit

Permalink
Merge pull request #469 from Travel-in-nanaland/feat/#466-swagger
Browse files Browse the repository at this point in the history
Feat/#466 swagger
  • Loading branch information
jyajoo authored Oct 27, 2024
2 parents 40bdfb9 + 5bccf5c commit d913669
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ->
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {

Expand Down

0 comments on commit d913669

Please sign in to comment.