Thanks Erwan,
That's what I ended up using

On Saturday, 21 May 2016 10:20:41 UTC-4, Erwan Arzur wrote:
>
> Le mardi 17 mai 2016 15:09:51 UTC+2, Zee a écrit :
>>
>> Hello,
>> We have a "microservices" style infrastructure where each component is 
>> it's own service. They all have BasicAuth using the dropwizard basic auth 
>> authentication model. Some services need to talk to other microservices, so 
>> I'm using the Jersey Client to make those calls. However, I need to pass 
>> the Basic Auth token from one service to another. Is there a way of 
>> accessing the basic auth token from my resource?  (I.E at authentication 
>> level, once the user is authenticated, pass that auth token to the client 
>> in the resource).
>>
>> Right now I have to hardcode the token in for a user, or store the 
>> password in Principal and create the token from that when making a client 
>> request. Both of these methods are obviously insecure.
>>
>> Thanks
>>
>
> I would use a @Context HttpHeaders parameter to my resource, jersey will 
> happily inject it when you ask...
>
> @GET
> public Response testGet(@Auth User user, @Context HttpHeaders headers) {
>
>      ....
>
>      String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION);
>
>     ....
> }
>
> That should get you going
>
> Erwan
>

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to