Class InfinispanUserSessionProvider
java.lang.Object
org.keycloak.models.sessions.infinispan.InfinispanUserSessionProvider
- All Implemented Interfaces:
UserSessionProvider,Provider
- Author:
- Stian Thorgersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.infinispan.Cache<UUID,SessionEntityWrapper<AuthenticatedClientSessionEntity>> protected final InfinispanChangelogBasedTransaction<UUID,AuthenticatedClientSessionEntity> protected final SessionEventsSenderTransactionprotected final InfinispanKeyGeneratorprotected final CrossDCLastSessionRefreshStoreprotected final booleanprotected final org.infinispan.Cache<UUID,SessionEntityWrapper<AuthenticatedClientSessionEntity>> protected final InfinispanChangelogBasedTransaction<UUID,AuthenticatedClientSessionEntity> protected final CrossDCLastSessionRefreshStoreprotected final org.infinispan.Cache<String,SessionEntityWrapper<UserSessionEntity>> protected final InfinispanChangelogBasedTransaction<String,UserSessionEntity> protected final PersisterLastSessionRefreshStoreprotected final RemoteCacheInvokerprotected final KeycloakSessionprotected final org.infinispan.Cache<String,SessionEntityWrapper<UserSessionEntity>> protected final InfinispanChangelogBasedTransaction<String,UserSessionEntity> -
Constructor Summary
ConstructorsConstructorDescriptionInfinispanUserSessionProvider(KeycloakSession session, RemoteCacheInvoker remoteCacheInvoker, CrossDCLastSessionRefreshStore lastSessionRefreshStore, CrossDCLastSessionRefreshStore offlineLastSessionRefreshStore, PersisterLastSessionRefreshStore persisterLastSessionRefreshStore, InfinispanKeyGenerator keyGenerator, org.infinispan.Cache<String, SessionEntityWrapper<UserSessionEntity>> sessionCache, org.infinispan.Cache<String, SessionEntityWrapper<UserSessionEntity>> offlineSessionCache, org.infinispan.Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> clientSessionCache, org.infinispan.Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> offlineClientSessionCache, boolean loadOfflineSessionsFromDatabase) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()createClientSession(RealmModel realm, ClientModel client, UserSessionModel userSession) createOfflineClientSession(AuthenticatedClientSessionModel clientSession, UserSessionModel offlineUserSession) createOfflineUserSession(UserSessionModel userSession) createUserSession(String id, RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId, UserSessionModel.SessionPersistenceState persistenceState) getActiveClientSessionStats(RealmModel realm, boolean offline) longgetActiveUserSessions(RealmModel realm, ClientModel client) protected org.infinispan.Cache<String,SessionEntityWrapper<UserSessionEntity>> getCache(boolean offline) getClientSession(UserSessionModel userSession, ClientModel client, String clientSessionId, boolean offline) protected org.infinispan.Cache<UUID,SessionEntityWrapper<AuthenticatedClientSessionEntity>> getClientSessionCache(boolean offline) getClientSessionTransaction(boolean offline) protected CrossDCLastSessionRefreshStoreprotected CrossDCLastSessionRefreshStorelonggetOfflineSessionsCount(RealmModel realm, ClientModel client) getOfflineUserSession(RealmModel realm, String userSessionId) getOfflineUserSessionByBrokerSessionId(RealmModel realm, String brokerSessionId) getOfflineUserSessionByBrokerUserIdStream(RealmModel realm, String brokerUserId) getOfflineUserSessionsStream(RealmModel realm, ClientModel client, Integer first, Integer max) getOfflineUserSessionsStream(RealmModel realm, UserModel user) protected PersisterLastSessionRefreshStoreintgetStartupTime(RealmModel realm) getTransaction(boolean offline) getUserSession(RealmModel realm, String id) protected UserSessionAdaptergetUserSession(RealmModel realm, String id, boolean offline) getUserSessionByBrokerSessionId(RealmModel realm, String brokerSessionId) getUserSessionByBrokerUserIdStream(RealmModel realm, String brokerUserId) protected longgetUserSessionsCount(RealmModel realm, ClientModel client, boolean offline) getUserSessionsStream(RealmModel realm, ClientModel client) getUserSessionsStream(RealmModel realm, ClientModel client, Integer firstResult, Integer maxResults) protected Stream<UserSessionModel>getUserSessionsStream(RealmModel realm, ClientModel client, Integer firstResult, Integer maxResults, boolean offline) protected Stream<UserSessionModel>getUserSessionsStream(RealmModel realm, UserSessionPredicate predicate, boolean offline) getUserSessionsStream(RealmModel realm, UserModel user) getUserSessionWithPredicate(RealmModel realm, String id, boolean offline, Predicate<UserSessionModel> predicate) protected UserSessionAdapterimportUserSession(UserSessionModel userSession, boolean offline) voidimportUserSessions(Collection<UserSessionModel> persistentUserSessions, boolean offline) voidonClientRemoved(RealmModel realm, ClientModel client) protected voidonClientRemovedEvent(String realmId, String clientUuid) voidonRealmRemoved(RealmModel realm) protected voidonRealmRemovedEvent(String realmId) protected voidonRemoveUserSessionsEvent(String realmId) protected voidonUserRemoved(RealmModel realm, UserModel user) voidvoidremoveExpired(RealmModel realm) voidremoveLocalUserSessions(String realmId, boolean offline) voidremoveOfflineUserSession(RealmModel realm, UserSessionModel userSession) voidremoveUserSession(RealmModel realm, UserSessionModel session) protected voidremoveUserSession(UserSessionEntity sessionEntity, boolean offline) voidremoveUserSessions(RealmModel realm) voidremoveUserSessions(RealmModel realm, UserModel user) protected voidremoveUserSessions(RealmModel realm, UserModel user, boolean offline) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.models.UserSessionProvider
createUserSession, getClientSession
-
Field Details
-
session
-
sessionCache
-
offlineSessionCache
protected final org.infinispan.Cache<String,SessionEntityWrapper<UserSessionEntity>> offlineSessionCache -
clientSessionCache
protected final org.infinispan.Cache<UUID,SessionEntityWrapper<AuthenticatedClientSessionEntity>> clientSessionCache -
offlineClientSessionCache
protected final org.infinispan.Cache<UUID,SessionEntityWrapper<AuthenticatedClientSessionEntity>> offlineClientSessionCache -
sessionTx
-
offlineSessionTx
-
clientSessionTx
protected final InfinispanChangelogBasedTransaction<UUID,AuthenticatedClientSessionEntity> clientSessionTx -
offlineClientSessionTx
protected final InfinispanChangelogBasedTransaction<UUID,AuthenticatedClientSessionEntity> offlineClientSessionTx -
clusterEventsSenderTx
-
lastSessionRefreshStore
-
offlineLastSessionRefreshStore
-
persisterLastSessionRefreshStore
-
remoteCacheInvoker
-
keyGenerator
-
loadOfflineSessionsFromDatabase
protected final boolean loadOfflineSessionsFromDatabase
-
-
Constructor Details
-
InfinispanUserSessionProvider
public InfinispanUserSessionProvider(KeycloakSession session, RemoteCacheInvoker remoteCacheInvoker, CrossDCLastSessionRefreshStore lastSessionRefreshStore, CrossDCLastSessionRefreshStore offlineLastSessionRefreshStore, PersisterLastSessionRefreshStore persisterLastSessionRefreshStore, InfinispanKeyGenerator keyGenerator, org.infinispan.Cache<String, SessionEntityWrapper<UserSessionEntity>> sessionCache, org.infinispan.Cache<String, SessionEntityWrapper<UserSessionEntity>> offlineSessionCache, org.infinispan.Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> clientSessionCache, org.infinispan.Cache<UUID, SessionEntityWrapper<AuthenticatedClientSessionEntity>> offlineClientSessionCache, boolean loadOfflineSessionsFromDatabase)
-
-
Method Details
-
getCache
protected org.infinispan.Cache<String,SessionEntityWrapper<UserSessionEntity>> getCache(boolean offline) -
getTransaction
protected InfinispanChangelogBasedTransaction<String,UserSessionEntity> getTransaction(boolean offline) -
getClientSessionCache
protected org.infinispan.Cache<UUID,SessionEntityWrapper<AuthenticatedClientSessionEntity>> getClientSessionCache(boolean offline) -
getClientSessionTransaction
protected InfinispanChangelogBasedTransaction<UUID,AuthenticatedClientSessionEntity> getClientSessionTransaction(boolean offline) -
getLastSessionRefreshStore
-
getOfflineLastSessionRefreshStore
-
getPersisterLastSessionRefreshStore
-
getKeycloakSession
- Specified by:
getKeycloakSessionin interfaceUserSessionProvider
-
createClientSession
public AuthenticatedClientSessionModel createClientSession(RealmModel realm, ClientModel client, UserSessionModel userSession) - Specified by:
createClientSessionin interfaceUserSessionProvider
-
createUserSession
public UserSessionModel createUserSession(String id, RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId, UserSessionModel.SessionPersistenceState persistenceState) - Specified by:
createUserSessionin interfaceUserSessionProvider
-
getUserSession
- Specified by:
getUserSessionin interfaceUserSessionProvider
-
getUserSession
-
getUserSessionsStream
protected Stream<UserSessionModel> getUserSessionsStream(RealmModel realm, UserSessionPredicate predicate, boolean offline) -
getClientSession
public AuthenticatedClientSessionAdapter getClientSession(UserSessionModel userSession, ClientModel client, String clientSessionId, boolean offline) - Specified by:
getClientSessionin interfaceUserSessionProvider
-
getUserSessionsStream
- Specified by:
getUserSessionsStreamin interfaceUserSessionProvider
-
getUserSessionByBrokerUserIdStream
public Stream<UserSessionModel> getUserSessionByBrokerUserIdStream(RealmModel realm, String brokerUserId) - Specified by:
getUserSessionByBrokerUserIdStreamin interfaceUserSessionProvider
-
getUserSessionByBrokerSessionId
- Specified by:
getUserSessionByBrokerSessionIdin interfaceUserSessionProvider
-
getUserSessionsStream
- Specified by:
getUserSessionsStreamin interfaceUserSessionProvider
-
getUserSessionsStream
public Stream<UserSessionModel> getUserSessionsStream(RealmModel realm, ClientModel client, Integer firstResult, Integer maxResults) - Specified by:
getUserSessionsStreamin interfaceUserSessionProvider
-
getUserSessionsStream
protected Stream<UserSessionModel> getUserSessionsStream(RealmModel realm, ClientModel client, Integer firstResult, Integer maxResults, boolean offline) -
getUserSessionWithPredicate
public UserSessionModel getUserSessionWithPredicate(RealmModel realm, String id, boolean offline, Predicate<UserSessionModel> predicate) - Specified by:
getUserSessionWithPredicatein interfaceUserSessionProvider
-
getActiveUserSessions
- Specified by:
getActiveUserSessionsin interfaceUserSessionProvider
-
getActiveClientSessionStats
- Specified by:
getActiveClientSessionStatsin interfaceUserSessionProvider
-
getUserSessionsCount
-
removeUserSession
- Specified by:
removeUserSessionin interfaceUserSessionProvider
-
removeUserSessions
- Specified by:
removeUserSessionsin interfaceUserSessionProvider
-
removeUserSessions
-
removeAllExpired
public void removeAllExpired()- Specified by:
removeAllExpiredin interfaceUserSessionProvider
-
removeExpired
- Specified by:
removeExpiredin interfaceUserSessionProvider
-
removeUserSessions
- Specified by:
removeUserSessionsin interfaceUserSessionProvider
-
onRemoveUserSessionsEvent
-
removeLocalUserSessions
-
onRealmRemoved
- Specified by:
onRealmRemovedin interfaceUserSessionProvider
-
onRealmRemovedEvent
-
onClientRemoved
- Specified by:
onClientRemovedin interfaceUserSessionProvider
-
onClientRemovedEvent
-
onUserRemoved
-
close
public void close()- Specified by:
closein interfaceProvider- Specified by:
closein interfaceUserSessionProvider
-
getStartupTime
- Specified by:
getStartupTimein interfaceUserSessionProvider
-
removeUserSession
-
createOfflineUserSession
- Specified by:
createOfflineUserSessionin interfaceUserSessionProvider
-
getOfflineUserSession
- Specified by:
getOfflineUserSessionin interfaceUserSessionProvider
-
getOfflineUserSessionByBrokerSessionId
public UserSessionModel getOfflineUserSessionByBrokerSessionId(RealmModel realm, String brokerSessionId) - Specified by:
getOfflineUserSessionByBrokerSessionIdin interfaceUserSessionProvider
-
getOfflineUserSessionByBrokerUserIdStream
public Stream<UserSessionModel> getOfflineUserSessionByBrokerUserIdStream(RealmModel realm, String brokerUserId) - Specified by:
getOfflineUserSessionByBrokerUserIdStreamin interfaceUserSessionProvider
-
removeOfflineUserSession
- Specified by:
removeOfflineUserSessionin interfaceUserSessionProvider
-
createOfflineClientSession
public AuthenticatedClientSessionModel createOfflineClientSession(AuthenticatedClientSessionModel clientSession, UserSessionModel offlineUserSession) - Specified by:
createOfflineClientSessionin interfaceUserSessionProvider
-
getOfflineUserSessionsStream
- Specified by:
getOfflineUserSessionsStreamin interfaceUserSessionProvider
-
getOfflineSessionsCount
- Specified by:
getOfflineSessionsCountin interfaceUserSessionProvider
-
getOfflineUserSessionsStream
public Stream<UserSessionModel> getOfflineUserSessionsStream(RealmModel realm, ClientModel client, Integer first, Integer max) - Specified by:
getOfflineUserSessionsStreamin interfaceUserSessionProvider
-
importUserSessions
public void importUserSessions(Collection<UserSessionModel> persistentUserSessions, boolean offline) - Specified by:
importUserSessionsin interfaceUserSessionProvider
-
importUserSession
-