highoutput-http-server
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -8,2 +8,3 @@ /// <reference types="node" /> | ||
type: 'jwt'; | ||
strict?: boolean; | ||
options: { | ||
@@ -14,2 +15,3 @@ secretKey: (() => Promise<string>) | string; | ||
type: 'basic'; | ||
strict?: boolean; | ||
options: { | ||
@@ -16,0 +18,0 @@ authenticate: (username: string, password: string) => Promise<boolean>; |
@@ -31,3 +31,3 @@ "use strict"; | ||
}; | ||
if (!ctx.headers.authorization) { | ||
if (this.options.auth.strict && !ctx.headers.authorization) { | ||
invalidToken(); | ||
@@ -38,3 +38,8 @@ return; | ||
if (!match) { | ||
invalidToken(); | ||
if (this.options.auth.strict) { | ||
invalidToken(); | ||
} | ||
else { | ||
await next(); | ||
} | ||
return; | ||
@@ -41,0 +46,0 @@ } |
{ | ||
"name": "highoutput-http-server", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A simple HTTP server class based on koa", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "2e0432fd8afafcfd1fa2994b4e3b95dd09e573aa" | ||
"gitHead": "ba7182d9d7c205869e5c8aa8a77eeb1a19333b4a" | ||
} |
@@ -13,2 +13,3 @@ import Koa from 'koa'; | ||
type: 'jwt'; | ||
strict?: boolean; | ||
options: { | ||
@@ -20,2 +21,3 @@ secretKey: (() => Promise<string>) | string; | ||
type: 'basic'; | ||
strict?: boolean; | ||
options: { | ||
@@ -58,3 +60,3 @@ authenticate: ( | ||
if (!ctx.headers.authorization) { | ||
if (this.options.auth!.strict && !ctx.headers.authorization) { | ||
invalidToken(); | ||
@@ -66,3 +68,8 @@ return; | ||
if (!match) { | ||
invalidToken(); | ||
if (this.options.auth!.strict) { | ||
invalidToken(); | ||
} else { | ||
await next(); | ||
} | ||
return; | ||
@@ -69,0 +76,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11844
252