public static final class SecurityMockMvcResultMatchers.AuthenticatedMatcher
extends java.lang.Object
MockMvc ResultMatcher that verifies a specific user is associated
to the MvcResult.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(SecurityContext expected)
SecurityContextexpected - the expected SecurityContextSecurityMockMvcResultMatchers.AuthenticatedMatcher for further customizationpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withAuthentication(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 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