Unfortunately, the proxy connection is still not working. I'm in the position
where I guess I have to use an NTLM proxy. This proxy does not require
authentication (for example, I can configure my web browser to point to
proxy.server.com:8080 and the web browser connects fine) However, whenever I
try to do this from my Java app, I always get a "access denied" page from the
proxy. Here is what I've tried for my HttpClient proxy configuration:
HttpHost proxy
= new HttpHost("proxy.server.com", 8080);
httpClient.getParams().setParameter(
ConnRoutePNames.DEFAULT_PROXY, proxy
);
AuthScope authScope = new AuthScope("proxy.server.com", 8080,
"[REALM]", "ntlm");
Credentials credentials = new NTCredentials("[MY_NT_USERNAME]",
"[MY_NT_PASSWORD]", "[WORKSTATION]", "[DOMAIN]");
httpClient.getCredentialsProvider().setCredentials(
proxyAuthScope, proxyCredentials
);
Now, I'm not exactly sure what the exact values are suppose to used for
"[REALM]", "[MY_NT_USERNAME]", "[MY_NT_PASSWORD]", "[WORKSTATION]", and
"[DOMAIN]", but I have tried a number of different combinations and have yet to
hit a working solution.
Any additional thoughts?
________________________________
From: Oleg Kalnichevski <[email protected]>
To: Michael Remijan <[email protected]>
Cc: HttpClient User Discussion <[email protected]>
Sent: Thursday, September 8, 2011 4:57 PM
Subject: Re: Confused about target host and proxy authentication
On Thu, 2011-09-08 at 12:36 -0700, Michael Remijan wrote:
> Do you call
>
> httpclient.getCredentialsProvider().setCredentials(..)
>
> multiple times then for however many credentials you have?
>
>
Absolutely. HttpClient will make use of them as needed.
Oleg
>
>
>
>
>
> ________________________________
> From: Oleg Kalnichevski <[email protected]>
> To: Michael Remijan <[email protected]>
> Cc: HttpClient User Discussion <[email protected]>
> Sent: Thursday, September 8, 2011 2:11 PM
> Subject: Re: Confused about target host and proxy authentication
>
> On Thu, 2011-09-08 at 11:30 -0700, Michael Remijan wrote:
> >
> > I'm sorry, I forgot to include that information...
> >
> > <dependency>
> > <groupId>org.apache.httpcomponents</groupId>
> > <artifactId>httpclient</artifactId>
> > <version>4.1.2</version>
> > </dependency>
> >
> >
>
> Then, I am not sure I understand the problem. All you have to do is to
> configure the auth credentials provider with two sets of credentials
> (one or target server and another one for the proxy) as described here
> [1] and HttpClient will take care of the rest.
>
> Oleg
>
> [1]
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e971
>
>
>
>
>
> >
> > ________________________________
> > From: Oleg Kalnichevski <[email protected]>
> > To: Michael Remijan <[email protected]>
> > Cc: HttpClient User Discussion <[email protected]>
> > Sent: Thursday, September 8, 2011 1:22 PM
> > Subject: Re: Confused about target host and proxy authentication
> >
> > On Thu, 2011-09-08 at 10:15 -0700, Michael Remijan wrote:
> > > I am working in an environment where I need to specify a proxy as well as
> > > login to the proxy. After I have the connection to the proxy, I then
> > > need to also provide BASIC authentication to target host I'm contacting.
> > > I'm confused how to do this configuration. I have followed the examples
> > > and I know how to get a non-authenticating proxy to work and I have also
> > > followed the examples to provide BASIC authentication to my target host.
> > > In my case the usernames/passwords for both are different so I'm confused
> > > how to provide authenticating information for the proxy as well. Any
> > > help would be appreciated.
> >
> > What version of HttpClient are you using?
> >
> > Oleg
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]