File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
backend/src/main/java/com/together/backend/global/config Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1616import org .springframework .security .web .SecurityFilterChain ;
1717import org .springframework .security .web .authentication .UsernamePasswordAuthenticationFilter ;
1818import lombok .extern .slf4j .Slf4j ;
19+ import org .springframework .web .cors .CorsConfiguration ;
20+ import org .springframework .web .cors .CorsConfigurationSource ;
21+ import org .springframework .web .cors .UrlBasedCorsConfigurationSource ;
1922
2023@ Slf4j
2124@ Configuration
@@ -27,6 +30,21 @@ public class SecurityConfig {
2730 private final CustomSuccessHandler customSuccessHandler ;
2831 private final JWTUtil jwtUtil ;
2932
33+ @ Bean
34+ public CorsConfigurationSource corsConfigurationSource () {
35+ CorsConfiguration config = new CorsConfiguration ();
36+ config .setAllowCredentials (true );
37+ config .addAllowedOrigin ("https://7-together.kro.kr" );
38+ config .addAllowedOrigin ("http://localhost:3000" );
39+ config .addAllowedHeader ("*" );
40+ config .addAllowedMethod ("*" );
41+ config .addExposedHeader ("Set-Cookie" );
42+
43+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource ();
44+ source .registerCorsConfiguration ("/**" , config );
45+ return source ;
46+ }
47+
3048 @ Bean
3149 public SecurityFilterChain filterChain (HttpSecurity http ) throws Exception {
3250 http
You can’t perform that action at this time.
0 commit comments