Skip to content

Commit 0b48e67

Browse files
authored
Merge pull request #642 from DuendeSoftware/roland/serversidesessionexp
Clarify/correct session expiration
2 parents f791da1 + a4edb32 commit 0b48e67

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

IdentityServer/v7/docs/content/ui/server_side_sessions/session_expiration.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ title: "Session Expiration"
33
weight: 20
44
---
55

6-
If a user abandons their session without triggering logout, the server-side session data will remain in the store by default.
7-
In order to clean up these expired records, there is an automatic cleanup mechanism that periodically scans for expired sessions.
6+
If the user session ends when the session cookie expires without explicitly triggering logout, there is most likely the need to clean up the server-side session data.
7+
In order to remove these expired records, there is an automatic cleanup mechanism that periodically scans for expired sessions.
88
When these records are cleaned up, you can optionally notify the client that the session has ended via back-channel logout.
99

1010
## Expiration Configuration
1111

1212
The expiration configuration features can be configured with the [server-side session options]({{<ref "/reference/options#server-side-sessions">}}).
1313
It is enabled by default, but if you wish to disable it or change how often IdentityServer will check for expired sessions, you can.
1414

15-
For example:
15+
For example, to change the interval:
1616

1717
```cs
1818
builder.Services.AddIdentityServer(options => {
@@ -21,6 +21,15 @@ builder.Services.AddIdentityServer(options => {
2121
.AddServerSideSessions();
2222
```
2323

24+
To disable:
25+
26+
```cs
27+
builder.Services.AddIdentityServer(options => {
28+
options.ServerSideSessions.RemoveExpiredSessions = false;
29+
})
30+
.AddServerSideSessions();
31+
```
32+
2433
### Back-channel Logout
2534
When the session cleanup job removes expired records, it will by default also trigger [back-channel logout notifications]({{<ref "/ui/logout/notification#back-channel-server-side-clients">}}) to client applications participating in the session. You can use this mechanism to create an [inactivity timeout]({{<ref "inactivity_timeout">}}) that applies across all your client applications.
2635

0 commit comments

Comments
 (0)