Package org.keycloak.services.managers
Class DefaultBruteForceProtector
- java.lang.Object
-
- org.keycloak.services.managers.DefaultBruteForceProtector
-
- All Implemented Interfaces:
Runnable,Provider,BruteForceProtector
public class DefaultBruteForceProtector extends Object implements Runnable, BruteForceProtector
A single thread will log failures. This is so that we can avoid concurrent writes as we want an accurate failure count- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classDefaultBruteForceProtector.FailedLoginprotected classDefaultBruteForceProtector.LoginEventprotected classDefaultBruteForceProtector.ShutdownEventprotected classDefaultBruteForceProtector.SuccessfulLogin
-
Field Summary
Fields Modifier and Type Field Description protected KeycloakSessionFactoryfactoryprotected longfailuresprotected longlastFailureprotected intmaxDeltaTimeSecondsprotected LinkedBlockingQueue<DefaultBruteForceProtector.LoginEvent>queueprotected booleanrunprotected CountDownLatchshutdownLatchprotected longtotalTimestatic intTRANSACTION_SIZE-
Fields inherited from interface org.keycloak.services.managers.BruteForceProtector
DISABLED_BY_PERMANENT_LOCKOUT
-
-
Constructor Summary
Constructors Constructor Description DefaultBruteForceProtector(KeycloakSessionFactory factory)
-
Method Summary
-
-
-
Field Detail
-
run
protected volatile boolean run
-
maxDeltaTimeSeconds
protected int maxDeltaTimeSeconds
-
factory
protected KeycloakSessionFactory factory
-
shutdownLatch
protected CountDownLatch shutdownLatch
-
failures
protected volatile long failures
-
lastFailure
protected volatile long lastFailure
-
totalTime
protected volatile long totalTime
-
queue
protected LinkedBlockingQueue<DefaultBruteForceProtector.LoginEvent> queue
-
TRANSACTION_SIZE
public static final int TRANSACTION_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultBruteForceProtector
public DefaultBruteForceProtector(KeycloakSessionFactory factory)
-
-
Method Detail
-
failure
protected void failure(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event)
-
getUserModel
protected UserLoginFailureModel getUserModel(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event)
-
getRealmModel
protected RealmModel getRealmModel(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event)
-
start
public void start()
-
shutdown
public void shutdown()
-
success
protected void success(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event)
-
logFailure
protected void logFailure(DefaultBruteForceProtector.LoginEvent event)
-
failedLogin
public void failedLogin(RealmModel realm, UserModel user, ClientConnection clientConnection)
- Specified by:
failedLoginin interfaceBruteForceProtector
-
successfulLogin
public void successfulLogin(RealmModel realm, UserModel user, ClientConnection clientConnection)
- Specified by:
successfulLoginin interfaceBruteForceProtector
-
isTemporarilyDisabled
public boolean isTemporarilyDisabled(KeycloakSession session, RealmModel realm, UserModel user)
- Specified by:
isTemporarilyDisabledin interfaceBruteForceProtector
-
isPermanentlyLockedOut
public boolean isPermanentlyLockedOut(KeycloakSession session, RealmModel realm, UserModel user)
- Specified by:
isPermanentlyLockedOutin interfaceBruteForceProtector
-
cleanUpPermanentLockout
public void cleanUpPermanentLockout(KeycloakSession session, RealmModel realm, UserModel user)
Description copied from interface:BruteForceProtectorClears any remaining traces of the permanent lockout. Does not enable the user as such!- Specified by:
cleanUpPermanentLockoutin interfaceBruteForceProtector
-
-