1
1
package org .flow .gateway .common .security ;
2
2
3
3
import java .util .Arrays ;
4
+ import java .util .Collections ;
4
5
5
6
import org .springframework .context .annotation .Bean ;
6
7
import org .springframework .context .annotation .Configuration ;
7
- import org .springframework .security .config .Customizer ;
8
8
import org .springframework .security .config .annotation .web .reactive .EnableWebFluxSecurity ;
9
9
import org .springframework .security .config .web .server .ServerHttpSecurity ;
10
10
import org .springframework .security .web .server .SecurityWebFilterChain ;
@@ -19,21 +19,21 @@ public class SecurityConfig {
19
19
@ Bean
20
20
public SecurityWebFilterChain securityWebFilterChain (ServerHttpSecurity http ) {
21
21
http
22
- .csrf (ServerHttpSecurity .CsrfSpec ::disable ) // CSRF 비활성화
23
- .cors (corsSpec -> corsSpec .configurationSource (corsConfigurationSource ())) // CORS 설정 추가
22
+ .csrf (ServerHttpSecurity .CsrfSpec ::disable )
23
+ .cors (corsSpec -> corsSpec .configurationSource (corsConfigurationSource ()))
24
24
.authorizeExchange (exchanges -> exchanges
25
25
.anyExchange ().permitAll ()
26
26
)
27
- .formLogin ( Customizer . withDefaults () )
28
- .httpBasic ( Customizer . withDefaults () );
27
+ .httpBasic ( ServerHttpSecurity . HttpBasicSpec :: disable )
28
+ .formLogin ( ServerHttpSecurity . FormLoginSpec :: disable );
29
29
30
30
return http .build ();
31
31
}
32
32
33
33
@ Bean
34
34
public CorsConfigurationSource corsConfigurationSource () {
35
35
CorsConfiguration corsConfig = new CorsConfiguration ();
36
- corsConfig .setAllowedOrigins (Arrays . asList ("http://localhost:3000" , "http://your-other-allowed-origin.com " ));
36
+ corsConfig .setAllowedOrigins (Collections . singletonList ("http://localhost:3000" ));
37
37
corsConfig .setAllowedMethods (Arrays .asList ("GET" , "POST" , "PUT" , "DELETE" ));
38
38
corsConfig .setAllowedHeaders (Arrays .asList ("*" ));
39
39
corsConfig .setAllowCredentials (true );
0 commit comments