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.OAuth2AuthorizedClient
convertToOAuth2AuthorizedClient
(P oauth2AuthorizedClientEntity, org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration) Performs a simple conversion fromOAuth2AuthorizedClientEntity
toOAuth2AuthorizedClient
.convertToOAuth2AuthorizedClientEntity
(org.springframework.security.oauth2.client.OAuth2AuthorizedClient oAuth2AuthorizedClient, String tenantId) Performs a simple conversion fromOAuth2AuthorizedClient
toOAuth2AuthorizedClientEntity
.Newly inserts the entity in the datastore.void
deleteByIdentifiers
(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 fromOAuth2AuthorizedClientEntity
toOAuth2AuthorizedClient
.- Parameters:
oauth2AuthorizedClientEntity
- the source entity to convertclientRegistration
- theClientRegistration
to inform conversion- Returns:
- the converted
OAuth2AuthorizedClient
-
convertToOAuth2AuthorizedClientEntity
P convertToOAuth2AuthorizedClientEntity(org.springframework.security.oauth2.client.OAuth2AuthorizedClient oAuth2AuthorizedClient, String tenantId) Performs a simple conversion fromOAuth2AuthorizedClient
toOAuth2AuthorizedClientEntity
.- Parameters:
oAuth2AuthorizedClient
- the sourceOAuth2AuthorizedClient
to 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
Optional
containing the matchingOAuth2AuthorizedClientEntity
if 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
-