Skip to content

Add support for nested user-name-attribute using dot notation #16857

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yybmion
Copy link

@yybmion yybmion commented Apr 1, 2025

Closes gh-16390

Hi team, this PR adds support for nested properties in the OAuth2 user-name-attribute using dot notation.
For example, if a provider returns a nested response like {"data": {"username": "user1"}},
users can now directly configure user-name-attribute: data.username without writing custom code.

Implementation

  • Added extractNestedAttribute utility method to extract values from nested paths
  • Modified loadUser method to handle attributes with dot notation
  • Applied the same changes to both servlet and reactive implementations
  • Added comprehensive tests to verify functionality

Testing

Added tests for

  • Simple nested attributes
  • Multi-level nested attributes

All tests pass and existing functionality is preserved.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 1, 2025
Implement the ability to use dot notation in user-name-attribute
to access nested properties in OAuth2 user info responses.

Closes spring-projectsgh-16390

Signed-off-by: yybmion <yunyubin54@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify support of username as a nested property
2 participants