Class DefaultUserChangePasswordAttemptService<P extends UserChangePasswordAttempt,D extends com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware & com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable>
java.lang.Object
com.broadleafcommerce.auth.user.service.DefaultUserChangePasswordAttemptService<P,D>
- All Implemented Interfaces:
UserChangePasswordAttemptService<P>
public class DefaultUserChangePasswordAttemptService<P extends UserChangePasswordAttempt,D extends com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware & com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable>
extends Object
implements UserChangePasswordAttemptService<P>
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultUserChangePasswordAttemptService
(UserChangePasswordAttemptRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionint
countConsideredUserChangePasswordAttempts
(String username, String authServerId) Count the number of failed and considered change password attemptsint
countConsideredUserChangePasswordAttempts
(String username, String authServerId, Duration age) Count number of failed and considered user change password attempts for a specific period of time (e.g.createUserChangePasswordAttempt
(String username, String userId, String changePasswordAttemptResult, String authServerId) Create a new user change password attempt.protected SimplePayloadMapper
protected UserChangePasswordAttemptRepository<D>
protected com.broadleafcommerce.common.extension.TypeFactory
void
purgeChangePasswordAttempts
(Duration changePasswordAttemptAge, String authServerId) Purges any change password attempts older than the specified duration.readConsideredUserChangePasswordAttempts
(String username, String authServerId, Duration age) Read user failed and considered change password attempts for a specific period of time (e.g.void
resetChangePasswordAttempts
(String username, String authServerId) Reset user change password attempts for a specific username and auth server ID.
-
Constructor Details
-
DefaultUserChangePasswordAttemptService
public DefaultUserChangePasswordAttemptService(UserChangePasswordAttemptRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
countConsideredUserChangePasswordAttempts
public int countConsideredUserChangePasswordAttempts(String username, String authServerId, Duration age) Description copied from interface:UserChangePasswordAttemptService
Count number of failed and considered user change password attempts for a specific period of time (e.g. for the last 24 hours)- Specified by:
countConsideredUserChangePasswordAttempts
in interfaceUserChangePasswordAttemptService<P extends UserChangePasswordAttempt>
- Parameters:
username
- The username used in the change password attemptauthServerId
- The auth server idage
- The period of time- Returns:
- The number of failed and considered change password attempts
-
countConsideredUserChangePasswordAttempts
Description copied from interface:UserChangePasswordAttemptService
Count the number of failed and considered change password attempts- Specified by:
countConsideredUserChangePasswordAttempts
in interfaceUserChangePasswordAttemptService<P extends UserChangePasswordAttempt>
- Parameters:
username
- The username to read forauthServerId
- The auth server ID- Returns:
- The number of failed and considered change password attempts
-
readConsideredUserChangePasswordAttempts
public List<P> readConsideredUserChangePasswordAttempts(String username, String authServerId, Duration age) Description copied from interface:UserChangePasswordAttemptService
Read user failed and considered change password attempts for a specific period of time (e.g. for the last 24 hours)- Specified by:
readConsideredUserChangePasswordAttempts
in interfaceUserChangePasswordAttemptService<P extends UserChangePasswordAttempt>
- Parameters:
username
- The username used in the change password attemptauthServerId
- The auth server idage
- The period of time- Returns:
- The list of failed and considered change password attempts
-
createUserChangePasswordAttempt
public P createUserChangePasswordAttempt(String username, String userId, String changePasswordAttemptResult, String authServerId) Description copied from interface:UserChangePasswordAttemptService
Create a new user change password attempt.- Specified by:
createUserChangePasswordAttempt
in interfaceUserChangePasswordAttemptService<P extends UserChangePasswordAttempt>
- Parameters:
username
- The usernameuserId
- The user ID. This should be non-null since a user can only change a password when they are logged in.changePasswordAttemptResult
- The change password result. SeeUserAttemptResult
authServerId
- The auth server id- Returns:
- The newly created user change password attempt
-
resetChangePasswordAttempts
Description copied from interface:UserChangePasswordAttemptService
Reset user change password attempts for a specific username and auth server ID. This should generally be called on a successful change password attempt- Specified by:
resetChangePasswordAttempts
in interfaceUserChangePasswordAttemptService<P extends UserChangePasswordAttempt>
- Parameters:
username
- The username to reset password change attempts forauthServerId
- The auth server ID
-
purgeChangePasswordAttempts
public void purgeChangePasswordAttempts(Duration changePasswordAttemptAge, @Nullable String authServerId) Description copied from interface:UserChangePasswordAttemptService
Purges any change password attempts older than the specified duration.- Specified by:
purgeChangePasswordAttempts
in interfaceUserChangePasswordAttemptService<P extends UserChangePasswordAttempt>
- Parameters:
changePasswordAttemptAge
- The age of change password attempts to purge. Any attempts greater than or equal to this age will be deleted.authServerId
- The auth server ID of change password attempts to purge. Optional.
-
getRepository
-
getMapper
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-