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

@smertins27/ldap-auth-wrapper

v1.2.0

Published

Wiederverwendbares LDAP Self-Authentication Package

Downloads

15

Readme

@smertins27/ldap-auth-wrapper

Reusable LDAP self-authentication package built on top of ldap-authentication. It wraps the typical configuration and returns a consistent result object.

Installation

npm install @smertins27/ldap-auth-wrapper

Features

  • LDAP self-authentication (user binds with own credentials)
  • Simple result object: { authenticated, user, error }
  • Usable as a class or a helper function
  • TypeScript types included

Usage

1) Direct call via helper function

import { authenticateLdapUser } from '@smertins27/ldap-auth-wrapper';

const result = await authenticateLdapUser({
  ldapOpts: { url: 'ldaps://ldap.example.org', tlsOptions: { rejectUnauthorized: false } },
  userDn: 'uid=jdoe,ou=people,dc=example,dc=org',
  userPassword: 'secret',
  attributes: ['dn', 'cn', 'mail'],
});

if (result.authenticated) {
  console.log('OK', result.user);
} else {
  console.log('FAIL', result.error);
}

2) Reuse via the class

import { LdapSelfAuthenticator } from '@smertins27/ldap-auth-wrapper';

const authenticator = new LdapSelfAuthenticator({
  ldapOpts: { url: 'ldap://ldap.example.org' },
  userDn: 'uid=jdoe,ou=people,dc=example,dc=org',
  attributes: ['dn', 'cn', 'mail'],
});

const result = await authenticator.authenticate('secret');

Configuration

SelfAuthConfig

  • ldapOpts (required): LDAP connection options.
  • userDn (required): Distinguished Name of the user.
  • userPassword (required): User password (only for authenticateLdapUser).
  • userSearchBase (optional): Base DN for user lookup.
  • usernameAttribute (optional): Username attribute (e.g. uid).
  • username (optional): Username for self-auth.
  • attributes (optional): LDAP attributes to return.
  • groupsSearchBase (optional): Base DN for group lookup.
  • groupClass (optional): LDAP group class (e.g. groupOfNames).
  • groupMemberAttribute (optional): Group membership attribute.
  • starttls (optional): Enable StartTLS.

LdapOptions

  • url (required): LDAP URL, e.g. ldap:// or ldaps://.
  • tlsOptions (optional): TLS settings (e.g. rejectUnauthorized).
  • connectTimeout (optional): Timeout in ms.

Return value

AuthenticationResult:

{
  authenticated: boolean;
  user?: LdapUser | null;
  error?: unknown;
}

On success, user contains LDAP data; otherwise it is null. If an error occurs (for example from the underlying LDAP library), error is set.

Notes

  • Errors are caught and returned as authenticated: false.
  • This package uses ldap-authentication under the hood.

License

MIT