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.long
count()
Get count of all sessions of this local running engine.create()
Creates a new session.current()
Gets the current session.default void
destroy
(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:
-
destroy(int, String)
- API:
- This public API is available in Java.
-
create
ISession create()Creates a new session. Prefer usingcreate(String)
.- Returns:
- new session
- See Also:
-
create(String)
- 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 theClusterSessionsSnapshot
contains the same information which can be fetched withall()
. If there are multiple cluster nodes theClusterSessionsSnapshot
contains as well information about sessions on other nodes. The parametermaxAge
controls how old theClusterSessionsSnapshot
can be. For example withmaxAge=5000
theClusterSessionsSnapshot
is maximal 5 seconds old. The longer themaxAge
is 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.
-