public Principal authenticate(String username,
String credentials) {
UniAddress machine;
String host;
host = Util.GetDCName(domain).replace('\\", ' ").trim();
log("Authenticating against host " + host);
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(domain, username, credentials);
try {
machine = UniAddress.getByName(host);
log("Authenticating against address " + machine);
} catch(java.net.UnknownHostException e) {
log("Exception finding domain controller", e);
return null;
}
try {
SmbSession.logon(machine, auth);
return new NTDCPrincipal(this, username, credentials);
} catch(jcifs.smb.SmbException e) {
log("Exception logging onto domain controller", e);
return null;
}
}
|