How to use the ldapjs.Attribute function in ldapjs

To help you get started, we’ve selected a few ldapjs 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 auth0 / ad-ldap-connector / node_modules / passport-windowsauth / lib / LdapLookup.js View on Github external
var ldap = require('ldapjs');
ldap.Attribute.settings.guid_format = ldap.GUID_FORMAT_D;

var LdapLookup = module.exports = function(options){
  this._options = options;
  this._client = ldap.createClient({
    url:            options.url,
    maxConnections: 10,
    bindDN:         options.bindDN,
    credentials:    options.bindCredentials  
  });

  this._client.on('error', function(e){
    console.log('LDAP connection error:', e);
  });

  this._queue = [];
github auth0 / ad-ldap-connector / node_modules / passport-windowsauth / lib / LdapValidator.js View on Github external
var ldap = require('ldapjs');
var LdapLookup = require('./LdapLookup');

ldap.Attribute.settings.guid_format = ldap.GUID_FORMAT_D;

var LdapValidator = module.exports = function(options){
  this._options = options;
  this._lookup = new LdapLookup(options);
};

LdapValidator.prototype.validate = function (username, password, callback) {
  //lookup by username
  this._lookup.search(username, function (err, up) {
    if(err) return callback(err);
    if(!up) return callback();
    var client = ldap.createClient({ url: this._options.url });
    //try bind by password
    client.bind(up.dn, password, function(err) {
      if(err) return callback(err);
      callback(null, up);