File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
server/src/main/java/org/cecd/server/external Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 2121import jakarta .servlet .http .HttpServletRequest ;
2222import jakarta .servlet .http .HttpServletResponse ;
2323import org .springframework .security .core .AuthenticationException ;
24+ import org .springframework .web .cors .CorsConfiguration ;
2425
2526import java .io .IOException ;
2627
@@ -38,11 +39,19 @@ public class SecurityConfig {
3839 @ Bean
3940 public SecurityFilterChain securityFilterChain (HttpSecurity httpSecurity ) throws Exception {
4041 httpSecurity
42+ .cors (cors -> cors .configurationSource (request -> {
43+ CorsConfiguration configuration = new CorsConfiguration ();
44+ configuration .addAllowedOrigin ("https://dgutestbed.netlify.app" );
45+ configuration .addAllowedMethod ("*" );
46+ configuration .addAllowedHeader ("*" );
47+ configuration .setAllowCredentials (true );
48+ return configuration ;
49+ }))
4150 .csrf (csrf -> csrf .disable ()) // CSRF 비활성화
4251 .sessionManagement (session ->
4352 session .sessionCreationPolicy (SessionCreationPolicy .STATELESS )) // 상태 없는 세션 관리
4453 .addFilterBefore (new JwtTokenFilter (memberService , jwtTokenUtil ), UsernamePasswordAuthenticationFilter .class )
45- .authorizeHttpRequests (authorize -> authorize // 권한 설정
54+ .authorizeHttpRequests (authorize -> authorize
4655 .requestMatchers ("/jwt-login/info" ).authenticated ()
4756 .requestMatchers ("/jwt-login/admin/**" ).hasAuthority (MemberRole .ADMIN .name ())
4857 .requestMatchers ("/ws/**" ).permitAll () // WebSocket 엔드포인트 허용
You can’t perform that action at this time.
0 commit comments