1.5.0 • Published 4 years ago
node-ad-ldap v1.5.0
Active directory connection
LDAP Client to do low level promise base interaction with ldap server
- Promise based functions
- type-safe with Typescript
How to use it:
npm i node-ad-ldap
import { IClientConfig, AdClient } from "node-ad-ldap";
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 adClient = new AdClient(config);
// do something with functionalities
// always free-Up after you done the job!
adClient.unbind();
API DOC
for full API documentation look at API Website
functionalities:
async queryAttributes()
/** get displayName of all users */
const users = await adClient.queryAttributes({
options: {
filter:
"(&(|(objectClass=user)(objectClass=person))(!(objectClass=computer))(!(objectClass=group)))",
attributes: ["displayName"],
scope: "sub",
paged: true,
},
});
// always unbind after finish the operation to prevent memory leak
adClient.unbind();
Advance Uses:
async query() (raw search to provided full flexibility)
/** get displayName and distinguished name of empty groups */
const groups = await adClient.query({
options: {
filter: "(&(objectClass=group)(!(member=*)))",
attributes: ["displayName", "dn"],
scope: "sub",
paged: true,
},
});
// always unbind after finish the operation to prevent memory leak
adClient.unbind();
async bind() to access underlying api. returns a connected ldap.js client.
NOTICE: lpad.js is using node EventEmitters not ES6 Promises
adClient.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
1.5.0
4 years ago
1.4.0
4 years ago
1.3.0
4 years ago
1.2.0
4 years ago
1.2.1
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.1.7
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.4
4 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago