Skip to content

Commit

Permalink
Merge pull request #42738 from sberyozkin/fix_oidc_discord
Browse files Browse the repository at this point in the history
Fix OIDC Discord provider configuration
  • Loading branch information
sberyozkin authored Aug 24, 2024
2 parents 15d0e96 + dba57b9 commit 27514a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 27514a6

Please sign in to comment.