From 49f16f3b077b6f8e3406a9a386ffd5a2cc5ffb13 Mon Sep 17 00:00:00 2001 From: rlarltj123 Date: Sun, 12 May 2024 16:49:18 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20log=EB=A5=BC=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-dev.yml | 2 +- .../com/moneymong/domain/user/api/UserControllerV2.java | 2 +- .../domain/user/api/request/UserDeleteRequest.java | 7 ++++--- .../com/moneymong/domain/user/service/UserService.java | 6 +++++- .../global/security/oauth/handler/AppleService.java | 5 ++++- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 0626b6e..b746944 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -4,7 +4,7 @@ on: push: branches: - dev - + - feat/** # 권한 설정 permissions: contents: read diff --git a/src/main/java/com/moneymong/domain/user/api/UserControllerV2.java b/src/main/java/com/moneymong/domain/user/api/UserControllerV2.java index 9413092..2adcb89 100644 --- a/src/main/java/com/moneymong/domain/user/api/UserControllerV2.java +++ b/src/main/java/com/moneymong/domain/user/api/UserControllerV2.java @@ -22,7 +22,7 @@ public class UserControllerV2 { @DeleteMapping("/me") public void deleteUser( @AuthenticationPrincipal JwtAuthentication user, - @Valid UserDeleteRequest deleteRequest + @RequestBody @Valid UserDeleteRequest deleteRequest ) { userFacadeService.revoke(deleteRequest, user.getId()); } diff --git a/src/main/java/com/moneymong/domain/user/api/request/UserDeleteRequest.java b/src/main/java/com/moneymong/domain/user/api/request/UserDeleteRequest.java index 2d71605..68bf2f6 100644 --- a/src/main/java/com/moneymong/domain/user/api/request/UserDeleteRequest.java +++ b/src/main/java/com/moneymong/domain/user/api/request/UserDeleteRequest.java @@ -1,13 +1,14 @@ package com.moneymong.domain.user.api.request; import jakarta.validation.constraints.NotBlank; +import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.NoArgsConstructor; @Getter +@AllArgsConstructor +@NoArgsConstructor public class UserDeleteRequest { @NotBlank private String provider; - - @NotBlank - private String token; } diff --git a/src/main/java/com/moneymong/domain/user/service/UserService.java b/src/main/java/com/moneymong/domain/user/service/UserService.java index 24baada..d7e26e0 100644 --- a/src/main/java/com/moneymong/domain/user/service/UserService.java +++ b/src/main/java/com/moneymong/domain/user/service/UserService.java @@ -13,12 +13,14 @@ import com.moneymong.global.security.oauth.dto.OAuthUserInfo; import com.moneymong.global.security.token.repository.RefreshTokenRepository; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.UUID; @Service +@Slf4j @RequiredArgsConstructor public class UserService { @@ -53,6 +55,9 @@ public User registerUser(OAuthUserInfo oauthUserInfo) { ); newUser = save(newUser); + log.info("[UserService] registerUserId = {}", newUser.getId()); + log.info("[UserService] refreshToken = {}", oauthUserInfo.getAppleRefreshToken()); + if (oauthUserInfo.getAppleRefreshToken() != null) { appleUserRepository.save( AppleUser.of( @@ -65,7 +70,6 @@ public User registerUser(OAuthUserInfo oauthUserInfo) { return newUser; } - @Transactional(readOnly = true) public UserProfileResponse getUserProfile(Long userId) { User user = userRepository.findById(userId) diff --git a/src/main/java/com/moneymong/global/security/oauth/handler/AppleService.java b/src/main/java/com/moneymong/global/security/oauth/handler/AppleService.java index a0eae78..7250a7f 100644 --- a/src/main/java/com/moneymong/global/security/oauth/handler/AppleService.java +++ b/src/main/java/com/moneymong/global/security/oauth/handler/AppleService.java @@ -174,9 +174,12 @@ private OAuthUserDataResponse decodePayload(String idToken, String nickname, Str DecodedJWT decoded = JWT.decode(idToken); Map claims = decoded.getClaims(); + log.info("[AppleService] claims = {}", claims.keySet()); String providerUid = decoded.getSubject(); - String email = claims.get("email").asString(); + String email = claims.get("sub").asString(); + log.info("[AppleService] email = {}", email); + log.info("[AppleService] nickname = {}", nickname); return OAuthUserDataResponse.builder() .provider(getAuthProvider().toString()) .oauthId(providerUid)