Skip to content

Commit

Permalink
๐Ÿ› CORS ์˜ค๋ฅ˜ ์ˆ˜์ •
Browse files Browse the repository at this point in the history
- ํ”„๋ฆฌํ”Œ๋ผ์ดํŠธ CORS ์˜ค๋ฅ˜๋ฅผ ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
  • Loading branch information
Ganghee-Lee-0522 committed Jan 12, 2024
1 parent ce8d47b commit 116f14d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.CorsUtils;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

import java.util.Collections;
Expand Down Expand Up @@ -80,9 +81,9 @@ protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
authorizeRequests
.requestMatchers(permitList).permitAll()
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
.anyRequest().hasAnyAuthority("ROLE_MEMBER");
})

.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class) // jwtFilter๋ฅผ UsernamePasswordAuthenticationFilter ์•ž์— ์ถ”๊ฐ€
.addFilterBefore(new JwtExceptionFilter(), JwtFilter.class) // JwtExceptionFilter๋ฅผ JwtFilter ์•ž์— ์ถ”๊ฐ€

Expand Down

0 comments on commit 116f14d

Please sign in to comment.