Add basic auth middleware
This commit is contained in:
parent
11cacc5e35
commit
8a2d98c67a
2 changed files with 9 additions and 0 deletions
8
src/middleware/basic-auth.ts
Normal file
8
src/middleware/basic-auth.ts
Normal 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
|
||||
});
|
||||
}
|
1
src/types/fakes.d.ts
vendored
1
src/types/fakes.d.ts
vendored
|
@ -2,3 +2,4 @@
|
|||
|
||||
declare module 'express-ip-access-control';
|
||||
declare module 'connect-static-file';
|
||||
declare module 'express-basic-auth'
|
||||
|
|
Reference in a new issue