From 49a792b4a4fbbf558e1844ffde56ff95bb52b215 Mon Sep 17 00:00:00 2001 From: Jack Kavanagh Date: Wed, 12 Oct 2022 17:39:23 +0200 Subject: [PATCH] o2k: removed partial support for oauth2 (#5260) * o2k: removed partial support for oauth2 * Fix fixtures Co-authored-by: Filipe Freire --- packages/openapi-2-kong/README.md | 5 +---- .../fixtures/security.expected.json | 14 -------------- .../src/declarative-config/security-plugins.ts | 11 ----------- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/packages/openapi-2-kong/README.md b/packages/openapi-2-kong/README.md index b1c4ee9623..dd6d7edd80 100644 --- a/packages/openapi-2-kong/README.md +++ b/packages/openapi-2-kong/README.md @@ -564,9 +564,6 @@ Supported types are: - `oauth2` - NOT YET IMPLEMENTED! - - except for the implicit flow - - implemented using the Kong plugin `openid-connect` - - extended by: `x-kong-security-openid-connect` - `openIdConnect` - implemented using the Kong plugin `openid-connect` - extended by: `x-kong-security-openid-connect` @@ -635,7 +632,7 @@ The `request-validator` plugin has three [parameters](https://docs.konghq.com/hu - `config.parameter_schema` - `config.allowed_content_types` -If any of these are *not* specified in the `x-kong-plugin-request-validator.config` object in the OpenAPI spec, they will be generated if possible, otherwise will be configured to allow all body/parameter/content types. +If any of these are _not_ specified in the `x-kong-plugin-request-validator.config` object in the OpenAPI spec, they will be generated if possible, otherwise will be configured to allow all body/parameter/content types. ```yaml paths: diff --git a/packages/openapi-2-kong/src/declarative-config/fixtures/security.expected.json b/packages/openapi-2-kong/src/declarative-config/fixtures/security.expected.json index 9133ed0fb0..e8530c3727 100644 --- a/packages/openapi-2-kong/src/declarative-config/fixtures/security.expected.json +++ b/packages/openapi-2-kong/src/declarative-config/fixtures/security.expected.json @@ -13,13 +13,6 @@ "strip_path": false, "tags": ["OAS3_import", "OAS3file_security.yaml"], "name": "Security_Example-only-oath2-get", - "plugins": [ - { - "config": { "auth_methods": ["client_credentials"] }, - "name": "openid-connect", - "tags": ["OAS3_import", "OAS3file_security.yaml"] - } - ], "paths": ["/only/oath2$"] }, { @@ -41,13 +34,6 @@ "strip_path": false, "tags": ["OAS3_import", "OAS3file_security.yaml"], "name": "Security_Example-and-based-auth-get", - "plugins": [ - { - "config": { "auth_methods": ["client_credentials"] }, - "name": "openid-connect", - "tags": ["OAS3_import", "OAS3file_security.yaml"] - } - ], "paths": ["/and/based/auth$"] }, { diff --git a/packages/openapi-2-kong/src/declarative-config/security-plugins.ts b/packages/openapi-2-kong/src/declarative-config/security-plugins.ts index d8a5b50404..f91c171593 100644 --- a/packages/openapi-2-kong/src/declarative-config/security-plugins.ts +++ b/packages/openapi-2-kong/src/declarative-config/security-plugins.ts @@ -71,13 +71,6 @@ export const generateOpenIdConnectSecurityPlugin = (scheme: OpenAPIV3.OpenIdSecu return openIdConnectPlugin; }; -export const generateOAuth2SecurityPlugin = (): OpenIDConnectPlugin => ({ - config: { - auth_methods: ['client_credentials'], - }, - name: 'openid-connect', -}); - export function generateSecurityPlugin( scheme: OA3SecurityScheme | null, args: string[], @@ -99,10 +92,6 @@ export function generateSecurityPlugin( plugin = generateOpenIdConnectSecurityPlugin(scheme as OpenAPIV3.OpenIdSecurityScheme, args); break; - case 'oauth2': - plugin = generateOAuth2SecurityPlugin(); - break; - default: return null; }