diff options
author | Johannes <johannes@cloudron.io> | 2016-11-17 12:54:21 +0100 |
---|---|---|
committer | Johannes <johannes@cloudron.io> | 2016-11-17 12:54:21 +0100 |
commit | 3d716d9ef715d3bfd70631161d022abda0467b71 (patch) | |
tree | d831396e73b3d4e5d96bbd30b8468fc621bd5650 | |
parent | f9f5c021adfc209eb095e682292db5e1ccdd272c (diff) | |
download | Surfer-3d716d9ef715d3bfd70631161d022abda0467b71.tar.gz Surfer-3d716d9ef715d3bfd70631161d022abda0467b71.tar.zst Surfer-3d716d9ef715d3bfd70631161d022abda0467b71.zip |
Rename auth exports
-rwxr-xr-x | app.js | 6 | ||||
-rw-r--r-- | src/auth.js | 4 |
2 files changed, 5 insertions, 5 deletions
@@ -22,9 +22,9 @@ var router = new express.Router(); | |||
22 | 22 | ||
23 | var multipart = multipart({ maxFieldsSize: 2 * 1024, limit: '512mb', timeout: 3 * 60 * 1000 }); | 23 | var multipart = multipart({ maxFieldsSize: 2 * 1024, limit: '512mb', timeout: 3 * 60 * 1000 }); |
24 | 24 | ||
25 | router.get ('/api/files/*', auth.ldap, files.get); | 25 | router.get ('/api/files/*', auth.verify, files.get); |
26 | router.put ('/api/files/*', auth.ldap, multipart, files.put); | 26 | router.put ('/api/files/*', auth.verify, multipart, files.put); |
27 | router.delete('/api/files/*', auth.ldap, files.del); | 27 | router.delete('/api/files/*', auth.verify, files.del); |
28 | router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); }); | 28 | router.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; | |||
24 | if (LDAP_URL && LDAP_USERS_BASE_DN) { | 24 | if (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); |