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

Fix Delegation-based Strategy with OidcUserService/OidcReactiveOAuth2UserService examples #12281

Closed
wants to merge 1 commit into from

Conversation

daniel-shuy
Copy link
Contributor

@daniel-shuy daniel-shuy commented Nov 24, 2022

The examples for Delegation-based Strategy with OidcUserService/OidcReactiveOAuth2UserService is bugged. If the userNameAttributeName is overridden with spring.security.oauth2.client.provider.<provider>.user-name-attribute, SecurityContextHolder.getContext().getAuthentication().getName() will return the value of sub (the default username attribute) regardless of what is set.

This fixes the example by obtaining the username attribute from OidcUserRequest and passing it to the new DefaultOidcUser.

See gh-12275 for the original discussion.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 24, 2022
…UserService examples

Fix examples not copying userNameAttributeName
@daniel-shuy daniel-shuy changed the title Fix Delegation-based Strategy with OidcUserService example Fix Delegation-based Strategy with OidcUserService/OidcReactiveOAuth2UserService examples Nov 24, 2022
@sjohnr sjohnr self-assigned this Dec 12, 2022
@sjohnr
Copy link
Member

sjohnr commented Mar 1, 2024

@daniel-shuy just an update that I will revisit this in the coming week to get this merged, as I think improving the docs will help. See also this comment regarding the related enhancement.

@sjohnr sjohnr added in: docs An issue in Documentation or samples type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 1, 2024
@sjohnr sjohnr added this to the 6.3.0-M3 milestone Mar 1, 2024
sjohnr added a commit that referenced this pull request Mar 7, 2024
@sjohnr
Copy link
Member

sjohnr commented Mar 7, 2024

Thanks @daniel-shuy! This is now merged via 488901d with minor polish 9751636.

@sjohnr sjohnr closed this Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: docs An issue in Documentation or samples type: enhancement A general enhancement
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants