Interface OAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>

All Known Implementing Classes:
DefaultOAuth2AuthorizedClientEntityService

public interface OAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>

This is a CRUD service for managing basic persistence operations around OAuth2AuthorizedClientEntity.

Notably, this is distinct from OAuth2AuthorizedClientService, which is a Spring component directly used by Spring Security. In practice, implementations of OAuth2AuthorizedClientService could internally delegate to this component for actual CRUD.

See Also:
  • Method Details

    • convertToOAuth2AuthorizedClient

      org.springframework.security.oauth2.client.OAuth2AuthorizedClient convertToOAuth2AuthorizedClient(P oauth2AuthorizedClientEntity, org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration)
      Performs a simple conversion from OAuth2AuthorizedClientEntity to OAuth2AuthorizedClient.
      Parameters:
      oauth2AuthorizedClientEntity - the source entity to convert
      clientRegistration - the ClientRegistration to inform conversion
      Returns:
      the converted OAuth2AuthorizedClient
    • convertToOAuth2AuthorizedClientEntity

      P convertToOAuth2AuthorizedClientEntity(org.springframework.security.oauth2.client.OAuth2AuthorizedClient oAuth2AuthorizedClient, String tenantId)
      Performs a simple conversion from OAuth2AuthorizedClient to OAuth2AuthorizedClientEntity.
      Parameters:
      oAuth2AuthorizedClient - the source OAuth2AuthorizedClient to convert
      tenantId - the tenant ID to set on the result
      Returns:
      the converted OAuth2AuthorizedClientEntity
    • readByIdentifiers

      Optional<P> readByIdentifiers(String clientRegistrationId, String principalName, String tenantId)
      Parameters:
      clientRegistrationId - the ClientRegistration.getRegistrationId() to filter by
      principalName - the Principal.getName() to filter by
      tenantId - the tenant ID to filter by
      Returns:
      an Optional containing the matching OAuth2AuthorizedClientEntity if found, else Optional.empty()
    • create

      P create(P oauth2AuthorizedClientEntity)
      Newly inserts the entity in the datastore.
      Parameters:
      oauth2AuthorizedClientEntity - the entity to insert
      Returns:
      the inserted entity, if successful
      Throws:
      org.springframework.dao.DataIntegrityViolationException - if there was an error caused by a uniqueness violation
    • replace

      P replace(P oauth2AuthorizedClientEntity)
      Replaces the entity in the datastore.
      Parameters:
      oauth2AuthorizedClientEntity - the replacement entity
      Returns:
      the replaced entity, if successful
    • deleteByIdentifiers

      void deleteByIdentifiers(String clientRegistrationId, String principalName, String tenantId)
      Deletes the entity in the datastore.
      Parameters:
      clientRegistrationId - the ClientRegistration.getRegistrationId() to filter by
      principalName - the Principal.getName() to filter by
      tenantId - the tenant ID to filter by
    • cleanupOutdatedEntities

      Deletes outdated entities as specified by request.
      Parameters:
      request - details about which entities need to be deleted
      Returns:
      a response describing the result of the execution