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

added authorize endpoint as specified by rfc6549 authorization code #2626

Merged
merged 11 commits into from
Dec 12, 2023

Conversation

woutslakhorst
Copy link
Member

@woutslakhorst woutslakhorst commented Nov 28, 2023

closes #2625

I changed the expectation of did:nuts for OpenID4VP into did:web.

The PR might also remove some unused stuff....

@woutslakhorst
Copy link
Member Author

woutslakhorst commented Dec 1, 2023

depends on did:web creation via api/client

@woutslakhorst woutslakhorst force-pushed the feature/2625/oauth2_authorize_endpoint branch 2 times, most recently from efe8242 to f32b958 Compare December 6, 2023 14:05
@woutslakhorst woutslakhorst marked this pull request as ready for review December 6, 2023 14:07
auth/api/iam/api.go Outdated Show resolved Hide resolved
auth/api/iam/openid4vp.go Show resolved Hide resolved
auth/api/iam/openid4vp.go Outdated Show resolved Hide resolved
auth/api/iam/openid4vp.go Outdated Show resolved Hide resolved
}
metadata, err := r.auth.Verifier().AuthorizationServerMetadata(ctx, *walletDID)
if err != nil {
return nil, oauthError(oauth.ServerError, "failed to get authorization server metadata (holder)", redirectURL)
Copy link
Member

Choose a reason for hiding this comment

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

Verifier, Wallet, Holder? Too many roles/concepts mixed here

auth/api/iam/openid4vp.go Outdated Show resolved Hide resolved
callbackURL := *ownURL
callbackURL.Path, err = url.JoinPath(callbackURL.Path, "response")
if err != nil {
return nil, oauthError(oauth.ServerError, "failed to construct redirect path", redirectURL)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this can ever occur?

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's hope not

"github.com/nuts-foundation/nuts-node/auth/oauth"
)

var _ Verifier = (*VerifierServiceProvider)(nil)
Copy link
Member

Choose a reason for hiding this comment

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

I'd expect a Verifier, which is from OpenID4VP, to be in an OpenID4VP package? Otherwise, we might have to prefix the type name with something that indicates the protocol/spec/domain? E.g. PresentationVerifier?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to complete the entire flow first and then see if stuff needs to move.

// Verifier implements the OpenID4VP Verifier role.
type Verifier interface {
// AuthorizationServerMetadata returns the metadata of the remote wallet.
AuthorizationServerMetadata(ctx context.Context, webdid did.DID) (*oauth.AuthorizationServerMetadata, error)
Copy link
Member

Choose a reason for hiding this comment

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

This is not OpenID4VP-specific, so I'd expect this to be in a more generic OAuth2 type?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is true, but currently it's closer related to things the verifier needs/has. Let's also park this till the end.

RedirectURI: redirectURL.String(),
}
// use nonce to store authorization request in session store
if err = r.oauthNonceStore().Put(nonce, openid4vpRequest); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be client state instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

both probably, but this automatically emerges in the next PR because there it's needed!

@woutslakhorst woutslakhorst force-pushed the feature/2625/oauth2_authorize_endpoint branch from 846b256 to 9d1f337 Compare December 12, 2023 09:14
@woutslakhorst woutslakhorst force-pushed the feature/2625/oauth2_authorize_endpoint branch from 9d1f337 to 3b47e20 Compare December 12, 2023 09:27
@reinkrul reinkrul self-requested a review December 12, 2023 09:45
@woutslakhorst woutslakhorst merged commit 8b33dec into master Dec 12, 2023
8 of 9 checks passed
@woutslakhorst woutslakhorst deleted the feature/2625/oauth2_authorize_endpoint branch December 12, 2023 14:39
woutslakhorst added a commit that referenced this pull request Jan 10, 2024
…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 added a commit that referenced this pull request Jan 10, 2024
…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 added a commit that referenced this pull request Jan 15, 2024
…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 added a commit that referenced this pull request Jan 16, 2024
…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

fix didkey pattern
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 added a commit that referenced this pull request Jan 22, 2024
* added authorize endpoint as specified by rfc6549 authorization code (#2626)
* add e2e test
woutslakhorst added a commit that referenced this pull request Jan 22, 2024
…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

fix didkey pattern
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create the authorization endpoint on the Nuts node. 13 to 16 in the diagram
2 participants