Class JdbcFederatedIdentityRepository

java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.social.JdbcFederatedIdentityRepository
All Implemented Interfaces:
FederatedIdentityRepository

@Repository public class JdbcFederatedIdentityRepository extends Object implements FederatedIdentityRepository
FederatedIdentityRepository over the federated_identities table. It joins the transaction of its caller, in which lockSubject(com.irurueta.authserver.authorization.domain.social.IdentityProvider, java.lang.String) takes a PostgreSQL transaction-level advisory lock on the provider's identity, so two first sign-ins of the same person are serialized and the unique constraint on (provider, subject) is never hit (a violation would abort the caller's transaction).
  • Field Details

    • SUBJECT_LOCK_NAMESPACE

      static final int SUBJECT_LOCK_NAMESPACE
      First key of the advisory locks of the identities, which keeps them apart from every other advisory lock.
      See Also:
    • LOCK_SUBJECT

      private static final String LOCK_SUBJECT
      Statement taking the advisory lock of an identity, released when the caller's transaction ends.
      See Also:
    • COLUMNS

      private static final String COLUMNS
      Columns selected for every query.
      See Also:
    • FIND_BY_SUBJECT

      private static final String FIND_BY_SUBJECT
      Query returning the link of a provider's subject.
      See Also:
    • FIND_BY_USER

      private static final String FIND_BY_USER
      Query returning the links of an account, oldest first.
      See Also:
    • FIND_BY_ID_AND_USER

      private static final String FIND_BY_ID_AND_USER
      Query returning one link of an account.
      See Also:
    • UPSERT

      private static final String UPSERT
      Statement inserting a link, or updating the e-mail address and last sign-in of the one with the same id.
      See Also:
    • jdbcClient

      private final org.springframework.jdbc.core.simple.JdbcClient jdbcClient
      JDBC client used to run the statements.
    • federatedIdentityRowMapper

      private final FederatedIdentityRowMapper federatedIdentityRowMapper
      Maps a row to an identity.
  • Constructor Details

    • JdbcFederatedIdentityRepository

      public JdbcFederatedIdentityRepository()
  • Method Details