Skip to content

Commit

Permalink
[#466] feat: cors 설정 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
jyajoo committed Oct 27, 2024
1 parent 32ed775 commit 57a42ea
Showing 1 changed file with 1 addition 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;
}
}

0 comments on commit 57a42ea

Please sign in to comment.