Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-ad-ldap

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ad-ldap

Query Microsoft Active Directory

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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:

  • 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);

const items = await adClient.findUser("USER_NAME");

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

functionalities:

findUser(username)

/** return first found user or fail */
const user = await adClient.findUser("USER_NAME");

findUsers(query)

/** return array of users based on UPN */
const users = await adClient.findUsers("DOMAIN.COM");

findGroup(groupName, options)

/**return group or fail */
const group = await adClient.findGroup("GROUP_NAME");

getGroupMembershipForUser(username)

/**return array of groups */
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

  • make baseDN optional
  • add where param to queries to be able of search base on fields
  • get list of members of a group
  • add options to have better flexibility on filters and controls
  • specify return attributes
  • add Windows Integrated Authentication Kerberos
  • dynamic query generator

Credits

inspired by package activedirectory

Keywords

FAQs

Package last updated on 03 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc