Skip to content

Commit

Permalink
fix: 로그아웃 SecurityConfig 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
gywns0417 committed Aug 5, 2024
1 parent 9575a3d commit a9ce93d
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.CorsUtils;
Expand Down Expand Up @@ -64,7 +65,12 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.oauth2Login(oauth2 -> oauth2
.userInfoEndpoint(userInfoEndpointConfig -> userInfoEndpointConfig.userService(customOAuth2UserService))
.successHandler(customSuccessHandler)
);
)
.logout(logout -> logout
.logoutRequestMatcher(new AntPathRequestMatcher("/members/logout"))
.logoutSuccessUrl("/")
.deleteCookies("Authorization", "refreshToken", "JSESSIONID", "accessToken")
.invalidateHttpSession(true));

return http.build();
}
Expand Down

0 comments on commit a9ce93d

Please sign in to comment.