From 72c827295ee094c7ca761a6dca01b4797a5f7326 Mon Sep 17 00:00:00 2001 From: golobitch Date: Tue, 6 Aug 2024 00:12:39 +0200 Subject: [PATCH 1/3] feat(auth): return granId for the grant lookup via interaction id --- packages/auth/src/interaction/routes.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/auth/src/interaction/routes.ts b/packages/auth/src/interaction/routes.ts index 8f29ea9fa5..cb8ecf0148 100644 --- a/packages/auth/src/interaction/routes.ts +++ b/packages/auth/src/interaction/routes.ts @@ -146,6 +146,7 @@ async function getGrantDetails( ) ctx.body = { + grantId: interaction.grant.id, access: access.map(toOpenPaymentsAccess), state: interaction.state } From 3a4bcf4df996d82683805bcf42c29c10111ea684 Mon Sep 17 00:00:00 2001 From: golobitch Date: Tue, 6 Aug 2024 00:13:19 +0200 Subject: [PATCH 2/3] test(auth): check grantId is returned for grant lookup via interaction id --- packages/auth/src/interaction/routes.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/auth/src/interaction/routes.test.ts b/packages/auth/src/interaction/routes.test.ts index 50137533fe..38e2271067 100644 --- a/packages/auth/src/interaction/routes.test.ts +++ b/packages/auth/src/interaction/routes.test.ts @@ -529,6 +529,7 @@ describe('Interaction Routes', (): void => { describe('IDP - Grant details', (): void => { let grant: Grant let access: Access + let interaction: Interaction; beforeAll(async (): Promise => { grant = await Grant.query().insert({ @@ -539,6 +540,10 @@ describe('Interaction Routes', (): void => { ...BASE_GRANT_ACCESS, grantId: grant.id }) + + interaction = await Interaction.query().insert( + generateBaseInteraction(grant) + ) }) test('Can get grant details', async (): Promise => { @@ -558,6 +563,7 @@ describe('Interaction Routes', (): void => { await expect(interactionRoutes.details(ctx)).resolves.toBeUndefined() expect(ctx.status).toBe(200) expect(ctx.body).toEqual({ + grantId: grant.id, access: [ { actions: access.actions, From 87d9fe0363fb861f1d1bf05abb6ec38c172bdca4 Mon Sep 17 00:00:00 2001 From: golobitch Date: Tue, 6 Aug 2024 00:13:49 +0200 Subject: [PATCH 3/3] docs(openapi): auth return grantId for grant lookup via interaction id --- packages/auth/src/interaction/routes.test.ts | 2 +- packages/auth/src/openapi/specs/id-provider.yaml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/auth/src/interaction/routes.test.ts b/packages/auth/src/interaction/routes.test.ts index 38e2271067..8b5a539cb4 100644 --- a/packages/auth/src/interaction/routes.test.ts +++ b/packages/auth/src/interaction/routes.test.ts @@ -529,7 +529,7 @@ describe('Interaction Routes', (): void => { describe('IDP - Grant details', (): void => { let grant: Grant let access: Access - let interaction: Interaction; + let interaction: Interaction beforeAll(async (): Promise => { grant = await Grant.query().insert({ diff --git a/packages/auth/src/openapi/specs/id-provider.yaml b/packages/auth/src/openapi/specs/id-provider.yaml index d3be9e897b..ad5e1afd7f 100644 --- a/packages/auth/src/openapi/specs/id-provider.yaml +++ b/packages/auth/src/openapi/specs/id-provider.yaml @@ -129,6 +129,9 @@ paths: - PENDING - APPROVED - DENIED + grantId: + description: Id of a grant + type: string '401': description: Unauthorized '404':