Class CustomUserTypesOAuth2UserService

java.lang.Object
org.springframework.security.oauth2.client.userinfo.CustomUserTypesOAuth2UserService
All Implemented Interfaces:
OAuth2UserService<OAuth2UserRequest,OAuth2User>

@Deprecated public class CustomUserTypesOAuth2UserService extends Object implements OAuth2UserService<OAuth2UserRequest,OAuth2User>
Deprecated.
It is recommended to use a delegation-based strategy of an OAuth2UserService to support custom OAuth2User types, as it provides much greater flexibility compared to this implementation. See the reference manual for details on how to implement.
An implementation of an 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.

Since:
5.0
See Also:
  • Constructor Details

    • CustomUserTypesOAuth2UserService

      public CustomUserTypesOAuth2UserService(Map<String,Class<? extends OAuth2User>> customUserTypes)
      Deprecated.
      Constructs a CustomUserTypesOAuth2UserService using the provided parameters.
      Parameters:
      customUserTypes - a Map of OAuth2User type(s) keyed by Registration Id
  • Method Details

    • loadUser

      public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException
      Deprecated.
      Description copied from interface: OAuth2UserService
      Returns an OAuth2User after obtaining the user attributes of the End-User from the UserInfo Endpoint.
      Specified by:
      loadUser in interface OAuth2UserService<OAuth2UserRequest,OAuth2User>
      Parameters:
      userRequest - the user request
      Returns:
      an OAuth2User
      Throws:
      OAuth2AuthenticationException - if an error occurs while attempting to obtain the user attributes from the UserInfo Endpoint
    • setRequestEntityConverter

      public final void setRequestEntityConverter(org.springframework.core.convert.converter.Converter<OAuth2UserRequest,org.springframework.http.RequestEntity<?>> requestEntityConverter)
      Deprecated.
      Sets the Converter used for converting the OAuth2UserRequest to a RequestEntity representation of the UserInfo Request.
      Parameters:
      requestEntityConverter - the Converter used for converting to a RequestEntity representation of the UserInfo Request
      Since:
      5.1
    • setRestOperations

      public final void setRestOperations(org.springframework.web.client.RestOperations restOperations)
      Deprecated.
      Sets the RestOperations used when requesting the UserInfo resource.

      NOTE: At a minimum, the supplied restOperations must be configured with the following:

      1. ResponseErrorHandler - OAuth2ErrorResponseErrorHandler
      Parameters:
      restOperations - the RestOperations used when requesting the UserInfo resource
      Since:
      5.1