Skip to content

Commit b9ec14f

Browse files
themr0cclaude
andauthored
[RHIDP-11458]: Document session management in RHDH (#2035)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5d3f572 commit b9ec14f

8 files changed

Lines changed: 175 additions & 2 deletions
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:_mod-docs-content-type: ASSEMBLY
2+
ifdef::context[:parent-context: {context}]
3+
4+
[id="manage-session-expiration_{context}"]
5+
= Manage session expiration
6+
7+
:context: manage-session-expiration
8+
9+
[role="_abstract"]
10+
You can manage how long users stay authenticated in {product} by configuring session duration and auto-logout settings.
11+
12+
include::../modules/shared/con-understand-session-management-in-rhdh.adoc[leveloffset=+1]
13+
14+
include::../modules/shared/proc-configure-session-management.adoc[leveloffset=+1]
15+
16+
include::../modules/shared/proc-enable-auto-logout-for-inactive-users.adoc[leveloffset=+1]
17+
18+
ifdef::parent-context[:context: {parent-context}]
19+
ifndef::parent-context[:!context:]

assemblies/shared/assembly-troubleshoot-authentication-issues.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ Learn how to troubleshoot common authentication issues.
1111

1212
include::../modules/shared/proc-reduce-the-size-of-issued-tokens.adoc[leveloffset=+1]
1313

14+
include::../modules/shared/proc-troubleshoot-unexpected-session-expiration.adoc[leveloffset=+1]
1415

15-
include::../modules/shared/ref-troubleshoot-login-failed-errors.adoc[leveloffset=+1]
16+
include::../modules/shared/proc-troubleshoot-missing-session-expiration-warning.adoc[leveloffset=+1]
17+
18+
include::../modules/shared/proc-troubleshoot-missing-login-redirect-after-session-expiration.adoc[leveloffset=+1]
1619

20+
include::../modules/shared/ref-troubleshoot-login-failed-errors.adoc[leveloffset=+1]
1721

1822
include::../modules/shared/ref-troubleshoot-catalog-provider-errors.adoc[leveloffset=+1]
1923

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
:_mod-docs-content-type: PROCEDURE
2+
3+
[id="configure-session-management_{context}"]
4+
= Configure session management
5+
6+
[role="_abstract"]
7+
You can configure the session duration for your authentication provider in {product}.
8+
9+
.Prerequisites
10+
11+
* You have administrative access to the {product} configuration files.
12+
13+
.Procedure
14+
15+
. To set the absolute session lifetime for an authentication provider, add the `sessionDuration` parameter to your `{my-app-config-file}` file:
16+
+
17+
[source,yaml,subs="+attributes,+quotes"]
18+
----
19+
auth:
20+
providers:
21+
<name>:
22+
<env>:
23+
sessionDuration: 24h
24+
----
25+
+
26+
`sessionDuration`::
27+
Enter the session lifetime in milliseconds, ISO duration, or human-readable format (for example, `24h`, `2 days`).
28+
When this duration elapses, the session expires regardless of user activity.
29+
+
30+
This parameter is not set by default.
31+
32+
. Restart the {product} application to apply the changes.
33+
34+
[role="_additional-resources"]
35+
.Additional resources
36+
* xref:enable-auto-logout-for-inactive-users_{context}[Enable auto-logout for inactive users]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:_mod-docs-content-type: PROCEDURE
2+
3+
[id="troubleshoot-missing-login-redirect-after-session-expiration_{context}"]
4+
= Troubleshoot missing login redirect after session expiration
5+
6+
[role="_abstract"]
7+
If users are not redirected to the login page after their session expires, verify the following.
8+
9+
.Procedure
10+
11+
. Verify that your {product-short} version includes the upstream session expiration fix.
12+
. Verify that your authentication provider is correctly configured with valid `metadataUrl`, `clientId`, and `clientSecret` settings.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
:_mod-docs-content-type: PROCEDURE
2+
3+
[id="troubleshoot-missing-session-expiration-warning_{context}"]
4+
= Troubleshoot missing session expiration warning
5+
6+
[role="_abstract"]
7+
If users receive no warning before their session expires, auto-logout might not be enabled.
8+
Without auto-logout, sessions expire silently based on `sessionDuration` or IdP settings.
9+
10+
.Procedure
11+
12+
* To enable pre-expiration warnings, configure the `auth.autologout` settings in your `{my-app-config-file}` file.
13+
14+
[role="_additional-resources"]
15+
.Additional resources
16+
* xref:enable-auto-logout-for-inactive-users_manage-session-expiration[Enable auto-logout for inactive users]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
:_mod-docs-content-type: PROCEDURE
2+
3+
[id="troubleshoot-unexpected-session-expiration_{context}"]
4+
= Troubleshoot unexpected session expiration
5+
6+
[role="_abstract"]
7+
If sessions expire sooner than expected, check the following settings.
8+
The mechanism with the shortest timeout takes effect first.
9+
10+
.Procedure
11+
12+
. Check the Identity Provider (IdP) session timeout: the IdP might have a shorter session lifetime than {product-short}.
13+
. Check the `sessionDuration` parameter for your authentication provider.
14+
. Check the AutoLogout `idleTimeoutMinutes` setting, if auto-logout is enabled.
15+
16+
[role="_additional-resources"]
17+
.Additional resources
18+
* xref:configure-session-management_manage-session-expiration[Configure session management]

titles/control-access_authentication-in-rhdh/master.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ include::assemblies/shared/assembly-enable-authentication-with-gitlab.adoc[level
2828

2929
include::assemblies/shared/assembly-enable-service-to-service-authentication.adoc[leveloffset=+1]
3030

31-
include::modules/shared/proc-enable-auto-logout-for-inactive-users.adoc[leveloffset=+1]
31+
include::assemblies/shared/assembly-manage-session-expiration.adoc[leveloffset=+1]
3232

3333
include::assemblies/shared/assembly-troubleshoot-authentication-issues.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)