File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed
docs/modules/ROOT/pages/reactive/test/web Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ After xref:reactive/test/web/setup.adoc[applying the Spring Security support to
6
6
.Java
7
7
[source,java,role="primary"]
8
8
----
9
+ import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.mockUser;
10
+
9
11
@Test
10
12
public void messageWhenNotAuthenticated() throws Exception {
11
13
this.rest
@@ -66,6 +68,7 @@ public void messageWhenMutateWithMockAdminThenOk() throws Exception {
66
68
[source,kotlin,role="secondary"]
67
69
----
68
70
import org.springframework.test.web.reactive.server.expectBody
71
+ import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.mockUser
69
72
70
73
//...
71
74
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ Spring Security also provides support for CSRF testing with `WebTestClient` -- f
6
6
.Java
7
7
[source,java,role="primary"]
8
8
----
9
+ import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf;
10
+
9
11
this.rest
10
12
// provide a valid CSRF token
11
13
.mutateWith(csrf())
@@ -17,6 +19,8 @@ this.rest
17
19
.Kotlin
18
20
[source,kotlin,role="secondary"]
19
21
----
22
+ import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.csrf
23
+
20
24
this.rest
21
25
// provide a valid CSRF token
22
26
.mutateWith(csrf())
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ The basic setup looks like this:
6
6
.Java
7
7
[source,java,role="primary"]
8
8
----
9
+ import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.springSecurity;
10
+ import static org.springframework.web.reactive.function.client.ExchangeFilterFunctions.basicAuthentication;
11
+
9
12
@ExtendWith(SpringExtension.class)
10
13
@ContextConfiguration(classes = HelloWebfluxMethodApplication.class)
11
14
public class HelloWebfluxMethodApplicationTests {
@@ -31,6 +34,9 @@ public class HelloWebfluxMethodApplicationTests {
31
34
.Kotlin
32
35
[source,kotlin,role="secondary"]
33
36
----
37
+ import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.springSecurity
38
+ import org.springframework.web.reactive.function.client.ExchangeFilterFunctions.basicAuthentication
39
+
34
40
@ExtendWith(SpringExtension::class)
35
41
@ContextConfiguration(classes = [HelloWebfluxMethodApplication::class])
36
42
class HelloWebfluxMethodApplicationTests {
You can’t perform that action at this time.
0 commit comments