|
| 1 | +:_mod-docs-content-type: CONCEPT |
| 2 | + |
| 3 | +[id="understand-session-management-in-rhdh_{context}"] |
| 4 | += Understand session management in {product-short} |
| 5 | + |
| 6 | +[role="_abstract"] |
| 7 | +Session management in {product} involves multiple mechanisms that control how long users stay authenticated and what happens when sessions expire. |
| 8 | + |
| 9 | +== What happens when a session expires |
| 10 | + |
| 11 | +When a session approaches expiration, {product-short} can display a pre-expiration warning dialog that includes a countdown timer. |
| 12 | +The timing of this warning depends on how you configure the auto-logout feature. |
| 13 | + |
| 14 | +After the session expires, {product-short} redirects the user to the login page. |
| 15 | +To continue working, the user must re-authenticate with the configured identity provider and is then returned to {product-short}. |
| 16 | + |
| 17 | +// TODO: Screenshot placeholder: warning dialog |
| 18 | +// TODO: Screenshot placeholder: login redirect |
| 19 | + |
| 20 | +== AutoLogout (frontend inactivity) |
| 21 | + |
| 22 | +The AutoLogout feature monitors user activity in the browser and logs out the user after a configurable idle period. |
| 23 | +AutoLogout revokes the refresh token for {product-short}, but does not end the Identity Provider (IdP) session. |
| 24 | +The logout mechanism is the same as if you manually logout from the user settings page. |
| 25 | + |
| 26 | +You configure AutoLogout under the `auth.autologout` section of your `{my-app-config-file}` file. |
| 27 | + |
| 28 | +== Session duration (provider-level) |
| 29 | + |
| 30 | +Session duration controls the absolute session lifetime regardless of user activity. |
| 31 | +This is a backend HTTP-only cookie configuration. |
| 32 | +When this duration elapses, no warning popup is displayed. |
| 33 | +Instead, the user is redirected to the sign-in page the next time they interact with {product-short}, such as navigating to a new page or refreshing the browser. |
| 34 | + |
| 35 | +You configure session duration per provider by using the `auth.providers.<name>.<env>.sessionDuration` parameter in your `{my-app-config-file}` file. |
| 36 | +This parameter accepts milliseconds, ISO duration, or human-readable duration values (for example, `24h`, `2 days`). |
| 37 | + |
| 38 | +== Identity Provider session settings |
| 39 | + |
| 40 | +Your Identity Provider (IdP), such as {rhbk-brand-name}, GitHub, {azure-brand-name}, or GitLab, maintains its own session timeout independently of {product-short}. |
| 41 | + |
| 42 | +Signing out of {product-short} does not end the IdP SSO session. |
| 43 | +This is expected behavior. |
| 44 | +If the IdP session is still active when a user signs back in to {product-short}, re-authentication might be seamless, with no password prompt. |
| 45 | + |
| 46 | +== How the mechanisms interact |
| 47 | + |
| 48 | +The three session management mechanisms operate at different layers: |
| 49 | + |
| 50 | +AutoLogout:: |
| 51 | +Triggers on user inactivity in the browser. |
| 52 | +Frontend-only: does not revoke tokens or end server-side sessions. |
| 53 | + |
| 54 | +Session duration:: |
| 55 | +Controls the absolute session lifetime on the server side. |
| 56 | +The session expires after the configured duration regardless of user activity. |
| 57 | +No warning popup is displayed; the user is redirected to the sign-in page on next interaction. |
| 58 | + |
| 59 | +Identity Provider session:: |
| 60 | +Outlives {product-short} sign-out. |
| 61 | +A user might re-enter {product-short} without a password prompt if the IdP session is still active. |
| 62 | + |
| 63 | +The mechanism with the shortest timeout takes effect first. |
| 64 | +For example, if AutoLogout is set to 30 minutes of idle time but the session duration is set to 15 minutes, the session expires after 15 minutes regardless of user activity. |
| 65 | + |
| 66 | +[role="_additional-resources"] |
| 67 | +.Additional resources |
| 68 | +* xref:enable-auto-logout-for-inactive-users_{context}[Enable auto-logout for inactive users] |
0 commit comments