public interface UserSessionProvider extends Provider
Modifier and Type | Method and Description |
---|---|
default UserLoginFailureModel |
addUserLoginFailure(RealmModel realm,
String userId)
Deprecated.
Use
addUserLoginFailure instead. |
void |
close() |
AuthenticatedClientSessionModel |
createClientSession(RealmModel realm,
ClientModel client,
UserSessionModel userSession) |
AuthenticatedClientSessionModel |
createOfflineClientSession(AuthenticatedClientSessionModel clientSession,
UserSessionModel offlineUserSession)
Will automatically attach newly created offline client session to the offlineUserSession
|
UserSessionModel |
createOfflineUserSession(UserSessionModel userSession)
Newly created userSession won't contain attached AuthenticatedClientSessions
|
UserSessionModel |
createUserSession(RealmModel realm,
UserModel user,
String loginUsername,
String ipAddress,
String authMethod,
boolean rememberMe,
String brokerSessionId,
String brokerUserId) |
UserSessionModel |
createUserSession(String id,
RealmModel realm,
UserModel user,
String loginUsername,
String ipAddress,
String authMethod,
boolean rememberMe,
String brokerSessionId,
String brokerUserId,
UserSessionModel.SessionPersistenceState persistenceState) |
Map<String,Long> |
getActiveClientSessionStats(RealmModel realm,
boolean offline)
Returns a summary of client sessions key is client.getId()
|
long |
getActiveUserSessions(RealmModel realm,
ClientModel client) |
AuthenticatedClientSessionModel |
getClientSession(UserSessionModel userSession,
ClientModel client,
String clientSessionId,
boolean offline) |
default AuthenticatedClientSessionModel |
getClientSession(UserSessionModel userSession,
ClientModel client,
UUID clientSessionId,
boolean offline)
Deprecated.
|
KeycloakSession |
getKeycloakSession()
Returns currently used Keycloak session.
|
long |
getOfflineSessionsCount(RealmModel realm,
ClientModel client) |
UserSessionModel |
getOfflineUserSession(RealmModel realm,
String userSessionId) |
UserSessionModel |
getOfflineUserSessionByBrokerSessionId(RealmModel realm,
String brokerSessionId) |
default List<UserSessionModel> |
getOfflineUserSessionByBrokerUserId(RealmModel realm,
String brokerUserId)
Deprecated.
Use
getOfflineUserSessionByBrokerUserIdStream
instead. |
Stream<UserSessionModel> |
getOfflineUserSessionByBrokerUserIdStream(RealmModel realm,
String brokerUserId)
Obtains the offline user sessions associated with the user that matches the specified
brokerUserId . |
default List<UserSessionModel> |
getOfflineUserSessions(RealmModel realm,
ClientModel client,
int first,
int max)
Deprecated.
use
getOfflineUserSessionsStream
instead. |
default List<UserSessionModel> |
getOfflineUserSessions(RealmModel realm,
UserModel user)
Deprecated.
Use
getOfflineUserSessionsStream instead. |
Stream<UserSessionModel> |
getOfflineUserSessionsStream(RealmModel realm,
ClientModel client,
Integer firstResult,
Integer maxResults)
Obtains the offline user sessions associated with the specified client, starting from the
firstResult and
containing at most maxResults . |
Stream<UserSessionModel> |
getOfflineUserSessionsStream(RealmModel realm,
UserModel user)
Obtains the offline user sessions associated with the specified user.
|
default UserLoginFailureModel |
getUserLoginFailure(RealmModel realm,
String userId)
Deprecated.
Use
getUserLoginFailure instead. |
UserSessionModel |
getUserSession(RealmModel realm,
String id) |
UserSessionModel |
getUserSessionByBrokerSessionId(RealmModel realm,
String brokerSessionId) |
default List<UserSessionModel> |
getUserSessionByBrokerUserId(RealmModel realm,
String brokerUserId)
Deprecated.
Use
getUserSessionByBrokerUserIdStream
instead. |
Stream<UserSessionModel> |
getUserSessionByBrokerUserIdStream(RealmModel realm,
String brokerUserId)
Obtains the online user sessions associated with the user that matches the specified
brokerUserId . |
default List<UserSessionModel> |
getUserSessions(RealmModel realm,
ClientModel client)
Deprecated.
Use
getUserSessionsStream instead. |
default List<UserSessionModel> |
getUserSessions(RealmModel realm,
ClientModel client,
int firstResult,
int maxResults)
Deprecated.
Use
getUserSessionsStream instead. |
default List<UserSessionModel> |
getUserSessions(RealmModel realm,
UserModel user)
Deprecated.
Use
getUserSessionsStream instead. |
Stream<UserSessionModel> |
getUserSessionsStream(RealmModel realm,
ClientModel client)
Obtains the online user sessions associated with the specified client.
|
Stream<UserSessionModel> |
getUserSessionsStream(RealmModel realm,
ClientModel client,
Integer firstResult,
Integer maxResults)
Obtains the online user sessions associated with the specified client, starting from the
firstResult and containing
at most maxResults . |
Stream<UserSessionModel> |
getUserSessionsStream(RealmModel realm,
UserModel user)
Obtains the online user sessions associated with the specified user.
|
UserSessionModel |
getUserSessionWithPredicate(RealmModel realm,
String id,
boolean offline,
Predicate<UserSessionModel> predicate)
Return userSession of specified ID as long as the predicate passes.
|
void |
importUserSessions(Collection<UserSessionModel> persistentUserSessions,
boolean offline)
Triggered by persister during pre-load.
|
void |
onClientRemoved(RealmModel realm,
ClientModel client) |
void |
onRealmRemoved(RealmModel realm) |
void |
removeAllExpired()
Remove expired user sessions and client sessions in all the realms
|
default void |
removeAllUserLoginFailures(RealmModel realm)
Deprecated.
Use
removeAllUserLoginFailures instead. |
void |
removeExpired(RealmModel realm)
Removes expired user sessions owned by this realm from this provider.
|
void |
removeOfflineUserSession(RealmModel realm,
UserSessionModel userSession)
Removes the attached clientSessions as well
|
default void |
removeUserLoginFailure(RealmModel realm,
String userId)
Deprecated.
Use
removeUserLoginFailure instead. |
void |
removeUserSession(RealmModel realm,
UserSessionModel session)
This will remove attached ClientLoginSessionModels too
|
void |
removeUserSessions(RealmModel realm) |
void |
removeUserSessions(RealmModel realm,
UserModel user) |
KeycloakSession getKeycloakSession()
KeycloakSession
AuthenticatedClientSessionModel createClientSession(RealmModel realm, ClientModel client, UserSessionModel userSession)
default AuthenticatedClientSessionModel getClientSession(UserSessionModel userSession, ClientModel client, UUID clientSessionId, boolean offline)
getClientSession(UserSessionModel, ClientModel, String, boolean)
instead.AuthenticatedClientSessionModel getClientSession(UserSessionModel userSession, ClientModel client, String clientSessionId, boolean offline)
UserSessionModel createUserSession(RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId)
UserSessionModel createUserSession(String id, RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId, UserSessionModel.SessionPersistenceState persistenceState)
UserSessionModel getUserSession(RealmModel realm, String id)
@Deprecated default List<UserSessionModel> getUserSessions(RealmModel realm, UserModel user)
getUserSessionsStream
instead.Stream<UserSessionModel> getUserSessionsStream(RealmModel realm, UserModel user)
realm
- a reference to the realm.user
- the user whose sessions are being searched.Stream
of online user sessions.@Deprecated default List<UserSessionModel> getUserSessions(RealmModel realm, ClientModel client)
getUserSessionsStream
instead.Stream<UserSessionModel> getUserSessionsStream(RealmModel realm, ClientModel client)
realm
- a reference to the realm.client
- the client whose user sessions are being searched.Stream
of online user sessions.@Deprecated default List<UserSessionModel> getUserSessions(RealmModel realm, ClientModel client, int firstResult, int maxResults)
getUserSessionsStream
instead.Stream<UserSessionModel> getUserSessionsStream(RealmModel realm, ClientModel client, Integer firstResult, Integer maxResults)
firstResult
and containing
at most maxResults
.realm
- a reference tot he realm.client
- the client whose user sessions are being searched.firstResult
- first result to return. Ignored if negative or null
.maxResults
- maximum number of results to return. Ignored if negative or null
.Stream
of online user sessions.@Deprecated default List<UserSessionModel> getUserSessionByBrokerUserId(RealmModel realm, String brokerUserId)
getUserSessionByBrokerUserIdStream
instead.Stream<UserSessionModel> getUserSessionByBrokerUserIdStream(RealmModel realm, String brokerUserId)
brokerUserId
.realm
- a reference to the realm.brokerUserId
- the id of the broker user whose sessions are being searched.Stream
of online user sessions.UserSessionModel getUserSessionByBrokerSessionId(RealmModel realm, String brokerSessionId)
UserSessionModel getUserSessionWithPredicate(RealmModel realm, String id, boolean offline, Predicate<UserSessionModel> predicate)
null
.
If predicate doesn't pass, implementation can do some best-effort actions to try have predicate passing (eg. download userSession from other DC)long getActiveUserSessions(RealmModel realm, ClientModel client)
Map<String,Long> getActiveClientSessionStats(RealmModel realm, boolean offline)
realm
- offline
- void removeUserSession(RealmModel realm, UserSessionModel session)
void removeUserSessions(RealmModel realm, UserModel user)
void removeAllExpired()
void removeExpired(RealmModel realm)
user sessions
is also propagated to relevant `UserSessionPersister`.realm
- RealmModel
Realm where all the expired user sessions to be removed from.void removeUserSessions(RealmModel realm)
@Deprecated default UserLoginFailureModel getUserLoginFailure(RealmModel realm, String userId)
getUserLoginFailure
instead.@Deprecated default UserLoginFailureModel addUserLoginFailure(RealmModel realm, String userId)
addUserLoginFailure
instead.@Deprecated default void removeUserLoginFailure(RealmModel realm, String userId)
removeUserLoginFailure
instead.@Deprecated default void removeAllUserLoginFailures(RealmModel realm)
removeAllUserLoginFailures
instead.void onRealmRemoved(RealmModel realm)
void onClientRemoved(RealmModel realm, ClientModel client)
UserSessionModel createOfflineUserSession(UserSessionModel userSession)
UserSessionModel getOfflineUserSession(RealmModel realm, String userSessionId)
void removeOfflineUserSession(RealmModel realm, UserSessionModel userSession)
AuthenticatedClientSessionModel createOfflineClientSession(AuthenticatedClientSessionModel clientSession, UserSessionModel offlineUserSession)
@Deprecated default List<UserSessionModel> getOfflineUserSessions(RealmModel realm, UserModel user)
getOfflineUserSessionsStream
instead.Stream<UserSessionModel> getOfflineUserSessionsStream(RealmModel realm, UserModel user)
realm
- a reference to the realm.user
- the user whose offline sessions are being searched.Stream
of offline user sessions.UserSessionModel getOfflineUserSessionByBrokerSessionId(RealmModel realm, String brokerSessionId)
@Deprecated default List<UserSessionModel> getOfflineUserSessionByBrokerUserId(RealmModel realm, String brokerUserId)
getOfflineUserSessionByBrokerUserIdStream
instead.Stream<UserSessionModel> getOfflineUserSessionByBrokerUserIdStream(RealmModel realm, String brokerUserId)
brokerUserId
.realm
- a reference to the realm.brokerUserId
- the id of the broker user whose sessions are being searched.Stream
of offline user sessions.long getOfflineSessionsCount(RealmModel realm, ClientModel client)
@Deprecated default List<UserSessionModel> getOfflineUserSessions(RealmModel realm, ClientModel client, int first, int max)
getOfflineUserSessionsStream
instead.Stream<UserSessionModel> getOfflineUserSessionsStream(RealmModel realm, ClientModel client, Integer firstResult, Integer maxResults)
firstResult
and
containing at most maxResults
.realm
- a reference tot he realm.client
- the client whose user sessions are being searched.firstResult
- first result to return. Ignored if negative or null
.maxResults
- maximum number of results to return. Ignored if negative or null
.Stream
of offline user sessions.void importUserSessions(Collection<UserSessionModel> persistentUserSessions, boolean offline)
Copyright © 2021 JBoss by Red Hat. All rights reserved.