@WithMockUser( 공식문서 )
- The user with the username "user" does not have to exist since we are mocking the user
- The
Authenticationthat is populated in theSecurityContextis of typeUsernamePasswordAuthenticationToken
- The principal on the
Authenticationis Spring Security’sUserobject
- The
Userwill have the username of "user", the password "password", and a singleGrantedAuthoritynamed "ROLE_USER" is used.
@WithSecurityContext
- WithMockCustomUserSecurityContextFactory에서 WithMockCustomUser를 받아서 Authentication을 생성하고 SecurityContext에 설정하는 것 까지 진행해줌 → 완전한 Customizing이 가능함