Class InfinispanAuthenticationSessionProvider
java.lang.Object
org.keycloak.models.sessions.infinispan.InfinispanAuthenticationSessionProvider
- All Implemented Interfaces:
Provider,AuthenticationSessionProvider
public class InfinispanAuthenticationSessionProvider
extends Object
implements AuthenticationSessionProvider
- Author:
- Marek Posolda
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SessionEventsSenderTransactionprotected final InfinispanChangelogBasedTransaction<String,RootAuthenticationSessionEntity> -
Constructor Summary
ConstructorsConstructorDescriptionInfinispanAuthenticationSessionProvider(KeycloakSession session, InfinispanChangelogBasedTransaction<String, RootAuthenticationSessionEntity> sessionTx, int authSessionsLimit) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Creates and registers a new authentication session with random ID.createRootAuthenticationSession(RealmModel realm, String id) Creates a new root authentication session specified by the provided realm and id.org.infinispan.Cache<String,SessionEntityWrapper<RootAuthenticationSessionEntity>> getCache()getRootAuthenticationSession(RealmModel realm, String authenticationSessionId) Returns the root authentication session specified by the provided realm and id.voidvoidonRealmRemoved(RealmModel realm) Removes all associated root authentication sessions to the given realm which was removed.protected voidonRealmRemovedEvent(String realmId) voidremoveRootAuthenticationSession(RealmModel realm, RootAuthenticationSessionModel authenticationSession) Removes provided root authentication session.voidremoveRootAuthenticationSessionsByAuthenticatedUser(RealmModel realm, UserModel user, String rootAuthenticationSessionIdToKeep) Removes all root authentication sessions of the given realm that hold an in-progress authentication session for the given authenticated user, except for the provided root authentication session id.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.sessions.AuthenticationSessionProvider
onClientRemoved, removeAllExpired, removeExpired, removeRootAuthenticationSession
-
Field Details
-
sessionTx
protected final InfinispanChangelogBasedTransaction<String,RootAuthenticationSessionEntity> sessionTx -
clusterEventsSenderTx
-
-
Constructor Details
-
InfinispanAuthenticationSessionProvider
public InfinispanAuthenticationSessionProvider(KeycloakSession session, InfinispanChangelogBasedTransaction<String, RootAuthenticationSessionEntity> sessionTx, int authSessionsLimit)
-
-
Method Details
-
createRootAuthenticationSession
Description copied from interface:AuthenticationSessionProviderCreates and registers a new authentication session with random ID. Authentication session entity will be prefilled with current timestamp, the given realm and client.- Specified by:
createRootAuthenticationSessionin interfaceAuthenticationSessionProvider- Parameters:
realm-RealmModelCan't benull.- Returns:
- Returns created
RootAuthenticationSessionModel. Never returnsnull.
-
createRootAuthenticationSession
Description copied from interface:AuthenticationSessionProviderCreates a new root authentication session specified by the provided realm and id.- Specified by:
createRootAuthenticationSessionin interfaceAuthenticationSessionProvider- Parameters:
realm-RealmModelCan't benull.id-StringId of newly created root authentication session. Ifnulla random id will be generated.- Returns:
- Returns created
RootAuthenticationSessionModel. Never returnsnull.
-
removeRootAuthenticationSessionsByAuthenticatedUser
public void removeRootAuthenticationSessionsByAuthenticatedUser(RealmModel realm, UserModel user, String rootAuthenticationSessionIdToKeep) Description copied from interface:AuthenticationSessionProviderRemoves all root authentication sessions of the given realm that hold an in-progress authentication session for the given authenticated user, except for the provided root authentication session id.- Specified by:
removeRootAuthenticationSessionsByAuthenticatedUserin interfaceAuthenticationSessionProvider- Parameters:
realm-RealmModelCan't benull.user-UserModelCan't benull.rootAuthenticationSessionIdToKeep- optional id of a root authentication session to keep.
-
onRealmRemoved
Description copied from interface:AuthenticationSessionProviderRemoves all associated root authentication sessions to the given realm which was removed.- Specified by:
onRealmRemovedin interfaceAuthenticationSessionProvider- Parameters:
realm-RealmModelCan't benull.
-
onRealmRemovedEvent
-
getRootAuthenticationSession
public RootAuthenticationSessionModel getRootAuthenticationSession(RealmModel realm, String authenticationSessionId) Description copied from interface:AuthenticationSessionProviderReturns the root authentication session specified by the provided realm and id.- Specified by:
getRootAuthenticationSessionin interfaceAuthenticationSessionProvider- Parameters:
realm-RealmModelCan't benull.authenticationSessionId-RootAuthenticationSessionModelIfnullthennullwill be returned.- Returns:
- Returns found
RootAuthenticationSessionModelornullif no root authentication session is found.
-
removeRootAuthenticationSession
public void removeRootAuthenticationSession(RealmModel realm, RootAuthenticationSessionModel authenticationSession) Description copied from interface:AuthenticationSessionProviderRemoves provided root authentication session.- Specified by:
removeRootAuthenticationSessionin interfaceAuthenticationSessionProvider- Parameters:
realm-RealmModelAssociated realm to the given root authentication session.authenticationSession-RootAuthenticationSessionModelCan't benull.
-
close
public void close() -
getCache
public org.infinispan.Cache<String,SessionEntityWrapper<RootAuthenticationSessionEntity>> getCache() -
getRootAuthSessionTransaction
public InfinispanChangelogBasedTransaction<String,RootAuthenticationSessionEntity> getRootAuthSessionTransaction() -
migrate
- Specified by:
migratein interfaceAuthenticationSessionProvider
-