webaccess: Return 401 for authn failure, 403 for authz failure

This makes it possible for reverse proxies to transform 403 errors
into something like "upgrade to a premium account to access this
pad".

Also add some webaccess tests.
This commit is contained in:
Richard Hansen 2020-08-26 22:08:07 -04:00 committed by John McLear
parent ff4da04907
commit 53fd0b4f98
4 changed files with 188 additions and 17 deletions

View file

@ -45,7 +45,7 @@ let started = false;
let stopped = false;
exports.start = async () => {
if (started) return;
if (started) return express.server;
started = true;
if (stopped) throw new Error('restart not supported');