Class SecurityMockServerConfigurers.OidcLoginMutator
- java.lang.Object
-
- org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.OidcLoginMutator
-
- 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.OidcLoginMutator 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.OidcLoginMutator
authorities(java.util.Collection<GrantedAuthority> authorities)
Use the provided authorities in theAuthentication
SecurityMockServerConfigurers.OidcLoginMutator
authorities(GrantedAuthority... authorities)
Use the provided authorities in theAuthentication
void
beforeServerCreated(org.springframework.web.server.adapter.WebHttpHandlerBuilder builder)
SecurityMockServerConfigurers.OidcLoginMutator
clientRegistration(ClientRegistration clientRegistration)
Use the providedClientRegistration
as the client to authorize.SecurityMockServerConfigurers.OidcLoginMutator
idToken(java.util.function.Consumer<OidcIdToken.Builder> idTokenBuilderConsumer)
Use the providedOidcIdToken
when constructing the authenticated userSecurityMockServerConfigurers.OidcLoginMutator
oidcUser(OidcUser oidcUser)
Use the providedOidcUser
as the authenticated user.SecurityMockServerConfigurers.OidcLoginMutator
userInfoToken(java.util.function.Consumer<OidcUserInfo.Builder> userInfoBuilderConsumer)
Use the providedOidcUserInfo
when constructing the authenticated user
-
-
-
Method Detail
-
authorities
public SecurityMockServerConfigurers.OidcLoginMutator authorities(java.util.Collection<GrantedAuthority> authorities)
Use the provided authorities in theAuthentication
- Parameters:
authorities
- the authorities to use- Returns:
- the
SecurityMockServerConfigurers.OidcLoginMutator
for further configuration
-
authorities
public SecurityMockServerConfigurers.OidcLoginMutator authorities(GrantedAuthority... authorities)
Use the provided authorities in theAuthentication
- Parameters:
authorities
- the authorities to use- Returns:
- the
SecurityMockServerConfigurers.OidcLoginMutator
for further configuration
-
idToken
public SecurityMockServerConfigurers.OidcLoginMutator idToken(java.util.function.Consumer<OidcIdToken.Builder> idTokenBuilderConsumer)
Use the providedOidcIdToken
when constructing the authenticated user- Parameters:
idTokenBuilderConsumer
- aConsumer
of aOidcIdToken.Builder
- Returns:
- the
SecurityMockServerConfigurers.OidcLoginMutator
for further configuration
-
userInfoToken
public SecurityMockServerConfigurers.OidcLoginMutator userInfoToken(java.util.function.Consumer<OidcUserInfo.Builder> userInfoBuilderConsumer)
Use the providedOidcUserInfo
when constructing the authenticated user- Parameters:
userInfoBuilderConsumer
- aConsumer
of aOidcUserInfo.Builder
- Returns:
- the
SecurityMockServerConfigurers.OidcLoginMutator
for further configuration
-
oidcUser
public SecurityMockServerConfigurers.OidcLoginMutator oidcUser(OidcUser oidcUser)
Use the providedOidcUser
as the authenticated user.Supplying an
OidcUser
will take precedence overidToken
,userInfo
, and list ofGrantedAuthority
s to use.- Parameters:
oidcUser
- theOidcUser
to use- Returns:
- the
SecurityMockServerConfigurers.OidcLoginMutator
for further configuration
-
clientRegistration
public SecurityMockServerConfigurers.OidcLoginMutator 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.OidcLoginMutator
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
-
-