Class SecurityMockMvcResultMatchers.AuthenticatedMatcher
- java.lang.Object
- 
- org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.AuthenticatedMatcher
 
- 
- All Implemented Interfaces:
- ResultMatcher
 - Enclosing class:
- SecurityMockMvcResultMatchers
 
 public static final class SecurityMockMvcResultMatchers.AuthenticatedMatcher extends Object - Since:
- 4.0
- Author:
- Rob Winch
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidmatch(MvcResult result)SecurityMockMvcResultMatchers.AuthenticatedMatcherwithAuthentication(org.springframework.security.core.Authentication expected)Specifies the expectedAuthenticationSecurityMockMvcResultMatchers.AuthenticatedMatcherwithAuthenticationName(String expected)Specifies the expectedPrincipal.getName()SecurityMockMvcResultMatchers.AuthenticatedMatcherwithAuthenticationPrincipal(Object expected)Specifies the expected principalSecurityMockMvcResultMatchers.AuthenticatedMatcherwithAuthorities(Collection<org.springframework.security.core.GrantedAuthority> expected)Specifies theAuthentication.getAuthorities()SecurityMockMvcResultMatchers.AuthenticatedMatcherwithRoles(String... roles)Specifies theAuthentication.getAuthorities()SecurityMockMvcResultMatchers.AuthenticatedMatcherwithSecurityContext(org.springframework.security.core.context.SecurityContext expected)Specifies the expectedSecurityContextSecurityMockMvcResultMatchers.AuthenticatedMatcherwithUsername(String expected)Specifies the expected username
 
- 
- 
- 
Method Detail- 
withUsernamepublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withUsername(String expected) Specifies the expected username- Parameters:
- expected- the expected username
- Returns:
- the SecurityMockMvcResultMatchers.AuthenticatedMatcherfor further customization
 
 - 
withSecurityContextpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withSecurityContext(org.springframework.security.core.context.SecurityContext expected) Specifies the expectedSecurityContext- Parameters:
- expected- the expected- SecurityContext
- Returns:
- the SecurityMockMvcResultMatchers.AuthenticatedMatcherfor further customization
 
 - 
withAuthenticationpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withAuthentication(org.springframework.security.core.Authentication expected) Specifies the expectedAuthentication- Parameters:
- expected- the expected- Authentication
- Returns:
- the SecurityMockMvcResultMatchers.AuthenticatedMatcherfor further customization
 
 - 
withAuthenticationPrincipalpublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withAuthenticationPrincipal(Object expected) Specifies the expected principal- Parameters:
- expected- the expected principal
- Returns:
- the SecurityMockMvcResultMatchers.AuthenticatedMatcherfor further customization
 
 - 
withAuthenticationNamepublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withAuthenticationName(String expected) Specifies the expectedPrincipal.getName()- Parameters:
- expected- the expected- Principal.getName()
- Returns:
- the SecurityMockMvcResultMatchers.AuthenticatedMatcherfor further customization
 
 - 
withAuthoritiespublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withAuthorities(Collection<org.springframework.security.core.GrantedAuthority> expected) Specifies theAuthentication.getAuthorities()- Parameters:
- expected- the- Authentication.getAuthorities()
- Returns:
- the SecurityMockMvcResultMatchers.AuthenticatedMatcherfor further customization
 
 - 
withRolespublic SecurityMockMvcResultMatchers.AuthenticatedMatcher withRoles(String... roles) Specifies theAuthentication.getAuthorities()- Parameters:
- roles- the roles. Each value is automatically prefixed with "ROLE_"
- Returns:
- the SecurityMockMvcResultMatchers.AuthenticatedMatcherfor further customization
 
 
- 
 
-