Session Timeouts and Concurrent-Session Limits
Configure Keycloak v26 session lifetimes and concurrent-session controls used by the HEAL UI.
HEAL relies on its Keycloak realm for authentication sessions and tokens. Administrators can configure how long sessions remain valid and, where required, how many sessions a user may hold.
Session lifetime#
In Keycloak v26, realm session timeouts are under Realm settings > Sessions. SSO Session Idle invalidates an inactive OIDC user session after the configured period, subject to Keycloak’s documented idle-time window. SSO Session Max limits the session’s total lifetime. Client-specific idle and maximum values can further restrict an individual HEAL client.
Access-token lifetimes are separate controls under Realm settings > Tokens. Choose session and token values according to your organization’s risk, usability, and incident-response requirements; do not treat example values from another environment as a HEAL default.
Concurrent-session limits#
Current Keycloak includes a built-in User Session Count Limiter authenticator. It can limit sessions per realm or per client and can either deny a new session or terminate the oldest session after the configured limit is reached.
Some HEAL deployments also contain a custom EventListenerProvider called the session-restrictor. That custom provider is a deployment-specific legacy design, not a requirement imposed by Keycloak itself. Confirm the deployed HEAL and Keycloak design before enabling, replacing, or combining session-limit mechanisms.
Configure realm session timeouts#
- Open the Keycloak v26 Administration Console and select the realm used by HEAL.
- Open Realm settings > Sessions.
- Set the SSO and client idle and maximum lifetimes required by policy. Use Realm settings > Tokens for access-token and action-token lifespans; token settings are not the location for SSO session idle and maximum values.
- Save the change and test idle and maximum expiry with a non-production user and an approved HEAL client. Use a new test session: existing cookies or sessions can obscure the result.
Configure the built-in session limiter#
- In Authentication > Flows, select or copy the bound browser flow used by the HEAL realm.
- Add User Session Count Limiter after the user is known, mark it required, and configure the realm/client limit and limit-reached behavior.
- Apply equivalent control to other authentication flows used by the deployment, such as direct grant, reset credentials, or post-broker login, after assessing their behavior.
- Test the configured deny-new-session or terminate-oldest-session behavior in separate browser sessions.
If the deployment must retain the HEAL custom provider, follow Session Restriction in Keycloak (sign-in required) and validate compatibility with the installed Keycloak version.