Skip to content

Commit

Permalink
fix: withdraw 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdtkdgns committed Jul 3, 2024
1 parent 238a887 commit b6a4926
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class OAuthService(
suspend fun withdraw(oauthInfo: OauthInfo, code: String?, googleAccessToken: String?, appleAccessToken: String?) {
when (oauthInfo.oAuthProvider) {
OAuthProvider.KAKAO -> kakaoOAuthService.withdraw(oauthInfo.oAuthId)
OAuthProvider.APPLE -> appleOAuthService.withdraw(googleAccessToken!!)
OAuthProvider.GOOGLE -> googleOAuthService.withdraw(appleAccessToken!!)
OAuthProvider.APPLE -> appleOAuthService.withdraw(appleAccessToken!!)
OAuthProvider.GOOGLE -> googleOAuthService.withdraw(googleAccessToken!!)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,11 @@ class AppleOAuthService(
}

/** 회원 탈퇴합니다 */
suspend fun withdraw(code: String) {
val tokens = getOAuthWithdrawToken(code)

suspend fun withdraw(accessToken: String) {
withMDCContext(Dispatchers.IO) {
appleClient.withdraw(
appleOAuthSecretConfig.clientId,
tokens.accessToken,
accessToken,
getClientSecret()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ class OidcService(
oidcPublicKeysResponse: OidcPublicKeysResponse,
): OidcDecodePayload {
val jwt = decodeIdToken(token, oidcPublicKeysResponse.keys)
logger.info { "1" }
jwt ?: throw InvalidTokenException(ErrorCode.INVALID_TOKEN)
?: throw InvalidTokenException(ErrorCode.INVALID_TOKEN)

verifyToken(jwt, iss, aud)

Expand Down Expand Up @@ -129,7 +128,6 @@ class OidcService(
val verifyAud = token.audience.firstOrNull() == aud
val verifyIssuer = token.issuer == iss

logger.info { "2 ${Date()} ${token.expiresAt} ${token.audience.firstOrNull()} $aud ${token.issuer} $iss" }
if (!verifyTime || !verifyAud || !verifyIssuer) {
throw InvalidTokenException(ErrorCode.INVALID_TOKEN)
}
Expand Down

0 comments on commit b6a4926

Please sign in to comment.