users@jersey.java.net

Re: [Jersey] HTTP Basic Authentication (header encoding)

From: Craig McClanahan <Craig.McClanahan_at_Sun.COM>
Date: Thu, 30 Apr 2009 14:37:21 -0700

Rabick, Mark A (IS) wrote:
>
> Does anyone have a code snippet for creating the Base64 encoded
> user/password combination for a Jersey server configured for BASIC
> authentication?
>
> In the Jersey client code, is it just:
>
> nodeBaseResource.header("Authorization",
> "base64encoded_userid:password").type("application/xml").post(nodeV1);
>
> ... for a post request?
>
Close. The header value has to be slightly different, though:

nodeBaseResource.header("Authorization", "Basic " +
"base64encoded_userid:password").type("application/xml").post(nodeV1);

Craig
>
> --mark
> *_______________________________________________*
> *Mark A. Rabick*
> Software Engineer
> Northrop Grumman - Integrated Mission Systems (IS/DSD/IMS)
> 3200 Samson Way
> Bellevue, NE 68123
> *Ph: (402) 293-7091*
> *Em: mark.rabick_at_ngc.com*
> /Remember PFC Ross A. McGinnis.../
> / //_http://www.army.mil/medalofhonor/McGinnis/index.html_/
> /... MA2 Michael A. Monsoor, Lt. Michael P. Murphy, Cpl. Jason Dunham,
> SFC Paul Ray Smith and the rest.../
> / //_http://www.cmohs.org/recipients/most_recent.htm_/
>
>