mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Move over to settings.adminAuth
This commit is contained in:
parent
74e1ef0823
commit
f3eb85c449
@ -30,7 +30,7 @@ var server = oauth2orize.createServer();
|
||||
server.exchange(oauth2orize.exchange.password(strategies.passwordTokenExchange));
|
||||
|
||||
function authenticate(req,res,next) {
|
||||
if (settings.httpAdminAuth) {
|
||||
if (settings.adminAuth) {
|
||||
if (/^\/auth\/.*/.test(req.originalUrl)) {
|
||||
next();
|
||||
} else {
|
||||
|
@ -22,9 +22,9 @@ var settings = require("../../settings");
|
||||
//{username:"nick",password:crypto.createHash('md5').update("foo",'utf8').digest('hex')}
|
||||
var users = [];
|
||||
|
||||
if (settings.httpAdminAuth) {
|
||||
if (settings.httpAdminAuth.user && settings.httpAdminAuth.pass) {
|
||||
users.push({username:settings.httpAdminAuth.user, password:settings.httpAdminAuth.pass});
|
||||
if (settings.adminAuth) {
|
||||
if (settings.adminAuth.user && settings.adminAuth.pass) {
|
||||
users.push({username:settings.adminAuth.user, password:settings.adminAuth.pass});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,6 @@ function init(adminApp) {
|
||||
adminApp.get("/auth/login",auth.login);
|
||||
adminApp.post("/auth/revoke",auth.revoke);
|
||||
|
||||
|
||||
// Flows
|
||||
adminApp.get("/flows",flows.get);
|
||||
adminApp.post("/flows",flows.post);
|
||||
|
@ -55,12 +55,5 @@ module.exports = {
|
||||
res.sendfile(defaultIcon);
|
||||
}
|
||||
},
|
||||
settings: function(req,res) {
|
||||
var safeSettings = {
|
||||
httpNodeRoot: settings.httpNodeRoot,
|
||||
version: settings.version
|
||||
};
|
||||
res.json(safeSettings);
|
||||
},
|
||||
editor: express.static(__dirname + '/../../public')
|
||||
};
|
||||
|
@ -46,7 +46,7 @@ function start() {
|
||||
wsServer = new ws.Server({server:server,path:path});
|
||||
|
||||
wsServer.on('connection',function(ws) {
|
||||
var pendingAuth = (settings.httpAdminAuth != null);
|
||||
var pendingAuth = (settings.adminAuth != null);
|
||||
if (!pendingAuth) {
|
||||
activeConnections.push(ws);
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@ describe("api auth middleware",function() {
|
||||
done(new Error("authentication not applied to auth path"));
|
||||
}
|
||||
});
|
||||
settings.init({httpAdminAuth:{}});
|
||||
settings.init({adminAuth:{}});
|
||||
var req = {
|
||||
originalUrl: "/auth/token"
|
||||
};
|
||||
@ -52,7 +52,7 @@ describe("api auth middleware",function() {
|
||||
done();
|
||||
}
|
||||
});
|
||||
settings.init({httpAdminAuth:{}});
|
||||
settings.init({adminAuth:{}});
|
||||
var req = {
|
||||
originalUrl: "/"
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user