public static final class SecurityMockMvcResultMatchers.AuthenticatedMatcher
extends java.lang.Object
MockMvc ResultMatcher that verifies a specific user is associated
to the MvcResult.| Modifier and Type | Method and Description |
|---|---|
void |
match(org.springframework.test.web.servlet.MvcResult result) |
SecurityMockMvcResultMatchers.AuthenticatedMatcher |
withAuthentication(org.springframework.security.core.Authentication expected)
Specifies the expected
Authentication |
SecurityMockMvcResultMatchers.AuthenticatedMatcher |
withAuthenticationName(java.lang.String expected)
Specifies the expected
Principal.getName() |
SecurityMockMvcResultMatchers.AuthenticatedMatcher |
withAuthenticationPrincipal(java.lang.Object expected)
Specifies the expected principal
|
SecurityMockMvcResultMatchers.AuthenticatedMatcher |
withAuthorities(java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> expected)
Specifies the
Authentication.getAuthorities() |
SecurityMockMvcResultMatchers.AuthenticatedMatcher |
withRoles(java.lang.String... roles)
Specifies the
Authentication.getAuthorities() |
SecurityMockMvcResultMatchers.AuthenticatedMatcher |
withSecurityContext(org.springframework.security.core.context.SecurityContext expected)
Specifies the expected
SecurityContext |
SecurityMockMvcResultMatchers.AuthenticatedMatcher |
withUsername(java.lang.String expected)
Specifies the expected username
|
public void match(org.springframework.test.web.servlet.MvcResult result)
throws java.lang.Exception
java.lang.Exceptionpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withUsername(java.lang.String expected)
expected - the expected usernameSecurityMockMvcResultMatchers.AuthenticatedMatcher for further customizationpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withSecurityContext(org.springframework.security.core.context.SecurityContext expected)
SecurityContextexpected - the expected SecurityContextSecurityMockMvcResultMatchers.AuthenticatedMatcher for further customizationpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withAuthentication(org.springframework.security.core.Authentication expected)
Authenticationexpected - the expected AuthenticationSecurityMockMvcResultMatchers.AuthenticatedMatcher for further customizationpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withAuthenticationPrincipal(java.lang.Object expected)
expected - the expected principalSecurityMockMvcResultMatchers.AuthenticatedMatcher for further customizationpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withAuthenticationName(java.lang.String expected)
Principal.getName()expected - the expected Principal.getName()SecurityMockMvcResultMatchers.AuthenticatedMatcher for further customizationpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withAuthorities(java.util.Collection<? extends org.springframework.security.core.GrantedAuthority> expected)
Authentication.getAuthorities()expected - the Authentication.getAuthorities()SecurityMockMvcResultMatchers.AuthenticatedMatcher for further customizationpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withRoles(java.lang.String... roles)
Authentication.getAuthorities()roles - the roles. Each value is automatically prefixed with "ROLE_"SecurityMockMvcResultMatchers.AuthenticatedMatcher for further customization