mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-17 21:56:36 +02:00
cfa6db10c7
Also draft some kind of plugin system for auth, although it essentially consists in writing a function and there is no mechanism to automatically fallback from one auth to another
22 lines
571 B
JavaScript
22 lines
571 B
JavaScript
"use strict";
|
|
|
|
const Helper = require("../../helper");
|
|
const _ldapAuthCommon = require("./_ldapCommon");
|
|
|
|
function ldapAuth(manager, client, user, password, callback) {
|
|
if (!user) {
|
|
return callback(false);
|
|
}
|
|
|
|
const config = Helper.config;
|
|
|
|
const userDN = user.replace(/([,\\/#+<>;"= ])/g, "\\$1");
|
|
const bindDN = config.ldap.primaryKey + "=" + userDN + "," + config.ldap.baseDN;
|
|
|
|
log.info("Auth against LDAP ", config.ldap.url, " with provided bindDN ", bindDN);
|
|
|
|
_ldapAuthCommon(manager, client, user, bindDN, password, callback);
|
|
}
|
|
|
|
module.exports = ldapAuth;
|