Skip to content
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

Handle direct_post return from wallet to verifier #2702

Merged
merged 3 commits into from
Jan 22, 2024

Conversation

woutslakhorst
Copy link
Member

@woutslakhorst woutslakhorst commented Dec 21, 2023

closes #2694

the /token API is also implemented but not yet used in the e2e test. The next PR should combine the two.

some method signatures are getting quite long. We might need to refactor these after completion of the entire flow.

the constructed callback url for the holder will be implemented by the next PR.

nonce and challenge are still a bit of a mess, but types will change in the future anyway...

@woutslakhorst woutslakhorst force-pushed the feature/2694/verifier_handle_response branch 4 times, most recently from 1a31b91 to a7a7bf1 Compare January 15, 2024 15:33
@woutslakhorst woutslakhorst marked this pull request as ready for review January 15, 2024 15:34
…2626)

wip

added bunch of tests

added missing API tests

fix failing test

add tests for failing directpost responses

refactor ami client and reuse response parsing/code checking

happy flow tests for holder service

error tests for holder service

comment

touchup on some comments
@woutslakhorst woutslakhorst force-pushed the feature/2694/verifier_handle_response branch from a7a7bf1 to c3f1594 Compare January 15, 2024 15:34
remove url decode from middleware, now handled by codegen bind
add callback, fix request logger
fix logger test
add e2e test
added handling of error direct_post
@woutslakhorst woutslakhorst force-pushed the feature/2694/verifier_handle_response branch from c3f1594 to 5963fd9 Compare January 15, 2024 15:36
signInstruction.Mappings[0].Path = "$.verifiableCredential"
}

// todo the check below actually depends on the format of the credential and not the format of the VP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this isn't right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did create an error when running the e2e-test. But "fixing" it now is a bit pro-active since VC formats are going to be changed anyway.

Comment on lines 154 to 155
// commented for now because it's needed for VPs in JWT format as well.
//if format == vc.JSONLDPresentationProofFormat {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just remove comment and commented out code?

e2e-tests/oauth-flow/openid4vp/docker-compose.yml Outdated Show resolved Hide resolved
e2e-tests/oauth-flow/openid4vp/run-test.sh Outdated Show resolved Hide resolved
e2e-tests/oauth-flow/openid4vp/run-test.sh Show resolved Hide resolved
docs/_static/auth/iam.yaml Show resolved Hide resolved
if err != nil {
return nil, fmt.Errorf("failed to create callback URL: %w", err)
}
callbackURL = callbackURL.JoinPath("callback")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not specified on the OpenAPI spec?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next PR

auth/services/oauth/interface.go Outdated Show resolved Hide resolved
auth/services/oauth/holder.go Show resolved Hide resolved
auth/services/oauth/holder.go Show resolved Hide resolved
auth/api/iam/session.go Outdated Show resolved Hide resolved
},
}, nil
}
log.Logger().Errorf("verifier responded with incorrect callbackURI: \"%s\" for wallet: %s", redirectURI, walletDID.String())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Logger().Errorf("verifier responded with incorrect callbackURI: \"%s\" for wallet: %s", redirectURI, walletDID.String())
log.Logger().Errorf("Verifier responded with incorrect callbackURI: \"%s\" for wallet: %s", redirectURI, walletDID)

@woutslakhorst woutslakhorst merged commit f642fec into master Jan 22, 2024
8 of 9 checks passed
@woutslakhorst woutslakhorst deleted the feature/2694/verifier_handle_response branch January 22, 2024 08:51
auth/api/iam/s2s_vptoken.go Show resolved Hide resolved
auth/api/iam/session.go Show resolved Hide resolved
auth/api/iam/validation.go Show resolved Hide resolved
summary: Used by wallets to post the authorization response or error to.
description: |
Specified by https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-response-mode-direct_postjw
The response is either an error response with error, error_description and state filled or a submission with vp_token and presentation_submission filled.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State param is RECOMMENDED in an authorization request, but MUST always be in the response if present in the request. Other implementation are likely not to rely on the nonce

RFC6749

state
REQUIRED if the "state" parameter was present in the client
authorization request. The exact value received from the
client.

docs/_static/auth/iam.yaml Show resolved Hide resolved
auth/api/iam/openid4vp.go Show resolved Hide resolved
auth/api/iam/openid4vp.go Show resolved Hide resolved
auth/api/iam/openid4vp.go Show resolved Hide resolved
auth/api/iam/openid4vp.go Show resolved Hide resolved
auth/api/iam/openid4vp.go Show resolved Hide resolved
rolandgroen added a commit that referenced this pull request Jan 25, 2024
* master: (38 commits)
  VDR: Fix duplicate results when listing DIDs (#2743)
  VDR: API to list owned DIDs (#2742)
  VDR: Move did:nuts specific to did:nuts creator (#2735)
  Discovery: API to list configured Discovery Services (#2739)
  PKI: Adjust validation logging; OK = trace, NOK = info (#2736)
  Discovery: update client copy of Discovery Services (#2718)
  VDR: Group all DID Document management funcs in a new interface (#2737)
  Handle direct_post return from wallet to verifier (#2702)
  Bump github.com/nats-io/nats.go from 1.31.0 to 1.32.0 (#2724)
  Discovery: fix API of Client.Search() (#2730)
  Bump github.com/amacneil/dbmate/v2 from 2.10.0 to 2.11.0 (#2729)
  Discovery: DID registration by clients (#2709)
  Config: Add HTTP-client timeout (#2725)
  Policy: prevent nil dereference when no backend is configured (#2723)
  Bump github.com/nats-io/nats-server/v2 from 2.10.7 to 2.10.9 (#2721)
  SQL: specify lengths for VARCHAR columns to avoid different behavior with different RDBMS's (#2717)
  Bump golang from 1.21.5-alpine to 1.21.6-alpine (#2719)
  Handle authorization request from verifier by holder/wallet (#2680)
  Bump golang.org/x/crypto from 0.17.0 to 0.18.0 (#2716)
  Bump github.com/lestrrat-go/jwx/v2 from 2.0.18 to 2.0.19 (#2715)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle authorization response from holder by verifier
3 participants