Active directory connection
LDAP Client to do low level promise base interaction with ldap server
How to use it:
import { IClientConfig, LdapClient } from "ldap-ts-client";
const config: IClientConfig = {
url: "ldap://Domain.com" ,
bindDN: "{USER_NAME}" ,
secret: "{PASSWORD}" ,
baseDN: "{ROOT_OF_TREE}" ,
};
const client = new LdapClient(config);
client.unbind();
API DOC
for full API documentation look at API Website
functionalities:
async queryAttributes()
const users = await client.queryAttributes({
options: {
filter:
"(&(|(objectClass=user)(objectClass=person))(!(objectClass=computer))(!(objectClass=group)))",
attributes: ["displayName"],
scope: "sub",
paged: true,
},
});
client.unbind();
Advance Uses:
async query() (raw search to provided full flexibility)
const groups = await client.query({
options: {
filter: "(&(objectClass=group)(!(member=*)))",
attributes: ["displayName", "dn"],
scope: "sub",
paged: true,
},
});
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