Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding basic auth to web ui

  • Loading branch information...
commit 825e05adfb7a946c04f70332dac2fd58c397bf1f 1 parent 03c62c3
@rgarcia rgarcia authored
Showing with 10 additions and 6 deletions.
  1. +10 −6 lib/http/index.js
View
16 lib/http/index.js
@@ -65,9 +65,13 @@ app.post('/job', provides('json'), express.bodyParser(), json.createJob);
// routes
-app.get('/', routes.jobs('active'));
-app.get('/active', routes.jobs('active'));
-app.get('/inactive', routes.jobs('inactive'));
-app.get('/failed', routes.jobs('failed'));
-app.get('/complete', routes.jobs('complete'));
-app.get('/delayed', routes.jobs('delayed'));
+var auth = function(req, res, next) {
+ if (!app.settings.auth) return next();
+ express.basicAuth(app.settings.auth[0], app.settings.auth[1])(req,res,next);
+}
+app.get('/', auth, routes.jobs('active'));
+app.get('/active', auth, routes.jobs('active'));
+app.get('/inactive', auth, routes.jobs('inactive'));
+app.get('/failed', auth, routes.jobs('failed'));
+app.get('/complete', auth, routes.jobs('complete'));
+app.get('/delayed', auth, routes.jobs('delayed'));
Please sign in to comment.
Something went wrong with that request. Please try again.