When I started to dig into HtmlUnit and wanted to test
a third source application, I realized, there is no
means to achieve NTLM-Authentication to an application,
only to a proxy. Whereas the underlying
org.apache.commons.HttpClient does NTLM. Therefore I
added a method
public void addCredentials(Credentials cred)
{
credentials_.put( AuthScope.ANY, cred );
}
to the
com.gargoylesoftware.htmlunit.DefaultCredentialProvider.
You might consider this API "too open" or whatsoever,
but it allows HTMLUnit to use any Credential,
HTTPClient does, so you might want to include something
similar in a next HTMLUnit release. You probably want
to expose the "AuthScope" API of HTTPClient also HTMLUnit.
Cheers,
Frank
(Micro) patched version of DefaultCredentialsProvider
Logged In: YES
user_id=402164
Wouldn't it make more sense to add
public void addNTLCredentials( final String username,
final String password, final String host,
final int port, final String clientHost, final
String clientDomain )
This would better fit to the other methods of
DefaultCredentialProvider.
PS: please submit patches as patches
(http://htmlunit.sourceforge.net/submittingPatches.html) and
not as plain text
Logged In: YES
user_id=392154
Hi,
public void addNTLCredentials( final String username,
final String password, final String clientHost, final
String clientDomain )
since those 4 arguments are the ones required to build an
corresponding NTLMCrendential in Apache HttpClient.
I wonder if it makes sense to add more and more special
purpose addCredentialXYZ Methods (with and without AuthScope
to multiply by 2). When there is a new authentication in
HttpClient 3.1, you are behind again. I'd suggest to rather
expose the HttpClient-API. Might be a matter of taste.
I'm sorry I didn't consider this little hack of mine a
true patch.
Logged In: YES
user_id=402164
to 1: sure. I've copied from the NTLM proxy version and
forgotten to removed the unnecessary params
to 2: perhaps. In fact this could be a job for a second
time. I suppose that most of the time tests don't need to
specify special host rules and therefore the priority would
be now to make it working for something that seems to be
quite basic: a normal (not proxy) NTLM credential.
Logged In: YES
user_id=402164
Now implemented in CVS