Skip to content

Added credentialsLookup

Compare
Choose a tag to compare
@vesse vesse released this 14 Sep 06:42
· 87 commits to master since this release

Added option credentialsLookup. It can be used to provide a synchronous function that receives req object as argument and must return object with keys username and password (or name and pass as a courtesy to basic-auth users) which will then be used for login.

Use for Basic Auth:

var basicAuth = require('basic-auth');
var ldapOpts = {
  server: { },
  credentialsLookup: basicAuth
}

Or eg. simpler body parsing when you know what you're handling:

var ldapOpts = {
  server: { },
  credentialsLookup: function(req) {
    return {username: req.body.username, password: req.body.password};
  }
}

Fixes #4, #30, #46