NTLM Authentication

L

L.Pietrzak

Hi
I need to login to a server that uses NTLM authentication scheme.
I figured out sth like that :
Authenticator.setDefault(new MyAuthenticator(login,password));
URL url = new URL(httpPage);
URLConnection connection = url.openConnection();
PasswordAuthentication pa =
Authenticator.requestPasswordAuthentication(InetAddress
.getByName(connection.getURL().getHost()),
connection.getURL().getPort(), connection
.getURL().getProtocol(), null,
"NTLM");

MyAuthenticator is a class that extends Authenticator, and of course
implements properly (rather sure) getPasswordAuthentication() method.

The problem is that I always get Unauthorized access :/. I'm quite sure
that I'm providing good login and password.
The thing I think is causing the problem is "NTLM" argument that I'm
providing in requestPasswordAuthentication. API says, that there should
be a schema there, but I don't know what the schema for the NTLM is.
Can anyone help me?

Btw. If I put there "NTLM1" for example, I get the same response
(Unauthorized accesss).
Regards
 
R

Rogan Dawes

Hi
I need to login to a server that uses NTLM authentication scheme.
I figured out sth like that :
Authenticator.setDefault(new MyAuthenticator(login,password));
URL url = new URL(httpPage);
URLConnection connection = url.openConnection();
PasswordAuthentication pa =
Authenticator.requestPasswordAuthentication(InetAddress
.getByName(connection.getURL().getHost()),
connection.getURL().getPort(), connection
.getURL().getProtocol(), null,
"NTLM");

MyAuthenticator is a class that extends Authenticator, and of course
implements properly (rather sure) getPasswordAuthentication() method.

The problem is that I always get Unauthorized access :/. I'm quite sure
that I'm providing good login and password.
The thing I think is causing the problem is "NTLM" argument that I'm
providing in requestPasswordAuthentication. API says, that there should
be a schema there, but I don't know what the schema for the NTLM is.
Can anyone help me?

Btw. If I put there "NTLM1" for example, I get the same response
(Unauthorized accesss).
Regards

I think you are barking up the wrong tree with these classes.

I suggest you take a look at jCIFS (google it), which provides a working
NTLM authentication mechanism.

Regards,

Rogan
 
D

Desperate

Rogan said:
I think you are barking up the wrong tree with these classes.

I suggest you take a look at jCIFS (google it), which provides a working
NTLM authentication mechanism.

Unfortunately (AFAIK) jCIFS does not support NTLM v2, and I require
this feature.
 
R

Rogan Dawes

Desperate said:
I read here : http://oaklandsoftware.com/papers/ntlm.html that it
doesn't support it and didn't have much time to question it.
Are you saying that jCIFS supports NTLM v2 ?
Regards

No, I"m not. Indeed, it appears that it doesn't support NTLM v2.

However, I have seen mention of patches to support NTLM v2 in the Apache
HttpClient, by doing a bit of googling. They were not accepted due to
licensing concerns, but you may be able to integrate them yourself . . . .

And, if you are on a Windows Platform, it seems that NTLM auth IS
natively supported in Java, from v1.5 onwards. Apparently you need to
set some system properties to enable it. You might have been on the
right track after all . . . .

Regards,

Rogan
 
L

LukaszP

And, if you are on a Windows Platform, it seems that NTLM auth IS natively
supported in Java, from v1.5 onwards. Apparently you need to set some
system properties to enable it. You might have been on the right track
after all . . . .

I've done some googling myself, but didn't come up with any patches for the
commons.httpclient.There is a solution created by oakland software, but is
not free.
I've read on the page I mentioned earlier that the authentication can be
done using java, but no one said that it does support ntlm v2. My recent
experiences show, that it rather doesn't :/. I can't find any (!) example on
the web.
Thx for help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top