How to use ldapauth-fork - 1 common examples

To help you get started, we’ve selected a few ldapauth-fork examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Alexandre-io / verdaccio-ldap / index.js View on Github external
const Promise = require('bluebird');
const rfc2253 = require('rfc2253');
const LdapAuth = require('ldapauth-fork');
const Cache = require('ldapauth-fork/lib/cache');
const bcrypt = require('bcryptjs');

Promise.promisifyAll(LdapAuth.prototype);

function authenticatedUserGroups(user, groupNameAttribute) {
  return [
    user.cn,
    // _groups or memberOf could be single els or arrays.
    ...user._groups ? [].concat(user._groups).map((group) => group[groupNameAttribute]) : [],
    ...user.memberOf ? [].concat(user.memberOf).map((groupDn) => rfc2253.parse(groupDn).get('CN')) : [],
  ];
}

function Auth(config, stuff) {
  const self = Object.create(Auth.prototype);
  self._users = {};

  // config for this module
  self._config = config;

ldapauth-fork

Authenticate against an LDAP server

MIT
Latest version published 2 months ago

Package Health Score

80 / 100
Full package analysis

Popular ldapauth-fork functions