Package org.keycloak.services.managers
Class DefaultBruteForceProtector
java.lang.Object
org.keycloak.services.managers.DefaultBruteForceProtector
- All Implemented Interfaces:
Runnable
,Provider
,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
Modifier and TypeClassDescriptionprotected static class
protected class
protected class
protected class
protected class
-
Field Summary
Modifier and TypeFieldDescriptionprotected KeycloakSessionFactory
protected long
protected long
protected int
protected boolean
protected CountDownLatch
protected long
static final int
Fields inherited from interface org.keycloak.services.managers.BruteForceProtector
DISABLED_BY_PERMANENT_LOCKOUT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanUpPermanentLockout
(KeycloakSession session, RealmModel realm, UserModel user) Clears any remaining traces of the permanent lockout.void
close()
void
failedLogin
(RealmModel realm, UserModel user, ClientConnection clientConnection) protected void
failure
(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event) protected RealmModel
getRealmModel
(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event) protected UserLoginFailureModel
getUserModel
(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event) boolean
isPermanentlyLockedOut
(KeycloakSession session, RealmModel realm, UserModel user) boolean
isTemporarilyDisabled
(KeycloakSession session, RealmModel realm, UserModel user) protected void
void
run()
protected void
sendEvent
(KeycloakSession session, RealmModel realm, UserLoginFailureModel userLoginFailure, EventType type) void
shutdown()
void
start()
protected void
success
(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event) void
successfulLogin
(RealmModel realm, UserModel user, ClientConnection clientConnection)
-
Field Details
-
run
protected volatile boolean run -
maxDeltaTimeSeconds
protected int maxDeltaTimeSeconds -
factory
-
shutdownLatch
-
failures
protected volatile long failures -
lastFailure
protected volatile long lastFailure -
totalTime
protected volatile long totalTime -
queue
-
TRANSACTION_SIZE
public static final int TRANSACTION_SIZE- See Also:
-
-
Constructor Details
-
DefaultBruteForceProtector
-
-
Method Details
-
failure
-
getUserModel
protected UserLoginFailureModel getUserModel(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event) -
getRealmModel
protected RealmModel getRealmModel(KeycloakSession session, DefaultBruteForceProtector.LoginEvent event) -
sendEvent
protected void sendEvent(KeycloakSession session, RealmModel realm, UserLoginFailureModel userLoginFailure, EventType type) -
start
public void start() -
shutdown
public void shutdown() -
run
public void run() -
success
-
logFailure
-
failedLogin
- Specified by:
failedLogin
in interfaceBruteForceProtector
-
successfulLogin
- Specified by:
successfulLogin
in interfaceBruteForceProtector
-
isTemporarilyDisabled
- Specified by:
isTemporarilyDisabled
in interfaceBruteForceProtector
-
isPermanentlyLockedOut
- Specified by:
isPermanentlyLockedOut
in interfaceBruteForceProtector
-
cleanUpPermanentLockout
Description copied from interface:BruteForceProtector
Clears any remaining traces of the permanent lockout. Does not enable the user as such!- Specified by:
cleanUpPermanentLockout
in interfaceBruteForceProtector
-
close
public void close()
-