I'm developing a simple node app using ldapjs. Unfortunately, I'm not sure how to make the connection with ldap.
Our IT department gave me the below credentials (some redacted for security).
My app.js file looks like the following. I just need to retrieve a user's data (given a username and password).
var ldap = require('ldapjs');
var client = ldap.createClient({
url: 'ldap://xx.xxx.xxx.xxxx/dc=xxxxx,dc=org'
});
var opts = {
filter: '(objectclass=user)',
scope: 'sub',
attributes: ['objectGUID']
};
client.bind('xx@xxxx.org', 'xxxx', function (err) {
console.log("Logging data...");
client.search('dc=xxxx,dc=org', function (err, search) {
search.on('searchEntry', function (entry) {
var user = entry.object;
console.log(user.objectGUID);
});
});
});
Any help is greatly appreciated. Thanks.