Move over to settings.adminAuth

This commit is contained in:
Nick O'Leary 2014-11-12 20:58:48 +00:00
parent 74e1ef0823
commit f3eb85c449
6 changed files with 7 additions and 15 deletions

View File

@ -30,7 +30,7 @@ var server = oauth2orize.createServer();
server.exchange(oauth2orize.exchange.password(strategies.passwordTokenExchange)); server.exchange(oauth2orize.exchange.password(strategies.passwordTokenExchange));
function authenticate(req,res,next) { function authenticate(req,res,next) {
if (settings.httpAdminAuth) { if (settings.adminAuth) {
if (/^\/auth\/.*/.test(req.originalUrl)) { if (/^\/auth\/.*/.test(req.originalUrl)) {
next(); next();
} else { } else {

View File

@ -22,9 +22,9 @@ var settings = require("../../settings");
//{username:"nick",password:crypto.createHash('md5').update("foo",'utf8').digest('hex')} //{username:"nick",password:crypto.createHash('md5').update("foo",'utf8').digest('hex')}
var users = []; var users = [];
if (settings.httpAdminAuth) { if (settings.adminAuth) {
if (settings.httpAdminAuth.user && settings.httpAdminAuth.pass) { if (settings.adminAuth.user && settings.adminAuth.pass) {
users.push({username:settings.httpAdminAuth.user, password:settings.httpAdminAuth.pass}); users.push({username:settings.adminAuth.user, password:settings.adminAuth.pass});
} }
} }

View File

@ -60,7 +60,6 @@ function init(adminApp) {
); );
adminApp.get("/auth/login",auth.login); adminApp.get("/auth/login",auth.login);
adminApp.post("/auth/revoke",auth.revoke); adminApp.post("/auth/revoke",auth.revoke);
// Flows // Flows
adminApp.get("/flows",flows.get); adminApp.get("/flows",flows.get);

View File

@ -55,12 +55,5 @@ module.exports = {
res.sendfile(defaultIcon); res.sendfile(defaultIcon);
} }
}, },
settings: function(req,res) {
var safeSettings = {
httpNodeRoot: settings.httpNodeRoot,
version: settings.version
};
res.json(safeSettings);
},
editor: express.static(__dirname + '/../../public') editor: express.static(__dirname + '/../../public')
}; };

View File

@ -46,7 +46,7 @@ function start() {
wsServer = new ws.Server({server:server,path:path}); wsServer = new ws.Server({server:server,path:path});
wsServer.on('connection',function(ws) { wsServer.on('connection',function(ws) {
var pendingAuth = (settings.httpAdminAuth != null); var pendingAuth = (settings.adminAuth != null);
if (!pendingAuth) { if (!pendingAuth) {
activeConnections.push(ws); activeConnections.push(ws);
} else { } else {

View File

@ -35,7 +35,7 @@ describe("api auth middleware",function() {
done(new Error("authentication not applied to auth path")); done(new Error("authentication not applied to auth path"));
} }
}); });
settings.init({httpAdminAuth:{}}); settings.init({adminAuth:{}});
var req = { var req = {
originalUrl: "/auth/token" originalUrl: "/auth/token"
}; };
@ -52,7 +52,7 @@ describe("api auth middleware",function() {
done(); done();
} }
}); });
settings.init({httpAdminAuth:{}}); settings.init({adminAuth:{}});
var req = { var req = {
originalUrl: "/" originalUrl: "/"
}; };