TestSecurityContextHolder
and the
SecurityContextHolder
after each test method.CsrfToken
as a request parameter
(default) will populate the CsrfToken
as a header.ResultMatcher
that verifies that a specified user is
authenticated.SecurityContext
that uses the specified Authentication
for the
Authentication.getPrincipal()
and a custom UserDetails
.GrantedAuthority
's.GrantedAuthority
's.SecurityContext
for each test method.SecurityContext
given an Annotation.RequestPostProcessor
that will automatically populate a
valid CsrfToken
in the request.CsrfToken
) that will
submit a form based login to POST "/login".CsrfToken
) that will
submit a form based login to POST loginProcessingUrl
.SecurityContext
from TestSecurityContextHolder
.CsrfTokenRepository
for the specified
HttpServletRequest
.SecurityContextRepository
for the specified
HttpServletRequest
.CsrfToken
) to
the specified logoutUrl
SecurityContext
to be used.MockMvcConfigurer
implementations.MockMvc
RequestBuilder
s.CsrfToken
.CsrfToken
)MockMvc
RequestPostProcessor
implementations for
Spring Security.CsrfToken
into the request.UsernamePasswordAuthenticationToken
and sets the
principal to be a User
and associates it to the
MockHttpServletRequest
.MockMvc
ResultMatcher
s.SecurityContextRepository
for the specified
HttpServletRequest
.RequestPostProcessor
that can be used to ensure that
the resulting request is ran with the user in the
TestSecurityContextHolder
.TestSecurityContextHolder
is very similar to
SecurityContextHolder
, but is necessary for testing.ResultMatcher
that verifies that no user is authenticated.SecurityContext
that has a
UsernamePasswordAuthenticationToken
for the
Authentication.getPrincipal()
and a User
for the
UsernamePasswordAuthenticationToken.getPrincipal()
.SecurityContext
that has a
UsernamePasswordAuthenticationToken
for the
Authentication.getPrincipal()
and a custom UserDetails
for the UsernamePasswordAuthenticationToken.getPrincipal()
.Authentication
Principal.getName()
Authentication.getAuthorities()
WithSecurityContextTestExecutionListener
this annotation can be
added to a test method to emulate running with a mocked user.Authentication.getAuthorities()
SecurityContext
to use.SecurityContext
SecurityContext
that is populated in the
TestSecurityContextHolder
.TestExecutionListener
that will find annotations that are annotated
with WithSecurityContext
on a test method or at the class level.WithSecurityContextTestExecutionListener
this annotation can be
added to a test method to emulate running with a UserDetails
returned
from the UserDetailsService
.