Class DefaultUserLoginAttemptService<P extends UserLoginAttempt,D extends com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware & com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable>
java.lang.Object
com.broadleafcommerce.auth.user.service.DefaultUserLoginAttemptService<P,D>
- All Implemented Interfaces:
UserLoginAttemptService<P>
public class DefaultUserLoginAttemptService<P extends UserLoginAttempt,D extends com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware & com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable>
extends Object
implements UserLoginAttemptService<P>
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultUserLoginAttemptService(UserLoginAttemptRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionintcountConsideredUserLoginAttempts(String username, String authServerId) Read the number of failed login attemptsintcountConsideredUserLoginAttempts(String username, String authServerId, Duration age) Count number of user login attempts for a specific period of time (e.g.createUserLoginAttempt(String username, String userId, String loginAttemptResult, String authServerId) Create a new user login attempt.voidpurgeLoginAttempts(Duration loginAttemptAge, String authServerId) Purges any login attempts older than the specified duration.readConsideredUserLoginAttempts(String username, String authServerId, Duration age) Read user login attempts for a specific period of time (e.g.voidresetLoginAttempts(String username, String authServerId) Reset user login attempts for a specific username and auth server ID.
-
Constructor Details
-
DefaultUserLoginAttemptService
public DefaultUserLoginAttemptService(UserLoginAttemptRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
countConsideredUserLoginAttempts
Description copied from interface:UserLoginAttemptServiceCount number of user login attempts for a specific period of time (e.g. for the last 24 hours)- Specified by:
countConsideredUserLoginAttemptsin interfaceUserLoginAttemptService<P extends UserLoginAttempt>- Parameters:
username- The username used in the login attemptauthServerId- The auth server idage- The period of time- Returns:
- The number of failed login attempts
-
countConsideredUserLoginAttempts
Description copied from interface:UserLoginAttemptServiceRead the number of failed login attempts- Specified by:
countConsideredUserLoginAttemptsin interfaceUserLoginAttemptService<P extends UserLoginAttempt>- Parameters:
username- The username to read forauthServerId- The auth server ID- Returns:
- The number of failed login attempts
-
readConsideredUserLoginAttempts
Description copied from interface:UserLoginAttemptServiceRead user login attempts for a specific period of time (e.g. for the last 24 hours)- Specified by:
readConsideredUserLoginAttemptsin interfaceUserLoginAttemptService<P extends UserLoginAttempt>- Parameters:
username- The username used in the login attemptauthServerId- The auth server idage- The period of time- Returns:
- The number of failed login attempts
-
createUserLoginAttempt
public P createUserLoginAttempt(String username, @Nullable String userId, String loginAttemptResult, String authServerId) Description copied from interface:UserLoginAttemptServiceCreate a new user login attempt.- Specified by:
createUserLoginAttemptin interfaceUserLoginAttemptService<P extends UserLoginAttempt>- Parameters:
username- The usernameuserId- The user ID. OptionalloginAttemptResult- The login result. SeeLoginAttemptResultauthServerId- The auth server id- Returns:
- The newly create user login attempt
-
resetLoginAttempts
Description copied from interface:UserLoginAttemptServiceReset user login attempts for a specific username and auth server ID. This should generally be called on a successful login attempt- Specified by:
resetLoginAttemptsin interfaceUserLoginAttemptService<P extends UserLoginAttempt>- Parameters:
username- The username to reset login attempts forauthServerId- The auth server ID
-
purgeLoginAttempts
@Transactional public void purgeLoginAttempts(Duration loginAttemptAge, @Nullable String authServerId) Description copied from interface:UserLoginAttemptServicePurges any login attempts older than the specified duration.- Specified by:
purgeLoginAttemptsin interfaceUserLoginAttemptService<P extends UserLoginAttempt>- Parameters:
loginAttemptAge- The age of login attempts to purge. Any attempts greater than or equal to this age will be deleted.authServerId- The auth server ID of login attempts to purge. Optional.
-