Commit 3d716d9e by Johannes

Rename auth exports

1 parent f9f5c021
Showing with 5 additions and 5 deletions
...@@ -22,9 +22,9 @@ var router = new express.Router(); ...@@ -22,9 +22,9 @@ var router = new express.Router();
var multipart = multipart({ maxFieldsSize: 2 * 1024, limit: '512mb', timeout: 3 * 60 * 1000 }); var multipart = multipart({ maxFieldsSize: 2 * 1024, limit: '512mb', timeout: 3 * 60 * 1000 });
router.get ('/api/files/*', auth.ldap, files.get); router.get ('/api/files/*', auth.verify, files.get);
router.put ('/api/files/*', auth.ldap, multipart, files.put); router.put ('/api/files/*', auth.verify, multipart, files.put);
router.delete('/api/files/*', auth.ldap, files.del); router.delete('/api/files/*', auth.verify, files.del);
router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); }); router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); });
// welcome screen in case / does not serve up any file yet // welcome screen in case / does not serve up any file yet
......
...@@ -24,11 +24,11 @@ var LDAP_USERS_BASE_DN = process.env.LDAP_USERS_BASE_DN; ...@@ -24,11 +24,11 @@ var LDAP_USERS_BASE_DN = process.env.LDAP_USERS_BASE_DN;
if (LDAP_URL && LDAP_USERS_BASE_DN) { if (LDAP_URL && LDAP_USERS_BASE_DN) {
console.log('Enable ldap auth'); console.log('Enable ldap auth');
exports.ldap = passport.authenticate('ldap'); exports.verify = passport.authenticate('ldap');
} else { } else {
console.log('Use local user file:', LOCAL_AUTH_FILE); console.log('Use local user file:', LOCAL_AUTH_FILE);
exports.ldap = function (req, res, next) { exports.verify = function (req, res, next) {
var users = safe.JSON.parse(safe.fs.readFileSync(LOCAL_AUTH_FILE)); var users = safe.JSON.parse(safe.fs.readFileSync(LOCAL_AUTH_FILE));
if (!users) return res.send(401); if (!users) return res.send(401);
if (!users[req.query.username]) return res.send(401); if (!users[req.query.username]) return res.send(401);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!