users@jersey.java.net

[Jersey] Re: How to make authenticated request to a jersey endpoint protected using spring-security

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Tue, 01 Nov 2011 11:15:37 +0100

Hi Farrukh,

HTTPBasicAuthFilter is already part of jersey-client, you can use as
easy as:

         Client c = Client.create();
         // client basic auth filter
         c.addFilter(new HTTPBasicAuthFilter("user", "password"));
         WebResource r = c.resource(Server.BASE_URI);
         ...

Regards,
Pavel

On 10/31/11 8:25 PM, Farrukh Najmi wrote:
>
> I am unable to find where the solution posted by Jorge L Williams and
> reviewed by Paul Sandoz as "Patch: HttpClient backend to Jersey Client
> <http://jersey.576304.n2.nabble.com/Re-Patch-HttpClient-backend-to-Jersey-Client-td1557083.html>"
> resides.
> Can some one familiar with this thread please help me locate the code
> that was the final outcome of that thread. Thanks for your help.
>
> On 10/31/2011 11:18 AM, Farrukh Najmi wrote:
>>
>> The last solution discussed on this thread:
>>
>> http://jersey.576304.n2.nabble.com/Jersey-Client-and-Basic-Authentication-tt735377.html#a1481578
>>
>> seems to be not a new ClientFilter but "adding an Apache HTTPClient
>> backend to Jersey client".
>> Latest version of Apache HTTPClient seems to be:
>>
>> http://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.1.2
>>
>> I will try using that unless someone has a better suggestion. Thank you.
>>
>>
>> On 10/31/2011 11:09 AM, Farrukh Najmi wrote:
>>>
>>> This archived thread seems related to my question:
>>>
>>> http://jersey.576304.n2.nabble.com/Jersey-Client-and-Basic-Authentication-td735377.html
>>>
>>> Since the thread is 3 years old I was hoping that the ClientFilter
>>> solution proposed by Mike Jones-2
>>> <http://jersey.576304.n2.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=124319>
>>> and Paul Sandoz
>>> <http://jersey.576304.n2.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=229235>
>>> is now part of jersey contrib.
>>> I did not find it. The ClientFilter Mike Jones-2
>>> <http://jersey.576304.n2.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=124319>
>>> posted here
>>> <http://jersey.576304.n2.nabble.com/Jersey-Client-and-Basic-Authentication-tt735377.html#a789433>
>>> no longer is available. Can anyone please tell me if this work was
>>> ever saved somewhere?
>>>
>>> On 10/29/2011 01:17 PM, Farrukh Najmi wrote:
>>>> Hi Guys,
>>>>
>>>> This is more of a spring question so I have posted it in spring forum:
>>>>
>>>> http://forum.springsource.org/showthread.php?116506-How-to-test-authenticated-access-to-endpoint-secured-with-spring-security&p=385173#post385173
>>>>
>>>>
>>>> If any one has the answer in the jersey community please share.
>>>> Thank you.
>
> --
> Regards,
> Farrukh Najmi
>
> Web:http://www.wellfleetsoftware.com
>