I'm using JHipster v4.5.5 and I'm working through the examples at https://jhipster.github.io/using-uaa/. I have two microservices that are trying to communicate. I secured one microservice method with these annotations:
@Secured({AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN})
I tried to contact this service from another microservice using an AuthorizedFeignClients:
@AuthorizedFeignClient(name = "MicroService2")
public interface MicroService2Client {
@RequestMapping(method = RequestMethod.GET, value = "/api/demo/string")
public String getString();
...
When I try it, I get:
An unexpected error occurred: status 403 reading MicroService2Client#getString(); content: {"message":"error.accessDenied","description":"Access is denied","fieldErrors":null}
What credentials / user is the FeignClient trying to use? Is it the "internal" client defined in application*.yml under the jhipster.security.client-authorization settings?
If so, what annotations should I use on the method to allow this user to access the REST method?
I would prefer that the user account be used and not try to use a service account. I see a note in the documentation that:
As an alternative, the access token of the initial request may be forwarded to further calls. Currently, there is no “default solution” provided by JHipster.
How do you forward the access token of the original request and forward it on?
I setup a working set of demo projects here: