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
Constructors Constructor Description DefaultUserLoginAttemptService(UserLoginAttemptRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcountConsideredUserLoginAttempts(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.PcreateUserLoginAttempt(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.List<P>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 Detail
-
DefaultUserLoginAttemptService
public DefaultUserLoginAttemptService(UserLoginAttemptRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Detail
-
countConsideredUserLoginAttempts
public int countConsideredUserLoginAttempts(String username, String authServerId, Duration age)
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
public int countConsideredUserLoginAttempts(String username, String authServerId)
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
public List<P> readConsideredUserLoginAttempts(String username, String authServerId, Duration age)
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
@Transactional public void resetLoginAttempts(String username, String authServerId)
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.
-
-