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 voidafterConfigureAdded(org.springframework.test.web.reactive.server.WebTestClient.MockServerSpec<?> serverSpec)voidafterConfigurerAdded(org.springframework.test.web.reactive.server.WebTestClient.Builder builder, org.springframework.web.server.adapter.WebHttpHandlerBuilder httpHandlerBuilder, org.springframework.http.client.reactive.ClientHttpConnector connector)SecurityMockServerConfigurers.OAuth2LoginMutatorattributes(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> attributesConsumer)Mutate the attributes using the givenConsumerSecurityMockServerConfigurers.OAuth2LoginMutatorauthorities(java.util.Collection<org.springframework.security.core.GrantedAuthority> authorities)Use the provided authorities in theAuthenticationSecurityMockServerConfigurers.OAuth2LoginMutatorauthorities(org.springframework.security.core.GrantedAuthority... authorities)Use the provided authorities in theAuthenticationvoidbeforeServerCreated(org.springframework.web.server.adapter.WebHttpHandlerBuilder builder)SecurityMockServerConfigurers.OAuth2LoginMutatorclientRegistration(org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration)Use the providedClientRegistrationas the client to authorize.SecurityMockServerConfigurers.OAuth2LoginMutatoroauth2User(org.springframework.security.oauth2.core.user.OAuth2User oauth2User)Use the providedOAuth2Useras the authenticated user.
-
-
-
Method Detail
-
authorities
public SecurityMockServerConfigurers.OAuth2LoginMutator authorities(java.util.Collection<org.springframework.security.core.GrantedAuthority> authorities)
Use the provided authorities in theAuthentication- Parameters:
authorities- the authorities to use- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutatorfor further configuration
-
authorities
public SecurityMockServerConfigurers.OAuth2LoginMutator authorities(org.springframework.security.core.GrantedAuthority... authorities)
Use the provided authorities in theAuthentication- Parameters:
authorities- the authorities to use- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutatorfor 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- TheConsumerfor mutating the of attributes- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutatorfor further configuration
-
oauth2User
public SecurityMockServerConfigurers.OAuth2LoginMutator oauth2User(org.springframework.security.oauth2.core.user.OAuth2User oauth2User)
Use the providedOAuth2Useras the authenticated user.- Parameters:
oauth2User- theOAuth2Userto use- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutatorfor further configuration
-
clientRegistration
public SecurityMockServerConfigurers.OAuth2LoginMutator clientRegistration(org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration)
Use the providedClientRegistrationas the client to authorize.The supplied
ClientRegistrationwill be registered into anWebSessionServerOAuth2AuthorizedClientRepository. Tests relying onRegisteredOAuth2AuthorizedClientannotations should register anWebSessionServerOAuth2AuthorizedClientRepositorybean to the application context.- Parameters:
clientRegistration- theClientRegistrationto use- Returns:
- the
SecurityMockServerConfigurers.OAuth2LoginMutatorfor further configuration
-
beforeServerCreated
public void beforeServerCreated(org.springframework.web.server.adapter.WebHttpHandlerBuilder builder)
- Specified by:
beforeServerCreatedin interfaceorg.springframework.test.web.reactive.server.MockServerConfigurer
-
afterConfigureAdded
public void afterConfigureAdded(org.springframework.test.web.reactive.server.WebTestClient.MockServerSpec<?> serverSpec)
- Specified by:
afterConfigureAddedin 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:
afterConfigurerAddedin interfaceorg.springframework.test.web.reactive.server.WebTestClientConfigurer
-
-