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 TypeMethodDescriptionintcountConsideredUserResetPasswordAttempts(String username, String authServerId) Read the number of failed and considered reset password attemptsintcountConsideredUserResetPasswordAttempts(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 SimplePayloadMapperprotected UserResetPasswordAttemptRepository<D>protected com.broadleafcommerce.common.extension.TypeFactoryvoidpurgeResetPasswordAttempts(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.voidresetResetPasswordAttempts(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:UserResetPasswordAttemptServiceCount number of failed and considered user reset password attempts for a specific period of time (e.g. for the last 24 hours)- Specified by:
countConsideredUserResetPasswordAttemptsin 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:UserResetPasswordAttemptServiceRead the number of failed and considered reset password attempts- Specified by:
countConsideredUserResetPasswordAttemptsin 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:UserResetPasswordAttemptServiceRead failed and considered user reset password attempts for a specific period of time (e.g. for the last 24 hours)- Specified by:
readConsideredUserResetPasswordAttemptsin 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:UserResetPasswordAttemptServiceCreate a new user reset password attempt.- Specified by:
createUserResetPasswordAttemptin 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. SeeUserAttemptResultauthServerId- The auth server id- Returns:
- The newly created user reset password attempt
-
resetResetPasswordAttempts
Description copied from interface:UserResetPasswordAttemptServiceReset 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:
resetResetPasswordAttemptsin 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:UserResetPasswordAttemptServicePurges any reset password attempts older than the specified duration.- Specified by:
purgeResetPasswordAttemptsin 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()
-