diff --git a/.changeset/cool-crews-press.md b/.changeset/cool-crews-press.md new file mode 100644 index 00000000..996e816c --- /dev/null +++ b/.changeset/cool-crews-press.md @@ -0,0 +1,6 @@ +--- +'@asgardeo/javascript': patch +'@asgardeo/i18n': patch +--- + +Add support for AsgardeoV2 platform in AuthenticationHelper to comply with RFC 8414 diff --git a/packages/i18n/src/models/i18n.ts b/packages/i18n/src/models/i18n.ts index fffddbaa..f5b4be11 100644 --- a/packages/i18n/src/models/i18n.ts +++ b/packages/i18n/src/models/i18n.ts @@ -176,7 +176,7 @@ export interface I18nMetadata { countryCode: string; languageCode: string; displayName: string; - direction: I18nTextDirection; + direction: I18nTextDirection | string; } export interface I18nBundle { diff --git a/packages/javascript/src/__legacy__/helpers/authentication-helper.ts b/packages/javascript/src/__legacy__/helpers/authentication-helper.ts index f6c845ac..709380c2 100644 --- a/packages/javascript/src/__legacy__/helpers/authentication-helper.ts +++ b/packages/javascript/src/__legacy__/helpers/authentication-helper.ts @@ -20,8 +20,10 @@ import OIDCDiscoveryConstants from '../../constants/OIDCDiscoveryConstants'; import TokenExchangeConstants from '../../constants/TokenExchangeConstants'; import {AsgardeoAuthException} from '../../errors/exception'; import {IsomorphicCrypto} from '../../IsomorphicCrypto'; +import {Config} from '../../models/config'; import {JWKInterface} from '../../models/crypto'; import {OIDCDiscoveryEndpointsApiResponse, OIDCDiscoveryApiResponse} from '../../models/oidc-discovery'; +import {Platform} from '../../models/platforms'; import {SessionData} from '../../models/session'; import {IdToken, TokenResponse, AccessTokenApiResponse} from '../../models/token'; import {User} from '../../models/user'; @@ -145,6 +147,19 @@ export class AuthenticationHelper { .USERINFO]: `${baseUrl}${OIDCDiscoveryConstants.Endpoints.USERINFO}`, }; + // For AsgardeoV2 (Thunder), the issuer must be the base URL (e.g., https://localhost:8090) + // to comply with RFC 8414 (Section 2 & 3) and OpenID Connect Discovery specs. + // The issuer should be a URL using "https" scheme with no query or fragment components. + // The well-known metadata endpoint is derived by inserting "/.well-known/oauth-authorization-server" + // between the host and path components of the issuer identifier. + // Reference: https://datatracker.ietf.org/doc/html/rfc8414#section-2 + // Trackers: + // - https://github.com/asgardeo/thunder/issues/815 + // - https://github.com/asgardeo/javascript/issues/322 + if ((configData as Config).platform === Platform.AsgardeoV2) { + defaultEndpoints[OIDCDiscoveryConstants.Storage.StorageKeys.Endpoints.ISSUER] = `${baseUrl}`; + } + return {...defaultEndpoints, ...oidcProviderMetaData}; }