-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
Enabled DPoP token request and verification within the OAuth2 workflow. Adjusted request headers and included new test cases to cover various DPoP scenarios.
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, |
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.
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") |
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.
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) |
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.
return nil, fmt.Errorf("failed service dpop response: %s", accessTokenResponse.HTTPResponse.Status) | |
return nil, fmt.Errorf("failed service DPoP response: %s", accessTokenResponse.HTTPResponse.Status) |
This reverts commit d00ac73.
Enabled DPoP token request and verification within the OAuth2 workflow. Adjusted request headers and included new test cases to cover various DPoP scenarios.