Class SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessor
java.lang.Object
org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessor
- All Implemented Interfaces:
org.springframework.test.web.servlet.request.RequestPostProcessor
- Enclosing class:
- SecurityMockMvcRequestPostProcessors
public static final class SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessor
extends Object
implements org.springframework.test.web.servlet.request.RequestPostProcessor
- Since:
- 5.3
-
Method Summary
Modifier and TypeMethodDescriptionattributes(Consumer<Map<String, Object>> attributesConsumer) Mutate the attributes using the givenConsumerauthorities(Collection<org.springframework.security.core.GrantedAuthority> authorities) Use the provided authorities in theAuthenticationauthorities(org.springframework.security.core.GrantedAuthority... authorities) Use the provided authorities in theAuthenticationclientRegistration(org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration) Use the providedClientRegistrationas the client to authorize.oauth2User(org.springframework.security.oauth2.core.user.OAuth2User oauth2User) Use the providedOAuth2Useras the authenticated user.org.springframework.mock.web.MockHttpServletRequestpostProcessRequest(org.springframework.mock.web.MockHttpServletRequest request)
-
Method Details
-
authorities
public SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessor authorities(Collection<org.springframework.security.core.GrantedAuthority> authorities) Use the provided authorities in theAuthentication- Parameters:
authorities- the authorities to use- Returns:
- the
SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessorfor further configuration
-
authorities
public SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessor authorities(org.springframework.security.core.GrantedAuthority... authorities) Use the provided authorities in theAuthentication- Parameters:
authorities- the authorities to use- Returns:
- the
SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessorfor further configuration
-
attributes
public SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessor attributes(Consumer<Map<String, Object>> attributesConsumer) Mutate the attributes using the givenConsumer- Parameters:
attributesConsumer- TheConsumerfor mutating theMapof attributes- Returns:
- the
SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessorfor further configuration
-
oauth2User
public SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessor oauth2User(org.springframework.security.oauth2.core.user.OAuth2User oauth2User) Use the providedOAuth2Useras the authenticated user.- Parameters:
oauth2User- theOAuth2Userto use- Returns:
- the
SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessorfor further configuration
-
clientRegistration
public SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessor clientRegistration(org.springframework.security.oauth2.client.registration.ClientRegistration clientRegistration) Use the providedClientRegistrationas the client to authorize. The suppliedClientRegistrationwill be registered into anOAuth2AuthorizedClientRepository.- Parameters:
clientRegistration- theClientRegistrationto use- Returns:
- the
SecurityMockMvcRequestPostProcessors.OAuth2LoginRequestPostProcessorfor further configuration
-
postProcessRequest
public org.springframework.mock.web.MockHttpServletRequest postProcessRequest(org.springframework.mock.web.MockHttpServletRequest request) - Specified by:
postProcessRequestin interfaceorg.springframework.test.web.servlet.request.RequestPostProcessor
-