Class CustomerPersistenceHandler
java.lang.Object
com.broadleafcommerce.auth.user.listener.AuthDataUpdatePersistenceHandler
com.broadleafcommerce.auth.user.listener.CustomerPersistenceHandler
- All Implemented Interfaces:
com.broadleafcommerce.common.messaging.PersistenceHandler
-
Constructor Summary
ConstructorDescriptionCustomerPersistenceHandler
(UserService<User> userService, AuthorizedClientService<AuthorizedClient> clientService, ApplicationService<Application> applicationService, UserCreationProducer userCreationProducer, com.fasterxml.jackson.databind.ObjectMapper objectMapper, UserLockoutService userLockoutService) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
createNewUser
(Customer customer) protected ApplicationService<Application>
protected Instant
getChangeTimestamp
(com.fasterxml.jackson.databind.JsonNode persistenceMessage) protected AuthorizedClientService<AuthorizedClient>
String[]
protected UserCreationProducer
protected String
protected UserLockoutService
protected UserMappingProperties
protected UserService<User>
protected @NotNull User
handleUserLockoutIfNecessary
(Customer customer, User user) void
protected boolean
mapAdditionalAttributes
(@NonNull Customer customer, @NonNull User user) protected IllegalArgumentException
protected void
notifyNewCustomerUserCreated
(User user, Customer customer) protected Customer
parseCustomer
(com.fasterxml.jackson.databind.JsonNode entityJson) void
processStateChange
(com.fasterxml.jackson.databind.JsonNode entityJson) protected List<Application>
readApplicationsForCustomer
(Customer customer) Finds all applications in the data store for the givenCustomer.getCustomerContextId()
.protected String
readAuthServerId
(String applicationId) void
setUserMappingProperties
(UserMappingProperties userMappingProperties) protected void
updateExistingUser
(Customer customer, Instant timestamp) protected void
updateOrCreateUser
(Customer customer, com.fasterxml.jackson.databind.JsonNode entityJson) protected boolean
updateUserFields
(Customer customer, User user) Updates user fields that auth is concerned with.protected Supplier<IllegalArgumentException>
userNotFound
(Customer customer, String userId) Methods inherited from class com.broadleafcommerce.auth.user.listener.AuthDataUpdatePersistenceHandler
getObjectMapper, handle, isNodeNull, isValidType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.common.messaging.PersistenceHandler
validate
-
Constructor Details
-
CustomerPersistenceHandler
public CustomerPersistenceHandler(UserService<User> userService, AuthorizedClientService<AuthorizedClient> clientService, ApplicationService<Application> applicationService, UserCreationProducer userCreationProducer, com.fasterxml.jackson.databind.ObjectMapper objectMapper, UserLockoutService userLockoutService)
-
-
Method Details
-
hook
-
processStateChange
public void processStateChange(com.fasterxml.jackson.databind.JsonNode entityJson) -
updateOrCreateUser
protected void updateOrCreateUser(Customer customer, com.fasterxml.jackson.databind.JsonNode entityJson) -
createNewUser
-
mapAdditionalAttributes
protected boolean mapAdditionalAttributes(@NonNull @NonNull Customer customer, @NonNull @NonNull User user) - Parameters:
customer
- The customer spawning the event.user
- The user to update.- Returns:
- Whether any updates occurred.
- See Also:
-
notifyNewCustomerUserCreated
-
updateExistingUser
-
updateUserFields
Updates user fields that auth is concerned with.- Parameters:
customer
- The customer fromuser
- The user to set fields on.- Returns:
- true if a value was updated, else false.
-
getUserId
-
userNotFound
-
parseCustomer
-
readAuthServerId
-
readApplicationsForCustomer
Finds all applications in the data store for the givenCustomer.getCustomerContextId()
.- Parameters:
customer
- the customer for which to find applications in the data store- Returns:
- the applications in the data store for the
Customer.getCustomerContextId()
. Never empty. - Throws:
IllegalArgumentException
- if no applications were found
-
getChangeTimestamp
-
handleUserLockoutIfNecessary
-
missingTimestampError
-
getSupportedSimpleTypeNames
-
getClientService
-
getApplicationService
-
getUserCreationProducer
-
getUserService
-
getUserLockoutService
-
getUserMappingProperties
-
setUserMappingProperties
-