diff --git a/src/main/java/com/ssafy/ssafsound/domain/auth/controller/AuthController.java b/src/main/java/com/ssafy/ssafsound/domain/auth/controller/AuthController.java index 635b2985..f614cbcc 100644 --- a/src/main/java/com/ssafy/ssafsound/domain/auth/controller/AuthController.java +++ b/src/main/java/com/ssafy/ssafsound/domain/auth/controller/AuthController.java @@ -47,11 +47,7 @@ public void socialLoginRedirect(@PathVariable(name = "oauthName") String oauthNa } @DeleteMapping("/logout") - public EnvelopeResponse logout( - @CookieValue(value = "accessToken", defaultValue = "") String accessToken, - @CookieValue(value = "refreshToken", defaultValue = "") String refreshToken, - HttpServletResponse response) { - authService.deleteTokens(accessToken, refreshToken); + public EnvelopeResponse logout(HttpServletResponse response) { cookieProvider.setResponseWithCookies(response, null, null); return EnvelopeResponse.builder() .build(); diff --git a/src/main/java/com/ssafy/ssafsound/domain/auth/service/AuthService.java b/src/main/java/com/ssafy/ssafsound/domain/auth/service/AuthService.java index 287af826..296bad95 100644 --- a/src/main/java/com/ssafy/ssafsound/domain/auth/service/AuthService.java +++ b/src/main/java/com/ssafy/ssafsound/domain/auth/service/AuthService.java @@ -20,12 +20,9 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.StringUtils; - import javax.servlet.http.HttpServletResponse; import java.time.Clock; import java.time.LocalDateTime; -import java.util.Objects; @Service @Slf4j @@ -73,26 +70,6 @@ public CreateMemberTokensResDto createToken(AuthenticatedMember authenticatedMem .build(); } - @Transactional - public void deleteTokens(String accessToken, String refreshToken) { - Long memberId = null; - - try { - if (StringUtils.hasText(accessToken)) { - AuthenticatedMember authenticatedMember = jwtTokenProvider.getParsedClaimsByAccessToken(accessToken); - memberId = authenticatedMember.getMemberId(); - } else if (StringUtils.hasText(refreshToken)) { - memberId = jwtTokenProvider.getMemberIdByRefreshToken(refreshToken); - } - - if (Objects.nonNull(memberId)) { - memberTokenRepository.deleteById(memberId); - } - } catch (AuthException e) { - log.debug("유효하지 않은 토큰입니다."); - } - } - @Transactional(readOnly = true) public MemberToken getMemberTokenByRefreshToken(String refreshToken) { Long memberId = jwtTokenProvider.getMemberIdByRefreshToken(refreshToken);