restify-auth-ldap

0.0.3 • Public • Published

restify-auth-ldap Build Status NPM version

Provide a LDAP authentication middleware for restify

Installation

npm install --save restify-auth-ldap

Usage

Restify-auth-ldap need a cache instance to avoid to making too many requests to the LDAP server. Only

cache.get(key);

and

cache.set(key, value);

methods are used.

We recommend using the lru-cache lib.

var auth = require('restify-auth-ldap');

var lruCache = require('lru-cache');

var options = {
    cache : lruCache({
        max: 10,
        maxAge: 300000
    }),
    ldap : {
        opts : { // LDAP server config, passed to ldapjs instance
            url : 'ldap://127.0.0.1:389'
        },
        user : {  // UserDN is: uid=[USERNAME],ou=People,dc=is,dc=bimedia-dev,dc=com 
            DN : 'ou=People,dc=is,dc=bimedia-dev,dc=com',
            attribute : 'uid'
        },
        search : { // Search userDN in member attribute of cn=App,ou=Applications,ou=Groups,dc=is,dc=bimedia-dev,dc=com
            base : 'cn=App,ou=Applications,ou=Groups,dc=is,dc=bimedia-dev,dc=com',
            options : {
                scope : 'sub',
                attributes : [ 'member' ]
            }
        }
    }
};

var middleware = auth(options);

restify.use(middleware);

Readme

Keywords

Package Sidebar

Install

npm i restify-auth-ldap

Weekly Downloads

0

Version

0.0.3

License

Apache-2.0

Last publish

Collaborators

  • z6p