Skip to content

Commit

Permalink
[#2]๐Ÿ›Fix: CORS ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
sumin220 committed Nov 22, 2024
1 parent 9712c82 commit 4ea389d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/main/java/univ/yesummit/global/auth/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.csrf(AbstractHttpConfigurer::disable)

// cors ์„ค์ •
.cors(cors -> cors.configurationSource(corsConfigurationSource()))
// .cors(cors -> cors.configurationSource(corsConfigurationSource()))

// ์‹œํ๋ฆฌํ‹ฐ ๊ธฐ๋ณธ ๋กœ๊ทธ์ธ ๋น„ํ™œ์„ฑํ™”
.formLogin(AbstractHttpConfigurer::disable)
Expand Down Expand Up @@ -102,18 +102,18 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
// @Value("${cors.allowed-origins")
// private List<String> allowOriginList;

@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.addAllowedOrigin("http://localhost:3000"); // ํด๋ผ์ด์–ธํŠธ ์ฃผ์†Œ
configuration.addAllowedMethod("*");
configuration.addAllowedHeader("*");
configuration.setAllowCredentials(true);
configuration.addExposedHeader("Authorization");
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
return source;
}
// @Bean
// public CorsConfigurationSource corsConfigurationSource() {
// CorsConfiguration configuration = new CorsConfiguration();
// configuration.addAllowedOrigin("http://localhost:3000"); // ํด๋ผ์ด์–ธํŠธ ์ฃผ์†Œ
// configuration.addAllowedMethod("*");
// configuration.addAllowedHeader("*");
// configuration.setAllowCredentials(true);
// configuration.addExposedHeader("Authorization");
// UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
// source.registerCorsConfiguration("/**", configuration);
// return source;
// }

public class JwtAuthenticationFilter extends OncePerRequestFilter {
private final JwtUtils jwtUtils;
Expand Down

0 comments on commit 4ea389d

Please sign in to comment.