From dba57b9c62756fc74e01e7497f66b9e666ccdd98 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Fri, 23 Aug 2024 18:59:42 +0100 Subject: [PATCH] Fix OIDC Discord provider configuration --- .../io/quarkus/oidc/runtime/providers/KnownOidcProviders.java | 3 +++ .../java/io/quarkus/oidc/runtime/KnownOidcProvidersTest.java | 2 ++ 2 files changed, 5 insertions(+) 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 36bc6425e2e49..a87f909dbbef2 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 @@ -191,14 +191,17 @@ private static OidcTenantConfig twitch() { private static OidcTenantConfig discord() { // Ref https://discord.com/developers/docs/topics/oauth2 OidcTenantConfig ret = new OidcTenantConfig(); + ret.setApplicationType(OidcTenantConfig.ApplicationType.WEB_APP); ret.setAuthServerUrl("https://discord.com/api/oauth2"); ret.setDiscoveryEnabled(false); ret.setAuthorizationPath("authorize"); ret.setTokenPath("token"); + ret.setJwksPath("keys"); ret.getAuthentication().setScopes(List.of("identify", "email")); ret.getAuthentication().setIdTokenRequired(false); ret.getToken().setVerifyAccessTokenWithUserInfo(true); ret.setUserInfoPath("https://discord.com/api/users/@me"); + return ret; } } diff --git a/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/KnownOidcProvidersTest.java b/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/KnownOidcProvidersTest.java index 715fe4a563fe6..fc593643f1395 100644 --- a/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/KnownOidcProvidersTest.java +++ b/extensions/oidc/runtime/src/test/java/io/quarkus/oidc/runtime/KnownOidcProvidersTest.java @@ -529,10 +529,12 @@ public void testAcceptDiscordProperties() throws Exception { OidcTenantConfig config = OidcUtils.mergeTenantConfig(tenant, KnownOidcProviders.provider(Provider.DISCORD)); assertEquals(OidcUtils.DEFAULT_TENANT_ID, config.getTenantId().get()); + assertEquals(ApplicationType.WEB_APP, config.getApplicationType().get()); assertFalse(config.discoveryEnabled.get()); assertEquals("https://discord.com/api/oauth2", config.getAuthServerUrl().get()); assertEquals("authorize", config.getAuthorizationPath().get()); assertEquals("token", config.getTokenPath().get()); + assertEquals("keys", config.getJwksPath().get()); assertEquals("https://discord.com/api/users/@me", config.getUserInfoPath().get()); assertEquals(List.of("identify", "email"), config.authentication.scopes.get()); assertFalse(config.getAuthentication().idTokenRequired.get());