Skip to content

Commit 79470fe

Browse files
committed
Referencing issue OAI#513. Clarify the spec to accommodate OAuth schemes where scope may be unspecified (optional scope) or where scope is not used at all.
1 parent b0ecc00 commit 79470fe

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

versions/3.0.3.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,12 +3286,14 @@ Field Name | Type | Applies To | Description
32863286
<a name="oauthFlowAuthorizationUrl"></a>authorizationUrl | `string` | `oauth2` (`"implicit"`, `"authorizationCode"`) | **REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL.
32873287
<a name="oauthFlowTokenUrl"></a>tokenUrl | `string` | `oauth2` (`"password"`, `"clientCredentials"`, `"authorizationCode"`) | **REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL.
32883288
<a name="oauthFlowRefreshUrl"></a>refreshUrl | `string` | `oauth2` | The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
3289-
<a name="oauthFlowScopes"></a>scopes | Map[`string`, `string`] | `oauth2` | **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
3289+
<a name="oauthFlowScopes"></a>scopes | Map[`string`, `string`] | `oauth2` | **REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. If scope is optional, the map MAY include an entry with an empty string as its key to represent the default scope. If scope is not used in the authorization scheme, the map MAY be empty.
32903290

32913291
This object MAY be extended with [Specification Extensions](#specificationExtensions).
32923292

32933293
##### OAuth Flow Object Examples
32943294

3295+
###### OAuth Flows with Required Scope
3296+
32953297
```JSON
32963298
{
32973299
"type": "oauth2",
@@ -3331,6 +3333,41 @@ flows:
33313333
read:pets: read your pets
33323334
```
33333335

3336+
###### OAuth Flows with Unspecified and Optional Scope
3337+
3338+
```JSON
3339+
{
3340+
"type": "oauth2",
3341+
"flows": {
3342+
"implicit": {
3343+
"authorizationUrl": "https://example.com/api/oauth/dialog",
3344+
"scopes": {}
3345+
},
3346+
"authorizationCode": {
3347+
"authorizationUrl": "https://example.com/api/oauth/dialog",
3348+
"tokenUrl": "https://example.com/api/oauth/token",
3349+
"scopes": {
3350+
"write:pets": "modify pets in your account",
3351+
"": "default scope provides read-only access"
3352+
}
3353+
}
3354+
}
3355+
}
3356+
```
3357+
3358+
```yaml
3359+
type: oauth2
3360+
flows:
3361+
implicit:
3362+
authorizationUrl: https://example.com/api/oauth/dialog
3363+
scopes: {}
3364+
authorizationCode:
3365+
authorizationUrl: https://example.com/api/oauth/dialog
3366+
tokenUrl: https://example.com/api/oauth/token
3367+
scopes:
3368+
write:pets: modify pets in your account
3369+
"" : default scope provides read-only access
3370+
```
33343371

33353372
#### <a name="securityRequirementObject"></a>Security Requirement Object
33363373

@@ -3346,7 +3383,7 @@ When a list of Security Requirement Objects is defined on the [OpenAPI Object](#
33463383

33473384
Field Pattern | Type | Description
33483385
---|:---:|---
3349-
<a name="securityRequirementsName"></a>{name} | [`string`] | Each name MUST correspond to a security scheme which is declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty.
3386+
<a name="securityRequirementsName"></a>{name} | [`string`] | Each name MUST correspond to a security scheme which is declared in the [Security Schemes](#componentsSecuritySchemes) under the [Components Object](#componentsObject). If the security scheme is of type `"oauth2"` or `"openIdConnect"`, then the value is a list of scope names required for the execution, and the list MAY be empty if authorization does not require a specified scope. For other security scheme types, the array MUST be empty.
33503387

33513388
##### Security Requirement Object Examples
33523389

0 commit comments

Comments
 (0)