RE: HttpClient + HTTPS + NTLM Authentication = HTTP/1.1401AccessDenied

2004-10-02 Thread Oleg Kalnichevski
faultHttpParams - Set parameter
> http.datep
> arser.patterns = [EEE, dd MMM  HH:mm:ss zzz, , dd-MMM-yy
> HH:mm:ss zzz, E
> EE MMM d HH:mm:ss , EEE, dd-MMM- HH:mm:ss z, EEE, dd-MMM-
> HH-mm-ss z
> , EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM- HH:mm:ss z, EEE dd MMM 
> HH:mm:s
> s z, EEE dd-MMM- HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE dd MMM yy
> HH:mm:s
> s z, EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM- HH:mm:ss z, EEE,
> dd-MM- HH:mm
> :ss z]
> 2004/10/01 16:33:03:400 CDT [DEBUG] HttpMethodBase - Adding Host request
> header
> 2004/10/01 16:33:03:581 CDT [DEBUG] HttpMethodDirector - Authorization
> required
> 2004/10/01 16:33:03:591 CDT [DEBUG] AuthChallengeProcessor - Supported
> authentic
> ation schemes in the order of preference: [ntlm, digest, basic]
> 2004/10/01 16:33:03:591 CDT [INFO] AuthChallengeProcessor - ntlm
> authentication
> scheme selected
> 2004/10/01 16:33:03:591 CDT [DEBUG] AuthChallengeProcessor - Using
> authenticatio
> n scheme: ntlm
> 2004/10/01 16:33:03:591 CDT [DEBUG] HttpMethodBase - Should close
> connection in
> response to Connection: close
> 
> 2004/10/01 16:33:03:591 CDT [DEBUG] HttpConnection - Connection is
> locked.  Call
>  to releaseConnection() ignored.
> 2004/10/01 16:33:03:591 CDT [DEBUG] HttpMethodDirector - Authenticating
> with NTL
> M @keystone.ibanksystems.com:443
> 2004/10/01 16:33:03:631 CDT [DEBUG] HttpMethodBase - Adding Host request
> header
> 2004/10/01 16:33:03:721 CDT [DEBUG] HttpMethodDirector - Authorization
> required
> 2004/10/01 16:33:03:721 CDT [DEBUG] AuthChallengeProcessor - Using
> authenticatio
> n scheme: ntlm
> 2004/10/01 16:33:03:721 CDT [DEBUG] HttpMethodBase - Resorting to
> protocol versi
> on default close connection policy
> 2004/10/01 16:33:03:721 CDT [DEBUG] HttpMethodBase - Should NOT close
> connection
> , using HTTP/1.1
> 2004/10/01 16:33:03:721 CDT [DEBUG] HttpConnection - Connection is
> locked.  Call
>  to releaseConnection() ignored.
> 2004/10/01 16:33:03:721 CDT [DEBUG] HttpMethodDirector - Authenticating
> with NTL
> M @keystone.ibanksystems.com:443
> 2004/10/01 16:33:03:981 CDT [DEBUG] HttpMethodBase - Adding Host request
> header
> 2004/10/01 16:33:04:181 CDT [DEBUG] HttpMethodBase - Cookie accepted:
> "$Version=
> 0; ASPSESSIONIDSCSBSCQC=JPOFEEOCIJAFDEDGLEKGIKDC; $Path=/"
> Status Code 1:  200
> 2004/10/01 16:33:04:181 CDT [DEBUG] HttpMethodBase - Buffering response
> body
> 2004/10/01 16:33:04:181 CDT [DEBUG] HttpMethodBase - Resorting to
> protocol versi
> on default close connection policy
> 2004/10/01 16:33:04:191 CDT [DEBUG] HttpMethodBase - Should NOT close
> connection
> , using HTTP/1.1
> 2004/10/01 16:33:04:191 CDT [DEBUG] HttpConnection - Releasing
> connection back t
> o connection manager.
> 2004/10/01 16:33:04:191 CDT [DEBUG] HttpMethodBase - Default charset
> used: ISO-8
> 859-1
> **keystone.ibanksystems.com Site Manager (Upload
> Page) ITLE>
>  keyston
> e.ibanksystems.com>
> 
> 
> 
>  FACE="Arial,
> Helvetica, sans-serif">keystone.ibanksystems.com ( SIZE=1>USER: IBAN
> KSYSTEMS\JWILLIAMSON)
>  FACE="Arial, Helvet
> ica, sans-serif" SIZE=4 COLOR="#FF"> Site Manager (Upload
> Page)<
> /FONT>
>  =2>Use this page to upload a single document to this web
> site.
> 
> 
> 
>  BGCOLOR="#E0E0E0" VALI
> GN=""TOP"">
>  ACTION="siteman.asp?u=D&d=c:\i
> m\">
> NAME OF DESTINATION
> FOLDER ON W
> EB SITE
> c:\im\
> PATHNAME OF LOCAL
> DOCUMENT(
> SEND THIS FILE TO THE WEB SERVER) NAME="F1"
> >
>   
> 
> If the
> [BROWSE...] bu
> tton is not displayed,
> you must upgrade your http://www.netscape.com";>Netscape
> or http://www.microsoft.com";>Microsoft browser.
> 
> 
> Your browser:HTTP_USER_AGENT: Jakarta
> Commons-HttpClient/3.0-alpha2
> 
> 
> 
> 
> 
> 
> 
>  COLOR="#66" SIZE=
> 3 FACE="Arial, Helvetica, sans-serif">keystone.ibanksystems.com ( SIZE=1>US
> ER: IBANKSYSTEMS\JWILLIAMSON)Friday, October 01, 2004
>   4
> :33:02 PM
> AnyPortal Site Manager (Upload Page) © Copyright 2004 by  TITLE="www.
> anyportal.com is a project of the ANDMORE Companies -- Houston, Texas"
> HREF="htt
> p://www.anyportal.com">www.AnyPortal.com
> 
> 
> 
> 2004/10/01 16:33:04:201 CDT [DEBUG] DefaultHttpParams - Set parameter
> http.proto
> col.expect-continue = true
> 2004/10/01 16:33:04:212 CDT [DEBUG] HttpMethodBase - Adding Host request
> header
> 2004/10/01 16:33:04:252 CDT [DEBUG] HttpMethodB

RE: HttpClient + HTTPS + NTLM Authentication = HTTP/1.1401AccessDenied

2004-10-01 Thread Burke, Christopher
rector - Authenticating
with NTL
M @keystone.ibanksystems.com:443
2004/10/01 16:33:03:631 CDT [DEBUG] HttpMethodBase - Adding Host request
header
2004/10/01 16:33:03:721 CDT [DEBUG] HttpMethodDirector - Authorization
required
2004/10/01 16:33:03:721 CDT [DEBUG] AuthChallengeProcessor - Using
authenticatio
n scheme: ntlm
2004/10/01 16:33:03:721 CDT [DEBUG] HttpMethodBase - Resorting to
protocol versi
on default close connection policy
2004/10/01 16:33:03:721 CDT [DEBUG] HttpMethodBase - Should NOT close
connection
, using HTTP/1.1
2004/10/01 16:33:03:721 CDT [DEBUG] HttpConnection - Connection is
locked.  Call
 to releaseConnection() ignored.
2004/10/01 16:33:03:721 CDT [DEBUG] HttpMethodDirector - Authenticating
with NTL
M @keystone.ibanksystems.com:443
2004/10/01 16:33:03:981 CDT [DEBUG] HttpMethodBase - Adding Host request
header
2004/10/01 16:33:04:181 CDT [DEBUG] HttpMethodBase - Cookie accepted:
"$Version=
0; ASPSESSIONIDSCSBSCQC=JPOFEEOCIJAFDEDGLEKGIKDC; $Path=/"
Status Code 1:  200
2004/10/01 16:33:04:181 CDT [DEBUG] HttpMethodBase - Buffering response
body
2004/10/01 16:33:04:181 CDT [DEBUG] HttpMethodBase - Resorting to
protocol versi
on default close connection policy
2004/10/01 16:33:04:191 CDT [DEBUG] HttpMethodBase - Should NOT close
connection
, using HTTP/1.1
2004/10/01 16:33:04:191 CDT [DEBUG] HttpConnection - Releasing
connection back t
o connection manager.
2004/10/01 16:33:04:191 CDT [DEBUG] HttpMethodBase - Default charset
used: ISO-8
859-1
**keystone.ibanksystems.com Site Manager (Upload
Page)




keystone.ibanksystems.com (USER: IBAN
KSYSTEMS\JWILLIAMSON)
 Site Manager (Upload
Page)<
/FONT>
Use this page to upload a single document to this web
site.





NAME OF DESTINATION
FOLDER ON W
EB SITE
c:\im\
PATHNAME OF LOCAL
DOCUMENT(
SEND THIS FILE TO THE WEB SERVER)
  

If the
[BROWSE...] bu
tton is not displayed,
you must upgrade your http://www.netscape.com";>Netscape
or http://www.microsoft.com";>Microsoft browser.


Your browser:HTTP_USER_AGENT: Jakarta
Commons-HttpClient/3.0-alpha2







keystone.ibanksystems.com (US
ER: IBANKSYSTEMS\JWILLIAMSON)Friday, October 01, 2004
  4
:33:02 PM
AnyPortal Site Manager (Upload Page) © Copyright 2004 by www.AnyPortal.com



2004/10/01 16:33:04:201 CDT [DEBUG] DefaultHttpParams - Set parameter
http.proto
col.expect-continue = true
2004/10/01 16:33:04:212 CDT [DEBUG] HttpMethodBase - Adding Host request
header
2004/10/01 16:33:04:252 CDT [DEBUG] HttpMethodBase - OK to continue
received
** Status Code 2:  200
2004/10/01 16:33:04:322 CDT [DEBUG] HttpMethodBase - Resorting to
protocol versi
on default close connection policy
2004/10/01 16:33:04:322 CDT [DEBUG] HttpMethodBase - Should NOT close
connection
, using HTTP/1.1
2004/10/01 16:33:04:322 CDT [DEBUG] HttpConnection - Releasing
connection back t
o connection manager.
Press any key to continue . . .

Thanks,
Chris


-Original Message-
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 30, 2004 12:42 PM
To: Commons HttpClient Project
Subject: RE: HttpClient + HTTPS + NTLM Authentication =
HTTP/1.1401AccessDenied

On Thu, 2004-09-30 at 17:14, Burke, Christopher wrote:
> Oleg,
> Thanks for your continued help.  I have done a few additional items.
> First, I have upgraded to HttpClient 3.0 Alpha 2.  Second, I have
> implemented the 'expect: continue' handshake.  This has not fixed the
> problem.  
> 
> Really no idea what do to know.  
> 

Christopher,
Beat me with a stick, but I have no clue either. This is what I suggest

(1) Activate content logging (see the logging guide for details)

http://jakarta.apache.org/commons/httpclient/3.0/logging.html

to make sure that HttpClient does send the file.

(2) Consider executing GET or HEAD against a protected URL on the server
to trigger authentication prior to executing the POST with the payload

(3) If you have access to the server, consider turning off NTLM
authentication. Since you use SSL there's no point in using NTLM. Basic
authentication over SSL is basically as secure as it gets

Hope this brings you a bit further

Oleg

> Code:
> 
> NTCredentials creds = new NTCredentials(uid,pwd,host,domain);
> HttpClient client = new HttpClient();
> MultipartPostMethod mpPostMethod = new MultipartPostMethod(url);
> 
>
mpPostMethod.getParams().setParameter(HttpMethodParams.USE_EXPECT_CONTIN
> UE, new Boolean(true));
> 
> client.getState().setCredentials(new AuthScope(host,port), creds);
> 
> File f = new File("C:\\secureHttp\\anotherLog.log");
> 
> mpPostMethod.addParameter("F1",f.getName(),f);
> //mpPostMethod.addParameter("F1",f);
> 
> int statusCode = client.executeMethod(mpPostMethod);
> 
> System.out.println("Status Line:  " + mpPostMethod.getStatusLine());
> System.out.println("Status Code:  " + statusCode);
> 
> mpPostMethod.rele