Add basic auth middleware

This commit is contained in:
Jake Howard 2017-02-15 07:37:00 +00:00
parent 11cacc5e35
commit 8a2d98c67a
2 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1,8 @@
import basicAuth from 'express-basic-auth';
export default function basicAuthHandler(username : string, password : string) {
return basicAuth({
authorizer: (req_username : string, req_password : string) => req_username === username && req_password === password,
challenge: true
});
}

View file

@ -2,3 +2,4 @@
declare module 'express-ip-access-control'; declare module 'express-ip-access-control';
declare module 'connect-static-file'; declare module 'connect-static-file';
declare module 'express-basic-auth'