Class SecurityMockServerConfigurers.UserExchangeMutator
- java.lang.Object
-
- org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.UserExchangeMutator
-
- All Implemented Interfaces:
org.springframework.test.web.reactive.server.MockServerConfigurer
,org.springframework.test.web.reactive.server.WebTestClientConfigurer
- Enclosing class:
- SecurityMockServerConfigurers
public static final class SecurityMockServerConfigurers.UserExchangeMutator extends java.lang.Object implements org.springframework.test.web.reactive.server.WebTestClientConfigurer, org.springframework.test.web.reactive.server.MockServerConfigurer
Updates the WebServerExchange using{@link SecurityMockServerConfigurers#mockUser(UserDetails)}
. Defaults to use a password of "password" and granted authorities of "ROLE_USER".
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SecurityMockServerConfigurers.UserExchangeMutator
accountExpired(boolean accountExpired)
SecurityMockServerConfigurers.UserExchangeMutator
accountLocked(boolean accountLocked)
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 webHttpHandlerBuilder, org.springframework.http.client.reactive.ClientHttpConnector clientHttpConnector)
SecurityMockServerConfigurers.UserExchangeMutator
authorities(java.lang.String... authorities)
Specifies theGrantedAuthority
s to use.SecurityMockServerConfigurers.UserExchangeMutator
authorities(java.util.Collection<? extends GrantedAuthority> authorities)
Specifies theGrantedAuthority
s to use.SecurityMockServerConfigurers.UserExchangeMutator
authorities(GrantedAuthority... authorities)
Specifies theGrantedAuthority
s to use.void
beforeServerCreated(org.springframework.web.server.adapter.WebHttpHandlerBuilder builder)
SecurityMockServerConfigurers.UserExchangeMutator
credentialsExpired(boolean credentialsExpired)
SecurityMockServerConfigurers.UserExchangeMutator
disabled(boolean disabled)
SecurityMockServerConfigurers.UserExchangeMutator
password(java.lang.String password)
Specifies the password to use.SecurityMockServerConfigurers.UserExchangeMutator
roles(java.lang.String... roles)
Specifies the roles to use.
-
-
-
Method Detail
-
password
public SecurityMockServerConfigurers.UserExchangeMutator password(java.lang.String password)
Specifies the password to use. Default is "password".- Parameters:
password
- the password to use- Returns:
- the UserExchangeMutator
-
roles
public SecurityMockServerConfigurers.UserExchangeMutator roles(java.lang.String... roles)
Specifies the roles to use. Default is "USER". This is similar to authorities except each role is automatically prefixed with "ROLE_USER".- Parameters:
roles
- the roles to use.- Returns:
- the UserExchangeMutator
-
authorities
public SecurityMockServerConfigurers.UserExchangeMutator authorities(GrantedAuthority... authorities)
Specifies theGrantedAuthority
s to use. Default is "ROLE_USER".- Parameters:
authorities
- the authorities to use.- Returns:
- the UserExchangeMutator
-
authorities
public SecurityMockServerConfigurers.UserExchangeMutator authorities(java.util.Collection<? extends GrantedAuthority> authorities)
Specifies theGrantedAuthority
s to use. Default is "ROLE_USER".- Parameters:
authorities
- the authorities to use.- Returns:
- the UserExchangeMutator
-
authorities
public SecurityMockServerConfigurers.UserExchangeMutator authorities(java.lang.String... authorities)
Specifies theGrantedAuthority
s to use. Default is "ROLE_USER".- Parameters:
authorities
- the authorities to use.- Returns:
- the UserExchangeMutator
-
accountExpired
public SecurityMockServerConfigurers.UserExchangeMutator accountExpired(boolean accountExpired)
-
accountLocked
public SecurityMockServerConfigurers.UserExchangeMutator accountLocked(boolean accountLocked)
-
credentialsExpired
public SecurityMockServerConfigurers.UserExchangeMutator credentialsExpired(boolean credentialsExpired)
-
disabled
public SecurityMockServerConfigurers.UserExchangeMutator disabled(boolean disabled)
-
beforeServerCreated
public void beforeServerCreated(org.springframework.web.server.adapter.WebHttpHandlerBuilder builder)
- Specified by:
beforeServerCreated
in interfaceorg.springframework.test.web.reactive.server.MockServerConfigurer
-
afterConfigureAdded
public void afterConfigureAdded(org.springframework.test.web.reactive.server.WebTestClient.MockServerSpec<?> serverSpec)
- Specified by:
afterConfigureAdded
in interfaceorg.springframework.test.web.reactive.server.MockServerConfigurer
-
afterConfigurerAdded
public void afterConfigurerAdded(org.springframework.test.web.reactive.server.WebTestClient.Builder builder, @Nullable org.springframework.web.server.adapter.WebHttpHandlerBuilder webHttpHandlerBuilder, @Nullable org.springframework.http.client.reactive.ClientHttpConnector clientHttpConnector)
- Specified by:
afterConfigurerAdded
in interfaceorg.springframework.test.web.reactive.server.WebTestClientConfigurer
-
-