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

Add DPoP support for token handling #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add DPoP support for token handling #2

wants to merge 3 commits into from

Conversation

rolandgroen
Copy link
Collaborator

Enabled DPoP token request and verification within the OAuth2 workflow. Adjusted request headers and included new test cases to cover various DPoP scenarios.

Enabled DPoP token request and verification within the OAuth2 workflow. Adjusted request headers and included new test cases to cover various DPoP scenarios.
@rolandgroen rolandgroen requested a review from reinkrul November 20, 2024 11:45
Modified the OAuth2 authorization header to consistently use "Bearer" instead of dynamically setting the token type. This change ensures that all requests adhere to standard OAuth2 practices and resolves inconsistencies in authentication token handling.
response, err := client.RequestServiceAccessToken(httpRequest.Context(), o.NutsSubject, iam.RequestServiceAccessTokenJSONRequestBody{
AuthorizationServer: authzServerURL.String(),
Credentials: &additionalCredentials,
Scope: scope,
TokenType: &tokenType,
Copy link
Member

Choose a reason for hiding this comment

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

now it ONLY supports DPoP, you probably want the client/application to be able to choose (and default to DPoP, but the Nuts node already does this). Probably creating the OAuth2TokenSource

var dPoPToken *string
if tokenType == iam.ServiceAccessTokenRequestTokenTypeDPoP {
if accessTokenResponse.JSON200.DpopKid == nil {
return nil, fmt.Errorf("type is DPoP but no DpopKid has been provided")
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
return nil, fmt.Errorf("type is DPoP but no DpopKid has been provided")
return nil, fmt.Errorf("type is DPoP but no dpop_kid has been provided")

return nil, err
}
if proofResponse.JSON200 == nil {
return nil, fmt.Errorf("failed service dpop response: %s", accessTokenResponse.HTTPResponse.Status)
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
return nil, fmt.Errorf("failed service dpop response: %s", accessTokenResponse.HTTPResponse.Status)
return nil, fmt.Errorf("failed service DPoP response: %s", accessTokenResponse.HTTPResponse.Status)

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.

2 participants