But how can we perform an authenticated request? Spring Security offers two annotations that can help:
- @WithMockUser—Loads the security context with a UserDetails using the given username, password, and authorization
- @WithUserDetails—Loads the security context by looking up a UserDetails object for the given username
In both cases, S...
spring-security can manage user object. And we can override it in test cases by @WithMockUser and @WithUserDetails.
Share this highlighthttp://www.safaribooksonline.com/a/spring-boot-in/985191/