-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathusers-keycloak.yaml
More file actions
629 lines (606 loc) · 18.1 KB
/
Copy pathusers-keycloak.yaml
File metadata and controls
629 lines (606 loc) · 18.1 KB
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
openapi: 3.0.0
info:
title: Users Keycloak API
version: v1
description: Users Keycloak API
servers:
- url: http://localhost:8081
description: Locally deployed server
paths:
/users-keycloak/users:
post:
operationId: createUser
description: Create a new user
tags:
- users
parameters:
- $ref: '#/components/parameters/keycloak-only'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/user'
responses:
'201':
description: 'User has been created'
content:
application/json:
schema:
$ref: '#/components/schemas/user'
'400':
$ref: '#/components/responses/badRequest'
'422':
$ref: '#/components/responses/unprocessableEntity'
'500':
$ref: '#/components/responses/internalServerError'
get:
operationId: getUsers
description: Retrieve a list of users
tags:
- users
parameters:
- $ref: '#/components/parameters/cql-query'
- $ref: '#/components/parameters/query-offset'
- $ref: '#/components/parameters/query-limit'
responses:
'200':
description: Retrieve a list of users
content:
application/json:
schema:
$ref: '#/components/schemas/users'
'400':
$ref: '#/components/responses/badRequest'
'500':
$ref: '#/components/responses/internalServerError'
delete:
operationId: deleteUsers
description: Delete a collection of users selected by a CQL query;
| this doesn't delete proxyFor records that reference them
tags:
- users
parameters:
- $ref: '#/components/parameters/cql-query'
responses:
'204':
description: All selected users deleted
content:
text/plain:
schema:
type: string
'400':
$ref: '#/components/responses/badRequest'
'500':
$ref: '#/components/responses/internalServerError'
/users-keycloak/users/{id}:
put:
operationId: updateUser
description: Update user with given id
tags:
- users
parameters:
- $ref: '#/components/parameters/path-entity-id'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/user'
responses:
'204':
content:
text/plain:
schema:
type: string
description: User successfully updated
'400':
$ref: '#/components/responses/badRequest'
'404':
$ref: '#/components/responses/entityNotFound'
'500':
$ref: '#/components/responses/internalServerError'
get:
operationId: getUser
description: Get a single user
tags:
- users
parameters:
- $ref: '#/components/parameters/path-entity-id'
responses:
'200':
description: Returns user with a given id
content:
application/json:
schema:
$ref: '#/components/schemas/user'
'404':
$ref: '#/components/responses/entityNotFound'
'500':
$ref: '#/components/responses/internalServerError'
delete:
operationId: deleteUser
description: Delete user with given id
tags:
- users
parameters:
- $ref: '#/components/parameters/path-entity-id'
responses:
'204':
description: User deleted successfully
content:
text/plain:
schema:
type: string
'400':
$ref: '#/components/responses/badRequest'
'404':
$ref: '#/components/responses/entityNotFound'
'500':
$ref: '#/components/responses/internalServerError'
/users-keycloak/users/{id}/permissions:
get:
operationId: findPermissions
description: Finds user permissions by filter. desiredPermissions query parameter is required. Wildcard (*) is supported.
tags:
- users
parameters:
- $ref: '#/components/parameters/path-entity-id'
- $ref: '#/components/parameters/desired-permissions'
responses:
'200':
description: Returns resolved permissions for a user
content:
application/json:
schema:
$ref: '#/components/schemas/permissionsContainer'
'400':
$ref: '#/components/responses/badRequest'
'404':
$ref: '#/components/responses/entityNotFound'
'500':
$ref: '#/components/responses/internalServerError'
/users-keycloak/_self:
get:
operationId: getUserBySelfReference
description: Get a user by self reference
tags:
- users
parameters:
- $ref: '#/components/parameters/query-include'
- $ref: '#/components/parameters/query-expand-permissions'
- $ref: '#/components/parameters/query-override-user'
responses:
'200':
description: Returns user by self reference
content:
application/json:
schema:
$ref: '#/components/schemas/compositeUser'
'400':
$ref: '#/components/responses/badRequest'
'403':
$ref: '#/components/responses/forbidden'
'404':
$ref: '#/components/responses/entityNotFound'
'500':
$ref: '#/components/responses/internalServerError'
/users-keycloak/migrations:
get:
operationId: getMigrations
description: Retrieve a list of user migrations
tags:
- migration
parameters:
- $ref: '#/components/parameters/cql-query'
- $ref: '#/components/parameters/query-offset'
- $ref: '#/components/parameters/query-limit'
responses:
'200':
description: Retrieve a list of user migrations
content:
application/json:
schema:
$ref: '#/components/schemas/userMigrationJobs'
'400':
$ref: '#/components/responses/badRequest'
'500':
$ref: '#/components/responses/internalServerError'
post:
operationId: migrateUsers
description: Migrate users from mod-users to Keycloak
tags:
- migration
responses:
'201':
description: 'User migration jobs'
content:
application/json:
schema:
$ref: '#/components/schemas/userMigrationJob'
'400':
$ref: '#/components/responses/badRequest'
'422':
$ref: '#/components/responses/unprocessableEntity'
'500':
$ref: '#/components/responses/internalServerError'
/users-keycloak/migrations/{id}:
get:
description: Retrieve a user migration
operationId: getMigration
tags:
- migration
parameters:
- $ref: '#/components/parameters/path-entity-id'
responses:
'200':
description: Retrieve a user migration
content:
application/json:
schema:
$ref: '#/components/schemas/userMigrationJob'
'400':
$ref: '#/components/responses/badRequest'
'500':
$ref: '#/components/responses/internalServerError'
delete:
description: Delete a user migration
operationId: deleteMigration
tags:
- migration
parameters:
- $ref: '#/components/parameters/path-entity-id'
responses:
'204':
description: Delete a user migration
content:
text/plain:
schema:
type: string
/users-keycloak/idp-migrations:
post:
operationId: linkUserIdpMigration
description: Link users to an identity provider migration operation
tags:
- idp-migration
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/usersIdp'
responses:
'204':
description: Link users to an identity provider migration operation
content:
text/plain:
schema:
type: string
delete:
operationId: unlinkUserIdpMigration
description: Unlink users from an identity provider migration operation
tags:
- idp-migration
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/usersIdp'
responses:
'204':
description: Unlink users from an identity provider migration operation
content:
text/plain:
schema:
type: string
/users-keycloak/forgotten/password:
post:
description: >
Called when a user has forgotten a password. Always returns 204 No Content
regardless of whether a user exists, to prevent username/email enumeration.
If a matching active user is found, a password reset link is sent.
Otherwise, the request is logged but no email is sent.
operationId: resetForgottenPassword
tags:
- forgotten-username-password
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/identifier'
responses:
'204':
$ref: '#/components/responses/noContent'
'500':
$ref: '#/components/responses/internalServerError'
/users-keycloak/forgotten/username:
post:
description: >
Called when a user has forgotten a username. Always returns 204 No Content
regardless of whether a user exists, to prevent username/email enumeration.
If a matching active user is found, a username reminder is sent.
Otherwise, the request is logged but no email is sent.
operationId: recoverForgottenUsername
tags:
- forgotten-username-password
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/identifier'
responses:
'204':
$ref: '#/components/responses/noContent'
'500':
$ref: '#/components/responses/internalServerError'
/users-keycloak/password-reset/reset:
post:
operationId: passwordReset
tags:
- password-reset
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/passwordReset'
responses:
'204':
description: "Successful password reset"
content:
text/plain:
schema:
type: string
'400':
$ref: '#/components/responses/badRequest'
'422':
$ref: '#/components/responses/unprocessableEntity'
'500':
$ref: '#/components/responses/internalServerError'
/users-keycloak/password-reset/link:
post:
operationId: generatePasswordResetLink
tags:
- password-reset
description: Generate and send password reset link
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/generateLinkRequest'
responses:
'200':
description: Response for reset password link generation
content:
application/json:
schema:
$ref: '#/components/schemas/generateLinkResponse'
/users-keycloak/password-reset/validate:
post:
operationId: validatePasswordResetLink
tags:
- password-reset
description: Validates password reset link
responses:
'204':
$ref: '#/components/responses/noContent'
'422':
$ref: '#/components/responses/unprocessableEntity'
'500':
$ref: '#/components/responses/internalServerError'
/users-keycloak/auth-users/{userId}:
get:
operationId: checkIfExistsAuthUserById
tags:
- auth-user
description: Check if AuthUser exists for the specified user ID
parameters:
- $ref: '#/components/parameters/path-entity-userId'
responses:
'204':
$ref: '#/components/responses/noContent'
description: "User is present in Keycloak"
'404':
$ref: '#/components/responses/entityNotFound'
description: "User is not present in Keycloak"
post:
operationId: createAuthUser
tags:
- auth-user
description: Check if AuthUser exists for the specified user ID
parameters:
- $ref: '#/components/parameters/path-entity-userId'
responses:
'201':
$ref: '#/components/responses/created'
description: "User was not present in Keycloak and was created"
'204':
$ref: '#/components/responses/noContent'
description: "User was already present in Keycloak so nothing was changed"
'400':
$ref: '#/components/responses/badRequest'
description: "User doesn't have a username"
'500':
$ref: '#/components/responses/internalServerError'
description: "Unexpected error"
components:
schemas:
errorResponse:
$ref: schemas/common/errors.json
error:
$ref: schemas/common/error.json
parameter:
$ref: schemas/common/parameter.json
user:
$ref: schemas/user.json
users:
$ref: schemas/users.json
compositeUser:
$ref: schemas/compositeUser.json
userTenant:
$ref: schemas/userTenant.json
userTenantCollection:
$ref: schemas/userTenantCollection.json
usersIdp:
$ref: schemas/usersIdp.json
userMigrationJob:
$ref: schemas/migration/userMigrationJob.json
userMigrationJobs:
$ref: schemas/migration/userMigrationJobs.json
userCapabilitiesRequest:
$ref: schemas/capability/user/userCapabilitiesRequest.json
capabilities:
$ref: schemas/capability/capabilities.json
identifier:
$ref: schemas/identifier.json
passwordReset:
$ref: schemas/passwordReset.json
generateLinkRequest:
$ref: schemas/generateLinkRequest.json
generateLinkResponse:
$ref: schemas/generateLinkResponse.json
errorCode:
$ref: schemas/common/errorCode.json
policy:
$ref: schemas/policy/policy.json
policies:
$ref: schemas/policy/policies.json
permissionsContainer:
$ref: schemas/user_permissions/permissions.json
includedField:
type: string
title: Included field
enum:
- groups
- perms
- proxiesfor
- servicepoints
- expanded_perms
- expanded_servicepoints
responses:
created:
description: Success, entity created
noContent:
description: Success, no content
content:
text/plain:
schema:
type: string
badRequest:
description: Bad request, e.g. malformed request body or query parameter
content:
application/json:
schema:
$ref: '#/components/schemas/errorResponse'
unprocessableEntity:
description: Validation errors
content:
application/json:
schema:
$ref: '#/components/schemas/errorResponse'
forbidden:
description: Access denied
content:
application/json:
schema:
$ref: '#/components/schemas/errorResponse'
entityNotFound:
description: Error response if entity is not found by id (in json format)
content:
application/json:
schema:
$ref: '#/components/schemas/errorResponse'
internalServerError:
description: Error response for unhandled or critical server exceptions, e.g. NullPointerException.
content:
application/json:
schema:
$ref: '#/components/schemas/errorResponse'
parameters:
path-entity-id:
in: path
required: true
name: id
description: Entity id
schema:
type: string
format: uuid
query-limit:
in: query
required: false
name: limit
description: Limit the number of elements returned in the response.
schema:
type: integer
minimum: 0
maximum: 500
default: 10
query-offset:
in: query
required: false
name: offset
description: Skip over a number of elements by specifying an offset value for the query.
schema:
type: integer
minimum: 0
default: 0
query-include:
in: query
required: false
name: include
description: Indicates which referenced fields should be populated (de-referenced) by the service
schema:
type: array
items:
$ref: '#/components/schemas/includedField'
query-expand-permissions:
in: query
required: false
name: expandPermissions
description: Whether or not to expand permissions listings
schema:
type: boolean
default: false
query-override-user:
in: query
required: false
name: overrideUser
description: When set to true the real user will be retrieved for ECS login into member tenants
schema:
type: boolean
default: false
cql-query:
name: query
in: query
required: false
description: A CQL query string with search conditions.
schema:
type: string
keycloak-only:
in: query
required: false
name: keycloakOnly
description: Create auth user only during user creation
schema:
type: boolean
default: false
desired-permissions:
in: query
required: true
name: desiredPermissions
description: Permissions of permission prefix to filter by
schema:
type: array
items:
type: string
example: [ "users.collection.get", "users.item.*" ]
path-entity-userId:
in: path
required: true
name: userId
description: User ID
schema:
type: string
format: uuid