aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xapp.js6
-rw-r--r--src/auth.js4
2 files changed, 5 insertions, 5 deletions
diff --git a/app.js b/app.js
index 3c76344..eaeed17 100755
--- a/app.js
+++ b/app.js
@@ -22,9 +22,9 @@ var router = new express.Router();
22 22
23var multipart = multipart({ maxFieldsSize: 2 * 1024, limit: '512mb', timeout: 3 * 60 * 1000 }); 23var multipart = multipart({ maxFieldsSize: 2 * 1024, limit: '512mb', timeout: 3 * 60 * 1000 });
24 24
25router.get ('/api/files/*', auth.ldap, files.get); 25router.get ('/api/files/*', auth.verify, files.get);
26router.put ('/api/files/*', auth.ldap, multipart, files.put); 26router.put ('/api/files/*', auth.verify, multipart, files.put);
27router.delete('/api/files/*', auth.ldap, files.del); 27router.delete('/api/files/*', auth.verify, files.del);
28router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); }); 28router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); });
29 29
30// welcome screen in case / does not serve up any file yet 30// welcome screen in case / does not serve up any file yet
diff --git a/src/auth.js b/src/auth.js
index 6ddb125..b56f09f 100644
--- a/src/auth.js
+++ b/src/auth.js
@@ -24,11 +24,11 @@ var LDAP_USERS_BASE_DN = process.env.LDAP_USERS_BASE_DN;
24if (LDAP_URL && LDAP_USERS_BASE_DN) { 24if (LDAP_URL && LDAP_USERS_BASE_DN) {
25 console.log('Enable ldap auth'); 25 console.log('Enable ldap auth');
26 26
27 exports.ldap = passport.authenticate('ldap'); 27 exports.verify = passport.authenticate('ldap');
28} else { 28} else {
29 console.log('Use local user file:', LOCAL_AUTH_FILE); 29 console.log('Use local user file:', LOCAL_AUTH_FILE);
30 30
31 exports.ldap = function (req, res, next) { 31 exports.verify = function (req, res, next) {
32 var users = safe.JSON.parse(safe.fs.readFileSync(LOCAL_AUTH_FILE)); 32 var users = safe.JSON.parse(safe.fs.readFileSync(LOCAL_AUTH_FILE));
33 if (!users) return res.send(401); 33 if (!users) return res.send(401);
34 if (!users[req.query.username]) return res.send(401); 34 if (!users[req.query.username]) return res.send(401);