Skip to content

Consider making UserInfo request opt-in instead of default in Spring Security 7 #16843

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
sjohnr opened this issue Mar 28, 2025 · 0 comments
Open
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: breaks-passivity A change that breaks passivity with the previous release type: enhancement A general enhancement
Milestone

Comments

@sjohnr
Copy link
Member

sjohnr commented Mar 28, 2025

Expected Behavior

A UserInfo request isn't performed by default in OpenID Connect login (oauth2Login() with openid and any of profile, email, address and phone scopes). A user should still be able to opt-in to calling the UserInfo endpoint to obtain additional claims for the OAuth2AuthenticationToken.

Current Behavior

A UserInfo request is performed whenever the ClientRegistration.providerDetails.userInfoEndpoint.uri (user-info-uri in Spring Boot properties) property is set, and any of profile, email, address or phone scopes are requested with openid.

Context

It is currently possible to disable the UserInfo request by either setting the user-info-uri property to blank, or calling OidcUserService#setShouldRetrieveUserInfo() with a Predicate<OidcUserRequest>. However, requesting UserInfo may not be required in most cases. It would be nice to default to not calling the UserInfo endpoint in Spring Security 7, which would reduce the number of requests made during login.

Related gh-16340

@sjohnr sjohnr added in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement labels Mar 28, 2025
@sjohnr sjohnr added this to the 7.0.0-M1 milestone Mar 28, 2025
@sjohnr sjohnr added the type: breaks-passivity A change that breaks passivity with the previous release label Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: breaks-passivity A change that breaks passivity with the previous release type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant