hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "anir ........." <anir1...@gmail.com>
Subject Re: Issue with NTLM proxy authentication over Https
Date Thu, 11 Oct 2012 11:14:43 GMT
Hi Dave,

Thanks for your reply but i can't use the cron job in my present
environment .
I was looking for some workaround (if any) using httpClient itself.
Moreover this is a pretty generalized code for all AuthSchemes and so i
don't want to break
the uniformity.
Thanks for your help .

Regards,
Anirban

On Thu, Oct 11, 2012 at 4:33 PM, Godbey, David J. (HQ-LM020)[DIGITAL
MANAGEMENT INC.] <david.j.godbey@nasa.gov> wrote:

> Anirban,
> I have a cron job working that successfully connects to an Exchange Web
> Service via JAXWS protected by NTLMv2. I can post my code if you think it
> will help.
> Dave
>
> -----Original Message-----
> From: anir ......... [mailto:anir1234@gmail.com]
> Sent: Thursday, October 11, 2012 1:20 AM
> To: httpclient-users@hc.apache.org
> Subject: Issue with NTLM proxy authentication over Https
>
> Hi,
>
> I am trying to return a secure socket connection from my code if the
> authentication through a proxy is successful.
> My code is something like this :-
>
> .....
> *        if (tcp.getProxyUser() != null && tcp.getProxyPassword() != null)
> {
> *
> *            // add basic authentication header for the proxy*
> *            authstring = "Basic "*
> *                    + XMLUtils.base64encode((tcp.getProxyUser() + ":" +
> tcp
> *
> *                    .getProxyPassword()).getBytes());*
> *        }*
> *
> *
> * //try 3 times*
> *       for (int i = 0; i <= 2; i++) {*
> *
> *
> *            repondChallange(out, connect, authstring);*
> *
> *
> *            if (processProxyResponse(is)) {*
> *                return socket;*
> *            }*
> *            Header[] headers = extractHeaders(is);*
> *            authstring = getAuthString(tcp, port, host, headers);*
> *            while (is.available() > 0 && is.read() > 0) {*
> *                // read all*
> *            }*
> *            if (closeConnection(headers)) {*
> *                socket.close();*
> *                socket = new Socket(tcp.getProxyHost(), proxyPort, null,
> 0);*
> *                socket.setTcpNoDelay(true);*
> *                socket.setSoTimeout(0);*
> *                is = new BufferedInputStream(socket.getInputStream(),
> 2048);*
> *                out = new BufferedOutputStream(socket.getOutputStream(),
> 2048);*
> *            }*
> .....
>
> The RespondChallange Method writes to the output stream with headers like
> User-Agent: , Proxy-Authorization: .
> The method* processProxyResponse(is) *checks for the reply from the proxy
> server and returns true only if status code of 200 is encountered.
> The getAuthString method basically is a generic method which returns the
> string based on the authentication Scheme selected  and serves as the value
> for
> *Proxy-Authorization: *header :-
>
> .....
> *            ConnectMethod method = new ConnectMethod();*
> *            authstring = authscheme.authenticate(credentials, method);*
> .....
>
> My code works fine for Basic,Digest  Authentication but fails for NTLM
> scheme with Error code :- 407.
>
> Using the JCIFS library it works though.
> Just wanted to know if this is a known problem with apache commons
> httclient ??
> Is there a workaround for this ,since i am not too keen on using JCIFS
> library ??
>
> Thanks,
> Anirban
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message