Skip to content

Commit 3ec1c8b

Browse files
authored
chore: apply cors configuration (#75)
1 parent ab4ead3 commit 3ec1c8b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/gdsc/konkuk/platformcore/global/configs/SecurityConfig.java

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.springframework.security.web.SecurityFilterChain;
2020
import org.springframework.security.web.access.AccessDeniedHandler;
2121
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
22+
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
2223

2324
@Configuration
2425
@EnableWebSecurity
@@ -30,6 +31,7 @@ public class SecurityConfig {
3031
private final CustomAuthenticationFailureHandler customAuthenticationFailureHandler;
3132
private final CustomOAuthUserService customOAuthUserService;
3233
private final GoogleOidcConfig googleOidcConfig;
34+
private final UrlBasedCorsConfigurationSource corsConfigurationSource;
3335

3436
@Bean
3537
@Order(2)
@@ -40,6 +42,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws
4042
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
4143

4244
httpSecurity
45+
.cors(cors -> cors.configurationSource(corsConfigurationSource))
4346
.csrf(AbstractHttpConfigurer::disable)
4447
.sessionManagement(session -> session
4548
.sessionCreationPolicy(SessionCreationPolicy.STATELESS))

0 commit comments

Comments
 (0)