From 11ded9658e1db5a1bfc0f8956a20a2b580b92ccf Mon Sep 17 00:00:00 2001 From: Keeton Hodgson Date: Mon, 9 Dec 2019 14:38:17 -0800 Subject: [PATCH 1/2] fix(httpapi): nest securitySchemes under components section in openapi (#1301) --- samtranslator/open_api/open_api.py | 5 +- .../input/http_api_existing_openapi.yaml | 41 +++++----- .../http_api_existing_openapi_conditions.yaml | 41 +++++----- .../output/aws-cn/explicit_http_api.json | 56 +++++++------- .../aws-cn/http_api_existing_openapi.json | 52 +++++++------ .../http_api_existing_openapi_conditions.json | 76 ++++++++++--------- ...mplicit_http_api_auth_and_simple_case.json | 56 +++++++------- ...mplicit_http_api_with_many_conditions.json | 28 +++---- .../output/aws-us-gov/explicit_http_api.json | 56 +++++++------- .../aws-us-gov/http_api_existing_openapi.json | 52 +++++++------ .../http_api_existing_openapi_conditions.json | 76 ++++++++++--------- ...mplicit_http_api_auth_and_simple_case.json | 56 +++++++------- ...mplicit_http_api_with_many_conditions.json | 28 +++---- .../translator/output/explicit_http_api.json | 58 +++++++------- .../output/http_api_existing_openapi.json | 52 +++++++------ .../http_api_existing_openapi_conditions.json | 76 ++++++++++--------- ...mplicit_http_api_auth_and_simple_case.json | 56 +++++++------- ...mplicit_http_api_with_many_conditions.json | 28 +++---- 18 files changed, 466 insertions(+), 427 deletions(-) diff --git a/samtranslator/open_api/open_api.py b/samtranslator/open_api/open_api.py index c92ee8812..5112a44c9 100644 --- a/samtranslator/open_api/open_api.py +++ b/samtranslator/open_api/open_api.py @@ -35,7 +35,7 @@ def __init__(self, doc): self._doc = copy.deepcopy(doc) self.paths = self._doc["paths"] - self.security_schemes = self._doc.get("securitySchemes", {}) + self.security_schemes = self._doc.get("components", {}).get("securitySchemes", {}) self.definitions = self._doc.get('definitions', {}) def get_path(self, path): @@ -346,7 +346,8 @@ def openapi(self): self._doc["paths"] = self.paths if self.security_schemes: - self._doc["securitySchemes"] = self.security_schemes + self._doc.setdefault("components", {}) + self._doc["components"]["securitySchemes"] = self.security_schemes return copy.deepcopy(self._doc) diff --git a/tests/translator/input/http_api_existing_openapi.yaml b/tests/translator/input/http_api_existing_openapi.yaml index 42df713ce..a9d7f2a08 100644 --- a/tests/translator/input/http_api_existing_openapi.yaml +++ b/tests/translator/input/http_api_existing_openapi.yaml @@ -72,23 +72,24 @@ Resources: - scope4 responses: {} openapi: 3.0.1 - securitySchemes: - oauth2Auth: - type: oauth2 - x-amazon-apigateway-authorizer: - identitySource: "$request.querystring.param" - type: jwt - jwtConfiguration: - audience: - - MyApi - issuer: https://www.example.com/v1/connect/oidc - OpenIdAuth: - type: openIdConnect - x-amazon-apigateway-authorizer: - identitySource: "$request.querystring.param" - type: jwt - jwtConfiguration: - audience: - - MyApi - issuer: https://www.example.com/v1/connect/oidc - openIdConnectUrl: https://www.example.com/v1/connect + components: + securitySchemes: + oauth2Auth: + type: oauth2 + x-amazon-apigateway-authorizer: + identitySource: "$request.querystring.param" + type: jwt + jwtConfiguration: + audience: + - MyApi + issuer: https://www.example.com/v1/connect/oidc + OpenIdAuth: + type: openIdConnect + x-amazon-apigateway-authorizer: + identitySource: "$request.querystring.param" + type: jwt + jwtConfiguration: + audience: + - MyApi + issuer: https://www.example.com/v1/connect/oidc + openIdConnectUrl: https://www.example.com/v1/connect diff --git a/tests/translator/input/http_api_existing_openapi_conditions.yaml b/tests/translator/input/http_api_existing_openapi_conditions.yaml index 056fef67b..7a42bd458 100644 --- a/tests/translator/input/http_api_existing_openapi_conditions.yaml +++ b/tests/translator/input/http_api_existing_openapi_conditions.yaml @@ -106,23 +106,24 @@ Resources: - scope4 responses: {} openapi: 3.0.1 - securitySchemes: - oauth2Auth: - type: oauth2 - x-amazon-apigateway-authorizer: - identitySource: "$request.querystring.param" - type: jwt - jwtConfiguration: - audience: - - MyApi - issuer: https://www.example.com/v1/connect/oidc - OpenIdAuth: - type: openIdConnect - x-amazon-apigateway-authorizer: - identitySource: "$request.querystring.param" - type: jwt - jwtConfiguration: - audience: - - MyApi - issuer: https://www.example.com/v1/connect/oidc - openIdConnectUrl: https://www.example.com/v1/connect + components: + securitySchemes: + oauth2Auth: + type: oauth2 + x-amazon-apigateway-authorizer: + identitySource: "$request.querystring.param" + type: jwt + jwtConfiguration: + audience: + - MyApi + issuer: https://www.example.com/v1/connect/oidc + OpenIdAuth: + type: openIdConnect + x-amazon-apigateway-authorizer: + identitySource: "$request.querystring.param" + type: jwt + jwtConfiguration: + audience: + - MyApi + issuer: https://www.example.com/v1/connect/oidc + openIdConnectUrl: https://www.example.com/v1/connect diff --git a/tests/translator/output/aws-cn/explicit_http_api.json b/tests/translator/output/aws-cn/explicit_http_api.json index 7dc935a8a..7325f725a 100644 --- a/tests/translator/output/aws-cn/explicit_http_api.json +++ b/tests/translator/output/aws-cn/explicit_http_api.json @@ -95,22 +95,24 @@ } } }, - "openapi": "3.0.1", - "securitySchemes": { - "OAuth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "OAuth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } } } - } + }, + "openapi": "3.0.1" } } }, @@ -192,22 +194,24 @@ } } }, - "openapi": "3.0.1", - "securitySchemes": { - "OAuth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "OAuth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } } } - } + }, + "openapi": "3.0.1" } } } diff --git a/tests/translator/output/aws-cn/http_api_existing_openapi.json b/tests/translator/output/aws-cn/http_api_existing_openapi.json index cf6d050d8..977b338a5 100644 --- a/tests/translator/output/aws-cn/http_api_existing_openapi.json +++ b/tests/translator/output/aws-cn/http_api_existing_openapi.json @@ -174,32 +174,34 @@ } } }, - "securitySchemes": { - "oauth2Auth": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2Auth": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } + } + }, + "OpenIdAuth": { + "type": "openIdConnect", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + }, + "openIdConnectUrl": "https://www.example.com/v1/connect" } - } - }, - "OpenIdAuth": { - "type": "openIdConnect", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" - }, - "openIdConnectUrl": "https://www.example.com/v1/connect" } } }, diff --git a/tests/translator/output/aws-cn/http_api_existing_openapi_conditions.json b/tests/translator/output/aws-cn/http_api_existing_openapi_conditions.json index df24e69a5..bb88669e2 100644 --- a/tests/translator/output/aws-cn/http_api_existing_openapi_conditions.json +++ b/tests/translator/output/aws-cn/http_api_existing_openapi_conditions.json @@ -218,45 +218,47 @@ } } }, - "securitySchemes": { - "oauth2Auth": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2Auth": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } - } - }, - "OAuth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + }, + "OAuth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } + } + }, + "OpenIdAuth": { + "type": "openIdConnect", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + }, + "openIdConnectUrl": "https://www.example.com/v1/connect" } - } - }, - "OpenIdAuth": { - "type": "openIdConnect", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" - }, - "openIdConnectUrl": "https://www.example.com/v1/connect" } } }, diff --git a/tests/translator/output/aws-cn/implicit_http_api_auth_and_simple_case.json b/tests/translator/output/aws-cn/implicit_http_api_auth_and_simple_case.json index 33fa97169..3a10cdfa7 100644 --- a/tests/translator/output/aws-cn/implicit_http_api_auth_and_simple_case.json +++ b/tests/translator/output/aws-cn/implicit_http_api_auth_and_simple_case.json @@ -213,36 +213,38 @@ } } }, - "openapi": "3.0.1", - "securitySchemes": { - "oauth2Auth": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2Auth": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } + } + }, + "OpenIdAuth": { + "type": "openIdConnect", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + }, + "openIdConnectUrl": "https://www.example.com/v1/connect" } - } - }, - "OpenIdAuth": { - "type": "openIdConnect", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" - }, - "openIdConnectUrl": "https://www.example.com/v1/connect" } } - } + }, + "openapi": "3.0.1" } } } diff --git a/tests/translator/output/aws-cn/implicit_http_api_with_many_conditions.json b/tests/translator/output/aws-cn/implicit_http_api_with_many_conditions.json index 74731cc7e..3f517aafb 100644 --- a/tests/translator/output/aws-cn/implicit_http_api_with_many_conditions.json +++ b/tests/translator/output/aws-cn/implicit_http_api_with_many_conditions.json @@ -647,22 +647,24 @@ ] } }, - "openapi": "3.0.1", - "securitySchemes": { - "oauth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } } } - } + }, + "openapi": "3.0.1" } }, "Condition": "ServerlessHttpApiCondition" diff --git a/tests/translator/output/aws-us-gov/explicit_http_api.json b/tests/translator/output/aws-us-gov/explicit_http_api.json index fc808cb42..bf6cc7670 100644 --- a/tests/translator/output/aws-us-gov/explicit_http_api.json +++ b/tests/translator/output/aws-us-gov/explicit_http_api.json @@ -95,22 +95,24 @@ } } }, - "openapi": "3.0.1", - "securitySchemes": { - "OAuth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "OAuth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } } } - } + }, + "openapi": "3.0.1" } } }, @@ -192,22 +194,24 @@ } } }, - "openapi": "3.0.1", - "securitySchemes": { - "OAuth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "OAuth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } } } - } + }, + "openapi": "3.0.1" } } } diff --git a/tests/translator/output/aws-us-gov/http_api_existing_openapi.json b/tests/translator/output/aws-us-gov/http_api_existing_openapi.json index e860c0677..28b9526e8 100644 --- a/tests/translator/output/aws-us-gov/http_api_existing_openapi.json +++ b/tests/translator/output/aws-us-gov/http_api_existing_openapi.json @@ -174,32 +174,34 @@ } } }, - "securitySchemes": { - "oauth2Auth": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2Auth": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } + } + }, + "OpenIdAuth": { + "type": "openIdConnect", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + }, + "openIdConnectUrl": "https://www.example.com/v1/connect" } - } - }, - "OpenIdAuth": { - "type": "openIdConnect", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" - }, - "openIdConnectUrl": "https://www.example.com/v1/connect" } } }, diff --git a/tests/translator/output/aws-us-gov/http_api_existing_openapi_conditions.json b/tests/translator/output/aws-us-gov/http_api_existing_openapi_conditions.json index 5a6bb6d4b..2b2b2f136 100644 --- a/tests/translator/output/aws-us-gov/http_api_existing_openapi_conditions.json +++ b/tests/translator/output/aws-us-gov/http_api_existing_openapi_conditions.json @@ -218,45 +218,47 @@ } } }, - "securitySchemes": { - "oauth2Auth": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2Auth": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } - } - }, - "OAuth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + }, + "OAuth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } + } + }, + "OpenIdAuth": { + "type": "openIdConnect", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + }, + "openIdConnectUrl": "https://www.example.com/v1/connect" } - } - }, - "OpenIdAuth": { - "type": "openIdConnect", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" - }, - "openIdConnectUrl": "https://www.example.com/v1/connect" } } }, diff --git a/tests/translator/output/aws-us-gov/implicit_http_api_auth_and_simple_case.json b/tests/translator/output/aws-us-gov/implicit_http_api_auth_and_simple_case.json index 1474af070..91e559f82 100644 --- a/tests/translator/output/aws-us-gov/implicit_http_api_auth_and_simple_case.json +++ b/tests/translator/output/aws-us-gov/implicit_http_api_auth_and_simple_case.json @@ -213,36 +213,38 @@ } } }, - "openapi": "3.0.1", - "securitySchemes": { - "oauth2Auth": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2Auth": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } + } + }, + "OpenIdAuth": { + "type": "openIdConnect", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + }, + "openIdConnectUrl": "https://www.example.com/v1/connect" } - } - }, - "OpenIdAuth": { - "type": "openIdConnect", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" - }, - "openIdConnectUrl": "https://www.example.com/v1/connect" } } - } + }, + "openapi": "3.0.1" } } } diff --git a/tests/translator/output/aws-us-gov/implicit_http_api_with_many_conditions.json b/tests/translator/output/aws-us-gov/implicit_http_api_with_many_conditions.json index 80690c335..dd70e3632 100644 --- a/tests/translator/output/aws-us-gov/implicit_http_api_with_many_conditions.json +++ b/tests/translator/output/aws-us-gov/implicit_http_api_with_many_conditions.json @@ -647,22 +647,24 @@ ] } }, - "openapi": "3.0.1", - "securitySchemes": { - "oauth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } } } - } + }, + "openapi": "3.0.1" } }, "Condition": "ServerlessHttpApiCondition" diff --git a/tests/translator/output/explicit_http_api.json b/tests/translator/output/explicit_http_api.json index 4a8dc33f2..2cf81d519 100644 --- a/tests/translator/output/explicit_http_api.json +++ b/tests/translator/output/explicit_http_api.json @@ -95,22 +95,24 @@ } } }, - "openapi": "3.0.1", - "securitySchemes": { - "OAuth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "OAuth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } } } - } + }, + "openapi": "3.0.1" } } }, @@ -192,24 +194,26 @@ } } }, - "openapi": "3.0.1", - "securitySchemes": { - "OAuth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "OAuth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } } } - } + }, + "openapi": "3.0.1" } } } } -} \ No newline at end of file +} diff --git a/tests/translator/output/http_api_existing_openapi.json b/tests/translator/output/http_api_existing_openapi.json index cb56f8aac..17372dbca 100644 --- a/tests/translator/output/http_api_existing_openapi.json +++ b/tests/translator/output/http_api_existing_openapi.json @@ -174,32 +174,34 @@ } } }, - "securitySchemes": { - "oauth2Auth": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2Auth": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } + } + }, + "OpenIdAuth": { + "type": "openIdConnect", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + }, + "openIdConnectUrl": "https://www.example.com/v1/connect" } - } - }, - "OpenIdAuth": { - "type": "openIdConnect", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" - }, - "openIdConnectUrl": "https://www.example.com/v1/connect" } } }, diff --git a/tests/translator/output/http_api_existing_openapi_conditions.json b/tests/translator/output/http_api_existing_openapi_conditions.json index 2628f4596..5f644f691 100644 --- a/tests/translator/output/http_api_existing_openapi_conditions.json +++ b/tests/translator/output/http_api_existing_openapi_conditions.json @@ -218,45 +218,47 @@ } } }, - "securitySchemes": { - "oauth2Auth": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2Auth": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } - } - }, - "OAuth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + }, + "OAuth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } + } + }, + "OpenIdAuth": { + "type": "openIdConnect", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + }, + "openIdConnectUrl": "https://www.example.com/v1/connect" } - } - }, - "OpenIdAuth": { - "type": "openIdConnect", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" - }, - "openIdConnectUrl": "https://www.example.com/v1/connect" } } }, diff --git a/tests/translator/output/implicit_http_api_auth_and_simple_case.json b/tests/translator/output/implicit_http_api_auth_and_simple_case.json index 11d4c5e42..069d06ea3 100644 --- a/tests/translator/output/implicit_http_api_auth_and_simple_case.json +++ b/tests/translator/output/implicit_http_api_auth_and_simple_case.json @@ -213,36 +213,38 @@ } } }, - "openapi": "3.0.1", - "securitySchemes": { - "oauth2Auth": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2Auth": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } + } + }, + "OpenIdAuth": { + "type": "openIdConnect", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + }, + "openIdConnectUrl": "https://www.example.com/v1/connect" } - } - }, - "OpenIdAuth": { - "type": "openIdConnect", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" - }, - "openIdConnectUrl": "https://www.example.com/v1/connect" } } - } + }, + "openapi": "3.0.1" } } } diff --git a/tests/translator/output/implicit_http_api_with_many_conditions.json b/tests/translator/output/implicit_http_api_with_many_conditions.json index 590bb5ce3..e2665f3a7 100644 --- a/tests/translator/output/implicit_http_api_with_many_conditions.json +++ b/tests/translator/output/implicit_http_api_with_many_conditions.json @@ -647,22 +647,24 @@ ] } }, - "openapi": "3.0.1", - "securitySchemes": { - "oauth2": { - "type": "oauth2", - "x-amazon-apigateway-authorizer": { - "identitySource": "$request.querystring.param", - "type": "jwt", - "jwtConfiguration": { - "audience": [ - "MyApi" - ], - "issuer": "https://www.example.com/v1/connect/oidc" + "components": { + "securitySchemes": { + "oauth2": { + "type": "oauth2", + "x-amazon-apigateway-authorizer": { + "identitySource": "$request.querystring.param", + "type": "jwt", + "jwtConfiguration": { + "audience": [ + "MyApi" + ], + "issuer": "https://www.example.com/v1/connect/oidc" + } } } } - } + }, + "openapi": "3.0.1" } }, "Condition": "ServerlessHttpApiCondition" From da1ecea1e5b42839f534ee01c832f921a2e55d1b Mon Sep 17 00:00:00 2001 From: Keeton Hodgson Date: Thu, 19 Dec 2019 11:06:44 -0800 Subject: [PATCH 2/2] chore: bump version to v1.19.1 --- samtranslator/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samtranslator/__init__.py b/samtranslator/__init__.py index 8ac48f095..7a99af9e4 100644 --- a/samtranslator/__init__.py +++ b/samtranslator/__init__.py @@ -1 +1 @@ -__version__ = '1.19.0' +__version__ = '1.19.1'