-
Notifications
You must be signed in to change notification settings - Fork 23
#4090: Wire credential_selection through API to presenter #4122
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
base: feature/4120-selection-selector
Are you sure you want to change the base?
Changes from all commits
f92fa08
9ebced5
f8859d2
b9c0019
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 |
|---|---|---|
|
|
@@ -773,8 +773,14 @@ func (r Wrapper) RequestServiceAccessToken(ctx context.Context, request RequestS | |
| if request.Body.TokenType != nil && strings.EqualFold(string(*request.Body.TokenType), AccessTokenTypeBearer) { | ||
| useDPoP = false | ||
| } | ||
| // Extract credential_selection from request | ||
| var credentialSelection map[string]string | ||
| if request.Body.CredentialSelection != nil { | ||
| credentialSelection = *request.Body.CredentialSelection | ||
| } | ||
|
|
||
| clientID := r.subjectToBaseURL(request.SubjectID) | ||
| tokenResult, err := r.auth.IAMClient().RequestRFC021AccessToken(ctx, clientID.String(), request.SubjectID, request.Body.AuthorizationServer, request.Body.Scope, useDPoP, credentials) | ||
| tokenResult, err := r.auth.IAMClient().RequestRFC021AccessToken(ctx, clientID.String(), request.SubjectID, request.Body.AuthorizationServer, request.Body.Scope, useDPoP, credentials, credentialSelection) | ||
|
Comment on lines
+776
to
+783
|
||
| if err != nil { | ||
| // this can be an internal server error, a 400 oauth error or a 412 precondition failed if the wallet does not contain the required credentials | ||
| return nil, err | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,7 @@ type Client interface { | |
| PresentationDefinition(ctx context.Context, endpoint string) (*pe.PresentationDefinition, error) | ||
| // RequestRFC021AccessToken is called by the local EHR node to request an access token from a remote OAuth2 Authorization Server using Nuts RFC021. | ||
|
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. godoc to explain |
||
| RequestRFC021AccessToken(ctx context.Context, clientID string, subjectDID string, authServerURL string, scopes string, useDPoP bool, | ||
| credentials []vc.VerifiableCredential) (*oauth.TokenResponse, error) | ||
| credentials []vc.VerifiableCredential, credentialSelection map[string]string) (*oauth.TokenResponse, error) | ||
|
|
||
| // OpenIdCredentialIssuerMetadata returns the metadata of the remote credential issuer. | ||
| // oauthIssuer is the URL of the issuer as specified by RFC 8414 (OAuth 2.0 Authorization Server Metadata). | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -235,7 +235,7 @@ func (c *OpenID4VPClient) AccessToken(ctx context.Context, code string, tokenEnd | |
| } | ||
|
|
||
| func (c *OpenID4VPClient) RequestRFC021AccessToken(ctx context.Context, clientID string, subjectID string, authServerURL string, scopes string, | ||
| useDPoP bool, additionalCredentials []vc.VerifiableCredential) (*oauth.TokenResponse, error) { | ||
| useDPoP bool, additionalCredentials []vc.VerifiableCredential, credentialSelection map[string]string) (*oauth.TokenResponse, error) { | ||
| iamClient := c.httpClient | ||
| metadata, err := c.AuthorizationServerMetadata(ctx, authServerURL) | ||
| if err != nil { | ||
|
|
@@ -296,7 +296,7 @@ func (c *OpenID4VPClient) RequestRFC021AccessToken(ctx context.Context, clientID | |
| additionalWalletCredentials[subjectDID] = append(additionalWalletCredentials[subjectDID], credential.AutoCorrectSelfAttestedCredential(curr, subjectDID)) | ||
| } | ||
| } | ||
| vp, submission, err := c.wallet.BuildSubmission(ctx, subjectDIDs, additionalWalletCredentials, *presentationDefinition, params) | ||
| vp, submission, err := c.wallet.BuildSubmission(ctx, subjectDIDs, additionalWalletCredentials, *presentationDefinition, credentialSelection, params) | ||
|
Comment on lines
237
to
+299
|
||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
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.
might be smart to initialize as empty map if not provided, because otherwise you'll be dealing with
nilfurther downstream, which is error-prone