Class DelegatingOAuth2UserService<R extends OAuth2UserRequest,U extends org.springframework.security.oauth2.core.user.OAuth2User>

java.lang.Object
org.springframework.security.oauth2.client.userinfo.DelegatingOAuth2UserService<R,U>
Type Parameters:
R - The type of OAuth 2.0 User Request
U - The type of OAuth 2.0 User
All Implemented Interfaces:
OAuth2UserService<R,U>

public class DelegatingOAuth2UserService<R extends OAuth2UserRequest,U extends org.springframework.security.oauth2.core.user.OAuth2User> extends Object implements OAuth2UserService<R,U>
An implementation of an OAuth2UserService that simply delegates to it's internal List of OAuth2UserService(s).

Each OAuth2UserService is given a chance to load an OAuth2User with the first non-null OAuth2User being returned.

Since:
5.0
See Also:
  • Constructor Details

    • DelegatingOAuth2UserService

      public DelegatingOAuth2UserService(List<OAuth2UserService<R,U>> userServices)
      Constructs a DelegatingOAuth2UserService using the provided parameters.
      Parameters:
      userServices - a List of OAuth2UserService(s)
  • Method Details

    • loadUser

      public U loadUser(R userRequest) throws org.springframework.security.oauth2.core.OAuth2AuthenticationException
      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<R extends OAuth2UserRequest,U extends org.springframework.security.oauth2.core.user.OAuth2User>
      Parameters:
      userRequest - the user request
      Returns:
      an OAuth2User
      Throws:
      org.springframework.security.oauth2.core.OAuth2AuthenticationException - if an error occurs while attempting to obtain the user attributes from the UserInfo Endpoint