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 Summary
Modifier and TypeMethodDescriptionDeletes outdated entities as specified byrequest.org.springframework.security.oauth2.client.OAuth2AuthorizedClientconvertToOAuth2AuthorizedClient(P oauth2AuthorizedClientEntity, org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration) Performs a simple conversion fromOAuth2AuthorizedClientEntitytoOAuth2AuthorizedClient.convertToOAuth2AuthorizedClientEntity(org.springframework.security.oauth2.client.OAuth2AuthorizedClient oAuth2AuthorizedClient, String tenantId) Performs a simple conversion fromOAuth2AuthorizedClienttoOAuth2AuthorizedClientEntity.Newly inserts the entity in the datastore.voiddeleteByIdentifiers(String clientRegistrationId, String principalName, String tenantId) Deletes the entity in the datastore.readByIdentifiers(String clientRegistrationId, String principalName, String tenantId) Replaces the entity in the datastore.
-
Method Details
-
convertToOAuth2AuthorizedClient
org.springframework.security.oauth2.client.OAuth2AuthorizedClient convertToOAuth2AuthorizedClient(P oauth2AuthorizedClientEntity, org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration) Performs a simple conversion fromOAuth2AuthorizedClientEntitytoOAuth2AuthorizedClient.- Parameters:
oauth2AuthorizedClientEntity- the source entity to convertclientRegistration- theClientRegistrationto inform conversion- Returns:
- the converted
OAuth2AuthorizedClient
-
convertToOAuth2AuthorizedClientEntity
P convertToOAuth2AuthorizedClientEntity(org.springframework.security.oauth2.client.OAuth2AuthorizedClient oAuth2AuthorizedClient, String tenantId) Performs a simple conversion fromOAuth2AuthorizedClienttoOAuth2AuthorizedClientEntity.- Parameters:
oAuth2AuthorizedClient- the sourceOAuth2AuthorizedClientto converttenantId- the tenant ID to set on the result- Returns:
- the converted
OAuth2AuthorizedClientEntity
-
readByIdentifiers
- Parameters:
clientRegistrationId- theClientRegistration.getRegistrationId()to filter byprincipalName- thePrincipal.getName()to filter bytenantId- the tenant ID to filter by- Returns:
- an
Optionalcontaining the matchingOAuth2AuthorizedClientEntityif found, elseOptional.empty()
-
create
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
Replaces the entity in the datastore.- Parameters:
oauth2AuthorizedClientEntity- the replacement entity- Returns:
- the replaced entity, if successful
-
deleteByIdentifiers
Deletes the entity in the datastore.- Parameters:
clientRegistrationId- theClientRegistration.getRegistrationId()to filter byprincipalName- thePrincipal.getName()to filter bytenantId- the tenant ID to filter by
-
cleanupOutdatedEntities
OAuth2AuthorizedClientEntityCleanupResponse cleanupOutdatedEntities(OAuth2AuthorizedClientEntityCleanupRequest request) Deletes outdated entities as specified byrequest.- Parameters:
request- details about which entities need to be deleted- Returns:
- a response describing the result of the execution
-