From 561fea47e90c34a2c7950f2a2d6e041311fe1cb6 Mon Sep 17 00:00:00 2001 From: lcqff Date: Fri, 22 Nov 2024 05:11:16 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9D=B8=EC=A6=9D=EC=9D=84=20=EB=8F=85?= =?UTF-8?q?=EB=A6=BD=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #27 --- .../global/config/security/Oauth2ClientConfig.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/MusicPlatform/global/config/security/Oauth2ClientConfig.java b/src/main/java/MusicPlatform/global/config/security/Oauth2ClientConfig.java index 02d918f..818f8b4 100644 --- a/src/main/java/MusicPlatform/global/config/security/Oauth2ClientConfig.java +++ b/src/main/java/MusicPlatform/global/config/security/Oauth2ClientConfig.java @@ -1,5 +1,7 @@ package MusicPlatform.global.config.security; +import static org.springframework.security.config.http.SessionCreationPolicy.STATELESS; + import MusicPlatform.domain.oauth2.service.OAuth2UserService; import MusicPlatform.global.filter.JwtAuthorizationFilter; import MusicPlatform.global.handler.LoginSuccessHandler; @@ -40,13 +42,15 @@ SecurityFilterChain securityFilterChane(HttpSecurity http) throws Exception { http.csrf(AbstractHttpConfigurer::disable); http.cors(AbstractHttpConfigurer::disable); + http.sessionManagement(sessionManagement -> sessionManagement.sessionCreationPolicy(STATELESS)); + http.oauth2Login(oauth2 -> oauth2 .userInfoEndpoint(userInfoEndpointConfig -> userInfoEndpointConfig.userService(oAuth2UserService)) .successHandler(loginSuccessHandler) .failureUrl(errorPage) ); - http.addFilterAfter(jwtAuthorizationFilter, UsernamePasswordAuthenticationFilter.class); + http.addFilterBefore(jwtAuthorizationFilter, UsernamePasswordAuthenticationFilter.class); http.exceptionHandling(exception -> exception .accessDeniedHandler(oauthAccessDeniedHandler)