From 9a9f1ab93b2d8e9f266f2780d3e23236acd8d0b8 Mon Sep 17 00:00:00 2001 From: sanderPostma Date: Wed, 2 Oct 2024 11:32:29 +0200 Subject: [PATCH] chore: added redirectUri support --- packages/siop-oid4vp/lib/authorization-request/Payload.ts | 1 + packages/siop-oid4vp/lib/authorization-request/types.ts | 1 + packages/siop-oid4vp/lib/rp/RP.ts | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/packages/siop-oid4vp/lib/authorization-request/Payload.ts b/packages/siop-oid4vp/lib/authorization-request/Payload.ts index 3219f700..6b9ce5ce 100644 --- a/packages/siop-oid4vp/lib/authorization-request/Payload.ts +++ b/packages/siop-oid4vp/lib/authorization-request/Payload.ts @@ -66,6 +66,7 @@ export const createAuthorizationRequestPayload = async ( ...(state && { state }), ...(registration.payload && isTarget(PropertyTarget.AUTHORIZATION_REQUEST, registration.clientMetadataOpts.targets) ? registration.payload : {}), ...(claims && { claims }), + ...(opts.redirectUri && { redirect_uri: opts.redirectUri }) } return removeNullUndefined(authRequestPayload) diff --git a/packages/siop-oid4vp/lib/authorization-request/types.ts b/packages/siop-oid4vp/lib/authorization-request/types.ts index 4d49e9f5..f4f609c2 100644 --- a/packages/siop-oid4vp/lib/authorization-request/types.ts +++ b/packages/siop-oid4vp/lib/authorization-request/types.ts @@ -62,6 +62,7 @@ interface AuthorizationRequestCommonOpts { payload?: AuthorizationRequestPayloadOpts requestObject: RequestObjectOpts uriScheme?: Schema | string // Use a custom scheme for the URI. By default openid:// will be used + redirectUri?: string; } export type AuthorizationRequestOptsVID1 = AuthorizationRequestCommonOpts diff --git a/packages/siop-oid4vp/lib/rp/RP.ts b/packages/siop-oid4vp/lib/rp/RP.ts index 8ff7e371..1f780764 100644 --- a/packages/siop-oid4vp/lib/rp/RP.ts +++ b/packages/siop-oid4vp/lib/rp/RP.ts @@ -294,6 +294,10 @@ export class RP { newOpts.requestObject.payload.claims = { ...newOpts.requestObject.payload.claims, ...claimsWithTarget.propertyValue } } } + + if(this._createRequestOptions.redirectUri !== undefined) { + newOpts.redirectUri = this._createRequestOptions.redirectUri + } return newOpts }