Package org.keycloak.models.utils
Class SessionExpirationUtils
java.lang.Object
org.keycloak.models.utils.SessionExpirationUtils
Shared methods to calculate the session expiration and idle.
- Author:
- rmartinc
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
calculateClientSessionIdleTimestamp
(boolean offline, boolean isRememberMe, long lastRefreshed, RealmModel realm, ClientModel client) Calculates the time in which the user session is expired via the idle configuration in the realm and client.static long
calculateClientSessionMaxLifespanTimestamp
(boolean offline, boolean isRememberMe, long clientSessionCreated, long userSessionCreated, RealmModel realm, ClientModel client) Calculates the time in which the client session is expired via lifespan configuration in the realm and client.static long
calculateUserSessionIdleTimestamp
(boolean offline, boolean isRememberMe, long lastRefreshed, RealmModel realm) Calculates the time in which the user session is expired via the idle configuration.static long
calculateUserSessionMaxLifespanTimestamp
(boolean offline, boolean isRememberMe, long created, RealmModel realm) Calculates the time in which the session is expired via max lifetime configuration.static int
static int
-
Constructor Details
-
SessionExpirationUtils
public SessionExpirationUtils()
-
-
Method Details
-
calculateUserSessionMaxLifespanTimestamp
public static long calculateUserSessionMaxLifespanTimestamp(boolean offline, boolean isRememberMe, long created, RealmModel realm) Calculates the time in which the session is expired via max lifetime configuration.- Parameters:
offline
- is the session offline?isRememberMe
- is the session remember me?created
- timestamp when the session was createdrealm
- The realm model- Returns:
- The time when the user session is expired or -1 if does not expire
-
calculateUserSessionIdleTimestamp
public static long calculateUserSessionIdleTimestamp(boolean offline, boolean isRememberMe, long lastRefreshed, RealmModel realm) Calculates the time in which the user session is expired via the idle configuration.- Parameters:
offline
- is the session offline?isRememberMe
- is the session remember me?lastRefreshed
- The last time the session was refreshedrealm
- The realm model- Returns:
- The time in which the user session is expired by idle timeout
-
calculateClientSessionMaxLifespanTimestamp
public static long calculateClientSessionMaxLifespanTimestamp(boolean offline, boolean isRememberMe, long clientSessionCreated, long userSessionCreated, RealmModel realm, ClientModel client) Calculates the time in which the client session is expired via lifespan configuration in the realm and client.- Parameters:
offline
- is the session offline?isRememberMe
- is the session remember me?clientSessionCreated
- timestamp when the client session was createduserSessionCreated
- timestamp when the user session was createdrealm
- The realm modelclient
- The client model- Returns:
- The time when the client session is expired or -1 if does not expire
-
calculateClientSessionIdleTimestamp
public static long calculateClientSessionIdleTimestamp(boolean offline, boolean isRememberMe, long lastRefreshed, RealmModel realm, ClientModel client) Calculates the time in which the user session is expired via the idle configuration in the realm and client.- Parameters:
offline
- is the session offline?isRememberMe
- is the session remember me?lastRefreshed
- the last time the client session was refreshedrealm
- the realm modelclient
- the client model- Returns:
- The time in which the client session is expired by idle timeout
-
getSsoSessionIdleTimeout
-
getOfflineSessionIdleTimeout
-