Created
August 21, 2014 21:24
-
-
Save thegoleffect/311b9b41e7b769b8f252 to your computer and use it in GitHub Desktop.
basic ldapjs usage example
This file contains 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 LDAP = require('ldapjs'); | |
var protocol = "ldap://"; | |
var host = "..."; | |
var post = 3268; | |
var dn = "cn=Van Nguyen,..."; | |
var password = "some password"; | |
var client = LDAP.createClient({ | |
url: protocol + host + ":" + port | |
}); | |
//authenticate | |
client.bind(dn, password, function (err) { | |
if (err) { | |
throw err; | |
} | |
// authentication successful | |
// do stuff | |
// close connection when done | |
client.unbind(function(err){ | |
if (err) { | |
throw err; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Modify your code :)