Skip to content

Commit ecd5228

Browse files
committed
chore: keep responseRedirectURI in AuthorizationRequestState
1 parent 3238e0f commit ecd5228

4 files changed

Lines changed: 24 additions & 5 deletions

File tree

packages/siop-oid4vp/lib/rp/InMemoryRPSessionManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export class InMemoryRPSessionManager implements IRPSessionManager {
199199
queryId: event.queryId ?? this.queryIdMapping[event.correlationId],
200200
...(type === 'request' && { request: event.subject }),
201201
...(type === 'response' && { response: event.subject }),
202+
...(type === 'request' && event.responseRedirectURI && {responseRedirectURI: event.responseRedirectURI}),
202203
...(event.error && { error: event.error }),
203204
status,
204205
timestamp: event.timestamp,

packages/siop-oid4vp/lib/rp/RP.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ export class RP {
9393
version?: SupportedVersion
9494
requestByReferenceURI?: string
9595
responseURI?: string
96-
responseURIType?: ResponseURIType
96+
responseURIType?: ResponseURIType,
97+
responseRedirectURI?: string
9798
}): Promise<AuthorizationRequest> {
9899
const authorizationRequestOpts = this.newAuthorizationRequestOpts(opts)
99100

@@ -131,7 +132,8 @@ export class RP {
131132
requestByReferenceURI?: string
132133
responseURI?: string
133134
responseURIType?: ResponseURIType
134-
callback?: CallbackOpts
135+
callback?: CallbackOpts,
136+
responseRedirectURI?: string
135137
}): Promise<URI> {
136138
const authorizationRequestOpts = this.newAuthorizationRequestOpts(opts)
137139

@@ -147,7 +149,8 @@ export class RP {
147149
correlationId: opts.correlationId,
148150
queryId: opts.queryId,
149151
subject: authRequest,
150-
callback: opts.callback
152+
callback: opts.callback,
153+
responseRedirectURI: opts.responseRedirectURI
151154
})
152155
return uri
153156
} catch (error) {
@@ -458,6 +461,7 @@ export class RP {
458461
queryId?: string
459462
subject?: AuthorizationRequest | AuthorizationResponse | AuthorizationResponsePayload
460463
callback?: CallbackOpts
464+
responseRedirectURI?: string
461465
error?: Error
462466
},
463467
): void {

packages/siop-oid4vp/lib/types/Events.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,23 @@ export class AuthorizationEvent<T> {
3333
private readonly _timestamp: number
3434
private readonly _correlationId: string
3535
private readonly _queryId: string
36-
37-
public constructor(args: { correlationId: string; queryId?: string, subject?: T; callback?: CallbackOpts, error?: Error }) {
36+
private readonly _responseRedirectURI: string
37+
38+
public constructor(args: {
39+
correlationId: string;
40+
queryId?: string,
41+
subject?: T;
42+
callback?: CallbackOpts;
43+
responseRedirectURI?: string,
44+
error?: Error
45+
}) {
3846
//fixme: Create correlationId if not provided. Might need to be deferred to registry though
3947
this._correlationId = args.correlationId
4048
this._queryId = args.queryId
4149
this._timestamp = Date.now()
4250
this._subject = args.subject
4351
this._callback = args.callback
52+
this._responseRedirectURI = args.responseRedirectURI
4453
this._error = args.error
4554
}
4655

@@ -60,6 +69,10 @@ export class AuthorizationEvent<T> {
6069
return this._callback
6170
}
6271

72+
get responseRedirectURI(): string {
73+
return this._responseRedirectURI
74+
}
75+
6376
public hasError(): boolean {
6477
return !!this._error
6578
}

packages/siop-oid4vp/lib/types/SessionManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface AuthorizationRequestState {
88
request: AuthorizationRequest
99
status: AuthorizationRequestStateStatus
1010
callback?: CallbackOpts
11+
responseRedirectURI?: string
1112
timestamp: number
1213
lastUpdated: number
1314
error?: Error

0 commit comments

Comments
 (0)