Skip to content

Commit

Permalink
feat : 애플 로그인 탈퇴 에러 페이지 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
1000kkannoo committed Aug 20, 2024
1 parent f049af6 commit 3ca49b4
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import cmc15.backend.domain.account.response.AppleSocialTokenInfoResponse;
import cmc15.backend.global.config.jwt.TokenDecoder;
import cmc15.backend.global.config.jwt.TokenProvider;
import cmc15.backend.global.exception.CustomException;
import io.jsonwebtoken.JwsHeader;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
Expand Down Expand Up @@ -41,7 +40,6 @@

import static cmc15.backend.domain.account.entity.Authority.ROLE_USER;
import static cmc15.backend.domain.account.entity.Platform.APPLE;
import static cmc15.backend.global.Result.DELETED_USER;
import static java.net.URLEncoder.encode;
import static java.nio.charset.StandardCharsets.UTF_8;

Expand Down Expand Up @@ -84,7 +82,9 @@ public AccountResponse.OAuthConnection toSocialLoginAccount(Platform platform, S
.build())
);

validateDeleteUser(account);
if (account.getDeleteAt() != null) {
return AccountResponse.OAuthConnection.toRedirect(account, "none", "none", "https://previewinsure.vercel.app/callback/errorApple?isRegistered=true");
}

String atk = tokenProvider.createAccessToken(account.getAccountId(), getAuthentication(account.getEmail(), oAuthSettings.getNonEncryptionPassword()));
String rtk = tokenProvider.createRefreshToken(account.getEmail());
Expand All @@ -94,12 +94,6 @@ public AccountResponse.OAuthConnection toSocialLoginAccount(Platform platform, S
return AccountResponse.OAuthConnection.toRedirect(account, atk, rtk, successUrl);
}

private static void validateDeleteUser(Account account) {
if (account.getDeleteAt() != null) {
throw new CustomException(DELETED_USER);
}
}

private AppleSocialTokenInfoResponse exchangeAppleSocialToken(String clientId, String clientSecret, String grantType, String code) {
// 요청 파라미터 설정
UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromHttpUrl(APPLE_AUTH_URL)
Expand Down

0 comments on commit 3ca49b4

Please sign in to comment.