Comparing version 0.1.1 to 0.2.0
@@ -104,5 +104,5 @@ "use strict"; | ||
for (const schemeName of Object.keys(securityRequirement)) { | ||
if (!context.options.securityPlugins[schemeName]) { | ||
if (!context.options.authenticators[schemeName]) { | ||
throw new Error(`Operation ${context.jsonPointer} references security scheme "${schemeName}" ` + | ||
`but no security plugin was provided.`); | ||
`but no authenticator was provided.`); | ||
} | ||
@@ -188,3 +188,3 @@ } | ||
if (exegesisContext.isResponseFinished()) { | ||
// Some plugin has written a response. We're done. :( | ||
// Some authenticator has written a response. We're done. :( | ||
failed = true; | ||
@@ -194,4 +194,4 @@ break; | ||
if (!(scheme in triedSchemes)) { | ||
const plugin = this.context.options.securityPlugins[scheme]; | ||
triedSchemes[scheme] = yield promise_breaker_1.default.call(plugin, null, exegesisContext); | ||
const authenticator = this.context.options.authenticators[scheme]; | ||
triedSchemes[scheme] = yield promise_breaker_1.default.call(authenticator, null, exegesisContext); | ||
} | ||
@@ -198,0 +198,0 @@ const authenticated = triedSchemes[scheme]; |
import { MimeTypeRegistry } from "./utils/mime"; | ||
import { CustomFormats, ExegesisOptions, StringParser, BodyParser, Controllers, SecurityPlugins } from './types'; | ||
import { CustomFormats, ExegesisOptions, StringParser, BodyParser, Controllers, Authenticators } from './types'; | ||
export interface ExgesisCompiledOptions { | ||
customFormats: CustomFormats; | ||
controllers: Controllers; | ||
securityPlugins: SecurityPlugins; | ||
authenticators: Authenticators; | ||
bodyParsers: MimeTypeRegistry<BodyParser>; | ||
@@ -8,0 +8,0 @@ parameterParsers: MimeTypeRegistry<StringParser>; |
@@ -71,3 +71,3 @@ "use strict"; | ||
: true; | ||
const securityPlugins = options.securityPlugins || {}; | ||
const authenticators = options.authenticators || {}; | ||
const autoHandleHttpErrors = options.autoHandleHttpErrors !== undefined | ||
@@ -79,3 +79,3 @@ ? !!options.autoHandleHttpErrors | ||
controllers, | ||
securityPlugins, | ||
authenticators, | ||
customFormats, | ||
@@ -82,0 +82,0 @@ parameterParsers, |
@@ -83,7 +83,7 @@ /// <reference types="node" /> | ||
} | ||
export declare type PromiseSecurityPlugin = (context: ExegesisPluginContext) => ExegesisAuthenticated | undefined | Promise<ExegesisAuthenticated>; | ||
export declare type CallbackSecurityPlugin = (context: ExegesisPluginContext, done: Callback<ExegesisAuthenticated | undefined>) => void; | ||
export declare type SecurityPlugin = PromiseSecurityPlugin | CallbackSecurityPlugin; | ||
export interface SecurityPlugins { | ||
[scheme: string]: SecurityPlugin; | ||
export declare type PromiseAuthenticator = (context: ExegesisPluginContext) => ExegesisAuthenticated | undefined | Promise<ExegesisAuthenticated>; | ||
export declare type CallbackAuthenticator = (context: ExegesisPluginContext, done: Callback<ExegesisAuthenticated | undefined>) => void; | ||
export declare type Authenticator = PromiseAuthenticator | CallbackAuthenticator; | ||
export interface Authenticators { | ||
[scheme: string]: Authenticator; | ||
} | ||
@@ -90,0 +90,0 @@ /** |
import { StringParser, BodyParser } from './bodyParser'; | ||
import { Controllers, SecurityPlugins } from './core'; | ||
import { Controllers, Authenticators } from './core'; | ||
/** | ||
@@ -41,7 +41,7 @@ * A function which validates custom formats. | ||
/** | ||
* An array of security plugins. See | ||
* A hash of authenticators. See | ||
* https://github.com/exegesis-js/exegesis/blob/master/docs/OAS3%20Security.md | ||
* for details. | ||
*/ | ||
securityPlugins?: SecurityPlugins; | ||
authenticators?: Authenticators; | ||
/** | ||
@@ -48,0 +48,0 @@ * Either a folder which contains controller modules, or a hash where keys |
{ | ||
"name": "exegesis", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Parses OpenAPI documents", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
264962