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.OAuth2AccessTokenbuildAccessToken(P oauth2AuthorizedClientEntity) protected org.springframework.security.oauth2.core.OAuth2RefreshTokenbuildRefreshToken(P oauth2AuthorizedClientEntity) Deletes outdated entities as specified byrequest.protected PconvertFromPersistentDomain(Object domain) Based onMappableCrudEntityHelper.convertFromPersistentDomain(Object)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.protected <D> PcreateInternal(P oauth2AuthorizedClientEntity) Based onMappableCrudEntityHelper.create(Object, CrudRepository)voiddeleteByIdentifiers(String clientRegistrationId, String principalName, String tenantId) Deletes the entity in the datastore.protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManagerprotected OAuth2AuthorizedClientEntityRepository<?,?> protected com.broadleafcommerce.common.extension.TypeFactoryreadByIdentifiers(String clientRegistrationId, String principalName, String tenantId) Replaces the entity in the datastore.protected <D> PreplaceInternal(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:
readByIdentifiersin interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>- 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()
-
convertToOAuth2AuthorizedClient
public org.springframework.security.oauth2.client.OAuth2AuthorizedClient convertToOAuth2AuthorizedClient(P oauth2AuthorizedClientEntity, org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration) Description copied from interface:OAuth2AuthorizedClientEntityServicePerforms a simple conversion fromOAuth2AuthorizedClientEntitytoOAuth2AuthorizedClient.- Specified by:
convertToOAuth2AuthorizedClientin interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>- Parameters:
oauth2AuthorizedClientEntity- the source entity to convertclientRegistration- theClientRegistrationto 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:OAuth2AuthorizedClientEntityServicePerforms a simple conversion fromOAuth2AuthorizedClienttoOAuth2AuthorizedClientEntity.- Specified by:
convertToOAuth2AuthorizedClientEntityin interfaceOAuth2AuthorizedClientEntityService<P extends OAuth2AuthorizedClientEntity>- Parameters:
oAuth2AuthorizedClient- the sourceOAuth2AuthorizedClientto converttenantId- the tenant ID to set on the result- Returns:
- the converted
OAuth2AuthorizedClientEntity
-
create
Description copied from interface:OAuth2AuthorizedClientEntityServiceNewly inserts the entity in the datastore.- Specified by:
createin 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:OAuth2AuthorizedClientEntityServiceReplaces the entity in the datastore.- Specified by:
replacein 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:OAuth2AuthorizedClientEntityServiceDeletes the entity in the datastore.- Specified by:
deleteByIdentifiersin 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:OAuth2AuthorizedClientEntityServiceDeletes outdated entities as specified byrequest.- Specified by:
cleanupOutdatedEntitiesin 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()
-