Package org.keycloak.authentication.jpa
Enum Class AuthenticationSessionExpirationAction
java.lang.Object
java.lang.Enum<AuthenticationSessionExpirationAction>
org.keycloak.authentication.jpa.AuthenticationSessionExpirationAction
- All Implemented Interfaces:
Serializable,Comparable<AuthenticationSessionExpirationAction>,Constable,ExpirationAction
public enum AuthenticationSessionExpirationAction
extends Enum<AuthenticationSessionExpirationAction>
implements ExpirationAction
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasWork(KeycloakSession session, String realmId) Checks with a single index lookup if the realm has any authentication sessions, to skip the per-bucket queries.booleanremoveExpired(KeycloakSession session, String realmId, int currentTime, int maxRemoval, IntConsumer removeCount) Removes expired entries from the database.Returns the enum constant of this class with the specified name.values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
removeExpired
public boolean removeExpired(KeycloakSession session, String realmId, int currentTime, int maxRemoval, IntConsumer removeCount) Description copied from interface:ExpirationActionRemoves expired entries from the database.This method is invoked inside a transaction. It should delete a batch of expired entries whose expiration time is at or before
currentTimeand report the number of removed rows viaremoveCount.- Specified by:
removeExpiredin interfaceExpirationAction- Parameters:
session- the current Keycloak session, valid for the duration of the enclosing transaction.realmId- the realm to clean up, ornullfor non-realm-aware expiration tasks.currentTime- the current time in seconds since epoch, used as the expiration threshold. This value is constant across all batches within a single task run.maxRemoval- the maximum number of entries to remove in this batch.removeCount- a consumer to report the number of entries removed in this batch.- Returns:
trueif there are more expired entries to remove (the framework will call this method again in a new transaction);falseif all expired entries have been removed.
-
hasWork
Checks with a single index lookup if the realm has any authentication sessions, to skip the per-bucket queries. Nothing is remembered between runs, so the result never depends on the clock or on the node running the task.- Specified by:
hasWorkin interfaceExpirationAction- Parameters:
session- the current Keycloak session, valid for the duration of the enclosing transaction.realmId- the realm to check.- Returns:
falseif the realm has nothing that could expire;trueotherwise. Defaults totrue.
-