public class SecurityMockServerConfigurers
extends java.lang.Object
WebTestClient.Builder.apply(WebTestClientConfigurer).| Modifier and Type | Class and Description |
|---|---|
static class |
SecurityMockServerConfigurers.CsrfMutator |
static class |
SecurityMockServerConfigurers.JwtMutator
Updates the WebServerExchange using
{@link SecurityMockServerConfigurers#mockAuthentication(Authentication)}. |
static class |
SecurityMockServerConfigurers.UserExchangeMutator
Updates the WebServerExchange using
{@link SecurityMockServerConfigurers#mockUser(UserDetails)}. |
| Constructor and Description |
|---|
SecurityMockServerConfigurers() |
| Modifier and Type | Method and Description |
|---|---|
static SecurityMockServerConfigurers.CsrfMutator |
csrf() |
static <T extends org.springframework.test.web.reactive.server.WebTestClientConfigurer & org.springframework.test.web.reactive.server.MockServerConfigurer> |
mockAuthentication(org.springframework.security.core.Authentication authentication)
Updates the ServerWebExchange to use the provided Authentication as the Principal
|
static SecurityMockServerConfigurers.JwtMutator |
mockJwt()
Updates the ServerWebExchange to establish a
SecurityContext that has a
JwtAuthenticationToken for the
Authentication and a Jwt for the
Authentication.getPrincipal(). |
static SecurityMockServerConfigurers.JwtMutator |
mockJwt(java.util.function.Consumer<org.springframework.security.oauth2.jwt.Jwt.Builder> jwtBuilderConsumer)
Updates the ServerWebExchange to establish a
SecurityContext that has a
JwtAuthenticationToken for the
Authentication and a Jwt for the
Authentication.getPrincipal(). |
static SecurityMockServerConfigurers.JwtMutator |
mockJwt(org.springframework.security.oauth2.jwt.Jwt jwt)
Updates the ServerWebExchange to establish a
SecurityContext that has a
JwtAuthenticationToken for the
Authentication and a Jwt for the
Authentication.getPrincipal(). |
static SecurityMockServerConfigurers.UserExchangeMutator |
mockUser()
Updates the ServerWebExchange to use a UserDetails to create a UsernamePasswordAuthenticationToken as
the Principal.
|
static SecurityMockServerConfigurers.UserExchangeMutator |
mockUser(java.lang.String username)
Updates the ServerWebExchange to use a UserDetails to create a UsernamePasswordAuthenticationToken as
the Principal.
|
static <T extends org.springframework.test.web.reactive.server.WebTestClientConfigurer & org.springframework.test.web.reactive.server.MockServerConfigurer> |
mockUser(org.springframework.security.core.userdetails.UserDetails userDetails)
Updates the ServerWebExchange to use the provided UserDetails to create a UsernamePasswordAuthenticationToken as
the Principal
|
static org.springframework.test.web.reactive.server.MockServerConfigurer |
springSecurity()
Sets up Spring Security's
WebTestClient test support |
public static org.springframework.test.web.reactive.server.MockServerConfigurer springSecurity()
WebTestClient test supportpublic static <T extends org.springframework.test.web.reactive.server.WebTestClientConfigurer & org.springframework.test.web.reactive.server.MockServerConfigurer> T mockAuthentication(org.springframework.security.core.Authentication authentication)
authentication - the Authentication to use.public static <T extends org.springframework.test.web.reactive.server.WebTestClientConfigurer & org.springframework.test.web.reactive.server.MockServerConfigurer> T mockUser(org.springframework.security.core.userdetails.UserDetails userDetails)
userDetails - the UserDetails to use.public static SecurityMockServerConfigurers.UserExchangeMutator mockUser()
SecurityMockServerConfigurers.UserExchangeMutator to usepublic static SecurityMockServerConfigurers.UserExchangeMutator mockUser(java.lang.String username)
WebTestClientConfigurer to usepublic static SecurityMockServerConfigurers.JwtMutator mockJwt()
SecurityContext that has a
JwtAuthenticationToken for the
Authentication and a Jwt for the
Authentication.getPrincipal(). All details are
declarative and do not require the JWT to be valid.SecurityMockServerConfigurers.JwtMutator to further configure or usepublic static SecurityMockServerConfigurers.JwtMutator mockJwt(java.util.function.Consumer<org.springframework.security.oauth2.jwt.Jwt.Builder> jwtBuilderConsumer)
SecurityContext that has a
JwtAuthenticationToken for the
Authentication and a Jwt for the
Authentication.getPrincipal(). All details are
declarative and do not require the JWT to be valid.jwtBuilderConsumer - For configuring the underlying JwtSecurityMockServerConfigurers.JwtMutator to further configure or usepublic static SecurityMockServerConfigurers.JwtMutator mockJwt(org.springframework.security.oauth2.jwt.Jwt jwt)
SecurityContext that has a
JwtAuthenticationToken for the
Authentication and a Jwt for the
Authentication.getPrincipal(). All details are
declarative and do not require the JWT to be valid.jwt - The preliminary constructed JwtSecurityMockServerConfigurers.JwtMutator to further configure or usepublic static SecurityMockServerConfigurers.CsrfMutator csrf()