When used with
WithSecurityContextTestExecutionListener
this annotation can be
added to a test method to emulate running with a
UserDetails
returned
from the
UserDetailsService
. In order to work with
MockMvc
The
SecurityContext
that is used will have the following properties:
- The
SecurityContext
created with be that of
SecurityContextHolder.createEmptyContext()
- It will be populated with an
UsernamePasswordAuthenticationToken
that uses the username of either value()
or #username()
,
GrantedAuthority
that are specified by #roles()
, and a
password specified by #password()
.