Comparing version 0.2.0 to 0.2.1
@@ -23,3 +23,8 @@ "use strict"; | ||
context.security = authenticated; | ||
context.user = authenticated && authenticated.user; | ||
if (authenticated) { | ||
const matchedSchemes = Object.keys(authenticated); | ||
if (matchedSchemes.length === 1) { | ||
context.user = authenticated[matchedSchemes[0]].user; | ||
} | ||
} | ||
}); | ||
@@ -26,0 +31,0 @@ } |
@@ -50,2 +50,17 @@ import * as oas3 from 'openapi3-ts'; | ||
validateParameters(parameterValues: ParametersByLocation<ParametersMap<any>>): IValidationError[] | null; | ||
/** | ||
* Checks a single security requirement from an OAS3 `security` field. | ||
* | ||
* @param triedSchemes - A cache where keys are names of security schemes | ||
* we've already tried, and values are the results returned by the | ||
* authenticator. | ||
* @param errors - An array of strings - we can push any errors we encounter | ||
* to this list. | ||
* @param securityRequirement - The security requirement to check. | ||
* @param exegesisContext - The context for the request to check. | ||
* @returns - If the security requirement matches, this returns an object | ||
* where keys are security schemes and the values are the results from | ||
* the authenticator. If the requirements are not met, returns undefined | ||
* (and adds some errors to `errors`). | ||
*/ | ||
private _checkSecurityRequirement(triedSchemes, errors, securityRequirement, exegesisContext); | ||
@@ -52,0 +67,0 @@ authenticate(exegesisContext: ExegesisContext): Promise<{ |
@@ -180,2 +180,17 @@ "use strict"; | ||
} | ||
/** | ||
* Checks a single security requirement from an OAS3 `security` field. | ||
* | ||
* @param triedSchemes - A cache where keys are names of security schemes | ||
* we've already tried, and values are the results returned by the | ||
* authenticator. | ||
* @param errors - An array of strings - we can push any errors we encounter | ||
* to this list. | ||
* @param securityRequirement - The security requirement to check. | ||
* @param exegesisContext - The context for the request to check. | ||
* @returns - If the security requirement matches, this returns an object | ||
* where keys are security schemes and the values are the results from | ||
* the authenticator. If the requirements are not met, returns undefined | ||
* (and adds some errors to `errors`). | ||
*/ | ||
_checkSecurityRequirement(triedSchemes, errors, securityRequirement, exegesisContext) { | ||
@@ -182,0 +197,0 @@ return __awaiter(this, void 0, void 0, function* () { |
{ | ||
"name": "exegesis", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"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
266902
4179