diff --git a/packages/core/__tests__/e2e.test.ts b/packages/core/__tests__/e2e.test.ts index 0d23137..c88a914 100644 --- a/packages/core/__tests__/e2e.test.ts +++ b/packages/core/__tests__/e2e.test.ts @@ -79,7 +79,11 @@ describe('End To End', async () => { jwks: { keys: [publicKeyJwk], }, - source_endpoint: `${iss}/fetch`, + metadata: { + federation_entity: { + federation_fetch_endpoint: `${iss}/fetch`, + }, + }, }, header: { kid: 'some-id', diff --git a/packages/core/__tests__/fetchEntityStatement.test.ts b/packages/core/__tests__/fetchEntityStatement.test.ts index 545b5f9..2202553 100644 --- a/packages/core/__tests__/fetchEntityStatement.test.ts +++ b/packages/core/__tests__/fetchEntityStatement.test.ts @@ -22,7 +22,11 @@ describe('fetch entity statement', () => { }, sub: iss, iss, - source_endpoint: `${iss}/fetch`, + metadata: { + federation_entity: { + federation_fetch_endpoint: `${iss}/fetch`, + }, + }, iat: 1, exp: 1, }, @@ -90,7 +94,11 @@ describe('fetch entity statement', () => { }, sub: iss, iss, - source_endpoint: `${iss}/fetch`, + metadata: { + federation_entity: { + federation_fetch_endpoint: `${iss}/fetch`, + }, + }, iat: 1, exp: 1, }, @@ -152,7 +160,11 @@ describe('fetch entity statement', () => { }, sub: iss, iss, - source_endpoint: `${iss}/fetch`, + metadata: { + federation_entity: { + federation_fetch_endpoint: `${iss}/fetch`, + }, + }, iat: 1, exp: 1, }, @@ -255,7 +267,11 @@ describe('fetch entity statement', () => { iss, iat: 1, exp: 1, - source_endpoint: `${iss}/fetch`, + metadata: { + federation_entity: { + federation_fetch_endpoint: `${iss}/fetch`, + }, + }, }, header: { kid: 'a', @@ -295,7 +311,11 @@ describe('fetch entity statement', () => { }, sub: iss, iss, - source_endpoint: `${iss}/fetch`, + metadata: { + federation_entity: { + federation_fetch_endpoint: `${iss}/fetch`, + }, + }, iat: 1, exp: 1, }, diff --git a/packages/core/__tests__/utils/setupConfigurationChain.ts b/packages/core/__tests__/utils/setupConfigurationChain.ts index 609bfc8..337d689 100644 --- a/packages/core/__tests__/utils/setupConfigurationChain.ts +++ b/packages/core/__tests__/utils/setupConfigurationChain.ts @@ -34,7 +34,11 @@ export const setupConfigurationChain = async ( iat: new Date(), jwks: jwks ?? { keys: [{ kid: 'a', kty: 'EC' }] }, authority_hints: authorityHints, - source_endpoint: `${entityId}/fetch`, + metadata: { + federation_entity: { + federation_fetch_endpoint: `${entityId}/fetch`, + }, + }, } // fix so `undefined` is not in the expected claims diff --git a/packages/core/src/entityStatement/fetchEntityStatement.ts b/packages/core/src/entityStatement/fetchEntityStatement.ts index 1d14e61..56f3f03 100644 --- a/packages/core/src/entityStatement/fetchEntityStatement.ts +++ b/packages/core/src/entityStatement/fetchEntityStatement.ts @@ -36,7 +36,7 @@ export const fetchEntityStatement = async ({ const issEntityConfigurationClaims = issEntityConfiguration ?? (await fetchEntityConfiguration({ entityId: iss, verifyJwtCallback })) - const fetchEndpoint = endpoint ?? issEntityConfigurationClaims.source_endpoint + const fetchEndpoint = endpoint ?? issEntityConfigurationClaims.metadata?.federation_entity?.federation_fetch_endpoint if (!fetchEndpoint) { throw new Error('No fetch endpoint provided or in the issuer configuration') diff --git a/packages/core/src/entityStatement/fetchEntityStatementChain.ts b/packages/core/src/entityStatement/fetchEntityStatementChain.ts index 2950b92..99693d6 100644 --- a/packages/core/src/entityStatement/fetchEntityStatementChain.ts +++ b/packages/core/src/entityStatement/fetchEntityStatementChain.ts @@ -37,12 +37,12 @@ export const fetchEntityStatementChain = async ({ // If we have no subject configuration we have reached the leaf entity as the `configuration` if (!subjectConfiguration) continue - const fetchEndpoint = configuration?.source_endpoint + const fetchEndpoint = configuration?.metadata?.federation_entity?.federation_fetch_endpoint if (!fetchEndpoint) { throw new OpenIdFederationError( ErrorCode.Validation, - `No source endpoint found for configuration for: '${configuration?.sub}'` + `No fetch endpoint found for configuration for: '${configuration?.sub}'` ) }