LordOfPorts
asked on
LDAP Based Authentication Through Jscript
I am attempting to authenticate users through JScript (server side) code and Active Directory. In its current behavior the code below throws an empty exception (e.description == "") if the username and password are invalid and if they are valid the exception "Class doesn't support Automation" is thrown. Thank you very much for your advice!
function AuthenticateUser(sUsername, sPassword)
{
try {
var ADS_SECURE_AUTHENTICATION = 1;
var ADS_USE_ENCRYPTION = 2;
var objLDAP = GetObject("LDAP:");
if(objLDAP) {
var sResult = objLDAP.OpenDSObject("LDAP://xxxxxxx.xxxx.xxx/cn=users,dc=xxxxxx,dc=xxxx,dc=xxx", sUsername + "@XXXXXXX", sPassword, ADS_SECURE_AUTHENTICATION || ADS_USE_ENCRYPTION);
}
}
catch (e) {
log("Exception in AuthenticateUser: " + e.description);
throw(e);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Most excellent. Thank you very much!
http://groups.msn.com/windowsscript/general.msnw?action=get_message&mview=0&ID_Message=13007&ID_CLast=13016&CDir=1