public static final class SecurityMockServerConfigurers.JwtMutator
extends java.lang.Object
implements org.springframework.test.web.reactive.server.WebTestClientConfigurer, org.springframework.test.web.reactive.server.MockServerConfigurer
{@link
SecurityMockServerConfigurers#mockAuthentication(Authentication)}.| Modifier and Type | Method and Description |
|---|---|
void |
afterConfigureAdded(org.springframework.test.web.reactive.server.WebTestClient.MockServerSpec<?> serverSpec) |
void |
afterConfigurerAdded(org.springframework.test.web.reactive.server.WebTestClient.Builder builder,
org.springframework.web.server.adapter.WebHttpHandlerBuilder httpHandlerBuilder,
org.springframework.http.client.reactive.ClientHttpConnector connector) |
SecurityMockServerConfigurers.JwtMutator |
authorities(java.util.Collection<org.springframework.security.core.GrantedAuthority> authorities)
Use the provided authorities in the token
|
SecurityMockServerConfigurers.JwtMutator |
authorities(org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,java.util.Collection<org.springframework.security.core.GrantedAuthority>> authoritiesConverter)
Provides the configured
Jwt so that custom authorities can be derived
from it |
SecurityMockServerConfigurers.JwtMutator |
authorities(org.springframework.security.core.GrantedAuthority... authorities)
Use the provided authorities in the token
|
void |
beforeServerCreated(org.springframework.web.server.adapter.WebHttpHandlerBuilder builder) |
SecurityMockServerConfigurers.JwtMutator |
jwt(java.util.function.Consumer<org.springframework.security.oauth2.jwt.Jwt.Builder> jwtBuilderConsumer)
Use the given
Jwt.Builder Consumer to configure the underlying
Jwt
This method first creates a default Jwt.Builder instance with default
values for the alg, sub, and scope claims. |
SecurityMockServerConfigurers.JwtMutator |
jwt(org.springframework.security.oauth2.jwt.Jwt jwt)
Use the given
Jwt |
public SecurityMockServerConfigurers.JwtMutator jwt(java.util.function.Consumer<org.springframework.security.oauth2.jwt.Jwt.Builder> jwtBuilderConsumer)
Jwt.Builder Consumer to configure the underlying
Jwt
This method first creates a default Jwt.Builder instance with default
values for the alg, sub, and scope claims. The
Consumer can then modify these or provide additional configuration.
Calling SecurityMockServerConfigurers.mockJwt() is the equivalent of
calling SecurityMockMvcRequestPostProcessors.mockJwt().jwt(() -> {}).jwtBuilderConsumer - For configuring the underlying JwtSecurityMockServerConfigurers.JwtMutator for further configurationpublic SecurityMockServerConfigurers.JwtMutator jwt(org.springframework.security.oauth2.jwt.Jwt jwt)
Jwtjwt - The Jwt to useSecurityMockServerConfigurers.JwtMutator for further configurationpublic SecurityMockServerConfigurers.JwtMutator authorities(java.util.Collection<org.springframework.security.core.GrantedAuthority> authorities)
authorities - the authorities to useSecurityMockServerConfigurers.JwtMutator for further configurationpublic SecurityMockServerConfigurers.JwtMutator authorities(org.springframework.security.core.GrantedAuthority... authorities)
authorities - the authorities to useSecurityMockServerConfigurers.JwtMutator for further configurationpublic SecurityMockServerConfigurers.JwtMutator authorities(org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,java.util.Collection<org.springframework.security.core.GrantedAuthority>> authoritiesConverter)
Jwt so that custom authorities can be derived
from itauthoritiesConverter - the conversion strategy from Jwt to a
Collection of GrantedAuthoritysSecurityMockServerConfigurers.JwtMutator for further configurationpublic void beforeServerCreated(org.springframework.web.server.adapter.WebHttpHandlerBuilder builder)
beforeServerCreated in interface org.springframework.test.web.reactive.server.MockServerConfigurerpublic void afterConfigureAdded(org.springframework.test.web.reactive.server.WebTestClient.MockServerSpec<?> serverSpec)
afterConfigureAdded in interface org.springframework.test.web.reactive.server.MockServerConfigurerpublic void afterConfigurerAdded(org.springframework.test.web.reactive.server.WebTestClient.Builder builder,
@Nullable
org.springframework.web.server.adapter.WebHttpHandlerBuilder httpHandlerBuilder,
@Nullable
org.springframework.http.client.reactive.ClientHttpConnector connector)
afterConfigurerAdded in interface org.springframework.test.web.reactive.server.WebTestClientConfigurer