Annotation Type WithUserDetails
@Target({METHOD,TYPE})
@Retention(RUNTIME)
@Inherited
@Documented
@WithSecurityContext(factory=org.springframework.security.test.context.support.WithUserDetailsSecurityContextFactory.class)
public @interface WithUserDetails
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
SecurityContextcreated with be that ofSecurityContextHolder.createEmptyContext() - It will be populated with an
UsernamePasswordAuthenticationTokenthat uses the username ofvalue().
- Since:
- 4.0
- Author:
- Rob Winch
- See Also:
-
Optional Element Summary
Optional Elements
-
Element Details
-
value
-