[jcifs] Re: SPNEGO NTLM

Jeffrey Winter jeffreywinter at gmail.com
Wed Jun 23 18:05:21 GMT 2004

Jeffrey Winter <jeffreywinter <at> gmail.com> writes:

Actually, I believe I discovered the problem:

In Authenticate.processNtlm() you're only creating
the challenge for the Type2 token, not for the 
NtlmPasswordAuthentication object.

I made a createChallenge() method in Authenticate
from the code in the case 1 block and call
it in both case 1 and case 3.  I am now able to
authenticate in the "WWW-Authenticate" "Negotiate"
mode wit NTLM


private byte[] createChallenge() 
  throws SmbException, UnknownHostException
 boolean loadBalance = false;
 String domainController =

 if (domainController == null) {
  domainController = getProperty("jcifs.smb.client.domain");
  String balance = getProperty("jcifs.http.loadBalance");
  loadBalance = (balance != null) ?
  Boolean.valueOf(balance).booleanValue() : true;

 UniAddress dc = loadBalance ? new UniAddress(
   NbtAddress.getByName(domainController, 0x1c, null)) :
   UniAddress.getByName(domainController, true);

  return SmbSession.getChallenge(dc);

More information about the jcifs mailing list