Simple LDAP Search
Searches LDAP. Nothing fancy.
A thin, promisified wrapper over LDAPjs's client.
Installation
$ npm install --save simple-ldap-search
Usage
import SimpleLDAP from 'simple-ldap-search';
const config = {
url: 'ldap://0.0.0.0:1389',
base: 'dc=users,dc=localhost',
dn: 'cn=root',
password: 'secret',
tlsOptions: {
},
};
const ldap = new SimpleLDAP(config);
const filter = '(uid=artvandelay)';
const attributes = ['idNumber', 'uid', 'givenName', 'sn', 'telephoneNumber'];
const users = await ldap.search(filter, attributes);
API
ldap.search(filter, attributes)
Parameters
filter
: filters results.attributes
: a list of attributes to return
Returns
- A promise for the results
ldap.destroy()
Destroys the connection to the LDAP server. Use when all done with LDAP client.