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 and Description |
---|
DefaultUserLoginAttemptService(UserLoginAttemptRepository<D> repository,
SimplePayloadMapper mapper,
com.broadleafcommerce.common.extension.TypeFactory typeFactory) |
Modifier and Type | Method and Description |
---|---|
int |
countConsideredUserLoginAttempts(String username,
String authServerId)
Read the number of failed login attempts
|
int |
countConsideredUserLoginAttempts(String username,
String authServerId,
Duration age)
Count number of user login attempts for a specific period of time (e.g.
|
P |
createUserLoginAttempt(String username,
String userId,
String loginAttemptResult,
String authServerId)
Create a new user login attempt.
|
void |
purgeLoginAttempts(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.
|
void |
resetLoginAttempts(String username,
String authServerId)
Reset user login attempts for a specific username and auth server ID.
|
public DefaultUserLoginAttemptService(UserLoginAttemptRepository<D> repository, SimplePayloadMapper mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
public int countConsideredUserLoginAttempts(String username, String authServerId, Duration age)
UserLoginAttemptService
countConsideredUserLoginAttempts
in interface UserLoginAttemptService<P extends UserLoginAttempt>
username
- The username used in the login attemptauthServerId
- The auth server idage
- The period of timepublic int countConsideredUserLoginAttempts(String username, String authServerId)
UserLoginAttemptService
countConsideredUserLoginAttempts
in interface UserLoginAttemptService<P extends UserLoginAttempt>
username
- The username to read forauthServerId
- The auth server IDpublic List<P> readConsideredUserLoginAttempts(String username, String authServerId, Duration age)
UserLoginAttemptService
readConsideredUserLoginAttempts
in interface UserLoginAttemptService<P extends UserLoginAttempt>
username
- The username used in the login attemptauthServerId
- The auth server idage
- The period of timepublic P createUserLoginAttempt(String username, @Nullable String userId, String loginAttemptResult, String authServerId)
UserLoginAttemptService
createUserLoginAttempt
in interface UserLoginAttemptService<P extends UserLoginAttempt>
username
- The usernameuserId
- The user ID. OptionalloginAttemptResult
- The login result. See
LoginAttemptResult
authServerId
- The auth server id@Transactional public void resetLoginAttempts(String username, String authServerId)
UserLoginAttemptService
resetLoginAttempts
in interface UserLoginAttemptService<P extends UserLoginAttempt>
username
- The username to reset login attempts forauthServerId
- The auth server ID@Transactional public void purgeLoginAttempts(Duration loginAttemptAge, @Nullable String authServerId)
UserLoginAttemptService
purgeLoginAttempts
in interface UserLoginAttemptService<P extends UserLoginAttempt>
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.Copyright © 2021. All rights reserved.