Package org.keycloak.models.session
Interface UserSessionPersisterProvider
- 
- All Superinterfaces:
- Provider
 - All Known Implementing Classes:
- DisabledUserSessionPersisterProvider,- JpaUserSessionPersisterProvider
 
 public interface UserSessionPersisterProvider extends Provider - Author:
- Marek Posolda
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidcreateClientSession(AuthenticatedClientSessionModel clientSession, boolean offline)voidcreateUserSession(UserSessionModel userSession, boolean offline)intgetUserSessionsCount(boolean offline)Retrieves the count of user sessions for all realms.intgetUserSessionsCount(RealmModel realm, ClientModel clientModel, boolean offline)Retrieves the count of user client-sessions for the given clientMap<String,Long>getUserSessionsCountsByClients(RealmModel realm, boolean offline)Returns aMapcontaining the number of user-sessions aggregated by client id for the given realm.AuthenticatedClientSessionModelloadClientSession(RealmModel realm, ClientModel client, UserSessionModel userSession, boolean offline)Loads client session from the db by provided user session and client.UserSessionModelloadUserSession(RealmModel realm, String userSessionId, boolean offline)Loads the user session with the given userSessionId.default List<UserSessionModel>loadUserSessions(int firstResult, int maxResults, boolean offline, int lastCreatedOn, String lastUserSessionId)Deprecated.UseloadUserSessionsStreaminstead.Stream<UserSessionModel>loadUserSessionsStream(Integer firstResult, Integer maxResults, boolean offline, String lastUserSessionId)Called during startup.Stream<UserSessionModel>loadUserSessionsStream(RealmModel realm, ClientModel client, boolean offline, Integer firstResult, Integer maxResults)Loads the user sessions for the givenClientModelin the givenRealmModelif present.Stream<UserSessionModel>loadUserSessionsStream(RealmModel realm, UserModel user, boolean offline, Integer firstResult, Integer maxResults)Loads the user sessions for the givenUserModelin the givenRealmModelif present.voidonClientRemoved(RealmModel realm, ClientModel client)voidonRealmRemoved(RealmModel realm)voidonUserRemoved(RealmModel realm, UserModel user)voidremoveClientSession(String userSessionId, String clientUUID, boolean offline)voidremoveExpired(RealmModel realm)voidremoveUserSession(String userSessionId, boolean offline)voidupdateLastSessionRefreshes(RealmModel realm, int lastSessionRefresh, Collection<String> userSessionIds, boolean offline)
 
- 
- 
- 
Method Detail- 
createUserSessionvoid createUserSession(UserSessionModel userSession, boolean offline) 
 - 
createClientSessionvoid createClientSession(AuthenticatedClientSessionModel clientSession, boolean offline) 
 - 
removeUserSessionvoid removeUserSession(String userSessionId, boolean offline) 
 - 
removeClientSessionvoid removeClientSession(String userSessionId, String clientUUID, boolean offline) 
 - 
onRealmRemovedvoid onRealmRemoved(RealmModel realm) 
 - 
onClientRemovedvoid onClientRemoved(RealmModel realm, ClientModel client) 
 - 
onUserRemovedvoid onUserRemoved(RealmModel realm, UserModel user) 
 - 
updateLastSessionRefreshesvoid updateLastSessionRefreshes(RealmModel realm, int lastSessionRefresh, Collection<String> userSessionIds, boolean offline) 
 - 
removeExpiredvoid removeExpired(RealmModel realm) 
 - 
loadUserSessionUserSessionModel loadUserSession(RealmModel realm, String userSessionId, boolean offline) Loads the user session with the given userSessionId.- Parameters:
- userSessionId-
- offline-
- Returns:
 
 - 
loadUserSessionsStreamStream<UserSessionModel> loadUserSessionsStream(RealmModel realm, UserModel user, boolean offline, Integer firstResult, Integer maxResults) Loads the user sessions for the givenUserModelin the givenRealmModelif present.- Parameters:
- realm-
- user-
- offline-
- firstResult-
- maxResults-
- Returns:
 
 - 
loadUserSessionsStreamStream<UserSessionModel> loadUserSessionsStream(RealmModel realm, ClientModel client, boolean offline, Integer firstResult, Integer maxResults) Loads the user sessions for the givenClientModelin the givenRealmModelif present.- Parameters:
- realm-
- client-
- offline-
- firstResult-
- maxResults-
- Returns:
 
 - 
loadUserSessions@Deprecated default List<UserSessionModel> loadUserSessions(int firstResult, int maxResults, boolean offline, int lastCreatedOn, String lastUserSessionId) Deprecated.UseloadUserSessionsStreaminstead.Called during startup. For each userSession, it loads also clientSessions
 - 
loadUserSessionsStreamStream<UserSessionModel> loadUserSessionsStream(Integer firstResult, Integer maxResults, boolean offline, String lastUserSessionId) Called during startup. For each userSession, it loads also clientSessions.- Parameters:
- firstResult-- IntegerIndex of the first desired user session. Ignored if negative or- null.
- maxResults-- IntegerMaximum number of returned user sessions. Ignored if negative or- null.
- offline-- booleanFlag to include offline sessions.
- lastUserSessionId-- StringId of the user session. It will return only user sessions with id's lexicographically greater than this. it will compare the id in dictionary order and takes only those created later.
- Returns:
- Stream of UserSessionModel. Never returnsnull.
 
 - 
loadClientSessionAuthenticatedClientSessionModel loadClientSession(RealmModel realm, ClientModel client, UserSessionModel userSession, boolean offline) Loads client session from the db by provided user session and client.- Parameters:
- realm- RealmModel Realm for the associated client session.
- client- ClientModel Client used for the creation of client session.
- userSession- UserSessionModel User session for the associated client session.
- offline- boolean Flag that indicates the client session should be online/offline.
- Returns:
- Client session according the provided criteria or nullif not found.
 
 - 
getUserSessionsCountint getUserSessionsCount(boolean offline) Retrieves the count of user sessions for all realms.- Parameters:
- offline-
- Returns:
 
 - 
getUserSessionsCountint getUserSessionsCount(RealmModel realm, ClientModel clientModel, boolean offline) Retrieves the count of user client-sessions for the given client- Parameters:
- realm-
- clientModel-
- offline-
- Returns:
 
 - 
getUserSessionsCountsByClientsMap<String,Long> getUserSessionsCountsByClients(RealmModel realm, boolean offline) Returns aMapcontaining the number of user-sessions aggregated by client id for the given realm.- Parameters:
- realm-
- offline-
- Returns:
- the count Mapwith clientId as key and session count as value
 
 
- 
 
-