Guest User

Untitled

a guest
Apr 26th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. var LDAP = require('ldapjs');
  2.  
  3. var protocol = "ldap://";
  4. var host = "...";
  5. var post = 3268;
  6. var dn = "cn=Van Nguyen,...";
  7. var password = "some password";
  8.  
  9. var client = LDAP.createClient({
  10. url: protocol + host + ":" + port
  11. });
  12.  
  13. //authenticate
  14. client.bind(dn, password, function (err) {
  15.  
  16. if (err) {
  17. throw err;
  18. }
  19.  
  20. // authentication successful
  21. // do stuff
  22.  
  23. // close connection when done
  24. client.unbind(function(err){
  25.  
  26. if (err) {
  27. throw err;
  28. }
  29. });
  30. });
Add Comment
Please, Sign In to add comment