diff --git a/user-service/src/main/java/kr/mafoo/user/service/AuthService.java b/user-service/src/main/java/kr/mafoo/user/service/AuthService.java index 15a23748..6b52af55 100644 --- a/user-service/src/main/java/kr/mafoo/user/service/AuthService.java +++ b/user-service/src/main/java/kr/mafoo/user/service/AuthService.java @@ -6,6 +6,11 @@ import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jws; import io.jsonwebtoken.Jwts; +import java.security.interfaces.RSAPublicKey; +import java.util.Arrays; +import java.util.Base64; +import java.util.LinkedHashMap; +import java.util.Set; import kr.mafoo.user.config.properties.AppleOAuthProperties; import kr.mafoo.user.config.properties.KakaoOAuthProperties; import kr.mafoo.user.controller.dto.response.AppleKeyListResponse; @@ -24,11 +29,6 @@ import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; -import java.security.interfaces.RSAPublicKey; -import java.util.Arrays; -import java.util.Base64; -import java.util.LinkedHashMap; - @RequiredArgsConstructor @Service public class AuthService { @@ -157,8 +157,8 @@ private Mono getUserInfoWithAppleAccessToken(AppleKeyResponse[] .build() .parseSignedClaims(identityToken); - String client = claims.getPayload().get("aud", String.class); - if (!client.equals(appleOAuthProperties.clientId())) { + Set audienceList = claims.getPayload().get("aud", Set.class); + if (audienceList == null || !audienceList.contains(appleOAuthProperties.clientId())) { throw new RuntimeException(); }