Skip to content

Commit

Permalink
chore: redirectUri correlationId & state params substitution
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Oct 2, 2024
1 parent 9a9f1ab commit 6900e09
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/siop-oid4vp/lib/rp/RP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ export class RP {
responseURIType?: ResponseURIType
}): Promise<URI> {
const authorizationRequestOpts = this.newAuthorizationRequestOpts(opts)

if(authorizationRequestOpts.redirectUri !== undefined) {
authorizationRequestOpts.redirectUri = authorizationRequestOpts.redirectUri
.replace(':correlation_id', opts.correlationId)
.replace(':correlationId', opts.correlationId)
if(typeof(opts.state) === 'string') {
authorizationRequestOpts.redirectUri = authorizationRequestOpts.redirectUri.replace(':state', opts.state)
}
}

return await URI.fromOpts(authorizationRequestOpts)
.then(async (uri: URI) => {
void this.emitEvent(AuthorizationEvents.ON_AUTH_REQUEST_CREATED_SUCCESS, {
Expand Down

0 comments on commit 6900e09

Please sign in to comment.