public static final class SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor extends Object implements RequestPostProcessor
UsernamePasswordAuthenticationToken and sets the principal to be
a User and associates it to the MockHttpServletRequest.| Modifier and Type | Method and Description |
|---|---|
SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor |
authorities(Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
Populates the user's
GrantedAuthority's. |
SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor |
authorities(org.springframework.security.core.GrantedAuthority... authorities)
Populates the user's
GrantedAuthority's. |
SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor |
password(String password)
Populates the user's password.
|
MockHttpServletRequest |
postProcessRequest(MockHttpServletRequest request) |
SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor |
roles(String... roles)
Specify the roles of the user to authenticate as.
|
public SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor roles(String... roles)
authorities(GrantedAuthority...), but just not as flexible.roles - The roles to populate. Note that if the role does not start with
ROLE_PREFIX it will automatically be prepended. This means by
default roles("ROLE_USER") and roles("USER") are equivalent.authorities(GrantedAuthority...),
ROLE_PREFIXpublic SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor authorities(org.springframework.security.core.GrantedAuthority... authorities)
GrantedAuthority's. The default is ROLE_USER.authorities - roles(String...)public SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor authorities(Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
GrantedAuthority's. The default is ROLE_USER.authorities - roles(String...)public SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor password(String password)
password - the user's passwordpublic MockHttpServletRequest postProcessRequest(MockHttpServletRequest request)
postProcessRequest in interface RequestPostProcessor