From 42c8dddf8c0ec76de98052198a27fe4409903918 Mon Sep 17 00:00:00 2001 From: Martin Auer Date: Thu, 1 Aug 2024 18:30:25 +0200 Subject: [PATCH] fix: redirect uri should not be set with direct_post --- .../lib/request-object/RequestObject.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/siop-oid4vp/lib/request-object/RequestObject.ts b/packages/siop-oid4vp/lib/request-object/RequestObject.ts index da606bbb..e8a444fd 100644 --- a/packages/siop-oid4vp/lib/request-object/RequestObject.ts +++ b/packages/siop-oid4vp/lib/request-object/RequestObject.ts @@ -2,7 +2,15 @@ import { ClaimPayloadCommonOpts, ClaimPayloadOptsVID1, CreateAuthorizationReques import { assertValidAuthorizationRequestOpts } from '../authorization-request/Opts' import { fetchByReferenceOrUseByValue, removeNullUndefined } from '../helpers' import { parseJWT } from '../helpers/jwtUtils' -import { AuthorizationRequestPayload, JwtIssuer, JwtIssuerWithContext, RequestObjectJwt, RequestObjectPayload, SIOPErrors } from '../types' +import { + AuthorizationRequestPayload, + JwtIssuer, + JwtIssuerWithContext, + RequestObjectJwt, + RequestObjectPayload, + ResponseMode, + SIOPErrors, +} from '../types' import { assertValidRequestObjectOpts } from './Opts' import { assertValidRequestObjectPayload, createRequestObjectPayload } from './Payload' @@ -92,7 +100,11 @@ export class RequestObject { } else if (jwtIssuer.method === 'x5c') { this.payload.iss = jwtIssuer.issuer this.payload.client_id = jwtIssuer.issuer - this.payload.redirect_uri = jwtIssuer.issuer + + if (this.opts.payload.response_mode !== ResponseMode.DIRECT_POST) { + this.payload.redirect_uri = jwtIssuer.issuer + } + this.payload.client_id_scheme = jwtIssuer.clientIdScheme const header = { x5c: jwtIssuer.x5c, typ: 'JWT' }