generated from wisdom-oss/microservice-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
313 lines (299 loc) · 9.25 KB
/
openapi.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
openapi: 3.0.3
info:
title: User Management Service
description: |
The User Management Service allows the management of external users and
their permissions within the WISdoM platform.
It uses an external OpenID Connect Provider.
version: 1.0.0
servers:
- url: '/api/auth/'
description: WISdoM Deployment
- url: 'http://localhost:8000'
description: Local Development
tags:
- name: Session Management
description: |
Routes in this category are used to manage sessions and allow users to
login and log out as well as creating long-living credentials and external
clients
- name: User Management
description: |
Routes in this category are used to read and write users
- name: Others
description: |
Routes in this category are used for miscellaneous tasks such as discovery
of resources and providing resources
components:
schemas:
ErrorResponse:
type: object
required:
- type
- status
- title
- detail
- instance
properties:
type:
type: string
status:
type: integer
title:
type: string
detail:
type: string
instance:
type: string
error:
type: string
AuthorizationCodeRequest:
type: object
required:
- grant_type
- code
- state
properties:
grant_type:
type: string
code:
type: string
state:
type: string
RefreshTokenRequest:
type: object
required:
- grant_type
- refresh_token
properties:
grant_type:
type: string
refresh_token:
type: string
ClientCredentialRequest:
type: object
required:
- grant_type
- client_id
- client_secret
properties:
grant_type:
type: string
client_id:
type: string
client_secret:
type: string
User:
type: object
properties:
id:
type: string
pattern: '/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i'
description: Internal User ID
externalIdentifier:
type: string
description: |
Externally generated user id (usually matching the `sub` claim)
name:
type: string
description: |
Full Name (as set in the external provider)
email:
type: string
description: |
E-Mail address (as set in the external provider)
username:
type: string
description: |
Username (as set in the external provider)
disabled:
type: boolean
administrator:
type: boolean
paths:
/.well-known/jwks.json:
get:
summary: JSON Web Key Set
tags:
- Others
description: |
Retrieve the JSON Web Key Set used to validate JSON Web Tokens issued
by the user management
externalDocs:
description: RFC 7517 (JSON Web Key (JWK))
url: https://www.rfc-editor.org/rfc/rfc7517
responses:
200:
description: JSON Web Key Set
content:
application/json:
schema:
type: object
properties:
keys:
type: array
items:
type: object
properties:
kty:
type: string
crv:
type: string
x:
type: string
y:
type: string
use:
type: string
kid:
type: string
n:
type: string
e:
type: string
alg:
type: string
example:
keys:
- kty: EC
crv: P-256
x: MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4
'y': 4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM
use: enc
kid: '1'
- kty: RSA
'n': >-
0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw
e: AQAB
alg: RS256
kid: '2011-04-29'
/login:
get:
summary: Initiate Login Process
parameters:
- in: query
required: true
name: redirect_uri
description: Redirection URI used by the IDP
tags:
- Session Management
description: |
Start the login process and redirect the user to the configured
identity provider
responses:
302:
description: Redirection to the identity provider
/callback:
get:
responses:
303:
description: A Message explaining how to gain access
content:
text/plain:
schema:
type: string
/token:
post:
summary: Generate Token Set
tags:
- Session Management
description: |
Exchange the authorization code for an access token
*Important Note*: When using a refresh token to generate a new token set
the refresh token used in the request is automatically invalidated.
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
oneOf:
- $ref: '#/components/schemas/AuthorizationCodeRequest'
- $ref: '#/components/schemas/RefreshTokenRequest'
- $ref: '#/components/schemas/ClientCredentialRequest'
discriminator:
propertyName: grant_type
mapping:
client_credentials: '#/components/schemas/ClientCredentialRequest'
authorization_code: '#/components/schemas/AuthorizationCodeRequest'
refresh_token: '#/components/schemas/RefreshTokenRequest'
responses:
200:
description: Token Set
content:
application/json:
schema:
properties:
access_token:
type: string
description: |
A signed JWT containing the users information and the
scopes they may access. It is signed using one of the keys
available at the `/.well-known/jwks.json` endpoint
expires_in:
type: integer
description: |
Denotes the time in seconds that the access token is valid
token_type:
type: string
enum:
- bearer
refresh_token:
type: string
description: |
A signed and encrypted JWT which can be used to retrieve
a new Token set, granted the refresh token has not been
revoked or didn't expire.
A refresh token is valid for 12h starting with the
generation on the server side.
403:
description: Forbidden
content:
application/problem+json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/revoke:
post:
tags:
- Session Management
summary: Revoke Refresh Token
description: |
The user management only supports revoking a refresh token as there is
no way for the dependent services to know if a token has been revoked.
Therefore, a access token should only be stored in the session storage
so it automatically is removed after closing the client
responses:
200:
description: Token revoked sucessfully
/users:
get:
tags:
- User Management
summary: Get User List
responses:
200:
description: User List
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
/users/{userID}:
parameters:
- in: path
name: userID
schema:
pattern: '/(^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$|^me$)/mi'
get:
tags:
- User Management
summary: Get User Details
responses:
200:
description: User Details
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'