Commit 4412285c authored by Phillip Webb's avatar Phillip Webb

Polish Spring Session WebFlux sample

Closes gh-11055
parent a8c027ba
......@@ -51,20 +51,16 @@ public class SampleSessionWebFluxApplicationTests {
public void userDefinedMappingsSecureByDefault() throws Exception {
WebClient webClient = this.webClientBuilder
.baseUrl("http://localhost:" + this.port + "/").build();
ClientResponse response = webClient.get().header("Authorization", getBasicAuth())
.exchange().block();
assertThat(response.statusCode()).isEqualTo(HttpStatus.OK);
ResponseCookie sessionCookie = response.cookies().getFirst("SESSION");
String sessionId = response.bodyToMono(String.class).block();
response = webClient.get().cookie("SESSION", sessionCookie.getValue()).exchange()
response = webClient.get().cookie("SESSION", sessionCookie.getValue()).exchange()
.block();
assertThat(response.statusCode()).isEqualTo(HttpStatus.OK);
assertThat(response.bodyToMono(String.class).block()).isEqualTo(sessionId);
Thread.sleep(1000);
response = webClient.get().cookie("SESSION", sessionCookie.getValue()).exchange()
.block();
assertThat(response.statusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment