Skip to content

Conversation

@enlightenedmouse
Copy link
Contributor

Fixes gh-488

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 11, 2021
@jgrandja jgrandja self-assigned this Nov 17, 2021
@jgrandja jgrandja added status: duplicate A duplicate of another issue type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 17, 2021
@jgrandja jgrandja assigned sjohnr and unassigned jgrandja Nov 17, 2021
Copy link
Collaborator

@jgrandja jgrandja left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @enlightenedmouse. Please see review comment.

.tokenEndpoint(asUrl(this.providerSettings.getIssuer(), this.providerSettings.getTokenEndpoint()))
.tokenEndpointAuthenticationMethods(clientAuthenticationMethods())
.jwkSetUrl(asUrl(this.providerSettings.getIssuer(), this.providerSettings.getJwkSetEndpoint()))
.userInfoEndpoint(asUrl(this.providerSettings.getIssuer(), this.providerSettings.getOidcUserInfoEndpoint()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

The UserInfo endpoint is not defined in RFC 8414 2. Authorization Server Metadata and instead defined only in 3. OpenID Provider Metadata.

Therefore, the update should only be accessible in OidcProviderConfiguration not in OAuth2AuthorizationServerMetadata

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jgrandja ... Got it thanks : ) I added it because of the comment at the end of Section 2. "Additional authorization server metadata parameters MAY also be used" and the sample in section 3.2. Authorization Server Metadata Response shows userinfo_endpoint. But more so, I added it because I wasn't sure if the ClientRegistration within oauth2-client would be configured using the openid configuration endpoint or an authorization server metadata endpoint. After looking into the docs, it appears it tries both. So your call ; ) Let me know.

@jgrandja jgrandja added this to the 0.2.2 milestone Dec 2, 2021
Copy link
Contributor

@sjohnr sjohnr left a comment

Choose a reason for hiding this comment

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

Hi @enlightenedmouse, thanks for the PR! Sorry for the long delay (over the holidays), but I wanted to pick this thread up again and help move it forward. I have provided some feedback for your PR below. Would you be able to take a look?

.tokenEndpoint(asUrl(this.providerSettings.getIssuer(), this.providerSettings.getTokenEndpoint()))
.tokenEndpointAuthenticationMethods(clientAuthenticationMethods())
.jwkSetUrl(asUrl(this.providerSettings.getIssuer(), this.providerSettings.getJwkSetEndpoint()))
.userInfoEndpoint(asUrl(this.providerSettings.getIssuer(), this.providerSettings.getOidcUserInfoEndpoint()))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the preference at the moment would be to remove this from OAuth2AuthorizationServerMetadataEndpointFilter at this time, as we want to align as closely to the spec as possible (and not support optional features/items such as this).

Since the OAuth2AuthorizationServerMetadataEndpointFilter is not very customizable at the moment, we should see if anyone requires this, and open an enhancement for customization options instead if needed.

Would you be able to provide an update to this PR to address this?

if (getClaims().get(OAuth2AuthorizationServerMetadataClaimNames.JWKS_URI) != null) {
validateURL(getClaims().get(OAuth2AuthorizationServerMetadataClaimNames.JWKS_URI), "jwksUri must be a valid URL");
}
if (getClaims().get(OAuth2AuthorizationServerMetadataClaimNames.USER_INFO_ENDPOINT) != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to supporting only oidc-configuration, please move this to OidcProviderConfiguration. Also, I think we should add a test to ensure this is covered.

* @param userInfoEndpoint the {@code URL} of the OAuth 2.0 UserInfo Endpoint
* @return the {@link AbstractBuilder} for further configuration
*/
public B userInfoEndpoint(String userInfoEndpoint) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to supporting only oidc-configuration, please move this to OidcProviderConfiguration and update the javadoc accordingly.

/**
* {@code userinfo_endpoint} - the {@code URL} of the OAuth 2.0 UserInfo Endpoint
*/
String USER_INFO_ENDPOINT = "userinfo_endpoint";
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to supporting only oidc-configuration, please move this to OidcProviderMetadataClaimNames.

.tokenEndpointAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC.getValue())
.tokenEndpointAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_POST.getValue())
.jwkSetUrl(asUrl(this.providerSettings.getIssuer(), this.providerSettings.getJwkSetEndpoint()))
.userInfoEndpoint(asUrl(this.providerSettings.getIssuer(), this.providerSettings.getOidcUserInfoEndpoint()))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should add to an existing test to ensure this is covered.

@sjohnr
Copy link
Contributor

sjohnr commented Jan 3, 2022

Just a friendly reminder also that it is now 2022 ❗😱, so you will want to think about updating changed files with 2022 in the copyright headers. 😄

@sjohnr
Copy link
Contributor

sjohnr commented Jan 10, 2022

@enlightenedmouse have you had a chance to review the above comments?

sjohnr pushed a commit to sjohnr/spring-authorization-server that referenced this pull request Jan 20, 2022
sjohnr pushed a commit to sjohnr/spring-authorization-server that referenced this pull request Jan 20, 2022
sjohnr pushed a commit to sjohnr/spring-authorization-server that referenced this pull request Jan 20, 2022
sjohnr pushed a commit to sjohnr/spring-authorization-server that referenced this pull request Jan 20, 2022
sjohnr pushed a commit to sjohnr/spring-authorization-server that referenced this pull request Jan 20, 2022
sjohnr pushed a commit that referenced this pull request Jan 20, 2022
@sjohnr
Copy link
Contributor

sjohnr commented Jan 20, 2022

@enlightenedmouse I went ahead and merged this into main as 4081d46 and added a polish commit 5412f10 for the feedback.

@sjohnr sjohnr closed this Jan 20, 2022
doba16 pushed a commit to doba16/spring-authorization-server that referenced this pull request Apr 21, 2023
doba16 pushed a commit to doba16/spring-authorization-server that referenced this pull request Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: duplicate A duplicate of another issue type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authorization server metadata is missing userinfo_endpoint

4 participants