authelia/app/lib/ldap_checker.js
2016-12-10 01:47:58 +01:00

15 lines
388 B
JavaScript

module.exports = {
'validate': validateCredentials
}
var Q = require('q');
var util = require('util');
var utils = require('./utils');
function validateCredentials(ldap_client, username, password, users_dn) {
var userDN = util.format("cn=%s,%s", username, users_dn);
var bind_promised = utils.promisify(ldap_client.bind, ldap_client);
return bind_promised(userDN, password);
}