Class UserWebTestClientConfigurer

java.lang.Object
org.springframework.test.web.reactive.server.UserWebTestClientConfigurer
All Implemented Interfaces:
WebTestClientConfigurer

public final class UserWebTestClientConfigurer extends Object implements WebTestClientConfigurer
WebTestClientConfigurer that modifies WebFlux mock server requests by setting their SslInfo.

You can apply the configurer to a WebTestClient.Builder:

WebTestClient client = webTestClientBuilder
        .apply(UserWebTestClientConfigurer.x509(certificate))
        .build();

Or mutate an already built WebTestClient:

WebTestClient newClient =
        client.mutateWith(UserWebTestClientConfigurer.x509(certificate));

Note: This configurer is applicable only to WebFlux mock server setup. For a WebTestClient.Builder with a live server setup, or a non-WebFlux, mock server, an IllegalStateException is raised.

For tests with a MockMvc server, refer to a similar facility to set the user identity per request through Spring Security's SecurityMockMvcRequestPostProcessors.

Since:
7.0
Author:
Rossen Stoyanchev