From 03e4545ab48e1314df17c1e427a20dc545f4cf47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Urba=C5=84czyk?= Date: Tue, 7 Feb 2023 16:53:07 +0100 Subject: [PATCH] feat: define new security mechanism (#316) --- definitions/3.0.0/SecurityRequirement.json | 12 ------------ definitions/3.0.0/oauth2Flow.json | 2 +- definitions/3.0.0/oauth2Flows.json | 15 +++++++++++---- definitions/3.0.0/openIdConnect.json | 7 +++++++ definitions/3.0.0/operation.json | 5 +---- definitions/3.0.0/securityRequirements.json | 16 ++++++++++++++++ definitions/3.0.0/server.json | 5 +---- 7 files changed, 37 insertions(+), 25 deletions(-) delete mode 100644 definitions/3.0.0/SecurityRequirement.json create mode 100644 definitions/3.0.0/securityRequirements.json diff --git a/definitions/3.0.0/SecurityRequirement.json b/definitions/3.0.0/SecurityRequirement.json deleted file mode 100644 index 410afeb6..00000000 --- a/definitions/3.0.0/SecurityRequirement.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "type": "string" - }, - "uniqueItems": true - }, - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "http://asyncapi.com/definitions/3.0.0/SecurityRequirement.json" -} \ No newline at end of file diff --git a/definitions/3.0.0/oauth2Flow.json b/definitions/3.0.0/oauth2Flow.json index f5a9e447..d3ca471b 100644 --- a/definitions/3.0.0/oauth2Flow.json +++ b/definitions/3.0.0/oauth2Flow.json @@ -13,7 +13,7 @@ "type": "string", "format": "uri" }, - "scopes": { + "availableScopes": { "$ref": "http://asyncapi.com/definitions/3.0.0/oauth2Scopes.json" } }, diff --git a/definitions/3.0.0/oauth2Flows.json b/definitions/3.0.0/oauth2Flows.json index bb895f28..735806c8 100644 --- a/definitions/3.0.0/oauth2Flows.json +++ b/definitions/3.0.0/oauth2Flows.json @@ -25,7 +25,7 @@ { "required": [ "authorizationUrl", - "scopes" + "availableScopes" ] }, { @@ -45,7 +45,7 @@ { "required": [ "tokenUrl", - "scopes" + "availableScopes" ] }, { @@ -65,7 +65,7 @@ { "required": [ "tokenUrl", - "scopes" + "availableScopes" ] }, { @@ -86,13 +86,20 @@ "required": [ "authorizationUrl", "tokenUrl", - "scopes" + "availableScopes" ] } ] } }, "additionalProperties": false + }, + "scopes": { + "type": "array", + "description": "List of the needed scope names.", + "items": { + "type": "string" + } } }, "patternProperties": { diff --git a/definitions/3.0.0/openIdConnect.json b/definitions/3.0.0/openIdConnect.json index 4d034031..2150ba4d 100644 --- a/definitions/3.0.0/openIdConnect.json +++ b/definitions/3.0.0/openIdConnect.json @@ -17,6 +17,13 @@ "openIdConnectUrl": { "type": "string", "format": "uri" + }, + "scopes": { + "type": "array", + "description": "List of the needed scope names.", + "items": { + "type": "string" + } } }, "patternProperties": { diff --git a/definitions/3.0.0/operation.json b/definitions/3.0.0/operation.json index bd99aa68..a8d00ad2 100644 --- a/definitions/3.0.0/operation.json +++ b/definitions/3.0.0/operation.json @@ -64,10 +64,7 @@ "description": "A longer description of the operation. CommonMark is allowed." }, "security": { - "type": "array", - "items": { - "$ref": "http://asyncapi.com/definitions/3.0.0/SecurityRequirement.json" - } + "$ref": "http://asyncapi.com/definitions/3.0.0/securityRequirements.json" }, "tags": { "type": "array", diff --git a/definitions/3.0.0/securityRequirements.json b/definitions/3.0.0/securityRequirements.json new file mode 100644 index 00000000..b8da3dcb --- /dev/null +++ b/definitions/3.0.0/securityRequirements.json @@ -0,0 +1,16 @@ +{ + "description": "An array representing security requirements.", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json" + }, + { + "$ref": "http://asyncapi.com/definitions/3.0.0/SecurityScheme.json" + } + ] + }, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://asyncapi.com/definitions/3.0.0/securityRequirements.json" +} diff --git a/definitions/3.0.0/server.json b/definitions/3.0.0/server.json index 5b4fbb4e..5da34f82 100644 --- a/definitions/3.0.0/server.json +++ b/definitions/3.0.0/server.json @@ -38,10 +38,7 @@ "$ref": "http://asyncapi.com/definitions/3.0.0/serverVariables.json" }, "security": { - "type": "array", - "items": { - "$ref": "http://asyncapi.com/definitions/3.0.0/SecurityRequirement.json" - } + "$ref": "http://asyncapi.com/definitions/3.0.0/securityRequirements.json" }, "bindings": { "$ref": "http://asyncapi.com/definitions/3.0.0/serverBindingsObject.json"