node.js - Protecting Node Server with Basic HTTP Auth -
i'm running mean.js app on server, want run test environment password protected. tried doing http-auth set so
var basic = auth.basic({ realm: "simon area.", file: __dirname + "/data/users.htpasswd" // gevorg:gpass, sarah:testpass ... }); // init express application var app = require('./config/express')(db); app.use(auth.connect(basic));
when this, there no authentication done on front end. sanity check changed var basic
to
var basic = auth.basic({ realm: "simon area.", }, function(username, password, callback) { console.log("authenticating"); callback(username === "username" && password === "password"); });
and nothing printed console. i'm thinking method of authentication not working.
in past have used apache passwordbasicauth protect application, simple. there way comparable authentication in node?
Comments
Post a Comment