users@jersey.java.net

Re: [Jersey] Jersey Client and Basic Authentication

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 11 Nov 2008 08:37:25 +0100

Hi Mike,

On Nov 10, 2008, at 11:53 PM, Mike Jones wrote:

> Sorry, for the slow reply .... busy day of meetings,
>
> So, does this mean you don't need a client filter implementation now?
> If yes, I can sent a patch next week. The Digest version is a bit crap
> and needs a bit more work.
>

If the Apache HTTP client can support the requirements then i don't
think we need to provide additional authentication-based client
filters, as long as developers are happy to defer to the Apache HTTP
client. It is also one less specific thing to test, maintain and
document :-)

Do you mind? I really appreciate that you took the time to investigate
this area and offered to help.

Paul.

> Cheers
> Mike
>
> 2008/11/10 Paul Sandoz <Paul.Sandoz_at_sun.com>:
>> Hi Jorge,
>> Wow! I sort of had in mind other client-based implementations when
>> designing the API but i did not expect things to go that smoothly :-)
>> Can't wait for next week!
>> Paul.
>>
>> On Nov 10, 2008, at 7:03 PM, Jorge L Williams wrote:
>>
>> Hey guys,
>>
>> I've added support for Basic, Digest, and NTLM authentication and
>> preemptive
>> authentication by adding an Apache HTTPClient backend to Jersey
>> client.
>> Cookie handling is also supported -- though off by default. This
>> also fixes
>> other errors associated with URLConnections like not being able to
>> retrieve
>> 401 error codes. Also, HTTPClient seems perform better than
>> URLConnection
>> -- though I haven't done any real benchmarking -- it does feel
>> snappier!
>> As as side note, I've also modified the WADL2Java implementation
>> so that it
>> uses Jersey client as a backend -- as a way of providing support
>> for these
>> features from a generated WADL client.
>>
>> I took the approach of simply creating a root ClientHandler and
>> ClientConfig
>> class (under impl). I didn't touch any of the Jersey Client API
>> code.
>> Basically the usage looks something like this:
>>
>>
>>
>> DefaultHttpClientConfig clientConfig = new DefaultHttpClientConfig();
>>
>> //
>> // Set the credentials (realm, host, port, username, password)
>> //
>> clientConfig.setCredentials (null, "host.inl.gov", 443, username,
>> password);
>> clientConfig.getProperties().put
>> (HttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION, Boolean.TRUE);
>>
>> Client c = new Client (new HttpClientHandler(), config);
>>
>>
>>
>> I've been testing my implementation for a week or so and things seems
>> stable. Unfortunately, I'm on my way out the door now and I'll be
>> away
>> from work for the rest of the week. I won't be able to get a
>> patch to you
>> guys till sometime next week at the earliest. Figured I'd
>> mentioned it now
>> since there seems to be interests in some of these features.
>>
>> -jOrGe W.
>>
>>
>>
>> Jeff Schmidt <jas_at_535consulting.com>
>>
>> 11/10/2008 09:48 AM
>>
>> Please respond to
>> users_at_jersey.dev.java.net
>> To
>> users_at_jersey.dev.java.net
>> cc
>> Subject
>> Re: [Jersey] Jersey Client and Basic Authentication
>>
>>
>>
>>
>> This would be great! :)
>>
>> Might I be so bold as to hope for preemptive authentication and
>> cookie
>> handling in order to maintain an HTTP session?
>>
>> Thanks!
>>
>> Jeff
>> --
>> Jeff Schmidt
>>
>> On Nov 10, 2008, at 1:38 AM, Paul Sandoz wrote:
>>
>>
>> On Nov 8, 2008, at 6:26 PM, Mike Jones wrote:
>>
>> Hi Paul,
>>
>> Is it worth revisiting Basic and Digest authentication support for
>> the
>> client now that 1.0 is released?
>>
>> Yes.
>>
>>
>> I'd be more than happy to try and
>> help out.
>>
>>
>> Great. How do you want to proceed? Do you want to send a patch?
>>
>> Paul.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>