Skip to content

Commit a7bc5dc

Browse files
committed
fix : Gateway에서 Spring Security 인증 체크 제거 및 MSA CORS 설정 정리
1 parent 123bfe8 commit a7bc5dc

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

gateway/src/main/java/com/joketdan/gateway/config/SecurityConfig.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,24 @@
55
import org.springframework.context.annotation.Configuration;
66
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
77
import org.springframework.security.config.web.server.ServerHttpSecurity;
8-
import org.springframework.security.config.web.server.ServerHttpSecurity.FormLoginSpec;
9-
import org.springframework.security.config.web.server.ServerHttpSecurity.HttpBasicSpec;
108
import org.springframework.security.web.server.SecurityWebFilterChain;
119
import org.springframework.web.cors.reactive.CorsConfigurationSource;
1210

1311
@Configuration
1412
@EnableWebFluxSecurity
1513
public class SecurityConfig {
1614

17-
@Bean
18-
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http, CorsConfigurationSource corsSource) {
19-
return http
20-
.csrf(csrf -> csrf.disable())
21-
.cors(cors -> cors.configurationSource(corsSource)) // ✅ 최신 방식
22-
.formLogin(ServerHttpSecurity.FormLoginSpec::disable) // 로그인폼 끄기
23-
.httpBasic(ServerHttpSecurity.HttpBasicSpec::disable) // 기본 인증도 끄기
24-
.authorizeExchange(ex -> ex
25-
.pathMatchers("/**","/auth/**" ,"/webjars","/swagger-ui/**", "/v3/api-docs/**").permitAll()
26-
.anyExchange().authenticated()
27-
)
28-
.build();
29-
}
15+
@Bean
16+
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http, CorsConfigurationSource corsSource) {
17+
return http
18+
.csrf(csrf -> csrf.disable())
19+
.cors(cors -> cors.configurationSource(corsSource))
20+
.formLogin(ServerHttpSecurity.FormLoginSpec::disable)
21+
.httpBasic(ServerHttpSecurity.HttpBasicSpec::disable)
22+
.authorizeExchange(ex -> ex
23+
.anyExchange().permitAll()
24+
)
25+
.build();
26+
}
3027
}
3128

0 commit comments

Comments
 (0)