I try to test the access of mvcControllers injecting the UserPrincipal :
restPockMockMvc .perform(get("/pocs").principal(authToken)) .andReturn();
and here's the method of the controller I try to test:
@PreAuthorize(value = "hasRole('AK_ADMIN')") @RequestMapping(method = RequestMethod.GET, produces = "application/json; charset=utf-8") public PagedResources collectionList(HttpServletRequest httpServletRequest){ ............}
httpServletRequest.getUserPrincipal()i s always null whereas I inject the userPrincipal and I do not understand why...
Your help would be welcome. Thank you
Aucun commentaire:
Enregistrer un commentaire