-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
35 lines (30 loc) · 855 Bytes
/
example.js
File metadata and controls
35 lines (30 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var ldap = require('ldapjs');
var client = ldap.createClient({
url: 'ldap://test.directory.cornell.edu:389',
timeout: 5000
});
var opts = {
filter: '(uid=kps1)',
scope: 'sub',
attributes: ['dn', 'sn', 'cn', 'givenname']
};
client.search('ou=People,o=Cornell University, c=US', opts, function(err, res) {
//assert.ifError(err);
res.on('searchEntry', function(entry) {
console.log('entry: ' + JSON.stringify(entry.object));
});
res.on('searchReference', function(referral) {
console.log('referral: ' + referral.uris.join());
});
res.on('error', function(err) {
console.error('error: ' + err.message);
});
res.on('end', function(result) {
console.log('status: ' + result.status);
console.log("The end is nigh!");
client.unbind(function(err) {
//assert.ifError(err);
});
});
console.log("fin");
});