From 8b6e37ed2e1a324c4814e9408308890489be14b0 Mon Sep 17 00:00:00 2001 From: Sejin Park <95167215+sejineer@users.noreply.github.com> Date: Mon, 1 Apr 2024 01:29:24 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=9A=8C=EC=9B=90=ED=83=88=ED=87=B4=20?= =?UTF-8?q?=ED=86=A0=ED=81=B0=20=EC=82=AD=EC=A0=9C=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#305)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 구글/카카오 로그인 API 수정 * fix: RefreshToken null 체크 로직 추가 * fix: findByProvicderId Status 조건 추가 * feat: 회원탈퇴 API 구현 * feat: 인증번호 전송 API 테스트 * fix: WebConfig 수정 * fix: 인증번호 Test 로직 제거 * fix: 회원탈퇴 로직 수정 --- .../java/com/shallwe/domain/auth/domain/OAuth2Token.java | 3 ++- .../com/shallwe/domain/user/application/UserServiceImpl.java | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/shallwe/domain/auth/domain/OAuth2Token.java b/src/main/java/com/shallwe/domain/auth/domain/OAuth2Token.java index 04af16d..b5e303b 100644 --- a/src/main/java/com/shallwe/domain/auth/domain/OAuth2Token.java +++ b/src/main/java/com/shallwe/domain/auth/domain/OAuth2Token.java @@ -1,5 +1,6 @@ package com.shallwe.domain.auth.domain; +import com.shallwe.domain.common.BaseEntity; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; @@ -12,7 +13,7 @@ @Table(name = "oauth2_token") @NoArgsConstructor(access = lombok.AccessLevel.PROTECTED) @Getter -public class OAuth2Token { +public class OAuth2Token extends BaseEntity { @Id @Column(name = "provider_id") diff --git a/src/main/java/com/shallwe/domain/user/application/UserServiceImpl.java b/src/main/java/com/shallwe/domain/user/application/UserServiceImpl.java index 3c3b2a9..83b4232 100644 --- a/src/main/java/com/shallwe/domain/user/application/UserServiceImpl.java +++ b/src/main/java/com/shallwe/domain/user/application/UserServiceImpl.java @@ -66,6 +66,7 @@ public void inactiveCurrentUser(final UserPrincipal userPrincipal, final PostCom .orElseThrow(InvalidOAuth2RefreshTokenException::new); appleJwtUtils.revokeToken(oAuth2RefreshToken.getRefreshToken()); + oAuth2TokenRepository.delete(oAuth2RefreshToken); } if (user.getProvider().equals(Provider.GOOGLE)) { @@ -86,6 +87,8 @@ public void inactiveCurrentUser(final UserPrincipal userPrincipal, final PostCom .body(body) .retrieve() .toBodilessEntity(); + + oAuth2TokenRepository.delete(oAuth2RefreshToken); } if (user.getProvider().equals(Provider.KAKAO)) { @@ -104,7 +107,7 @@ public void inactiveCurrentUser(final UserPrincipal userPrincipal, final PostCom .toBodilessEntity(); } - RefreshToken refreshToken = refreshTokenRepository.findByProviderId(user.getEmail()) + RefreshToken refreshToken = refreshTokenRepository.findByProviderId(user.getProviderId()) .orElseThrow(InvalidTokenException::new); user.updateStatus(Status.DELETE);