File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
chat/src/main/java/org/example/soundlinkchat_java/global/config
default/src/main/java/org/dfbf/soundlink/global/config Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 11package org .example .soundlinkchat_java .global .config ;
22
3+ import jakarta .servlet .ServletRequest ;
34import lombok .RequiredArgsConstructor ;
45import org .example .soundlinkchat_java .global .auth .JwtAuthenticationFilter ;
56import org .example .soundlinkchat_java .global .auth .JwtProvider ;
@@ -21,6 +22,9 @@ public class SecurityConfig {
2122 @ Bean
2223 public SecurityFilterChain filterChain (HttpSecurity http ) throws Exception {
2324 http
25+ .csrf (csrf -> csrf
26+ .requireCsrfProtectionMatcher (ServletRequest ::isSecure ) // HTTPS만 CSRF 보호 적용
27+ )
2428 .authorizeHttpRequests (auth -> auth
2529// .requestMatchers("/api/**").permitAll()
2630// .requestMatchers("/swagger-ui/**").permitAll()
Original file line number Diff line number Diff line change 11package org .dfbf .soundlink .global .config ;
22
3+ import jakarta .servlet .ServletRequest ;
34import lombok .RequiredArgsConstructor ;
45import org .dfbf .soundlink .global .auth .JwtAuthenticationFilter ;
56import org .dfbf .soundlink .global .auth .JwtProvider ;
@@ -27,6 +28,9 @@ public BCryptPasswordEncoder passwordEncoder() {
2728 @ Bean
2829 public SecurityFilterChain filterChain (HttpSecurity http ) throws Exception {
2930 http
31+ .csrf (csrf -> csrf
32+ .requireCsrfProtectionMatcher (ServletRequest ::isSecure ) // HTTPS만 CSRF 보호 적용
33+ )
3034 .authorizeHttpRequests (auth -> auth
3135// .requestMatchers("/api/**").permitAll()
3236// .requestMatchers("/swagger-ui/**").permitAll()
You can’t perform that action at this time.
0 commit comments