aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/auth.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/auth.js b/src/auth.js
index 80fa122..96f3045 100644
--- a/src/auth.js
+++ b/src/auth.js
@@ -12,8 +12,8 @@ var passport = require('passport'),
12 HttpSuccess = require('connect-lastmile').HttpSuccess, 12 HttpSuccess = require('connect-lastmile').HttpSuccess,
13 webdavErrors = require('webdav-server').v2.Errors; 13 webdavErrors = require('webdav-server').v2.Errors;
14 14
15const LDAP_URL = process.env.LDAP_URL; 15const LDAP_URL = process.env.CLOUDRON_LDAP_URL;
16const LDAP_USERS_BASE_DN = process.env.LDAP_USERS_BASE_DN; 16const LDAP_USERS_BASE_DN = process.env.CLOUDRON_LDAP_USERS_BASE_DN;
17const LOCAL_AUTH_FILE = path.resolve(process.env.LOCAL_AUTH_FILE || './.users.json'); 17const LOCAL_AUTH_FILE = path.resolve(process.env.LOCAL_AUTH_FILE || './.users.json');
18const TOKENSTORE_FILE = path.resolve(process.env.TOKENSTORE_FILE || './.tokens.json'); 18const TOKENSTORE_FILE = path.resolve(process.env.TOKENSTORE_FILE || './.tokens.json');
19const AUTH_METHOD = (LDAP_URL && LDAP_USERS_BASE_DN) ? 'ldap' : 'local'; 19const AUTH_METHOD = (LDAP_URL && LDAP_USERS_BASE_DN) ? 'ldap' : 'local';
@@ -79,16 +79,16 @@ passport.deserializeUser(function (id, done) {
79 79
80function verifyUser(username, password, callback) { 80function verifyUser(username, password, callback) {
81 if (AUTH_METHOD === 'ldap') { 81 if (AUTH_METHOD === 'ldap') {
82 var ldapClient = ldapjs.createClient({ url: process.env.LDAP_URL }); 82 var ldapClient = ldapjs.createClient({ url: process.env.CLOUDRON_LDAP_URL });
83 ldapClient.on('error', function (error) { 83 ldapClient.on('error', function (error) {
84 console.error('LDAP error', error); 84 console.error('LDAP error', error);
85 }); 85 });
86 86
87 ldapClient.bind(process.env.LDAP_BIND_DN, process.env.LDAP_BIND_PASSWORD, function (error) { 87 ldapClient.bind(process.env.CLOUDRON_LDAP_BIND_DN, process.env.CLOUDRON_LDAP_BIND_PASSWORD, function (error) {
88 if (error) return callback(error); 88 if (error) return callback(error);
89 89
90 var filter = `(|(uid=${username})(mail=${username})(username=${username})(sAMAccountName=${username}))`; 90 var filter = `(|(uid=${username})(mail=${username})(username=${username})(sAMAccountName=${username}))`;
91 ldapClient.search(process.env.LDAP_USERS_BASE_DN, { filter: filter }, function (error, result) { 91 ldapClient.search(process.env.CLOUDRON_LDAP_USERS_BASE_DN, { filter: filter }, function (error, result) {
92 if (error) return callback(error); 92 if (error) return callback(error);
93 93
94 var items = []; 94 var items = [];