From 440b1daf255737be757f79dbb42cd694c99d2bf2 Mon Sep 17 00:00:00 2001 From: Danny Pendle <37051679+fredhair@users.noreply.github.com> Date: Wed, 16 Aug 2023 09:59:38 +0100 Subject: [PATCH] Added useCustomAuth0Domain flag openid-configuration now contains an optional flag to allow custom domains in auth0 to function as normal. A small change in the url service checks if the authority ends with auth0.com OR the useCustomAuth0Domain is set. --- .../src/lib/config/openid-configuration.ts | 6 ++++++ .../src/lib/utils/url/url.service.ts | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/angular-auth-oidc-client/src/lib/config/openid-configuration.ts b/projects/angular-auth-oidc-client/src/lib/config/openid-configuration.ts index 1b37eebc..b292635d 100644 --- a/projects/angular-auth-oidc-client/src/lib/config/openid-configuration.ts +++ b/projects/angular-auth-oidc-client/src/lib/config/openid-configuration.ts @@ -66,6 +66,12 @@ export interface OpenIdConfiguration { * By entering a value, you can renew the tokens before the tokens expire. */ renewTimeBeforeTokenExpiresInSeconds?: number; + /** + * Allows for a custom domain to be used with Auth0. + * With this flag set the 'authority' does not have to end with + * 'auth0.com' to trigger the auth0 special handling of logouts. + */ + useCustomAuth0Domain?: boolean; /** * When set to true, refresh tokens are used to renew the user session. * When set to false, standard silent renew is used. diff --git a/projects/angular-auth-oidc-client/src/lib/utils/url/url.service.ts b/projects/angular-auth-oidc-client/src/lib/utils/url/url.service.ts index b26cd2c6..c003c4e3 100644 --- a/projects/angular-auth-oidc-client/src/lib/utils/url/url.service.ts +++ b/projects/angular-auth-oidc-client/src/lib/utils/url/url.service.ts @@ -796,13 +796,13 @@ export class UrlService { } private isAuth0Endpoint(configuration: OpenIdConfiguration): boolean { - const { authority } = configuration; + const { authority, useCustomAuth0Domain } = configuration; if (!authority) { return false; } - return authority.endsWith(AUTH0_ENDPOINT); + return authority.endsWith(AUTH0_ENDPOINT) || useCustomAuth0Domain; } private composeAuth0Endpoint(configuration: OpenIdConfiguration): string {