Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openapi-security-handler

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openapi-security-handler - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

4

CHANGELOG.md

@@ -7,2 +7,6 @@ # openapi-security-handler Changelog

## 2.0.4 - 2019-01-31
### Fixed
- openapi-types: Allowing to set a property of BaseSchemaObject as a reference to another SchemaObject (#312)
## 2.0.3 - 2018-10-04

@@ -9,0 +13,0 @@ ### Fixed

4

dist/index.d.ts

@@ -15,5 +15,3 @@ import { OpenAPI, OpenAPIV2, OpenAPIV3 } from 'openapi-types';

export declare type SecurityScope = string;
export interface SecurityHandler {
(req: OpenAPI.Request, scopes: SecurityScope[], definition: OpenAPIV2.SecuritySchemeObject): Promise<boolean> | boolean;
}
export declare type SecurityHandler = (req: OpenAPI.Request, scopes: SecurityScope[], definition: OpenAPIV2.SecuritySchemeObject) => Promise<boolean> | boolean;
export default class OpenAPISecurityHandler implements IOpenAPISecurityHandler {

@@ -20,0 +18,0 @@ private operationSecurity;

@@ -59,10 +59,15 @@ "use strict";

.map(function (security) {
return Object.keys(security).map(function (scheme) {
return Object.keys(security)
.map(function (scheme) {
if (!securityDefinitions[scheme]) {
throw new Error(loggingKey + 'Unknown security scheme "' + scheme +
throw new Error(loggingKey +
'Unknown security scheme "' +
scheme +
'" used in operation.');
}
if (!securityHandlers[scheme]) {
console.warn(loggingKey + 'No handler defined for security scheme "' +
scheme + '"');
console.warn(loggingKey +
'No handler defined for security scheme "' +
scheme +
'"');
return null;

@@ -73,3 +78,5 @@ }

'Security handlers must be functions. Non function ' +
'given for scheme "' + scheme + '"');
'given for scheme "' +
scheme +
'"');
}

@@ -82,3 +89,5 @@ return {

})
.filter(function (security) {
.filter(
/* tslint:disable-next-line:no-shadowed-variable */
function (security) {
return !!security;

@@ -96,3 +105,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var lastError, operationSecurity;
var operationSecurity;
return __generator(this, function (_a) {

@@ -108,2 +117,3 @@ operationSecurity = this.operationSecurity;

return Promise.all(resultPromises).then(function (results) {
/* tslint:disable-next-line:no-shadowed-variable */
return results.filter(function (result) { return !result; }).length === 0;

@@ -110,0 +120,0 @@ });

{
"name": "openapi-security-handler",
"version": "2.0.3",
"version": "2.0.4",
"description": "A library to process OpenAPI security definitions in parallel.",

@@ -31,3 +31,3 @@ "main": "./dist/index.js",

"dependencies": {
"openapi-types": "^1.3.1"
"openapi-types": "1.3.4"
},

@@ -34,0 +34,0 @@ "devDependencies": {

@@ -1,2 +0,2 @@

# openapi-security-handler [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url]
# openapi-security-handler [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
> A library to process OpenAPI security definitions in parallel.

@@ -106,1 +106,4 @@

[coveralls-image]: https://coveralls.io/repos/github/kogosoftwarellc/open-api/badge.svg?branch=master
[gitter-url]: https://gitter.im/kogosoftwarellc/open-api
[gitter-image]: https://badges.gitter.im/kogosoftwarellc/open-api.png

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc