Skip to content

Commit c86fd99

Browse files
Update max sessions docs
Add WebSessionStore constructor parameter to the handler Issue gh-6192
1 parent a5ce8ae commit c86fd99

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

docs/modules/ROOT/pages/reactive/authentication/concurrent-sessions-control.adoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,13 @@ Java::
202202
[source,java,role="primary"]
203203
----
204204
@Bean
205-
SecurityWebFilterChain filterChain(ServerHttpSecurity http) {
205+
SecurityWebFilterChain filterChain(ServerHttpSecurity http, DefaultWebSessionManager webSessionManager) {
206206
http
207207
// ...
208208
.sessionManagement((sessions) -> sessions
209209
.concurrentSessions((concurrency) -> concurrency
210210
.maximumSessions(SessionLimit.of(1))
211-
.maximumSessionsExceededHandler(new PreventLoginMaximumSessionsExceededHandler())
211+
.maximumSessionsExceededHandler(new PreventLoginMaximumSessionsExceededHandler(webSessionManager.getSessionStore()))
212212
)
213213
);
214214
return http.build();
@@ -225,13 +225,13 @@ Kotlin::
225225
[source,kotlin,role="secondary"]
226226
----
227227
@Bean
228-
open fun springSecurity(http: ServerHttpSecurity): SecurityWebFilterChain {
228+
open fun springSecurity(http: ServerHttpSecurity, webSessionManager: DefaultWebSessionManager): SecurityWebFilterChain {
229229
return http {
230230
// ...
231231
sessionManagement {
232232
sessionConcurrency {
233233
maximumSessions = SessionLimit.of(1)
234-
maximumSessionsExceededHandler = PreventLoginMaximumSessionsExceededHandler()
234+
maximumSessionsExceededHandler = PreventLoginMaximumSessionsExceededHandler(webSessionManager.sessionStore)
235235
}
236236
}
237237
}
@@ -380,6 +380,11 @@ public class SessionControl {
380380
----
381381
======
382382

383+
[NOTE]
384+
====
385+
If you are not using the `WebSessionStoreReactiveSessionRegistry` as the implementation, and you want the `WebSession` to be invalidated as well, you will need to use the `WebSessionStore` to retrieve and invalidate the `WebSession`.
386+
====
387+
383388
[[disabling-for-authentication-filters]]
384389
== Disabling It for Some Authentication Filters
385390

0 commit comments

Comments
 (0)