From 280e72f5cd62e0a0f11c103993d6347d577f2bfc Mon Sep 17 00:00:00 2001 From: RyuKwanKon Date: Sun, 17 Sep 2023 05:06:41 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20#40=20=EB=84=A4=EC=9D=B4=EB=B2=84=20acc?= =?UTF-8?q?ess=20token=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/auth/naver/NaverAccessTokenInfo.java | 11 +++++++++-- .../user/auth/naver/NaverOAuthProvider.java | 15 ++------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/kusithm/hdmedi_server/domain/user/auth/naver/NaverAccessTokenInfo.java b/src/main/java/com/kusithm/hdmedi_server/domain/user/auth/naver/NaverAccessTokenInfo.java index f433280..cf787dc 100644 --- a/src/main/java/com/kusithm/hdmedi_server/domain/user/auth/naver/NaverAccessTokenInfo.java +++ b/src/main/java/com/kusithm/hdmedi_server/domain/user/auth/naver/NaverAccessTokenInfo.java @@ -1,11 +1,18 @@ package com.kusithm.hdmedi_server.domain.user.auth.naver; import lombok.AccessLevel; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Builder @Getter public class NaverAccessTokenInfo { - private Long id; + private String accessToken; + + public static NaverAccessTokenInfo of(String accessToken){ + return NaverAccessTokenInfo.builder() + .accessToken(accessToken) + .build(); + } } diff --git a/src/main/java/com/kusithm/hdmedi_server/domain/user/auth/naver/NaverOAuthProvider.java b/src/main/java/com/kusithm/hdmedi_server/domain/user/auth/naver/NaverOAuthProvider.java index 6fa35df..5f62e61 100644 --- a/src/main/java/com/kusithm/hdmedi_server/domain/user/auth/naver/NaverOAuthProvider.java +++ b/src/main/java/com/kusithm/hdmedi_server/domain/user/auth/naver/NaverOAuthProvider.java @@ -12,22 +12,11 @@ @RequiredArgsConstructor @Component public class NaverOAuthProvider { - private final NaverFeignClient naverFeignClient; - public String getNaverPlatformId(String accessToken) { NaverAccessToken naverAccessToken = NaverAccessToken.of(accessToken); String accessTokenWithTokenType = naverAccessToken.getAccessTokenWithTokenType(); - NaverAccessTokenInfo naverAccessTokenInfo = getNaverAccessTokenInfo(accessTokenWithTokenType); - return String.valueOf(naverAccessTokenInfo.getId()); - } - - private NaverAccessTokenInfo getNaverAccessTokenInfo(String accessTokenWithTokenType) { - try { - return naverFeignClient.getNaverAccessTokenInfo(accessTokenWithTokenType); - } catch (FeignException e) { - log.error("Feign Exception: ", e); - throw new UnauthorizedException(INVALID_NAVER_ACCESS_TOKEN); - } + NaverAccessTokenInfo naverAccessTokenInfo = NaverAccessTokenInfo.of(accessTokenWithTokenType); + return naverAccessTokenInfo.getAccessToken(); } }