From 05d892334b6166d7ec2ada4d45d32fc3f30a9a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=AA=85=EB=B2=94?= <72181693+mungmnb777@users.noreply.github.com> Date: Sun, 4 Feb 2024 01:37:09 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8,=20=EC=B9=B4?= =?UTF-8?q?=EC=B9=B4=EC=98=A4=20=EB=A1=9C=EA=B7=B8=EC=9D=B8,=20=ED=86=A0?= =?UTF-8?q?=ED=81=B0=20=EA=B0=B1=EC=8B=A0=20=EC=9D=91=EB=8B=B5=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 일반 로그인에서 닉네임, 전용재료, 재고를 응답에서 제외 * fix: 토큰 갱신에서 닉네임, 전용재료, 재고를 응답에서 제외 * fix: 카카오 로그인에서 닉네임, 전용재료, 재고를 응답에서 제외 --- .../global/security/dto/WebLoginResponse.java | 8 -------- .../CustomAuthenticationSuccessHandler.java | 6 ------ .../member/presentation/AuthController.java | 9 +-------- .../member/presentation/OAuthController.java | 4 +--- .../presentation/dto/WebIssuedTokensResponse.java | 14 +------------- .../presentation/dto/WebOAuthLoginResponse.java | 8 +------- 6 files changed, 4 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/tteokguk/tteokguk/global/security/dto/WebLoginResponse.java b/src/main/java/com/tteokguk/tteokguk/global/security/dto/WebLoginResponse.java index 6f43877..8e76537 100644 --- a/src/main/java/com/tteokguk/tteokguk/global/security/dto/WebLoginResponse.java +++ b/src/main/java/com/tteokguk/tteokguk/global/security/dto/WebLoginResponse.java @@ -1,15 +1,7 @@ package com.tteokguk.tteokguk.global.security.dto; -import java.util.List; - -import com.tteokguk.tteokguk.item.application.dto.response.ItemResponse; -import com.tteokguk.tteokguk.tteokguk.constants.Ingredient; - public record WebLoginResponse( Long id, - String nickname, - Ingredient primaryIngridient, - List items, String accessToken, String refreshToken ) { diff --git a/src/main/java/com/tteokguk/tteokguk/global/security/handler/CustomAuthenticationSuccessHandler.java b/src/main/java/com/tteokguk/tteokguk/global/security/handler/CustomAuthenticationSuccessHandler.java index c37673d..feffd14 100644 --- a/src/main/java/com/tteokguk/tteokguk/global/security/handler/CustomAuthenticationSuccessHandler.java +++ b/src/main/java/com/tteokguk/tteokguk/global/security/handler/CustomAuthenticationSuccessHandler.java @@ -38,7 +38,6 @@ public class CustomAuthenticationSuccessHandler implements AuthenticationSuccess private final ObjectMapper om; private final JwtService jwtService; - private final UserInfoService userInfoService; @Override public void onAuthenticationSuccess( @@ -65,15 +64,10 @@ private String getJsonResponse(Member member) throws IOException { String accessToken = jwtService.getAccessToken(member, now).getEncodedBody(); String refreshToken = jwtService.getRefreshToken(member, now).getEncodedBody(); - AppMyIngredientResponse myInfo = userInfoService.getMyIngredients(member.getId()); - return om.writerWithDefaultPrettyPrinter() .writeValueAsString( new WebLoginResponse( member.getId(), - myInfo.nickname(), - myInfo.primaryIngredient(), - myInfo.items(), accessToken, refreshToken ) diff --git a/src/main/java/com/tteokguk/tteokguk/member/presentation/AuthController.java b/src/main/java/com/tteokguk/tteokguk/member/presentation/AuthController.java index 852229b..32cdf1c 100644 --- a/src/main/java/com/tteokguk/tteokguk/member/presentation/AuthController.java +++ b/src/main/java/com/tteokguk/tteokguk/member/presentation/AuthController.java @@ -12,11 +12,8 @@ import com.tteokguk.tteokguk.member.application.AuthService; import com.tteokguk.tteokguk.member.application.RefreshTokenService; -import com.tteokguk.tteokguk.member.application.UserInfoService; import com.tteokguk.tteokguk.member.application.dto.response.AppIssuedTokensResponse; import com.tteokguk.tteokguk.member.application.dto.response.AppJoinResponse; -import com.tteokguk.tteokguk.member.application.dto.response.AppMyIngredientResponse; -import com.tteokguk.tteokguk.member.application.dto.response.MyPageResponse; import com.tteokguk.tteokguk.member.presentation.dto.WebCheckEmailRequest; import com.tteokguk.tteokguk.member.presentation.dto.WebCheckNicknameRequest; import com.tteokguk.tteokguk.member.presentation.dto.WebExistedResourceResponse; @@ -35,7 +32,6 @@ public class AuthController { private final AuthService authService; - private final UserInfoService userInfoService; private final RefreshTokenService refreshTokenService; @PostMapping("/join") @@ -60,9 +56,6 @@ public ResponseEntity checkNickname(@Validated WebCh @PostMapping("/token") public ResponseEntity reIssueTokens(@RequestBody WebIssuedTokensRequest request) { AppIssuedTokensResponse issuedTokensResponse = refreshTokenService.issueTokens(request.refreshToken()); - AppMyIngredientResponse myInfoResponse = userInfoService.getMyIngredients(issuedTokensResponse.id()); - return ResponseEntity.ok( - WebIssuedTokensResponse.of(issuedTokensResponse, myInfoResponse) - ); + return ResponseEntity.ok(WebIssuedTokensResponse.of(issuedTokensResponse)); } } diff --git a/src/main/java/com/tteokguk/tteokguk/member/presentation/OAuthController.java b/src/main/java/com/tteokguk/tteokguk/member/presentation/OAuthController.java index e4bde52..d46de94 100644 --- a/src/main/java/com/tteokguk/tteokguk/member/presentation/OAuthController.java +++ b/src/main/java/com/tteokguk/tteokguk/member/presentation/OAuthController.java @@ -34,7 +34,6 @@ public class OAuthController { private final OAuthService oAuthService; - private final UserInfoService userInfoService; @GetMapping("/{provider}/login") public String oAuthLogin(@PathVariable String provider, @RequestParam String code, HttpServletRequest request) { @@ -63,7 +62,6 @@ public ResponseEntity oAuthLogin( AppOAuthLoginResponse response = oAuthService.getByAccessToken( ProviderType.valueOf(provider.toUpperCase()), request.accessToken() ); - AppMyIngredientResponse myIngredientResponse= userInfoService.getMyIngredients(response.id()); - return ResponseEntity.ok(WebOAuthLoginResponse.of(response, myIngredientResponse)); + return ResponseEntity.ok(WebOAuthLoginResponse.of(response)); } } diff --git a/src/main/java/com/tteokguk/tteokguk/member/presentation/dto/WebIssuedTokensResponse.java b/src/main/java/com/tteokguk/tteokguk/member/presentation/dto/WebIssuedTokensResponse.java index 1d5eaa8..e3b72d7 100644 --- a/src/main/java/com/tteokguk/tteokguk/member/presentation/dto/WebIssuedTokensResponse.java +++ b/src/main/java/com/tteokguk/tteokguk/member/presentation/dto/WebIssuedTokensResponse.java @@ -1,27 +1,15 @@ package com.tteokguk.tteokguk.member.presentation.dto; -import java.util.List; - -import com.tteokguk.tteokguk.item.application.dto.response.ItemResponse; import com.tteokguk.tteokguk.member.application.dto.response.AppIssuedTokensResponse; -import com.tteokguk.tteokguk.member.application.dto.response.AppMyIngredientResponse; -import com.tteokguk.tteokguk.member.application.dto.response.MyPageResponse; -import com.tteokguk.tteokguk.tteokguk.constants.Ingredient; public record WebIssuedTokensResponse( Long id, - String nickname, - Ingredient primaryIngredient, - List items, String accessToken, String refreshToken ) { - public static WebIssuedTokensResponse of(AppIssuedTokensResponse response, AppMyIngredientResponse myInfo) { + public static WebIssuedTokensResponse of(AppIssuedTokensResponse response) { return new WebIssuedTokensResponse( response.id(), - myInfo.nickname(), - myInfo.primaryIngredient(), - myInfo.items(), response.accessToken(), response.refreshToken() ); diff --git a/src/main/java/com/tteokguk/tteokguk/member/presentation/dto/WebOAuthLoginResponse.java b/src/main/java/com/tteokguk/tteokguk/member/presentation/dto/WebOAuthLoginResponse.java index baec3ea..e3570d4 100644 --- a/src/main/java/com/tteokguk/tteokguk/member/presentation/dto/WebOAuthLoginResponse.java +++ b/src/main/java/com/tteokguk/tteokguk/member/presentation/dto/WebOAuthLoginResponse.java @@ -10,19 +10,13 @@ public record WebOAuthLoginResponse( Long id, - String nickname, - Ingredient primaryIngredient, - List items, String accessToken, String refreshToken, boolean isInitialized ) { - public static WebOAuthLoginResponse of(AppOAuthLoginResponse response, AppMyIngredientResponse myInfo) { + public static WebOAuthLoginResponse of(AppOAuthLoginResponse response) { return new WebOAuthLoginResponse( response.id(), - myInfo.nickname(), - myInfo.primaryIngredient(), - myInfo.items(), response.accessToken(), response.refreshToken(), response.isInitialized()