@Component(value="cuba_BruteForceProtectionAPI") public class BruteForceProtectionBean extends java.lang.Object implements BruteForceProtectionAPI
Modifier and Type | Field and Description |
---|---|
protected boolean |
initialized |
protected java.util.concurrent.locks.ReadWriteLock |
lock |
protected com.google.common.cache.LoadingCache<java.lang.String,java.lang.Integer> |
loginAttemptsCache |
protected ServerConfig |
serverConfig |
NAME
Constructor and Description |
---|
BruteForceProtectionBean() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkInitialized() |
int |
getBruteForceBlockIntervalSec()
Returns a time interval for which a user is blocked after the number
of allowed login attempts is exceeded
|
java.util.Set<java.lang.String> |
getLockedUsersInfo()
Returns an information about the locked users
|
protected void |
init() |
boolean |
isBruteForceProtectionEnabled() |
int |
loginAttemptsLeft(java.lang.String login,
java.lang.String ipAddress)
Returns a number of login attempts left for the specified pair of login and IP-address
|
protected java.lang.String |
makeCacheKey(java.lang.String login,
java.lang.String ipAddress) |
int |
registerUnsuccessfulLogin(java.lang.String login,
java.lang.String ipAddress)
Registers unsuccessful login attempt
|
void |
unlockUser(java.lang.String login,
java.lang.String ipAddress)
Unlocks the blocked user
|
@Inject protected ServerConfig serverConfig
protected com.google.common.cache.LoadingCache<java.lang.String,java.lang.Integer> loginAttemptsCache
protected boolean initialized
protected java.util.concurrent.locks.ReadWriteLock lock
protected void checkInitialized()
protected void init()
public int loginAttemptsLeft(java.lang.String login, java.lang.String ipAddress)
BruteForceProtectionAPI
loginAttemptsLeft
in interface BruteForceProtectionAPI
login
- user loginipAddress
- user IP-addresspublic int registerUnsuccessfulLogin(java.lang.String login, java.lang.String ipAddress)
BruteForceProtectionAPI
registerUnsuccessfulLogin
in interface BruteForceProtectionAPI
public java.util.Set<java.lang.String> getLockedUsersInfo()
BruteForceProtectionAPI
getLockedUsersInfo
in interface BruteForceProtectionAPI
public void unlockUser(java.lang.String login, java.lang.String ipAddress)
BruteForceProtectionAPI
unlockUser
in interface BruteForceProtectionAPI
login
- user loginipAddress
- user IP-addresspublic boolean isBruteForceProtectionEnabled()
isBruteForceProtectionEnabled
in interface BruteForceProtectionAPI
public int getBruteForceBlockIntervalSec()
BruteForceProtectionAPI
getBruteForceBlockIntervalSec
in interface BruteForceProtectionAPI
protected java.lang.String makeCacheKey(java.lang.String login, java.lang.String ipAddress)