2.1.0 • Published 7 years ago

simple-ldapjs v2.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

simple-ldapjs

Installation

$ [sudo] npm install simple-ldapjs --save

Usage

Example

// optional environment variables
$ LDAP_USER=ldap_user
$ LDAP_PASSWORD=ldap_user_password
$ LDAP_URL=ldap://dns.net
$ LDAP_OU=OU=Example
$ LDAP_FIELD=mail

import ldap from 'simple-ldapjs';

// Look for a user with a certain principle like email
User.findOne(principle)
  .then(user => {
    return user || ldap({
      principal: 'example@domain.net',
      ou: 'OU=example',
      url: 'ldap://dns.net',
      user: 'ldap_user', 
      password: 'ldap_password',
      field: 'mail'
      })
      .then(foundUser => {
         // foundUser is the matching AD user of the principle
        ...
      });
  });

License

MIT