From 0c094da17afc5dd3095cbe672d6e85615df0d14b Mon Sep 17 00:00:00 2001 From: yang Date: Wed, 22 May 2024 20:30:19 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20logout=20=EC=84=B1=EA=B3=B5=20handl?= =?UTF-8?q?ing=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sanbosillok/sanbosillokserver/config/SecurityConfig.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/sanbosillok/sanbosillokserver/config/SecurityConfig.java b/src/main/java/com/sanbosillok/sanbosillokserver/config/SecurityConfig.java index 202e3fe..fbd371a 100644 --- a/src/main/java/com/sanbosillok/sanbosillokserver/config/SecurityConfig.java +++ b/src/main/java/com/sanbosillok/sanbosillokserver/config/SecurityConfig.java @@ -18,6 +18,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.authentication.logout.HttpStatusReturningLogoutSuccessHandler; import org.springframework.web.cors.CorsConfiguration; import java.util.Arrays; @@ -75,6 +76,10 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { //http basic 인증 방식 disable .httpBasic(AbstractHttpConfigurer::disable) + // logout + .logout((logout) -> logout + .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler())) + //경로별 인가 작업 .authorizeHttpRequests((auth) -> auth .requestMatchers("/signup", "/login", "/checkUserName/{username}", "/image/{fileName}").permitAll()