Class DefaultUserResetPasswordAttemptService<P extends UserResetPasswordAttempt,D extends com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware & com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable>
java.lang.Object
com.broadleafcommerce.auth.user.service.DefaultUserResetPasswordAttemptService<P,D>
- All Implemented Interfaces:
UserResetPasswordAttemptService<P>
public class DefaultUserResetPasswordAttemptService<P extends UserResetPasswordAttempt,D extends com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware & com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable>
extends Object
implements UserResetPasswordAttemptService<P>
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultUserResetPasswordAttemptService
(UserResetPasswordAttemptRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionint
countConsideredUserResetPasswordAttempts
(String username, String authServerId) Read the number of failed and considered reset password attemptsint
countConsideredUserResetPasswordAttempts
(String username, String authServerId, Duration age) Count number of failed and considered user reset password attempts for a specific period of time (e.g.createUserResetPasswordAttempt
(String username, String userId, String resetPasswordAttemptResult, String authServerId) Create a new user reset password attempt.protected SimplePayloadMapper
protected UserResetPasswordAttemptRepository<D>
protected com.broadleafcommerce.common.extension.TypeFactory
void
purgeResetPasswordAttempts
(Duration resetPasswordAttemptAge, String authServerId) Purges any reset password attempts older than the specified duration.readConsideredUserResetPasswordAttempts
(String username, String authServerId, Duration age) Read failed and considered user reset password attempts for a specific period of time (e.g.void
resetResetPasswordAttempts
(String username, String authServerId) Reset user reset password attempts for a specific username and auth server ID.
-
Constructor Details
-
DefaultUserResetPasswordAttemptService
public DefaultUserResetPasswordAttemptService(UserResetPasswordAttemptRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
countConsideredUserResetPasswordAttempts
public int countConsideredUserResetPasswordAttempts(String username, String authServerId, Duration age) Description copied from interface:UserResetPasswordAttemptService
Count number of failed and considered user reset password attempts for a specific period of time (e.g. for the last 24 hours)- Specified by:
countConsideredUserResetPasswordAttempts
in interfaceUserResetPasswordAttemptService<P extends UserResetPasswordAttempt>
- Parameters:
username
- The username used in the reset password attemptauthServerId
- The auth server idage
- The period of time- Returns:
- The number of failed and considered reset password attempts
-
countConsideredUserResetPasswordAttempts
Description copied from interface:UserResetPasswordAttemptService
Read the number of failed and considered reset password attempts- Specified by:
countConsideredUserResetPasswordAttempts
in interfaceUserResetPasswordAttemptService<P extends UserResetPasswordAttempt>
- Parameters:
username
- The username to read forauthServerId
- The auth server ID- Returns:
- The number of failed and considered reset password attempts
-
readConsideredUserResetPasswordAttempts
public List<P> readConsideredUserResetPasswordAttempts(String username, String authServerId, Duration age) Description copied from interface:UserResetPasswordAttemptService
Read failed and considered user reset password attempts for a specific period of time (e.g. for the last 24 hours)- Specified by:
readConsideredUserResetPasswordAttempts
in interfaceUserResetPasswordAttemptService<P extends UserResetPasswordAttempt>
- Parameters:
username
- The username used in the reset password attemptauthServerId
- The auth server idage
- The period of time- Returns:
- The list of failed and considered reset password attempts
-
createUserResetPasswordAttempt
public P createUserResetPasswordAttempt(String username, @Nullable String userId, String resetPasswordAttemptResult, String authServerId) Description copied from interface:UserResetPasswordAttemptService
Create a new user reset password attempt.- Specified by:
createUserResetPasswordAttempt
in interfaceUserResetPasswordAttemptService<P extends UserResetPasswordAttempt>
- Parameters:
username
- The usernameuserId
- The user ID. This is nullable, as an attempt could be made to reset the password using a specific username, but no user exists for that username.resetPasswordAttemptResult
- The reset password result. SeeUserAttemptResult
authServerId
- The auth server id- Returns:
- The newly created user reset password attempt
-
resetResetPasswordAttempts
Description copied from interface:UserResetPasswordAttemptService
Reset user reset password attempts for a specific username and auth server ID. This should generally be called on a successful reset password attempt- Specified by:
resetResetPasswordAttempts
in interfaceUserResetPasswordAttemptService<P extends UserResetPasswordAttempt>
- Parameters:
username
- The username to reset password reset attempts forauthServerId
- The auth server ID
-
purgeResetPasswordAttempts
public void purgeResetPasswordAttempts(Duration resetPasswordAttemptAge, @Nullable String authServerId) Description copied from interface:UserResetPasswordAttemptService
Purges any reset password attempts older than the specified duration.- Specified by:
purgeResetPasswordAttempts
in interfaceUserResetPasswordAttemptService<P extends UserResetPasswordAttempt>
- Parameters:
resetPasswordAttemptAge
- The age of reset password attempts to purge. Any attempts greater than or equal to this age will be deleted.authServerId
- The auth server ID of reset password attempts to purge. Optional.
-
getRepository
-
getMapper
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-