Active directory connection
Connection to Microsoft Active Directory using LDAPjs
- Promise based functions
- type-safe with Typescript
- high-level functions to query from MS AD easily
How to use it:
import { IClientConfig, AdClient } from "node-ad-ldap";
const config: IClientConfig = {
url: "ldap://Domain.com" ,
bindDN: "{USER_NAME}" ,
secret: "{PASSWORD}" ,
baseDN: "{ROOT_OF_TREE}" ,
};
const adClient = new AdClient(config);
const items = await adClient.findUser("USER_NAME");
adClient.unbind();
functionalities:
findUser(username)
const user = await adClient.findUser("USER_NAME");
findUsers(query)
const users = await adClient.findUsers("DOMAIN.COM");
findGroup(groupName, options)
const group = await adClient.findGroup("GROUP_NAME");
getGroupMembershipForUser(username)
const groups = await adClient.getGroupMembershipForUser("USER_NAME");
bind()
returns a connected ldap client that is useful for use flexibility of ldap.js directly.
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
Credits