-
-
Notifications
You must be signed in to change notification settings - Fork 202
/
security.yaml
145 lines (133 loc) 路 2.87 KB
/
security.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
openapi: "3.0.2"
info:
version: 1.0.0
title: requestBodies $ref
description: requestBodies $ref Test
servers:
- url: /v1/
paths:
/apikey_and_bearer_or_basic:
get:
security:
- ApiKeyAuth: []
BearerAuth: []
- BasicAuth: []
responses:
"200":
description: OK
"401":
description: unauthorized
/no_security:
get:
responses:
"200":
description: OK
/api_key:
get:
security:
- ApiKeyAuth: []
responses:
"200":
description: OK
"401":
description: unauthorized
/api_key_or_anonymous:
get:
security:
# {} means anonyous or no security - see https://github.com/OAI/OpenAPI-Specification/issues/14
- {}
- ApiKeyAuth: []
responses:
"200":
description: OK
"401":
description: unauthorized
# This api key with scopes should fail validation and return 500
# scopes are only allowed for oauth2 and openidconnect
/api_key_with_scopes:
get:
security:
- ApiKeyAuth: ["read", "write"]
responses:
"200":
description: OK
"401":
description: unauthorized
/bearer:
get:
security:
- BearerAuth: []
responses:
"200":
description: OK
"401":
description: unauthorized
/basic:
get:
security:
- BasicAuth: []
responses:
"200":
description: OK
"401":
description: unauthorized
/cookie_auth:
get:
security:
- CookieAuth: []
responses:
"200":
description: OK
"401":
description: unauthorized
/oauth2:
get:
security:
- OAuth2:
- scope1
- scope2
responses:
"200":
description: OK
"401":
description: unauthorized
/openid:
get:
security:
- OpenID:
- scope1
- scope2
responses:
"200":
description: OK
"401":
description: unauthorized
components:
securitySchemes:
BasicAuth:
type: http
scheme: basic
BearerAuth:
type: http
scheme: bearer
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
CookieAuth:
type: apiKey
in: cookie
name: JSESSIONID # cookie name
OpenID:
type: openIdConnect
openIdConnectUrl: https://example.com/.well-known/openid-configuration
OAuth2:
type: oauth2
flows:
authorizationCode:
authorizationUrl: https://example.com/oauth/authorize
tokenUrl: https://example.com/oauth/token
scopes:
read: Grants read access
write: Grants write access
admin: Grants access to admin operations