Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ› Google id token issuer mismatch ์ด์Šˆ ํ•ด๊ฒฐ #40

Merged
merged 6 commits into from
Apr 10, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public OidcDecodePayload getPayload(Provider provider, String idToken) {
OauthOidcClientProperties properties = oauthOidcClients.get(provider).values().iterator().next();
OidcPublicKeyResponse response = client.getOidcPublicKey();

return getPayloadFromIdToken(idToken, properties.getJwksUri(), properties.getSecret(), null, response);
return getPayloadFromIdToken(idToken, properties.getIssuer(), properties.getSecret(), null, response);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ public interface OauthOidcClientProperties {
String getJwksUri();

String getSecret();

String getIssuer();
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ private String getUnsignedToken(String token) {
*/
private Jws<Claims> getOIDCTokenJws(String token, String modulus, String exponent) {
try {
log.info("token : {}", token);
return Jwts.parser()
.verifyWith(getRSAPublicKey(modulus, exponent))
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
public class AppleOidcProperties implements OauthOidcClientProperties {
private final String jwksUri;
private final String secret;

@Override
public String getIssuer() {
return jwksUri;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
public class GoogleOidcProperties implements OauthOidcClientProperties {
private final String jwksUri;
private final String secret;
private final String issuer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
public class KakaoOidcProperties implements OauthOidcClientProperties {
private final String jwksUri;
private final String secret;

@Override
public String getIssuer() {
return jwksUri;
}
}
7 changes: 4 additions & 3 deletions pennyway-infra/src/main/resources/application-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ oauth2:
client:
provider:
kakao:
jwks-uri: ${KAKAO_JWKS_URI:https://kauth.kakao.com}
jwks-uri: ${KAKAO_JWKS_URI:https://kakao.com}
secret: ${KAKAO_CLIENT_SECRET:liuhil5068l2j5o0912}
google:
jwks-uri: ${GOOGLE_JWKS_URI:https://www.googleapis.com}
jwks-uri: ${GOOGLE_JWKS_URI:https://google.com}
secret: ${GOOGLE_CLIENT_SECRET:123456789012-67hm9vokrt6ukmiwtvd8ak67oflecm.apps.googleusercontent.com}
issuer: ${GOOGLE_ISSUER:https://google.com}
apple:
jwks-uri: ${APPLE_JWKS_URI:https://appleid.apple.com}
jwks-uri: ${APPLE_JWKS_URI:https://apple.com}
secret: ${APPLE_CLIENT_SECRET:pennyway-jayang-was}

---
Expand Down
Loading