Class FederatedOidcUserService

java.lang.Object
com.irurueta.authserver.authorization.api.web.social.FederatedOidcUserService
All Implemented Interfaces:
org.springframework.security.oauth2.client.userinfo.OAuth2UserService<org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest,org.springframework.security.oauth2.core.oidc.user.OidcUser>

public class FederatedOidcUserService extends Object implements org.springframework.security.oauth2.client.userinfo.OAuth2UserService<org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest,org.springframework.security.oauth2.core.oidc.user.OidcUser>
The user service of the OpenID Connect providers (Google, Microsoft, Apple): the framework's service loads the user as it always does (the ID token, and the UserInfo endpoint where the provider has one), then the account is resolved (found, linked by verified e-mail or provisioned, and refused when it may not sign in) and the principal becomes the local one, named after the account.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Resolves the local account.
    private final org.springframework.security.oauth2.client.userinfo.OAuth2UserService<org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest,org.springframework.security.oauth2.core.oidc.user.OidcUser>
    The framework's service, which loads the user the provider describes.
    private static final String
    Message of the failure when the user has no subject.
    private static final String
    Message of the failure when the framework's service answers no user.
    private final FederatedUserMapper
    Builds the local principal.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.oauth2.core.oidc.user.OidcUser
    loadUser(org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest request)
    Loads the user of a sign-in.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MISSING_USER

      private static final String MISSING_USER
      Message of the failure when the framework's service answers no user.
      See Also:
    • MISSING_SUBJECT

      private static final String MISSING_SUBJECT
      Message of the failure when the user has no subject.
      See Also:
    • delegate

      private final org.springframework.security.oauth2.client.userinfo.OAuth2UserService<org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest,org.springframework.security.oauth2.core.oidc.user.OidcUser> delegate
      The framework's service, which loads the user the provider describes.
    • accountResolver

      private final FederatedAccountResolver accountResolver
      Resolves the local account.
    • userMapper

      private final FederatedUserMapper userMapper
      Builds the local principal.
  • Constructor Details

    • FederatedOidcUserService

      public FederatedOidcUserService()
  • Method Details

    • loadUser

      public org.springframework.security.oauth2.core.oidc.user.OidcUser loadUser(org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest request) throws org.springframework.security.oauth2.core.OAuth2AuthenticationException
      Loads the user of a sign-in.
      Specified by:
      loadUser in interface org.springframework.security.oauth2.client.userinfo.OAuth2UserService<org.springframework.security.oauth2.client.oidc.userinfo.OidcUserRequest,org.springframework.security.oauth2.core.oidc.user.OidcUser>
      Parameters:
      request - the request, with the registration, the access token and the ID token.
      Returns:
      the local principal.
      Throws:
      org.springframework.security.oauth2.core.OAuth2AuthenticationException - if the provider is unknown or the sign-in is refused.