Last active
November 25, 2020 15:29
-
-
Save michimau/fd900651df60b758a77ea42bdada5805 to your computer and use it in GitHub Desktop.
ldapjs ldaps example
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 ldapjs = require('ldapjs'); | |
let host = process.env.ldaphost || 'changeme'; | |
let username = process.env.ldapusername || 'changeme'; | |
let dn = process.env.ldapdn || 'ou=changeme,o=changeme,l=changeme'; | |
let password = process.env.ldappassword || 'changeme'; | |
let client = ldapjs.createClient ({ url: 'ldaps://' + host }); | |
client.bind('uid=' + username + ',' + ldapdn, password, function (err) { | |
if (err) { | |
console.log('LDAP bind error: ' + err); | |
} else { | |
console.log('LDAP bind success'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment