-
Notifications
You must be signed in to change notification settings - Fork 1
Send OID4VP authorization requests in Requests #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fda9a8b
4d5cbee
e5bffda
6bfc0e2
2d59100
5638d89
12f1475
78e0353
92b90c6
d31df69
97a6c36
e267eea
bf1552f
f7eeae4
9c33867
4b971ce
f1c0971
3d7efef
b7cb86d
81a0286
9993c7d
ee45063
f58f896
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { Serializable, serialize, type, validate } from "@js-soft/ts-serval"; | ||
| import { OwnIdentityAttribute, OwnIdentityAttributeJSON } from "../../../attributes"; | ||
| import { AcceptRequestItemParametersJSON } from "../../incoming/decide/AcceptRequestItemParameters"; | ||
|
|
||
| export interface AcceptShareAuthorizationRequestRequestItemParametersJSON extends AcceptRequestItemParametersJSON { | ||
| attribute: OwnIdentityAttributeJSON; | ||
| } | ||
|
|
||
| @type("AcceptShareAuthorizationRequestRequestItemParameters") | ||
| export class AcceptShareAuthorizationRequestRequestItemParameters extends Serializable { | ||
| @serialize() | ||
| @validate() | ||
| public attribute: OwnIdentityAttribute; | ||
|
|
||
| public static from(value: AcceptShareAuthorizationRequestRequestItemParametersJSON): AcceptShareAuthorizationRequestRequestItemParameters { | ||
| return this.fromAny(value); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { AcceptResponseItem, ResponseItemResult, ShareAuthorizationRequestRequestItem } from "@nmshd/content"; | ||
| import { OwnIdentityAttribute } from "../../../attributes"; | ||
| import { GenericRequestItemProcessor } from "../GenericRequestItemProcessor"; | ||
| import { LocalRequestInfo } from "../IRequestItemProcessor"; | ||
| import { AcceptShareAuthorizationRequestRequestItemParametersJSON } from "./AcceptShareAuthorizationRequestRequestItemParameters"; | ||
|
|
||
| export class ShareAuthorizationRequestRequestItemProcessor extends GenericRequestItemProcessor<ShareAuthorizationRequestRequestItem> { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to validate the Authorization Request in a canCreateOutgoingRequestItem function before sending it?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolving it is the only way I see for some validation - I'll put it in but I don't expect it to come up as long as we only use our service to do send those requests |
||
| public override async accept( | ||
| requestItem: ShareAuthorizationRequestRequestItem, | ||
| params: AcceptShareAuthorizationRequestRequestItemParametersJSON, | ||
| _requestInfo: LocalRequestInfo | ||
| ): Promise<AcceptResponseItem> { | ||
| const resolvedAuthorizationRequest = await this.consumptionController.openId4Vc.resolveAuthorizationRequest(requestItem.authorizationRequestUrl); | ||
| await this.consumptionController.openId4Vc.acceptAuthorizationRequest(resolvedAuthorizationRequest.authorizationRequest, OwnIdentityAttribute.from(params.attribute)); | ||
|
|
||
| return AcceptResponseItem.from({ result: ResponseItemResult.Accepted }); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { serialize, type, validate } from "@js-soft/ts-serval"; | ||
| import { RequestItemJSON } from "../.."; | ||
| import { IRequestItem, RequestItem } from "../../RequestItem"; | ||
|
|
||
| export interface ShareAuthorizationRequestRequestItemJSON extends RequestItemJSON { | ||
| "@type": "ShareAuthorizationRequestRequestItem"; | ||
| authorizationRequestUrl: string; | ||
| } | ||
|
|
||
| export interface IShareAuthorizationRequestRequestItem extends IRequestItem { | ||
| authorizationRequestUrl: string; | ||
| } | ||
|
|
||
| @type("ShareAuthorizationRequestRequestItem") | ||
| export class ShareAuthorizationRequestRequestItem extends RequestItem implements IShareAuthorizationRequestRequestItem { | ||
| @serialize() | ||
| @validate() | ||
| public authorizationRequestUrl: string; | ||
|
|
||
| public static from( | ||
| value: IShareAuthorizationRequestRequestItem | Omit<ShareAuthorizationRequestRequestItemJSON, "@type"> | ShareAuthorizationRequestRequestItemJSON | ||
| ): ShareAuthorizationRequestRequestItem { | ||
| return this.fromAny(value); | ||
| } | ||
|
|
||
| public override toJSON(verbose?: boolean | undefined, serializeAsString?: boolean | undefined): ShareAuthorizationRequestRequestItemJSON { | ||
| return super.toJSON(verbose, serializeAsString) as ShareAuthorizationRequestRequestItemJSON; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,3 +82,9 @@ export interface ShareCredentialOfferRequestItemDVO extends RequestItemDVO { | |
| credentialOfferUrl: string; | ||
| credentialResponses?: OpenId4VciCredentialResponseJSON[]; | ||
| } | ||
|
|
||
| export interface ShareAuthorizationRequestRequestItemDVO extends RequestItemDVO { | ||
| type: "ShareAuthorizationRequestRequestItemDVO"; | ||
| authorizationRequestUrl: string; | ||
| matchingCredentials: LocalAttributeDVO[]; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we type this as OwnIdentityAttributeDVO? |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need a canAccept that