public class DefaultOAuth2UserService extends java.lang.Object implements OAuth2UserService
OAuth2UserService
that supports standard OAuth 2.0 Provider's.
For standard OAuth 2.0 Provider's, the attribute name (from the UserInfo Response)
for the "user's name" is required and therefore must be supplied via
ClientRegistration.ProviderDetails.UserInfoEndpoint#getUserNameAttributeName()
.
NOTE: Attribute names are not standardized between providers and therefore will vary. Please consult the provider's API documentation for the set of supported user attribute names.
This implementation uses a UserInfoRetriever
to obtain the user attributes
of the End-User (resource owner) from the UserInfo Endpoint.
OAuth2UserService
,
DefaultOAuth2User
,
UserInfoRetriever
Constructor and Description |
---|
DefaultOAuth2UserService() |
Modifier and Type | Method and Description |
---|---|
protected UserInfoRetriever |
getUserInfoRetriever() |
OAuth2User |
loadUser(OAuth2ClientAuthenticationToken clientAuthentication) |
void |
setUserInfoRetriever(UserInfoRetriever userInfoRetriever) |
public OAuth2User loadUser(OAuth2ClientAuthenticationToken clientAuthentication) throws OAuth2AuthenticationException
loadUser
in interface OAuth2UserService
OAuth2AuthenticationException
protected UserInfoRetriever getUserInfoRetriever()
public final void setUserInfoRetriever(UserInfoRetriever userInfoRetriever)