3.1.2 • Published 2 years ago

simple-ldap-search v3.1.2

Weekly downloads
242
License
MIT
Repository
github
Last release
2 years ago

Simple LDAP Search

NPM Version

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',
  // optionally pass tls options to ldapjs
  tlsOptions: {
    // tls options ...
  },
};

// create a new client
const ldap = new SimpleLDAP(config);

// setup a filter and attributes for your LDAP query
const filter = '(uid=artvandelay)';
const attributes = ['idNumber', 'uid', 'givenName', 'sn', 'telephoneNumber'];

// using async/await
const users = await ldap.search(filter, attributes);

// [{
//   dn: 'uid=artvandelay, dc=users, dc=localhost',
//   idNumber: 1234567,
//   uid: 'artvandelay',
//   givenName: 'Art',
//   sn: 'Vandelay',
//   telephoneNumber: '555-123-4567',
// }]

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.

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.11

5 years ago

2.0.10

6 years ago

2.0.9

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.4

6 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago