From 89d63523e60528371ba6dd297cdb97ba62534cde Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:38:42 +0900 Subject: [PATCH 01/14] =?UTF-8?q?chore:=20openfeign=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doorip-external/build.gradle | 5 +++++ .../main/java/org/doorip/config/FeignClientConfig.java | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/config/FeignClientConfig.java diff --git a/doorip-external/build.gradle b/doorip-external/build.gradle index 75eae5c..9ad1895 100644 --- a/doorip-external/build.gradle +++ b/doorip-external/build.gradle @@ -1,4 +1,9 @@ dependencies { + implementation 'org.springframework.cloud:spring-cloud-starter-openfeign:4.0.3' + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'io.jsonwebtoken:jjwt-api:0.11.2' + runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.2' + runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.2' implementation project(path: ':doorip-common') } diff --git a/doorip-external/src/main/java/org/doorip/config/FeignClientConfig.java b/doorip-external/src/main/java/org/doorip/config/FeignClientConfig.java new file mode 100644 index 0000000..1b41be6 --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/config/FeignClientConfig.java @@ -0,0 +1,10 @@ +package org.doorip.config; + +import org.doorip.ExternalRoot; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableFeignClients(basePackageClasses = ExternalRoot.class) +public class FeignClientConfig { +} From e73234e226afa20111ec5afe76ab9908aacce17f Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:41:49 +0900 Subject: [PATCH 02/14] =?UTF-8?q?feat:=20=EC=95=A0=ED=94=8C=20feign=20clie?= =?UTF-8?q?nt=20=EA=B5=AC=ED=98=84=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/doorip/openfeign/apple/AppleFeignClient.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/apple/AppleFeignClient.java diff --git a/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleFeignClient.java b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleFeignClient.java new file mode 100644 index 0000000..cc2b702 --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleFeignClient.java @@ -0,0 +1,10 @@ +package org.doorip.openfeign.apple; + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; + +@FeignClient(name = "${oauth.apple.name}", url = "${oauth.apple.url}") +public interface AppleFeignClient { + @GetMapping("/keys") + ApplePublicKeys getApplePublicKeys(); +} From c99e17b9f181cc6f60bec484f9d109a7370c3374 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:42:27 +0900 Subject: [PATCH 03/14] =?UTF-8?q?feat:=20=EC=95=A0=ED=94=8C=20=EA=B3=B5?= =?UTF-8?q?=EA=B0=9C=ED=82=A4=20response=20dto=20=EA=B5=AC=ED=98=84=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../doorip/openfeign/apple/ApplePublicKey.java | 11 +++++++++++ .../doorip/openfeign/apple/ApplePublicKeys.java | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKey.java create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKeys.java diff --git a/doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKey.java b/doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKey.java new file mode 100644 index 0000000..ca9031a --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKey.java @@ -0,0 +1,11 @@ +package org.doorip.openfeign.apple; + +public record ApplePublicKey( + String kty, + String kid, + String use, + String alg, + String n, + String e) { +} + diff --git a/doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKeys.java b/doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKeys.java new file mode 100644 index 0000000..cb05809 --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKeys.java @@ -0,0 +1,17 @@ +package org.doorip.openfeign.apple; + +import org.doorip.exception.UnauthorizedException; +import org.doorip.message.ErrorMessage; + +import java.util.List; + +public class ApplePublicKeys { + private List keys; + + public ApplePublicKey getMatchesKey(String alg, String kid) { + return keys.stream() + .filter(applePublicKey -> applePublicKey.alg().equals(alg) && applePublicKey.kid().equals(kid)) + .findFirst() + .orElseThrow(() -> new UnauthorizedException(ErrorMessage.INVALID_IDENTITY_TOKEN)); + } +} From a94b8d8b0fd50078e31989b64ceef06038d4c3f8 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:43:04 +0900 Subject: [PATCH 04/14] =?UTF-8?q?feat:=20=EC=95=A0=ED=94=8C=20=EA=B3=B5?= =?UTF-8?q?=EA=B0=9C=ED=82=A4=20generator=20=EA=B5=AC=ED=98=84=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apple/ApplePublicKeyGenerator.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKeyGenerator.java diff --git a/doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKeyGenerator.java b/doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKeyGenerator.java new file mode 100644 index 0000000..d0d019c --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/apple/ApplePublicKeyGenerator.java @@ -0,0 +1,35 @@ +package org.doorip.openfeign.apple; + +import org.doorip.exception.UnauthorizedException; +import org.doorip.message.ErrorMessage; +import org.springframework.stereotype.Component; + +import java.security.KeyFactory; +import java.security.NoSuchAlgorithmException; +import java.security.PublicKey; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.RSAPublicKeySpec; +import java.util.Base64; +import java.util.Map; +import java.math.BigInteger; + +@Component +public class ApplePublicKeyGenerator { + public PublicKey generatePublicKeyWithApplePublicKeys(Map headers, ApplePublicKeys applePublicKeys) { + ApplePublicKey applePublicKey = applePublicKeys + .getMatchesKey(headers.get("alg"), headers.get("kid")); + + byte[] nBytes = Base64.getUrlDecoder().decode(applePublicKey.n()); + byte[] eBytes = Base64.getUrlDecoder().decode(applePublicKey.e()); + + RSAPublicKeySpec rsaPublicKeySpec = new RSAPublicKeySpec( + new BigInteger(1, nBytes), new BigInteger(1, eBytes)); + + try { + KeyFactory keyFactory = KeyFactory.getInstance(applePublicKey.kty()); + return keyFactory.generatePublic(rsaPublicKeySpec); + } catch (NoSuchAlgorithmException | InvalidKeySpecException exception) { + throw new UnauthorizedException(ErrorMessage.UNABLE_TO_CREATE_APPLE_PUBLIC_KEY); + } + } +} From 51dc3af67ccc47498f8d2340f0d8afec9ca983af Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:43:24 +0900 Subject: [PATCH 05/14] =?UTF-8?q?feat:=20=EC=95=A0=ED=94=8C=20identity=20t?= =?UTF-8?q?oken=20parser=20=EA=B5=AC=ED=98=84=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apple/AppleIdentityTokenParser.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java diff --git a/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java new file mode 100644 index 0000000..979533a --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java @@ -0,0 +1,48 @@ +package org.doorip.openfeign.apple; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.jsonwebtoken.*; +import org.doorip.exception.UnauthorizedException; +import org.doorip.message.ErrorMessage; +import org.springframework.stereotype.Component; + +import java.nio.charset.StandardCharsets; +import java.security.Key; +import java.security.PublicKey; +import java.util.Base64; +import java.util.Map; + + +@Component +public class AppleIdentityTokenParser { + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + public Map parseHeaders(String identityToken) { + try { + String encoded = identityToken.split("\\.")[0];; + String decoded = new String(Base64.getUrlDecoder().decode(encoded), StandardCharsets.UTF_8); + return OBJECT_MAPPER.readValue(decoded, Map.class); + } catch (JsonProcessingException | ArrayIndexOutOfBoundsException e) { + throw new UnauthorizedException(ErrorMessage.INVALID_IDENTITY_TOKEN); + } + } + + public Claims parseWithPublicKeyAndGetClaims(String identityToken, PublicKey publicKey) { + try { + return getJwtParser(publicKey) + .parseClaimsJws(identityToken) + .getBody(); + } catch (ExpiredJwtException e) { + throw new UnauthorizedException(ErrorMessage.EXPIRED_IDENTITY_TOKEN); + } catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException e) { + throw new UnauthorizedException(ErrorMessage.INVALID_IDENTITY_TOKEN_VALUE); + } + } + + private JwtParser getJwtParser(Key key) { + return Jwts.parserBuilder() + .setSigningKey(key) + .build(); + } +} From 7fd702b18c533f40004113b952da620c07301136 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:44:21 +0900 Subject: [PATCH 06/14] =?UTF-8?q?feat:=20=EC=95=A0=ED=94=8C=20identity=20t?= =?UTF-8?q?oken=20validator=20=EA=B5=AC=ED=98=84=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apple/AppleIdentityTokenValidator.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenValidator.java diff --git a/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenValidator.java b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenValidator.java new file mode 100644 index 0000000..df85f23 --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenValidator.java @@ -0,0 +1,18 @@ +package org.doorip.openfeign.apple; + +import io.jsonwebtoken.Claims; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +public class AppleIdentityTokenValidator { + @Value("${oauth.apple.iss}") + private String iss; + @Value("${oauth.apple.client-id}") + private String clientId; + + public boolean isValidAppleIdentityToken(Claims claims) { + return claims.getIssuer().contains(iss) + && claims.getAudience().equals(clientId); + } +} From 998960f6c9a24421fb8fead7b804b6108b682db0 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:44:57 +0900 Subject: [PATCH 07/14] =?UTF-8?q?feat:=20=EC=95=A0=ED=94=8C=20platform=20i?= =?UTF-8?q?d=20=EC=A0=9C=EA=B3=B5=20oauth=20provider=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openfeign/apple/AppleOAuthProvider.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/apple/AppleOAuthProvider.java diff --git a/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleOAuthProvider.java b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleOAuthProvider.java new file mode 100644 index 0000000..08368f4 --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleOAuthProvider.java @@ -0,0 +1,35 @@ +package org.doorip.openfeign.apple; + +import io.jsonwebtoken.Claims; +import lombok.RequiredArgsConstructor; +import org.doorip.exception.UnauthorizedException; +import org.doorip.message.ErrorMessage; +import org.springframework.stereotype.Component; + +import java.security.PublicKey; +import java.util.Map; + +@RequiredArgsConstructor +@Component +public class AppleOAuthProvider { + private final AppleFeignClient appleFeignClient; + private final AppleIdentityTokenParser appleIdentityTokenParser; + private final ApplePublicKeyGenerator applePublicKeyGenerator; + private final AppleIdentityTokenValidator appleIdentityTokenValidator; + + public String getApplePlatformId(String identityToken) { + Map headers = appleIdentityTokenParser.parseHeaders(identityToken); + ApplePublicKeys applePublicKeys = appleFeignClient.getApplePublicKeys(); + PublicKey publicKey = applePublicKeyGenerator.generatePublicKeyWithApplePublicKeys(headers, applePublicKeys); + Claims claims = appleIdentityTokenParser.parseWithPublicKeyAndGetClaims(identityToken, publicKey); + validateClaims(claims); + + return claims.getSubject(); + } + + private void validateClaims(Claims claims) { + if (!appleIdentityTokenValidator.isValidAppleIdentityToken(claims)) { + throw new UnauthorizedException(ErrorMessage.INVALID_IDENTITY_TOKEN_CLAIMS); + } + } +} From 89fa8a03594f896d2ebb6dab324ebb15f975c1f1 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:45:22 +0900 Subject: [PATCH 08/14] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20fei?= =?UTF-8?q?gn=20client=20=EA=B5=AC=ED=98=84=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/doorip/openfeign/kakao/KakaoFeignClient.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoFeignClient.java diff --git a/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoFeignClient.java b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoFeignClient.java new file mode 100644 index 0000000..f6ecf9f --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoFeignClient.java @@ -0,0 +1,12 @@ +package org.doorip.openfeign.kakao; + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestHeader; + +@FeignClient(name = "${oauth.kakao.name}", url = "${oauth.kakao.url}") +public interface KakaoFeignClient { + @GetMapping + KakaoAccessTokenInfo getKakaoAccessTokenInfo(@RequestHeader("Authorization") String accessTokenWithTokenType); +} + From 98d8a91ed7a702c4a73090d26683b96afe86090b Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:46:14 +0900 Subject: [PATCH 09/14] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20acc?= =?UTF-8?q?ess=20token=20response=20dto=20=EA=B5=AC=ED=98=84=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openfeign/kakao/KakaoAccessToken.java | 20 +++++++++++++++++++ .../openfeign/kakao/KakaoAccessTokenInfo.java | 10 ++++++++++ 2 files changed, 30 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessToken.java create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessTokenInfo.java diff --git a/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessToken.java b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessToken.java new file mode 100644 index 0000000..1a0e695 --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessToken.java @@ -0,0 +1,20 @@ +package org.doorip.openfeign.kakao; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Getter +public class KakaoAccessToken { + private static final String TOKEN_TYPE = "Bearer "; + private String accessToken; + + public static KakaoAccessToken createKakaoAccessToken(String accessToken) { + return new KakaoAccessToken(accessToken); + } + + public String getAccessTokenWithTokenType() { + return TOKEN_TYPE + accessToken; + } +} \ No newline at end of file diff --git a/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessTokenInfo.java b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessTokenInfo.java new file mode 100644 index 0000000..5c1f063 --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessTokenInfo.java @@ -0,0 +1,10 @@ +package org.doorip.openfeign.kakao; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +public record KakaoAccessTokenInfo( + Long id +) { +} From 4ae82d02944df55be905084f2468b6b5c5c4b47e Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:46:36 +0900 Subject: [PATCH 10/14] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20acc?= =?UTF-8?q?ess=20token=20response=20dto=20=EA=B5=AC=ED=98=84=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openfeign/kakao/KakaoOAuthProvider.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoOAuthProvider.java diff --git a/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoOAuthProvider.java b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoOAuthProvider.java new file mode 100644 index 0000000..426b53a --- /dev/null +++ b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoOAuthProvider.java @@ -0,0 +1,31 @@ +package org.doorip.openfeign.kakao; + +import feign.FeignException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.doorip.exception.UnauthorizedException; +import org.doorip.message.ErrorMessage; +import org.springframework.stereotype.Component; + +@Slf4j +@RequiredArgsConstructor +@Component +public class KakaoOAuthProvider { + private final KakaoFeignClient kakaoFeignClient; + + public String getKakaoPlatformId(String accessToken) { + KakaoAccessToken kakaoAccessToken = KakaoAccessToken.createKakaoAccessToken(accessToken); + String accessTokenWithTokenType = kakaoAccessToken.getAccessTokenWithTokenType(); + KakaoAccessTokenInfo kakaoAccessTokenInfo = getKakaoAccessTokenInfo(accessTokenWithTokenType); + return String.valueOf(kakaoAccessTokenInfo.id()); + } + + private KakaoAccessTokenInfo getKakaoAccessTokenInfo(String accessTokenWithTokenType) { + try { + return kakaoFeignClient.getKakaoAccessTokenInfo(accessTokenWithTokenType); + } catch (FeignException e) { + log.error("Feign Exception: ", e); + throw new UnauthorizedException(ErrorMessage.INVALID_KAKAO_ACCESS_TOKEN); + } + } +} \ No newline at end of file From 471b562bf79f762c273a4e4e1810d68c27d8e0bd Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:47:06 +0900 Subject: [PATCH 11/14] =?UTF-8?q?feat:=20=EC=95=A0=ED=94=8C,=20=EC=B9=B4?= =?UTF-8?q?=EC=B9=B4=EC=98=A4=20=EA=B4=80=EB=A0=A8=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=B6=94=EA=B0=80=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/doorip/message/ErrorMessage.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java b/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java index 76aadb7..fd26d2e 100644 --- a/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java +++ b/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java @@ -24,6 +24,12 @@ public enum ErrorMessage { INVALID_REFRESH_TOKEN_VALUE(HttpStatus.UNAUTHORIZED, "e4015", "리프레시 토큰의 값이 올바르지 않습니다."), EXPIRED_REFRESH_TOKEN(HttpStatus.UNAUTHORIZED, "e4016", "리프레시 토큰이 만료되었습니다. 다시 로그인해 주세요."), MISMATCH_REFRESH_TOKEN(HttpStatus.UNAUTHORIZED, "e4017", "리프레시 토큰이 일치하지 않습니다."), + INVALID_IDENTITY_TOKEN(HttpStatus.UNAUTHORIZED, "e4018", "애플 아이덴티티 토큰의 형식이 올바르지 않습니다."), + INVALID_IDENTITY_TOKEN_VALUE(HttpStatus.UNAUTHORIZED, "e4019", "애플 아이덴티티 토큰의 값이 올바르지 않습니다."), + UNABLE_TO_CREATE_APPLE_PUBLIC_KEY(HttpStatus.UNAUTHORIZED, "e4020", "애플 로그인 중 퍼블릭 키 생성에 문제가 발생했습니다."), + EXPIRED_IDENTITY_TOKEN(HttpStatus.UNAUTHORIZED, "e4021", "애플 로그인 중 아이덴티티 토큰의 유효 기간이 만료되었습니다."), + INVALID_IDENTITY_TOKEN_CLAIMS(HttpStatus.UNAUTHORIZED, "e4022", "애플 아이덴터티 토큰의 클레임 값이 올바르지 않습니다."), + INVALID_KAKAO_ACCESS_TOKEN(HttpStatus.UNAUTHORIZED, "e4023", "카카오 액세스 토큰의 정보를 조회하는 과정에서 오류가 발생하였습니다."), /** * 403 Forbidden From e0fe0960a04e0b92820be1915ee38d53c86047b4 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Fri, 5 Jan 2024 11:51:54 +0900 Subject: [PATCH 12/14] =?UTF-8?q?del:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20import=20=EC=A0=9C=EA=B1=B0=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/doorip/openfeign/apple/AppleIdentityTokenParser.java | 2 +- .../java/org/doorip/openfeign/kakao/KakaoAccessTokenInfo.java | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java index 979533a..afce650 100644 --- a/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java +++ b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java @@ -20,7 +20,7 @@ public class AppleIdentityTokenParser { public Map parseHeaders(String identityToken) { try { - String encoded = identityToken.split("\\.")[0];; + String encoded = identityToken.split("\\.")[0]; String decoded = new String(Base64.getUrlDecoder().decode(encoded), StandardCharsets.UTF_8); return OBJECT_MAPPER.readValue(decoded, Map.class); } catch (JsonProcessingException | ArrayIndexOutOfBoundsException e) { diff --git a/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessTokenInfo.java b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessTokenInfo.java index 5c1f063..6a951e0 100644 --- a/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessTokenInfo.java +++ b/doorip-external/src/main/java/org/doorip/openfeign/kakao/KakaoAccessTokenInfo.java @@ -1,9 +1,5 @@ package org.doorip.openfeign.kakao; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; - public record KakaoAccessTokenInfo( Long id ) { From 584dffe997dc26aac774e455843a2ae10d2f0265 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Sun, 7 Jan 2024 16:08:58 +0900 Subject: [PATCH 13/14] =?UTF-8?q?fix:=20error=20message=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/doorip/message/ErrorMessage.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java b/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java index fd26d2e..8de3cef 100644 --- a/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java +++ b/doorip-common/src/main/java/org/doorip/message/ErrorMessage.java @@ -26,10 +26,10 @@ public enum ErrorMessage { MISMATCH_REFRESH_TOKEN(HttpStatus.UNAUTHORIZED, "e4017", "리프레시 토큰이 일치하지 않습니다."), INVALID_IDENTITY_TOKEN(HttpStatus.UNAUTHORIZED, "e4018", "애플 아이덴티티 토큰의 형식이 올바르지 않습니다."), INVALID_IDENTITY_TOKEN_VALUE(HttpStatus.UNAUTHORIZED, "e4019", "애플 아이덴티티 토큰의 값이 올바르지 않습니다."), - UNABLE_TO_CREATE_APPLE_PUBLIC_KEY(HttpStatus.UNAUTHORIZED, "e4020", "애플 로그인 중 퍼블릭 키 생성에 문제가 발생했습니다."), - EXPIRED_IDENTITY_TOKEN(HttpStatus.UNAUTHORIZED, "e4021", "애플 로그인 중 아이덴티티 토큰의 유효 기간이 만료되었습니다."), - INVALID_IDENTITY_TOKEN_CLAIMS(HttpStatus.UNAUTHORIZED, "e4022", "애플 아이덴터티 토큰의 클레임 값이 올바르지 않습니다."), - INVALID_KAKAO_ACCESS_TOKEN(HttpStatus.UNAUTHORIZED, "e4023", "카카오 액세스 토큰의 정보를 조회하는 과정에서 오류가 발생하였습니다."), + UNABLE_TO_CREATE_APPLE_PUBLIC_KEY(HttpStatus.UNAUTHORIZED, "e40110", "애플 로그인 중 퍼블릭 키 생성에 문제가 발생했습니다."), + EXPIRED_IDENTITY_TOKEN(HttpStatus.UNAUTHORIZED, "e40111", "애플 로그인 중 아이덴티티 토큰의 유효 기간이 만료되었습니다."), + INVALID_IDENTITY_TOKEN_CLAIMS(HttpStatus.UNAUTHORIZED, "e40112", "애플 아이덴터티 토큰의 클레임 값이 올바르지 않습니다."), + INVALID_KAKAO_ACCESS_TOKEN(HttpStatus.UNAUTHORIZED, "e40113", "카카오 액세스 토큰의 정보를 조회하는 과정에서 오류가 발생하였습니다."), /** * 403 Forbidden From dc5d6da324c36c197ff9897331dcc2385229db75 Mon Sep 17 00:00:00 2001 From: gardening-y <60008786@naver.com> Date: Sun, 7 Jan 2024 16:13:18 +0900 Subject: [PATCH 14/14] =?UTF-8?q?chore:=20code=20=EC=A0=95=EB=A0=AC=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/doorip/openfeign/apple/AppleIdentityTokenParser.java | 1 - 1 file changed, 1 deletion(-) diff --git a/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java index afce650..8603cda 100644 --- a/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java +++ b/doorip-external/src/main/java/org/doorip/openfeign/apple/AppleIdentityTokenParser.java @@ -13,7 +13,6 @@ import java.util.Base64; import java.util.Map; - @Component public class AppleIdentityTokenParser { private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();