Skip to content

Commit

Permalink
hotfix: 로그아웃 시, cookie default value 지정
Browse files Browse the repository at this point in the history
  • Loading branch information
YongsHub committed Oct 8, 2023
1 parent aa75402 commit 12488b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public void socialLoginRedirect(@PathVariable(name = "oauthName") String oauthNa

@DeleteMapping("/logout")
public EnvelopeResponse<Void> logout(
@CookieValue(value = "accessToken") String accessToken,
@CookieValue(value = "refreshToken") String refreshToken,
@CookieValue(value = "accessToken", defaultValue = "") String accessToken,
@CookieValue(value = "refreshToken", defaultValue = "") String refreshToken,
HttpServletResponse response) {
authService.deleteTokens(accessToken, refreshToken);
cookieProvider.setResponseWithCookies(response, null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public Long getMemberIdByRefreshToken(String token) {
.getBody();
} catch (ExpiredJwtException e) {
throw new AuthException(AuthErrorInfo.AUTH_TOKEN_EXPIRED);
} catch (JwtException | IllegalArgumentException e) {
throw new AuthException(AuthErrorInfo.AUTH_TOKEN_INVALID);
}
return claims.get("memberId", Long.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;


Expand Down Expand Up @@ -47,6 +47,7 @@ public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authInterceptor)
.addPathPatterns("/**")
.excludePathPatterns("/auth/callback")
.excludePathPatterns("/auth/logout")
.excludePathPatterns("/members/nickname")
.excludePathPatterns("/boards");
}
Expand Down

0 comments on commit 12488b8

Please sign in to comment.