Created
March 18, 2020 16:00
-
-
Save prodehghan/5fb96403404e73f28b7763b48d92cb4f to your computer and use it in GitHub Desktop.
A test for active directory authentication, using "ldapauth-fork" library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var LdapAuth = require('ldapauth-fork'); | |
var ldap = new LdapAuth({ | |
url: 'ldap://sgdc.SYSTEMGROUP.NET', | |
bindDN: "[email protected]",//"CN=MohammadHasan Dehghan,OU=Users,OU=MIS,OU=VNK,OU=SG Main,DC=systemgroup,DC=net", | |
bindCredentials: 'your_password', // <-- supply a valid email and password | |
searchBase: 'DC=systemgroup,DC=net', | |
searchFilter: '(|(samaccountname={{username}})(mail={{username}}))', | |
reconnect: true | |
}); | |
ldap.authenticate('user_name', 'password', function (err, user) { | |
if (err) { | |
return console.log(err); | |
} | |
else { | |
console.log('succeeded:'); | |
console.log(user); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment