-
Notifications
You must be signed in to change notification settings - Fork 6k
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
ClientRegistrations class's OpenID Provider Configuration Validation does not conform to specification #16460
Comments
@abchau, thanks for getting in touch!
The spec states (emphasis added by me):
This makes it quite clear that the requirement is to use strict equality to validate the issuer returned.
Adding additional data to the request, such as However, I believe doing so is not in the spirit of the specification and it appears the provider is deviating from that. The well-known URL is very well defined, and should not require additional parameters. If you disagree, please provide a reference in the spec where provision is made for this requirement. Otherwise, I think the next step would be exploring other options for working around this issue. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
Describe the bug
The section 4.3 in the OpenID Connect Discovery specification says "the Issuer URL that was used as the prefix to /.well-known/openid-configuration". However, the validation in
ClientRegistrations.class
does anequal()
comparison of the entire issuer URL which is comparing too much because a provider's Issuer URL might contain additional parameters.For example, in Azure AD B2C multiple OIDC configurations could be using the same Issuer and configuration URL in Azure AD B2C is not an straightforward URL. An additional parameter
p
is added at the end to identify which configurations you want to retrieve.Usual Provider:
Azure AD B2C:
To Reproduce
Follow the procedure at https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-active-directory-b2c-oidc
Because the well known uri is
https://eaxmple.b2clogin.com/00000000-0000-0000-00000000-000000000000/v2.0/.well-known/openid-configuration?p=b2c_1_policy_name_a
, this Issuer URL must be configurated with additional?p=b2c_1_policy_name_a
at the end.The following exception will be thrown during start up.
The exception was due to this method is comparing
https://eaxmple.b2clogin.com/00000000-0000-0000-00000000-000000000000/v2.0/
(metadata.getIssuer().getValue()
) andhttps://eaxmple.b2clogin.com/00000000-0000-0000-00000000-000000000000/v2.0/?p=b2c_1_policy_name_a
(issuer
).Expected behavior
The validation should be validating whether the
issuer
value from well known configuration is the prefix of Issuer URL.defined in
spring.security.oauth2.client.provider.b2c.issuer-uri=
without taking into account of additional query string parameters .Possible Solution
I've tested in my local that using
issuer.startsWith(metadataIssuer)
instead ofissuer.equals(metadataIssuer)
could avoid the issue and it seems more conform to the specification as in "the Issuer URL that was used as the prefix to /.well-known/openid-configuration".e.g.
The text was updated successfully, but these errors were encountered: