Package ch.ivyteam.ivy.security.session
Interface ISessionRepository
public interface ISessionRepository
Session repository to create, destroy and find sessions.
- Since:
- 9.3
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionall()Gets all sessions of the security context / application.CallsclusterSnapshot(long)with the default value of maxAge=1000 (1 second)clusterSnapshot(long maxAge) Returns a snapshot containing information of all sessions at the time this method was invoked.longcount()Get count of all sessions of this local running engine.create()Creates a new session.current()Gets the current session.default voiddestroy(int sessionIdentifier) Destroys a session.find(int sessionIdentifier) Finds a session by its identifierGets all sessions of the given user.Gets the session of the system user
-
Method Details
-
all
Gets all sessions of the security context / application. In a cluster environment returns only the sessions of the local cluster node. To get information of session on all cluster nodes useclusterSnapshot()- Returns:
- sessions
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS SessionReadAll PERMISSION OR OWNS SessionReadAll@SYSTEM PERMISSION
-
ofUser
Gets all sessions of the given user. In a cluster environment returns only the sessions of the user on the local cluster node.- Returns:
- sessions of the given user
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS SessionReadAll PERMISSION OR OWNS SessionReadAll@SYSTEM PERMISSION
-
count
long count()Get count of all sessions of this local running engine.- Returns:
- count of sessions (without system user session)
- API:
- This public API is available in Java.
-
find
Finds a session by its identifier- Parameters:
sessionIdentifier- session identifier- Returns:
- session or null
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS SessionReadAll PERMISSION OR OWNS SessionReadAll@SYSTEM PERMISSION
-
systemUser
ISession systemUser()Gets the session of the system user- Returns:
- system user session
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS SessionReadAll PERMISSION OR OWNS SessionReadAll@SYSTEM PERMISSION
-
current
ISession current()Gets the current session. Gets the current session associated to the current thread- Returns:
- current session or null if current thread has no session associated
- See Also:
- API:
- This public API is available in Java.
-
destroy
default void destroy(int sessionIdentifier) Destroys a session. Prefer usingdestroy(int, String)I- Parameters:
sessionIdentifier- session identifier- See Also:
- API:
- This public API is available in Java.
-
create
ISession create()Creates a new session. Prefer usingcreate(String). When manually create a new session, make sure that you alsodestroy(int)it again after usage, otherwise you may run into a session leak.- Returns:
- new session
- See Also:
- API:
- This public API is available in Java.
-
clusterSnapshot
ClusterSessionsSnapshot clusterSnapshot()CallsclusterSnapshot(long)with the default value of maxAge=1000 (1 second)- Returns:
- a cluster session snapshot. Never null
- API:
- This public API is available in Java.
-
clusterSnapshot
Returns a snapshot containing information of all sessions at the time this method was invoked. If there is only one cluster node theClusterSessionsSnapshotcontains the same information which can be fetched withall(). If there are multiple cluster nodes theClusterSessionsSnapshotcontains as well information about sessions on other nodes. The parametermaxAgecontrols how old theClusterSessionsSnapshotcan be. For example withmaxAge=5000theClusterSessionsSnapshotis maximal 5 seconds old. The longer themaxAgeis the less network traffic is caused.- Parameters:
maxAge- in milliSeconds- Returns:
- a cluster session snapshot. Never null
- API:
- This public API is available in Java.
-