npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ldap-connector-client

v1.0.1

Published

Define the environment variables to configure the LDAP client:

Readme

Configuration

Define the environment variables to configure the LDAP client:

  • url: LDAP server URL, e.g., ldap://127.0.0.1:1389
  • userBase: Base for user searches, e.g., dc=example,dc=com
  • authorizedGroups: Comma-separated list of authorized groups

Example configuration:

const config = {
    url: process.env.LDAP_URL,
    userBase: process.env.LDAP_USER_BASE,
    authorizedGroups: process.env.LDAP_AUTHORIZED_GROUPS
};

Usage

Connecting to the LDAP Server

Import the LDAP client and create an instance of the LdapClient class with the configured settings.

const LdapClient = require('ldap-client-connector');
const client = new LdapClient(config);
await client.connect();

User Authentication

Use the bind method to authenticate a user by providing their username and password.

async function authenticateUser(username, password) {
    try {
        await client.bind(username, password);
        console.log('User successfully authenticated!');
    } catch (error) {
        console.error('Authentication failed:', error);
    }
}

Retrieving User Information

After successful authentication, retrieve user information such as groups and email.

const groups = await client.getUserGroups(username);
const email = await client.getUserEmail(username);
console.log('User Groups:', groups);
console.log('User Email:', email);

Authorization Check

Verify if the user is part of any authorized groups:

if (client.isAuthorized(groups)) {
    console.log('User is authorized.');
} else {
    console.log('User is not authorized.');
}

Disconnecting

When done, disconnect from the LDAP server.

await client.unbind();

Complete Documentation

For a comprehensive list of methods and configuration options, refer to the LdapClient documentation, to see it start a live server from the index.html inside the docs/ folder.