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 🙏

© 2024 – Pkg Stats / Ryan Hefner

easy-ldap-login

v0.1.8

Published

easy-ldap-login allows you to easily authenticate users on LDAP server and check if they are in a specific group

Downloads

14

Readme

easy-ldap-login

easy-ldap-login is a wrapper of ldapjs package that allows you to easily authenticate users on LDAP server and check if they are in a specific group.

Installation

npm i easy-ldap-login

Usage

const LDAPLogin = require( 'easy-ldap-login' );
const ldapLogin = new LDAPLogin( 'ldap://myldap01.server.com', 'dc=domain,dc=com', { searchGroups: 'team_marketing', userSearchAttributes: ['givenName'] } );
ldapLogin.auth( 'userName', 'password' )
.then( userAttrs => console.log( `Hello ${userAttrs.givenName}!` ) )
.catch( () => console.log( 'Wrong credentials' ) );

Methods

LDAPLogin.constructor

new LDAPLogin( serverUrls: String | Array, dcString: String [, options: Object = {} ] );

Parameters

  • serverUrls Required - URL of the ldap server as String or an Array of URL Strings for round-robin
  • dcString Required - String that identifies Domain Component
  • options Optional - Module options as an Object with some properties:
    • usersOu Optional - String that identifies Organization Unit base for Users (Default: 'ou=users')
    • userAttribute Optional - String that identifies ID attribute for Users (Default: 'uid')
    • groupsOu Optional - String that identifies Organization Unit base for Groups (Default: 'ou=groups')
    • groupMemberAttribute Optional - String that identifies Group attribute to use for searching its members (Default: 'member')
    • searchGroups Optional - It can be one of these:
      • String that identifies Common Name of Group that User must have
      • Object with properties:
        • cn Required - String that identifies Common Name of the Group that User must have
        • ou Required - String that identifies Organization Unit base string of the Group
        • userAttribute Optional - String that identifies ID attribute for Users in the Group
        • groupMemberAttribute Optional - String that identifies Group attribute to use for searching its members
      • Array of the previous data for multiple groups
    • userSearchAttributes Optional - Array of Strings that indentify user attributes you want to retrieve
    • tlsOptions Optional - Object options passed to TLS connection layer when connecting via ldaps:// (See: TLS for node.js)
      • caCertPath Optional - String path of CA Cert File
      • certPath Optional - String path of Cert File

Return

An instance of LDAPLogin

LDAPLogin.auth

ldapLogin.auth( userName: String, password: String [, options: Object = {} ] );

Parameters

  • userName Required - User's userName
  • password Required - User's password
  • options Optional - Module options as an Object with some properties:
    • serverUrls Optional - URL of the ldap server as String or an Array of URL Strings for multiple attempts
    • usersOu Optional - String that identifies Organization Unit base for Users (Default: 'ou=users')
    • userAttribute Optional - String that identifies ID attribute for Users (Default: 'uid')
    • groupsOu Optional - String that identifies Organization Unit base for Groups (Default: 'ou=groups')
    • groupMemberAttribute Optional - String that identifies Group attribute to use for searching its members (Default: 'member')
    • searchGroups Optional - It can be one of these:
      • String that identifies Common Name of Group that User must have
      • Object with properties:
        • cn Required - String that identifies Common Name of the Group that User must have
        • ou Required - String that identifies Organization Unit base string of the Group
        • userAttribute Optional - String that identifies ID attribute for Users in the Group
        • groupMemberAttribute Optional - String that identifies Group attribute to use for searching its members
      • Array of the previous data for multiple groups
    • userSearchAttributes Optional - Array of Strings that indentify user attributes you want to retrieve
    • tlsOptions Optional - Object options passed to TLS connection layer when connecting via ldaps:// (See: TLS for node.js)
      • caCertPath Optional - String path of CA Cert File
      • certPath Optional - String path of Cert File

Return

A promise that resolve if user correctly logged or reject error