public class CustomUserTypesOAuth2UserService extends java.lang.Object implements OAuth2UserService<OAuth2UserRequest,org.springframework.security.oauth2.core.user.OAuth2User>
OAuth2UserService that supports custom OAuth2User types.
The custom user type(s) is supplied via the constructor,
using a Map of OAuth2User type(s) keyed by String,
which represents the Registration Id of the Client.
OAuth2UserService,
OAuth2UserRequest,
OAuth2User,
ClientRegistration| Constructor and Description |
|---|
CustomUserTypesOAuth2UserService(java.util.Map<java.lang.String,java.lang.Class<? extends org.springframework.security.oauth2.core.user.OAuth2User>> customUserTypes)
Constructs a
CustomUserTypesOAuth2UserService using the provided parameters. |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.security.oauth2.core.user.OAuth2User |
loadUser(OAuth2UserRequest userRequest)
Returns an
OAuth2User after obtaining the user attributes of the End-User from the UserInfo Endpoint. |
void |
setRequestEntityConverter(org.springframework.core.convert.converter.Converter<OAuth2UserRequest,org.springframework.http.RequestEntity<?>> requestEntityConverter)
Sets the
Converter used for converting the OAuth2UserRequest
to a RequestEntity representation of the UserInfo Request. |
void |
setRestOperations(org.springframework.web.client.RestOperations restOperations)
Sets the
RestOperations used when requesting the UserInfo resource. |
public CustomUserTypesOAuth2UserService(java.util.Map<java.lang.String,java.lang.Class<? extends org.springframework.security.oauth2.core.user.OAuth2User>> customUserTypes)
CustomUserTypesOAuth2UserService using the provided parameters.customUserTypes - a Map of OAuth2User type(s) keyed by Registration Idpublic org.springframework.security.oauth2.core.user.OAuth2User loadUser(OAuth2UserRequest userRequest) throws org.springframework.security.oauth2.core.OAuth2AuthenticationException
OAuth2UserServiceOAuth2User after obtaining the user attributes of the End-User from the UserInfo Endpoint.loadUser in interface OAuth2UserService<OAuth2UserRequest,org.springframework.security.oauth2.core.user.OAuth2User>userRequest - the user requestOAuth2Userorg.springframework.security.oauth2.core.OAuth2AuthenticationException - if an error occurs while attempting to obtain the user attributes from the UserInfo Endpointpublic final void setRequestEntityConverter(org.springframework.core.convert.converter.Converter<OAuth2UserRequest,org.springframework.http.RequestEntity<?>> requestEntityConverter)
Converter used for converting the OAuth2UserRequest
to a RequestEntity representation of the UserInfo Request.requestEntityConverter - the Converter used for converting to a RequestEntity representation of the UserInfo Requestpublic final void setRestOperations(org.springframework.web.client.RestOperations restOperations)
RestOperations used when requesting the UserInfo resource.
NOTE: At a minimum, the supplied restOperations must be configured with the following:
ResponseErrorHandler - OAuth2ErrorResponseErrorHandlerrestOperations - the RestOperations used when requesting the UserInfo resource