diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfigBuilder.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfigBuilder.java index a189f2aa7fa6f..2600affd4c7fa 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfigBuilder.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfigBuilder.java @@ -466,20 +466,11 @@ public OidcTenantConfigBuilder token(Token token) { } /** - * @param verifyAccessTokenWithUserInfo {@link Token#verifyAccessTokenWithUserInfo()} * @param principalClaim {@link Token#principalClaim()} * @return this builder */ - public OidcTenantConfigBuilder token(boolean verifyAccessTokenWithUserInfo, String principalClaim) { - return token().verifyAccessTokenWithUserInfo(verifyAccessTokenWithUserInfo).principalClaim(principalClaim).end(); - } - - /** - * @param verifyAccessTokenWithUserInfo {@link Token#verifyAccessTokenWithUserInfo()} - * @return this builder - */ - public OidcTenantConfigBuilder token(boolean verifyAccessTokenWithUserInfo) { - return token().verifyAccessTokenWithUserInfo(verifyAccessTokenWithUserInfo).end(); + public OidcTenantConfigBuilder token(String principalClaim) { + return token().principalClaim(principalClaim).end(); } /** diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/providers/KnownOidcProviders.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/providers/KnownOidcProviders.java index 8e1e6348e94e4..8912c22ad4065 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/providers/KnownOidcProviders.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/providers/KnownOidcProviders.java @@ -34,7 +34,7 @@ private static OidcTenantConfig slack() { return OidcTenantConfig .authServerUrl("https://slack.com") .applicationType(WEB_APP) - .token().principalClaim("name").end() + .token("name") .authentication() .forceRedirectHttpsScheme() .scopes("profile", "email") @@ -64,7 +64,7 @@ private static OidcTenantConfig github() { .authorizationPath("authorize") .tokenPath("access_token") .userInfoPath("https://api.github.com/user") - .token(true, "name") + .token().verifyAccessTokenWithUserInfo(true).principalClaim("name").end() .authentication(authBuilder.build()) .build(); } @@ -93,7 +93,7 @@ private static OidcTenantConfig google() { .authServerUrl("https://accounts.google.com") .applicationType(WEB_APP) .authentication().scopes("openid", "email", "profile").end() - .token(true, "name") + .token().verifyAccessTokenWithUserInfo(true).principalClaim("name").end() .build(); } @@ -171,7 +171,7 @@ private static OidcTenantConfig spotify() { .authorizationPath("authorize") .tokenPath("api/token") .userInfoPath("https://api.spotify.com/v1/me") - .token(true, "display_name") + .token().verifyAccessTokenWithUserInfo(true).principalClaim("display_name").end() .authentication(authentication) .build(); } @@ -183,7 +183,7 @@ private static OidcTenantConfig strava() { .discoveryEnabled(false) .authorizationPath("authorize") .tokenPath("token") - .token(true) + .token().verifyAccessTokenWithUserInfo(true).end() .userInfoPath("https://www.strava.com/api/v3/athlete"); builder.authentication() @@ -218,7 +218,7 @@ private static OidcTenantConfig discord() { .authorizationPath("authorize") .tokenPath("token") .jwksPath("keys") - .token(true) + .token().verifyAccessTokenWithUserInfo(true).end() .authentication().scopes("identify", "email").idTokenRequired(false).end() .userInfoPath("https://discord.com/api/users/@me") .build(); diff --git a/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/OidcTenantConfigBuilderTest.java b/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/OidcTenantConfigBuilderTest.java index 50fa9f66815eb..a3bb7b8b92798 100644 --- a/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/OidcTenantConfigBuilderTest.java +++ b/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/OidcTenantConfigBuilderTest.java @@ -1089,7 +1089,7 @@ public void testTokenBuilder() { .requiredClaims(Map.of("III", "IV")) .audience("extra"); var config2 = second.end() - .token(false, "prince") + .token().verifyAccessTokenWithUserInfo(false).principalClaim("prince").end() .build(); var builtSecond = config2.token(); assertFalse(builtSecond.verifyAccessTokenWithUserInfo().orElseThrow()); @@ -1107,7 +1107,7 @@ public void testTokenBuilder() { assertTrue(builtSecond.audience().orElseThrow().contains("extra")); assertEquals("prince", builtSecond.principalClaim().orElse(null)); - var config3 = OidcTenantConfig.builder(config2).token(true).build(); + var config3 = OidcTenantConfig.builder(config2).token().verifyAccessTokenWithUserInfo().end().build(); assertTrue(config3.token().verifyAccessTokenWithUserInfo().orElseThrow()); assertEquals("haha", config3.tenantId().orElse(null));