public static final class SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor
extends java.lang.Object
implements org.springframework.test.web.servlet.request.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(java.util.Collection<? extends GrantedAuthority> authorities)
Populates the user's
GrantedAuthority's. |
SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor |
authorities(GrantedAuthority... authorities)
Populates the user's
GrantedAuthority's. |
SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor |
password(java.lang.String password)
Populates the user's password.
|
org.springframework.mock.web.MockHttpServletRequest |
postProcessRequest(org.springframework.mock.web.MockHttpServletRequest request) |
SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor |
roles(java.lang.String... roles)
Specify the roles of the user to authenticate as.
|
public SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor roles(java.lang.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(GrantedAuthority... authorities)
GrantedAuthority's. The default is ROLE_USER.authorities - roles(String...)public SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor authorities(java.util.Collection<? extends GrantedAuthority> authorities)
GrantedAuthority's. The default is ROLE_USER.authorities - roles(String...)public SecurityMockMvcRequestPostProcessors.UserRequestPostProcessor password(java.lang.String password)
password - the user's passwordpublic org.springframework.mock.web.MockHttpServletRequest postProcessRequest(org.springframework.mock.web.MockHttpServletRequest request)
postProcessRequest in interface org.springframework.test.web.servlet.request.RequestPostProcessor