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