I have deployed my Sails app to a PaaS, and I'd like to have simple password protect so that no one can access my staging server.
What's the simplest way to do that?
Looks like http-auth, the doc explains how to implement for ExpressJS, but with SailsJS I don't find app.use()
what I have tried
In my policies.js
file
module.exports.policies = {
// '*': true,
'*': require('http-auth').basic({
realm: 'admin area'
}, function customAuthMethod (username, password, onwards) {
return onwards(username === "Tina" && password === "Bullock");
}),
which leads to
info: Starting app...
error: Cannot map invalid policy: { realm: 'admin area',
msg401: '401 Unauthorized',
msg407: '407 Proxy authentication required',
contentType: 'text/plain',
users: [] }
also it looks like Policies can't apply to views, but to actions only hm...