Class SecurityMockServerConfigurers.OAuth2LoginMutator
- java.lang.Object
-
- org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.OAuth2LoginMutator
-
- 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.OAuth2LoginMutator extends java.lang.Object implements org.springframework.test.web.reactive.server.WebTestClientConfigurer, org.springframework.test.web.reactive.server.MockServerConfigurer
- Since:
- 5.3
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.OAuth2LoginMutator
attributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)
Mutate the attributes using the givenConsumer
SecurityMockServerConfigurers.OAuth2LoginMutator
authorities(java.util.Collection<GrantedAuthority> authorities)
Use the provided authorities in theAuthentication
SecurityMockServerConfigurers.OAuth2LoginMutator
authorities(GrantedAuthority... authorities)
Use the provided authorities in theAuthentication
void
beforeServerCreated(org.springframework.web.server.adapter.WebHttpHandlerBuilder builder)
SecurityMockServerConfigurers.OAuth2LoginMutator
clientRegistration(ClientRegistration clientRegistration)
Use the providedClientRegistration
as the client to authorize.SecurityMockServerConfigurers.OAuth2LoginMutator
oauth2User(OAuth2User oauth2User)
Use the providedOAuth2User
as the authenticated user.
-
-
-
Method Detail
-
authorities
public SecurityMockServerConfigurers.OAuth2LoginMutator authorities(java.util.Collection<GrantedAuthority> authorities)
Use the provided authorities in theAuthentication
- Parameters:
authorities
- the authorities to use- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutator
for further configuration
-
authorities
public SecurityMockServerConfigurers.OAuth2LoginMutator authorities(GrantedAuthority... authorities)
Use the provided authorities in theAuthentication
- Parameters:
authorities
- the authorities to use- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutator
for further configuration
-
attributes
public SecurityMockServerConfigurers.OAuth2LoginMutator attributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)
Mutate the attributes using the givenConsumer
- Parameters:
attributesConsumer
- TheConsumer
for mutating the of attributes- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutator
for further configuration
-
oauth2User
public SecurityMockServerConfigurers.OAuth2LoginMutator oauth2User(OAuth2User oauth2User)
Use the providedOAuth2User
as the authenticated user.- Parameters:
oauth2User
- theOAuth2User
to use- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutator
for further configuration
-
clientRegistration
public SecurityMockServerConfigurers.OAuth2LoginMutator clientRegistration(ClientRegistration clientRegistration)
Use the providedClientRegistration
as the client to authorize.The supplied
ClientRegistration
will be registered into anWebSessionServerOAuth2AuthorizedClientRepository
. Tests relying onRegisteredOAuth2AuthorizedClient
annotations should register anWebSessionServerOAuth2AuthorizedClientRepository
bean to the application context.- Parameters:
clientRegistration
- theClientRegistration
to use- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutator
for further configuration
-
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 httpHandlerBuilder, @Nullable org.springframework.http.client.reactive.ClientHttpConnector connector)
- Specified by:
afterConfigurerAdded
in interfaceorg.springframework.test.web.reactive.server.WebTestClientConfigurer
-
-