File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
docs/manual/src/docs/asciidoc/_includes/reactive Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ include::registered-oauth2-authorized-client.adoc[leveloffset=+1]
10
10
11
11
include::x509.adoc[leveloffset=+1]
12
12
13
+ include::logout.adoc[leveloffset=+1]
14
+
13
15
include::webclient.adoc[leveloffset=+1]
14
16
15
17
include::method.adoc[leveloffset=+1]
Original file line number Diff line number Diff line change
1
+ [[reactive-logout]]
2
+ = Logout
3
+
4
+ Spring Security provides a logout endpoint by default.
5
+ Once logged in, you can `GET /logout` to see a default logout confirmation page, or you can `POST /logout` to initiate logout.
6
+ This will:
7
+
8
+ - clear the `ServerCsrfTokenRepository`, `ServerSecurityContextRepository`, and
9
+ - redirect back to the login page
10
+
11
+ Often, you will want to also invalidate the session on logout.
12
+ To achieve this, you can add the `WebSessionServerLogoutHandler` to your logout configuration, like so:
13
+
14
+ [source,java]
15
+ ----
16
+ @Bean
17
+ SecurityWebFilterChain http(ServerHttpSecurity http) throws Exception {
18
+ DelegatingServerLogoutHandler logoutHandler = new DelegatingServerLogoutHandler(
19
+ new WebSessionServerLogoutHandler(), new SecurityContextServerLogoutHandler()
20
+ );
21
+
22
+ http
23
+ .authorizeExchange((exchange) -> exchange.anyExchange().authenticated())
24
+ .logout((logout) -> logout.logoutHandler(logoutHandler));
25
+
26
+ return http.build();
27
+ }
28
+ ----
You can’t perform that action at this time.
0 commit comments