Commit 3d716d9e authored by Johannes Zellner's avatar Johannes Zellner

Rename auth exports

parent f9f5c021
......@@ -22,9 +22,9 @@ var router = new express.Router();
var multipart = multipart({ maxFieldsSize: 2 * 1024, limit: '512mb', timeout: 3 * 60 * 1000 });
router.get ('/api/files/*', auth.ldap, files.get);
router.put ('/api/files/*', auth.ldap, multipart, files.put);
router.delete('/api/files/*', auth.ldap, files.del);
router.get ('/api/files/*', auth.verify, files.get);
router.put ('/api/files/*', auth.verify, multipart, files.put);
router.delete('/api/files/*', auth.verify, files.del);
router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); });
// 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;
if (LDAP_URL && LDAP_USERS_BASE_DN) {
console.log('Enable ldap auth');
exports.ldap = passport.authenticate('ldap');
exports.verify = passport.authenticate('ldap');
} else {
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));
if (!users) return res.send(401);
if (!users[req.query.username]) return res.send(401);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment