0.14.8 • Published 2 years ago

ldap-ts-client v0.14.8

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

Type-safe Promise base LDAP Client

LDAP Client to do low level promise base interaction with ldap server

How to use it:

  • npm i ldap-ts-client
import { IClientConfig, LdapClient } from "ldap-ts-client";

const config: IClientConfig = {
  url: "ldap://Domain.com" /** Domain name here */,
  bindDN: "{USER_NAME}" /** user name to connect to AD server */,
  secret: "{PASSWORD}" /** password for account */,
  baseDN: "{ROOT_OF_TREE}" /** root of tree that want to query */,
};

const client = new LdapClient(config);

// do something with client!

// always free-Up after you done the job!
client.unbind();

API Documentation

for full API documentation look at API Website.

functionalities:

async queryAttributes()

/** get displayName of all users */
const users = await client.queryAttributes({
  attributes: ["displayName"],
  options: {
    filter:
      "(&(|(objectClass=user)(objectClass=person))(!(objectClass=computer))(!(objectClass=group)))",
    scope: "sub",
    paged: true,
  },
});

// always unbind after finish the operation to prevent memory leak
client.unbind();

Advance Uses:

async query() (raw search to provided full flexibility)

/** get displayName and distinguished name  of empty groups */
const groups = await client.query({
  attributes: ["displayName", "dn"],
  options: {
    filter: "(&(objectClass=group)(!(member=*)))",
    scope: "sub",
    paged: true,
  },
});

// always unbind after finish the operation to prevent memory leak
client.unbind();

async bind() to access underlying api. returns a connected ldap.js client.

NOTICE: lpad.js is using node EventEmitters not ES6 Promises

client.bind().then((client) => {
  client.search(this.config.baseDN, opts, (err, res) => {
    if (err) {
      reject(err);
    }
    res.on("searchEntry", (entry) => {});
    res.on("error", (err) => {});
    res.on("end", function (result) {
      client.unbind();
    });
  });
});

TODO

  • remove dependency to ldap.js package
  • add Windows Integrated Authentication Kerberos
0.14.5

2 years ago

0.14.6

2 years ago

0.14.7

2 years ago

0.14.8

2 years ago

0.14.4

2 years ago

0.14.3

3 years ago

0.14.2

3 years ago

0.14.0

4 years ago

0.12.0

4 years ago

0.13.0

4 years ago

0.13.1

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.1

4 years ago

0.10.2

4 years ago

0.10.0

4 years ago

0.9.1

4 years ago

0.9.1-beta10

4 years ago

0.9.1-beta8

4 years ago

0.9.1-beta7

4 years ago

0.9.1-beta9

4 years ago

0.9.1-beta6

4 years ago

0.9.1-beta5

4 years ago

0.9.1-beta4

4 years ago

0.9.1-beta2

4 years ago

0.9.1-beta3

4 years ago

0.9.1-beta1

4 years ago

0.9.0

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago