[jcifs] Reg. NTLM Authentication
eglass1 at comcast.net
eglass1 at comcast.net
Wed Jun 2 14:52:10 GMT 2004
> I have to write a stand alone program
> to verify that a given user name/password is valid in
>
> a domain using ntlm protocol
>
> For this do I have to write both
> client side (for sending type 1 and 3 messages)
> and server side(for type 2 message) code?
>
> I think that will be not difficult.
>
> But in that case how does server respond to a type 3
> message
>
Define "standalone"; are you using jCIFS? If so, and you just need to
authenticate the credentials, you can do:
public boolean auth(String domain, String user, String password)
throws IOException {
NtlmPasswordAuthentication auth =
new NtlmPasswordAuthentication(domain, user, password);
UniAddress dc = UniAddress.getByName(domain, true);
try {
SmbSession.logon(dc, auth);
return true;
} catch (SmbAuthException) { }
return false;
}
This authenticates the provided credentials against a domain controller
for the specified domain. Do you actually need to pass the NTLM tokens back
and forth as part of a protocol? If so, the protocol determines how the
server and client process the tokens. For HTTP, for example, a
401-Unauthorized status is reported to the client. For SMB, you get a wire
exception (reported in jCIFS as the SmbAuthException seen above).
Does this answer your question?
Eric
More information about the jcifs
mailing list