-
Notifications
You must be signed in to change notification settings - Fork 20
Expose OIDC provider server metadata in Provider #172
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
Expose OIDC provider server metadata in Provider #172
Conversation
oidc/provider.go
Outdated
| return p, nil | ||
| } | ||
|
|
||
| // Claims unmarshals raw fields returned by the server during discovery. |
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.
| // Claims unmarshals raw fields returned by the server during discovery. | |
| // Claims unmarshals raw fields returned by the provider during discovery. | |
| // | |
| // For a list of fields defined by the OpenID Connect spec see: | |
| // https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata | |
| // see also: https://datatracker.ietf.org/doc/html/rfc8414 | |
| // | |
| // This list of fields may include 'authorization_response_iss_parameter_supported' | |
| // which can be used to prevent mix-up attacks. | |
| // https://datatracker.ietf.org/doc/html/rfc9207#section-3 |
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.
Thank you!
| @@ -929,6 +930,12 @@ func (p *TestProvider) UserInfoReply() map[string]interface{} { | |||
| return p.replyUserinfo | |||
| } | |||
|
|
|||
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.
can you add a godoc here?
|
Thanks @jimlambrt! Godocs have been added & updated, ready for another pass |
f772afb to
a498de3
Compare
a498de3 to
f52be16
Compare
jimlambrt
left a comment
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.
Looks good! Ty.
jimlambrt
left a comment
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.
Ty
This exposes the OIDC Provider auth server metadata that is returned during service discovery, and exposed by go-oidc, and adds a way to supply it during testing. This allows OP metadata to be accessed on the provider object once its been discovered, instead of making an additional request to the same endpoint, or having to have explicit support.
Hi! I'm an engineer on Nomad and I'm hoping to add some support for RFC 9207 (OAuth 2.0 Authorization Server Issuer Identification), which involves two steps during the OIDC Complete Authorization step of the login flow:
authorization_response_iss_parameter_supportedof the OP auth server metadata (returned in the.well-known/openid-configurationendpoint)issparam value in the Auth Response is present & matches based on OP supportCurrently there isn't a way to check the auth server metadata via the cap/oidc library for an unsupported configuration value. Once we have a way to access the metadata, we can determine if we should manually check the
issparam in the auth response. Theauthorization_response_iss_parameter_supportedisn't required to be set, so the approach I took was to supply a way to get the configuration value out; I'm happy to discuss any other thoughts about the best way to approach. I'm hoping this will help any other users of the library support the same functionality.The approach is to expose the same
Claims()function on the Provider as defined in go-oidc, as a new function with a unit test.The test provider has been updated to be able to supply additional server metadata that gets merged and returned in the
openidConfigurationpath. (The test was implemented with an arbitrary config value, but I can update it to something realistic)PCI review checklist
I have documented a clear reason for, and description of, the change I am making.
If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
If applicable, I've documented the impact of any changes to security controls.
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.