Class DefaultOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>
java.lang.Object
com.broadleafcommerce.auth.client.service.DefaultOAuth2AuthorizedClientEntityService<P>
- All Implemented Interfaces:
OAuth2AuthorizedClientEntityService<P>
public class DefaultOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>
extends Object
implements OAuth2AuthorizedClientEntityService<P>
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultOAuth2AuthorizedClientEntityService
(OAuth2AuthorizedClientEntityRepository<?, ?> entityRepository, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager domainMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.security.oauth2.core.OAuth2AccessToken
buildAccessToken
(P oauth2AuthorizedClientEntity) protected org.springframework.security.oauth2.core.OAuth2RefreshToken
buildRefreshToken
(P oauth2AuthorizedClientEntity) Deletes outdated entities as specified byrequest
.protected P
convertFromPersistentDomain
(Object domain) Based onMappableCrudEntityHelper.convertFromPersistentDomain(Object)
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.protected <D> P
createInternal
(P oauth2AuthorizedClientEntity) Based onMappableCrudEntityHelper.create(Object, CrudRepository)
void
deleteByIdentifiers
(String clientRegistrationId, String principalName, String tenantId) Deletes the entity in the datastore.protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager
protected OAuth2AuthorizedClientEntityRepository<?,
?> protected com.broadleafcommerce.common.extension.TypeFactory
readByIdentifiers
(String clientRegistrationId, String principalName, String tenantId) Replaces the entity in the datastore.protected <D> P
replaceInternal
(P oauth2AuthorizedClientEntity) Based onMappableCrudEntityHelper.replace(String, Object, CrudRepository)
-
Constructor Details
-
DefaultOAuth2AuthorizedClientEntityService
public DefaultOAuth2AuthorizedClientEntityService(OAuth2AuthorizedClientEntityRepository<?, ?> entityRepository, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager domainMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
readByIdentifiers
public Optional<P> readByIdentifiers(String clientRegistrationId, String principalName, String tenantId) - Specified by:
readByIdentifiers
in interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>
- 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()
-
convertToOAuth2AuthorizedClient
public org.springframework.security.oauth2.client.OAuth2AuthorizedClient convertToOAuth2AuthorizedClient(P oauth2AuthorizedClientEntity, org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration) Description copied from interface:OAuth2AuthorizedClientEntityService
Performs a simple conversion fromOAuth2AuthorizedClientEntity
toOAuth2AuthorizedClient
.- Specified by:
convertToOAuth2AuthorizedClient
in interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>
- Parameters:
oauth2AuthorizedClientEntity
- the source entity to convertclientRegistration
- theClientRegistration
to inform conversion- Returns:
- the converted
OAuth2AuthorizedClient
-
buildAccessToken
protected org.springframework.security.oauth2.core.OAuth2AccessToken buildAccessToken(P oauth2AuthorizedClientEntity) -
buildRefreshToken
@Nullable protected org.springframework.security.oauth2.core.OAuth2RefreshToken buildRefreshToken(P oauth2AuthorizedClientEntity) -
convertToOAuth2AuthorizedClientEntity
public P convertToOAuth2AuthorizedClientEntity(org.springframework.security.oauth2.client.OAuth2AuthorizedClient oAuth2AuthorizedClient, String tenantId) Description copied from interface:OAuth2AuthorizedClientEntityService
Performs a simple conversion fromOAuth2AuthorizedClient
toOAuth2AuthorizedClientEntity
.- Specified by:
convertToOAuth2AuthorizedClientEntity
in interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>
- Parameters:
oAuth2AuthorizedClient
- the sourceOAuth2AuthorizedClient
to converttenantId
- the tenant ID to set on the result- Returns:
- the converted
OAuth2AuthorizedClientEntity
-
create
Description copied from interface:OAuth2AuthorizedClientEntityService
Newly inserts the entity in the datastore.- Specified by:
create
in interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>
- Parameters:
oauth2AuthorizedClientEntity
- the entity to insert- Returns:
- the inserted entity, if successful
-
createInternal
Based onMappableCrudEntityHelper.create(Object, CrudRepository)
- Type Parameters:
D
- the persisted domain type- Parameters:
oauth2AuthorizedClientEntity
- the entity to create- Returns:
- the created entity
-
replace
Description copied from interface:OAuth2AuthorizedClientEntityService
Replaces the entity in the datastore.- Specified by:
replace
in interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>
- Parameters:
oauth2AuthorizedClientEntity
- the replacement entity- Returns:
- the replaced entity, if successful
-
replaceInternal
Based onMappableCrudEntityHelper.replace(String, Object, CrudRepository)
- Type Parameters:
D
- the persisted domain type- Parameters:
oauth2AuthorizedClientEntity
- the replacement- Returns:
- the replaced entity
-
deleteByIdentifiers
Description copied from interface:OAuth2AuthorizedClientEntityService
Deletes the entity in the datastore.- Specified by:
deleteByIdentifiers
in interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>
- Parameters:
clientRegistrationId
- theClientRegistration.getRegistrationId()
to filter byprincipalName
- thePrincipal.getName()
to filter bytenantId
- the tenant ID to filter by
-
cleanupOutdatedEntities
public OAuth2AuthorizedClientEntityCleanupResponse cleanupOutdatedEntities(OAuth2AuthorizedClientEntityCleanupRequest request) Description copied from interface:OAuth2AuthorizedClientEntityService
Deletes outdated entities as specified byrequest
.- Specified by:
cleanupOutdatedEntities
in interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>
- Parameters:
request
- details about which entities need to be deleted- Returns:
- a response describing the result of the execution
-
convertFromPersistentDomain
Based onMappableCrudEntityHelper.convertFromPersistentDomain(Object)
- Parameters:
domain
- the persisted domain entity- Returns:
- the business domain representation
-
getOAuth2AuthorizedClientEntityRepository
-
getDomainMapper
protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager getDomainMapper() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-