keycloak-api-manager 1.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1411 @@
1
+ /**
2
+ * **************************************************************************************************
3
+ * **************************************************************************************************
4
+ * Clients entity provides a set of methods to manage clients (i.e., applications or services) within a realm.
5
+ * Clients represent entities that want to interact with Keycloak for authentication or authorization (e.g., web apps, APIs).
6
+ * **************************************************************************************************
7
+ * **************************************************************************************************
8
+ */
9
+ let kcAdminClientHandler=null;
10
+ exports.setKcAdminClient=function(kcAdminClient){
11
+ kcAdminClientHandler=kcAdminClient;
12
+ }
13
+
14
+
15
+ /**
16
+ * ***************************** - CREATE - *******************************
17
+ * Creates a new client with the provided configuration
18
+ * @parameters:
19
+ * - client_dictionary: An object(JSON) of type ClientRepresentation, containing the configuration for the new client.
20
+ * - clientId: [required] string The unique identifier for the client (required).
21
+ * - name: [required] string A human-readable name for the client.
22
+ * - enabled: [optional] boolean Whether the client is enabled. Default is true.
23
+ * - publicClient: [optional] boolean Whether the client is public (no secret).
24
+ * - secret: [optional] string Client secret (if not a public client).
25
+ * - redirectUris: [optional] string[] List of allowed redirect URIs (for browser-based clients).
26
+ * - baseUrl: [optional] string Base URL of the client.
27
+ * - protocol: [optional] string Protocol to use (openid-connect, saml, etc.).
28
+ * - standardFlowEnabled: [optional] boolean Enables standard OAuth2 Authorization Code Flow.
29
+ * - {Other client fields}: [optional] Other client fields
30
+ */
31
+ exports.create=function(client_dictionary){
32
+ return (kcAdminClientHandler.clients.create(client_dictionary));
33
+ }
34
+
35
+
36
+
37
+ /**
38
+ * ***************************** - find - *******************************
39
+ * Retrieves a list of all clients in the current realm, optionally filtered by query parameters.
40
+ * This method is useful for listing all registered applications or services in Keycloak or searching
41
+ * for a specific one using filters like clientId.
42
+ * @parameters:
43
+ * - filter: A JSON structure used to filter results based on specific fields:
44
+ * - clientId: [optional] string filter to search clients by their clientId.
45
+ * - viewableOnly: [optional] boolean value. If true, returns only clients that the current user is allowed to view.
46
+ * - first:[optional] Pagination: index of the first result to return.
47
+ * - max:[optional] Pagination: maximum number of results to return.
48
+ */
49
+ exports.find=function(filter){
50
+ return (kcAdminClientHandler.clients.find(filter));
51
+ }
52
+
53
+
54
+ /**
55
+ * ***************************** - findOne - *******************************
56
+ * Retrieves detailed information about a specific client within a realm by its unique client ID.
57
+ * This method fetches the client’s configuration, including its settings, roles, protocols, and other metadata.
58
+ * @parameters:
59
+ * - filter: A JSON structure used to filter results based on specific fields:
60
+ * - id: [optional] The unique identifier of the client to retrieve
61
+ */
62
+ exports.findOne=function(filter){
63
+ return (kcAdminClientHandler.clients.findOne(filter));
64
+ }
65
+
66
+
67
+ /**
68
+ * ***************************** - del - *******************************
69
+ * Deletes a client from the realm using its internal ID.
70
+ * This operation is irreversible and will remove the client and all its associated roles, permissions, and configurations.
71
+ * @parameters:
72
+ * - filter: A JSON structure used to filter results based on specific fields:
73
+ * - id: [required] The internal ID of the client to delete (not clientId)
74
+ */
75
+ exports.del=function(filter){
76
+ return (kcAdminClientHandler.clients.del(filter));
77
+ }
78
+
79
+
80
+
81
+ /**
82
+ * ***************************** - update - *******************************
83
+ * Updates the configuration of an existing client in the realm.
84
+ * You can modify various attributes such as the client name, redirect URIs, protocol, access type, and more.
85
+ * @parameters:
86
+ * - filter: A JSON structure used to filter results based on specific fields:
87
+ * - id: [required] The unique ID of the client you want to update
88
+ * - clientRepresentation: [required] The new configuration for the client
89
+ */
90
+ exports.update=function(filter,clientRepresentation){
91
+ return (kcAdminClientHandler.clients.update(filter,clientRepresentation));
92
+ }
93
+
94
+
95
+
96
+ /**
97
+ * ***************************** - createRole - *******************************
98
+ * Creates a new client role under a specific client.
99
+ * Client roles are roles associated with a specific client (application), and are useful
100
+ * for fine-grained access control within that client.
101
+ * @parameters:
102
+ * - role_parameters: JSON structure that defines the role like:
103
+ * - id: [required] The internal ID of the client where the role will be created.
104
+ * - name: [required] Name of the new role.
105
+ * - description: [optional] Optional description of the role.
106
+ * - [optional] Other role fields
107
+ */
108
+ exports.createRole=function(role_parameters){
109
+ return (kcAdminClientHandler.clients.createRole(role_parameters));
110
+ }
111
+
112
+
113
+
114
+ /**
115
+ * ***************************** - findRole - *******************************
116
+ * Retrieves a specific client role by name from a given client.
117
+ * This is useful when you want to inspect or verify the properties of a role defined within a particular client.
118
+ * @parameters:
119
+ * - filter: JSON structure that defines the filter parameters:
120
+ * - id: [required] The internal ID of the client (not the clientId string) where the role is defined.
121
+ * - roleName: [required] The name of the client role you want to find.
122
+ */
123
+ exports.findRole=function(filter){
124
+ return (kcAdminClientHandler.clients.findRole(filter));
125
+ }
126
+
127
+
128
+
129
+ /**
130
+ * ***************************** - updateRole - *******************************
131
+ * Updates the attributes of a specific client role in Keycloak.
132
+ * This includes changing the role's name, description, or any associated metadata.
133
+ * @parameters:
134
+ * - filter: JSON structure that defines the filter parameters:
135
+ * - id: [required] The internal ID of the client (not the clientId string) where the role is defined.
136
+ * - roleName: [required] The name of the client role you want to update
137
+ * - roleRepresentation: [required] An object with the updated properties of the role
138
+ */
139
+ exports.updateRole=function(filter,roleRepresentation){
140
+ return (kcAdminClientHandler.clients.updateRole(filter,roleRepresentation));
141
+ }
142
+
143
+
144
+ /**
145
+ * ***************************** - delRole - *******************************
146
+ * Deletes a client role by its name for a specific client.
147
+ * This permanently removes the role from the specified client in Keycloak.
148
+ * A promise that resolves to void if the deletion is successful.
149
+ * If the role does not exist or the operation fails, an error will be thrown.
150
+ * @parameters:
151
+ * - filter: JSON structure that defines the filter parameters:
152
+ * - id: [required] The internal ID of the client (not the clientId string) where the role is defined.
153
+ * - roleName: [required] The name of the client role you want to delete.
154
+ */
155
+ exports.delRole=function(filter){
156
+ return (kcAdminClientHandler.clients.delRole(filter));
157
+ }
158
+
159
+
160
+
161
+
162
+ /**
163
+ * ***************************** - listRoles - *******************************
164
+ * Retrieves all roles defined for a specific client within the realm.
165
+ * These roles can be used to assign permissions to users or groups for the specific client application.
166
+ * @parameters:
167
+ * - filter: JSON structure that defines the filter parameters:
168
+ * - id: [required] The internal ID of the client (not clientId)
169
+ */
170
+ exports.listRoles=function(filter){
171
+ return (kcAdminClientHandler.clients.listRoles(filter));
172
+ }
173
+
174
+
175
+
176
+ /**
177
+ * ***************************** - getClientSecret - *******************************
178
+ * Retrieves the client secret associated with a confidential client in Keycloak.
179
+ * This is typically used for clients using client_credentials or authorization_code flows where the secret is required to authenticate the client.
180
+ * @parameters:
181
+ * - filter: JSON structure that defines the filter parameters:
182
+ * - id: [required] The internal ID of the client (not clientId)
183
+ */
184
+ exports.getClientSecret=function(filter){
185
+ return (kcAdminClientHandler.clients.getClientSecret(filter));
186
+ }
187
+
188
+
189
+ /**
190
+ * ***************************** - generateNewClientSecret - *******************************
191
+ * Generates a new client secret for a confidential client in Keycloak. This will overwrite the existing secret and return the newly generated one.
192
+ * It is useful when rotating credentials or recovering access.
193
+ * @parameters:
194
+ * - filter: JSON structure that defines the filter parameters:
195
+ * - id: [required] The internal ID of the client (not clientId)
196
+ */
197
+ exports.generateNewClientSecret=function(filter){
198
+ return (kcAdminClientHandler.clients.creatgenerateNewClientSecrete(filter));
199
+ }
200
+
201
+
202
+ /**
203
+ * ***************************** - generateRegistrationAccessToken - *******************************
204
+ * Generates a new registration access token for a client. This token allows the client to make authorized requests to the client registration REST API.
205
+ * It’s particularly useful in dynamic client registration workflows or when automating client updates via external systems.
206
+ * @parameters:
207
+ * - filter: JSON structure that defines the filter parameters:
208
+ * - id: [required] The internal ID of the client (not clientId)
209
+ */
210
+ exports.generateRegistrationAccessToken=function(filter){
211
+ return (kcAdminClientHandler.clients.generateRegistrationAccessToken(filter));
212
+ }
213
+
214
+
215
+
216
+ /**
217
+ * ***************************** - invalidateSecret - *******************************
218
+ * Invalidates (revokes) the current client secret, making it no longer valid.
219
+ * After invalidation, the client will no longer be able to authenticate using the old secret and a new secret should be generated.
220
+ *
221
+ * @parameters:
222
+ * - filter: JSON structure that defines the filter parameters:
223
+ * - id: [required] The internal ID of the client (not clientId)
224
+ */
225
+ exports.invalidateSecret=function(filter){
226
+ return (kcAdminClientHandler.clients.invalidateSecret(filter));
227
+ }
228
+
229
+
230
+ /**
231
+ * ***************************** - getInstallationProviders - *******************************
232
+ * Retrieves a list of available installation providers for a specific client.
233
+ * Installation providers define how client configuration can be exported or installed,
234
+ * for example as a JSON file, Keycloak XML adapter config, or other formats supported by Keycloak.
235
+ * Return an array of installation provider objects, each representing a supported installation format for the client.
236
+ *
237
+ * @parameters:
238
+ * - filter: JSON structure that defines the filter parameters:
239
+ * - id: [required] The internal ID of the client (not clientId)
240
+ *
241
+ */
242
+ exports.getInstallationProviders=function(filter){
243
+ return (kcAdminClientHandler.clients.getInstallationProviders(filter));
244
+ }
245
+
246
+
247
+ /**
248
+ * ***************************** - listPolicyProviders - *******************************
249
+ * The method retrieves the list of available policy providers for a client’s resource server.
250
+ * Policy providers define the logic used to evaluate authorization decisions (e.g., role-based, group-based, time-based, JavaScript rules).
251
+ * This method allows you to see which policy types are supported and available to be created for a given client.
252
+ *
253
+ * @parameters:
254
+ * - filter: JSON structure that defines the filter parameters:
255
+ * - id: [required] The ID of the client (resource server) for which to list available policy providers.
256
+ */
257
+ exports.listPolicyProviders=function(filter){
258
+ return (kcAdminClientHandler.clients.listPolicyProviders(filter));
259
+ }
260
+
261
+
262
+ /**
263
+ * ***************************** - getServiceAccountUser - *******************************
264
+ * Retrieves the service account user associated with a specific client.
265
+ * In Keycloak, clients configured as service accounts have a corresponding user representing them,
266
+ * which can be used for token-based access and permissions management.
267
+ * Return an object representing the user linked to the client's service account,
268
+ * including details such as user ID, username, email, and other user attributes.
269
+ *
270
+ * @parameters:
271
+ * - filter: JSON structure that defines the filter parameters:
272
+ * - id: [required] The internal ID of the client (not clientId)
273
+ *
274
+ */
275
+ exports.getServiceAccountUser=function(filter){
276
+ return (kcAdminClientHandler.clients.getServiceAccountUser(filter));
277
+ }
278
+
279
+
280
+ /**
281
+ * ***************************** - addDefaultClientScope - *******************************
282
+ * The method is used to associate a client scope as a default scope for a specific client.
283
+ * Default scopes are automatically included in tokens issued to the client.
284
+ *
285
+ * @parameters:
286
+ * - filter: JSON structure that defines the filter parameters:
287
+ * - id: [required] The internal ID of the client (not clientId)
288
+ * - clientScopeId: [required] The ID of the client scope you want to add as a default scope.
289
+ */
290
+ exports.addDefaultClientScope=function(filter){
291
+ return (kcAdminClientHandler.clients.addDefaultClientScope(filter));
292
+ }
293
+
294
+
295
+
296
+ /**
297
+ * ***************************** - delDefaultClientScope - *******************************
298
+ * This function detaches a default client scope (either default or optional) from a client.
299
+ * Default scopes are automatically assigned to tokens issued for the client.
300
+ *
301
+ * @parameters:
302
+ * - filter: JSON structure that defines the filter parameters:
303
+ * - id: [required] The internal ID of the client (not clientId)
304
+ * - clientScopeId: [required] The ID of the client scope to be removed.
305
+ */
306
+ exports.delDefaultClientScope=function(filter){
307
+ return (kcAdminClientHandler.clients.delDefaultClientScope(filter));
308
+ }
309
+
310
+
311
+
312
+ /**
313
+ * ***************************** - delOptionalClientScope - *******************************
314
+ * The method is used to remove an optional client scope from a specific client.
315
+ * Optional client scopes are those that are not automatically assigned to clients but can be requested during authentication.
316
+ *
317
+ * @parameters:
318
+ * - filter: JSON structure that defines the filter parameters:
319
+ * - id: [required] The internal ID of the client (not clientId)
320
+ * - clientScopeId: [required] The ID of the client scope you want to unlink from the client.
321
+ */
322
+ exports.delOptionalClientScope=function(filter){
323
+ return (kcAdminClientHandler.clients.delOptionalClientScope(filter));
324
+ }
325
+
326
+
327
+ /**
328
+ * ***************************** - listDefaultClientScopes - *******************************
329
+ * This method lists those default scopes for a given client.
330
+ * Default client scopes are automatically assigned to a client during token requests (e.g., openid, profile).
331
+ *
332
+ * @parameters:
333
+ * - filter: JSON structure that defines the filter parameters:
334
+ * - id: [required] The client ID of the client whose default client scopes you want to list.
335
+ */
336
+ exports.listDefaultClientScopes=function(filter){
337
+ return (kcAdminClientHandler.clients.listDefaultClientScopes(filter));
338
+ }
339
+
340
+
341
+
342
+ /**
343
+ * ***************************** - listOptionalClientScopes - *******************************
344
+ * The method is used to retrieve all optional client scopes currently assigned to a specific client.
345
+ * Optional scopes are those that a client can request explicitly but are not automatically applied.
346
+ *
347
+ * @parameters:
348
+ * - filter: JSON structure that defines the filter parameters:
349
+ * - id: [required] The client ID of the client whose optional client scopes you want to list.
350
+ */
351
+ exports.listOptionalClientScopes=function(filter){
352
+ return (kcAdminClientHandler.clients.listOptionalClientScopes(filter));
353
+ }
354
+
355
+
356
+
357
+ /**
358
+ * ***************************** - addOptionalClientScope - *******************************
359
+ * The method is used to assign an optional client scope to a specific client.
360
+ * Optional scopes are not automatically applied during login unless explicitly requested by the client in the scope parameter.
361
+ *
362
+ * @parameters:
363
+ * - filter: JSON structure that defines the filter parameters:
364
+ * - id: [required] The internal client ID of the client
365
+ * - clientScopeId: [required] The ID of the client scope you want to assign as optional.
366
+ */
367
+ exports.addOptionalClientScope=function(filter){
368
+ return (kcAdminClientHandler.clients.addOptionalClientScope(filter));
369
+ }
370
+
371
+
372
+
373
+ /**
374
+ * ***************************** - listScopeMappings - *******************************
375
+ * This method is used to list all scope mappings (roles assigned via scopes) for a given client in Keycloak.
376
+ * This includes realm-level roles and client-level roles that are mapped to the client.
377
+ *
378
+ * @parameters:
379
+ * - filter: JSON structure that defines the filter parameters:
380
+ * - id: [required] The ID of the client whose scope mappings you want to list.
381
+ */
382
+ exports.listScopeMappings=function(filter){
383
+ return (kcAdminClientHandler.clients.listScopeMappings(filter));
384
+ }
385
+
386
+
387
+
388
+ /**
389
+ * ***************************** - listAvailableClientScopeMappings - *******************************
390
+ * The method is used to list the client roles that are available to be mapped (but not yet assigned) to a specific client in Keycloak.
391
+ * This helps you discover which client roles you can still add as scope mappings.
392
+ *
393
+ * @parameters:
394
+ * - filter: JSON structure that defines the filter parameters:
395
+ * - id: [required] The ID of the target client (the one receiving the scope mappings).
396
+ * - client: [required] The client ID of the source client (the one that owns the roles to be mapped).
397
+ */
398
+ exports.listAvailableClientScopeMappings=function(filter){
399
+ return (kcAdminClientHandler.clients.listAvailableClientScopeMappings(filter));
400
+ }
401
+
402
+
403
+
404
+ /**
405
+ * ***************************** - addClientScopeMappings - *******************************
406
+ * The method is used to assign client roles (from a source client) to another client as scope mappings.
407
+ * This means the target client will inherit these roles when requesting tokens.
408
+ *
409
+ * @parameters:
410
+ * - filter: JSON structure that defines the filter parameters:
411
+ * - id: [required] The ID of the target client (the one receiving the scope mappings).
412
+ * - client: [required] The client ID of the source client (the one that owns the roles to be mapped).
413
+ * - roles: [required] An array of role representations(RoleRepresentation) to be mapped. At minimum, each role needs its id and name.
414
+ * - id: [required] The role ID
415
+ * - name: [required] The role name
416
+ * - {other RoleRepresentation fields}
417
+ */
418
+ exports.addClientScopeMappings=function(filter){
419
+ return (kcAdminClientHandler.clients.addClientScopeMappings(filter));
420
+ }
421
+
422
+
423
+
424
+ /**
425
+ * ***************************** - listClientScopeMappings - *******************************
426
+ * The method is used to list all client role mappings assigned to a client.
427
+ * It shows which roles from another client (source) are already mapped to the target client.
428
+ * @parameters:
429
+ * - filter: JSON structure that defines the filter parameters:
430
+ * - id: [required] The ID of the target client (where roles are mapped)
431
+ * - client: [required] The ID of the source client (the one that owns the roles being mapped)
432
+ */
433
+ exports.listClientScopeMappings=function(filter){
434
+ return (kcAdminClientHandler.clients.listClientScopeMappings(filter));
435
+ }
436
+
437
+
438
+ /**
439
+ * ***************************** - listCompositeClientScopeMappings - *******************************
440
+ * The method is used to list both direct and composite (inherited) client role mappings that are assigned to a target client.
441
+ * It differs from listClientScopeMappings because it expands composite roles and shows all roles that are effectively available to the client.
442
+ * @parameters:
443
+ * - filter: JSON structure that defines the filter parameters:
444
+ * - id: [required] The ID of the target client (the one receiving the mappings)
445
+ * - client: [required] The ID of the source client (the one that owns the roles)
446
+ */
447
+ exports.listCompositeClientScopeMappings=function(filter){
448
+ return (kcAdminClientHandler.clients.listCompositeClientScopeMappings(filter));
449
+ }
450
+
451
+
452
+ /**
453
+ * ***************************** - delClientScopeMappings - *******************************
454
+ * The method is used to remove one or more client role mappings from a target client.
455
+ * It is the reverse of clients.addClientScopeMappings
456
+ * @parameters:
457
+ * - filter: JSON structure that defines the filter parameters:
458
+ * - id: [required] ID of the target client (the client losing the roles)
459
+ * - client: [required] ID of the source client (the client where the roles are defined)
460
+ * - roles: [required] array of RoleRepresentation roles to remove. Each role needs at least id or name
461
+ * - id: [required] The role ID
462
+ * - name: [required] The role name
463
+ * - {other RoleRepresentation fields}
464
+ */
465
+ exports.delClientScopeMappings=function(filter){
466
+ return (kcAdminClientHandler.clients.delClientScopeMappings(filter));
467
+ }
468
+
469
+
470
+
471
+ /**
472
+ * ***************************** - listAvailableRealmScopeMappings - *******************************
473
+ * The method is used to retrieve all realm-level roles that are available to be assigned to a specific client.
474
+ * These are roles defined at the realm level that the client does not yet have mapped, allowing you to see what can be added.
475
+ * @parameters:
476
+ * filter: JSON structure that defines the filter parameters:
477
+ * - id: [required] The ID of the client for which you want to list available realm-level role mappings.
478
+ */
479
+ exports.listAvailableRealmScopeMappings=function(filter){
480
+ return (kcAdminClientHandler.clients.listAvailableRealmScopeMappings(filter));
481
+ }
482
+
483
+
484
+ /**
485
+ * ***************************** - listAvailableRealmScopeMappings - *******************************
486
+ * The method is used to retrieve all realm-level roles that are available to be assigned to a specific client.
487
+ * These are roles defined at the realm level that the client does not yet have mapped, allowing you to see what can be added.
488
+ * @parameters:
489
+ * - filter: JSON structure that defines the filter parameters:
490
+ * - id: [required] The ID of the client for which you want to list available realm-level role mappings.
491
+ */
492
+ exports.listAvailableRealmScopeMappings=function(filter){
493
+ return (kcAdminClientHandler.clients.listAvailableRealmScopeMappings(filter));
494
+ }
495
+
496
+
497
+ /**
498
+ * ***************************** - listRealmScopeMappings - *******************************
499
+ * The method retrieves the realm-level roles currently assigned to a client as part of its scope mappings.
500
+ * This shows which realm roles the client is allowed to request on behalf of users.
501
+ * @parameters:
502
+ * - filter: JSON structure that defines the filter parameters:
503
+ * - id: [required] The client ID whose realm-level scope mappings you want to list
504
+ */
505
+ exports.listRealmScopeMappings=function(filter){
506
+ return (kcAdminClientHandler.clients.listRealmScopeMappings(filter));
507
+ }
508
+
509
+
510
+
511
+ /**
512
+ * ***************************** - listCompositeRealmScopeMappings - *******************************
513
+ * The method retrieves all composite realm-level roles associated with a client through its scope mappings.
514
+ * This includes not only the roles directly mapped to the client, but also roles inherited through composite roles.
515
+ * @parameters:
516
+ * - filter: JSON structure that defines the filter parameters:
517
+ * - id: [required] The client ID whose composite realm scope mappings you want to list
518
+ */
519
+ exports.listCompositeRealmScopeMappings=function(filter){
520
+ return (kcAdminClientHandler.clients.listCompositeRealmScopeMappings(filter));
521
+ }
522
+
523
+
524
+
525
+ /**
526
+ * ***************************** - addRealmScopeMappings - *******************************
527
+ * The method is used to assign realm-level role mappings to a specific client.
528
+ * This effectively grants the client access to the specified realm roles.
529
+ * @parameters:
530
+ * - filter: JSON structure that defines the filter parameters:
531
+ * - id: [required] The client ID that will receive the new realm-level role mappings.
532
+ * - roles: [required] An array of realm roles to be mapped to the client. Each role object typically contains at least id and name
533
+ */
534
+ exports.addRealmScopeMappings=function(filter,roles){
535
+ return (kcAdminClientHandler.clients.addRealmScopeMappings(filter,roles));
536
+ }
537
+
538
+
539
+
540
+ /**
541
+ * ***************************** - delRealmScopeMappings - *******************************
542
+ * The method removes realm-level roles from a client’s scope mappings.
543
+ * This is the opposite of clients.addRealmScopeMappings.
544
+ * @parameters:
545
+ * - filter: JSON structure that defines the filter parameters:
546
+ * - id: [required] The client ID whose realm role mapping must be removed.
547
+ * - roles: [required] An array of role objects you want to remove. Each role object must at least contain the id or name field.
548
+ */
549
+ exports.delRealmScopeMappings=function(filter,roles){
550
+ return (kcAdminClientHandler.clients.delRealmScopeMappings(filter,roles));
551
+ }
552
+
553
+
554
+ /**
555
+ * ***************************** - listSessions - *******************************
556
+ * The method retrieves active user sessions for a specific client.
557
+ * @parameters:
558
+ * - filter: JSON structure that defines the filter parameters:
559
+ * - id: [required] The client ID whose session must be retrieved
560
+ * - first:[optional] pagination field. First result index for pagination.
561
+ * - max: [optional] pagination field. Maximum number of results.
562
+ */
563
+ exports.listSessions=function(filter){
564
+ return (kcAdminClientHandler.clients.listSessions(filter));
565
+ }
566
+
567
+
568
+
569
+ /**
570
+ * ***************************** - listOfflineSessions - *******************************
571
+ * The method retrieves offline sessions associated with a given client.
572
+ * Offline sessions are created when a client uses offline tokens (refresh tokens with offline_access scope)
573
+ * @parameters:
574
+ * - filter: JSON structure that defines the filter parameters:
575
+ * - id: [required] The client ID whose session must be retrieved
576
+ * - first:[optional] pagination field. First result index for pagination.
577
+ * - max: [optional] pagination field. Maximum number of results.
578
+ */
579
+ exports.listOfflineSessions=function(filter){
580
+ return (kcAdminClientHandler.clients.listOfflineSessions(filter));
581
+ }
582
+
583
+
584
+ /**
585
+ * ***************************** - getSessionCount - *******************************
586
+ * The method retrieves the number of active user sessions for a given client.
587
+ * This includes online sessions, not offline sessions (those are retrieved with listOfflineSessions).
588
+ * @parameters:
589
+ * - filter: JSON structure that defines the filter parameters:
590
+ * - id: [required] The client ID whose session must be retrieved
591
+ */
592
+ exports.getSessionCount=function(filter){
593
+ return (kcAdminClientHandler.clients.getSessionCount(filter));
594
+ }
595
+
596
+
597
+
598
+
599
+
600
+ /**
601
+ * ***************************** - getOfflineSessionCount - *******************************
602
+ * The method retrieves the number of offline sessions associated with a given client.
603
+ * Offline sessions represent sessions where the user has a valid offline token, typically used for long-lived access
604
+ * without requiring active login.
605
+ * @parameters:
606
+ * - filter: JSON structure that defines the filter parameters:
607
+ * - id: [required] The ID of the client for which you want to count offline sessions.
608
+ */
609
+ exports.getOfflineSessionCount=function(filter){
610
+ return (kcAdminClientHandler.clients.getOfflineSessionCount(filter));
611
+ }
612
+
613
+
614
+
615
+
616
+ /**
617
+ * ***************************** - addClusterNode - *******************************
618
+ * The method is used to register a cluster node for a specific Keycloak client.
619
+ * This is relevant in scenarios where you are running Keycloak in a clustered environment and want to synchronize
620
+ * client sessions and node information across multiple instances.
621
+ * @parameters:
622
+ * - filter: JSON structure that defines the filter parameters:
623
+ * - id: [required] The ID of the client for which you want to add a cluster node.
624
+ * - node: [required] The name or identifier of the cluster node to register.
625
+ */
626
+ exports.addClusterNode=function(filter){
627
+ return (kcAdminClientHandler.clients.addClusterNode(filter));
628
+ }
629
+
630
+
631
+
632
+ /**
633
+ * ***************************** - deleteClusterNode - *******************************
634
+ * The method in Keycloak Admin Client is used to remove a previously registered cluster node for a specific client.
635
+ * This is useful in clustered environments when a node is no longer active or should be deregistered from the
636
+ * client session synchronization.
637
+ * @parameters:
638
+ * - filter: JSON structure that defines the filter parameters:
639
+ * - id: [required] The ID of the client for which you want to remove a cluster node.
640
+ * - node: [required] The name or identifier of the cluster node to remove.
641
+ */
642
+ exports.deleteClusterNode=function(filter){
643
+ return (kcAdminClientHandler.clients.deleteClusterNode(filter));
644
+ }
645
+
646
+
647
+
648
+ /**
649
+ * ***************************** - generateAndDownloadKey - *******************************
650
+ * The method is used to generate a new cryptographic key for a client and download it.
651
+ * This is typically used for clients that require client credentials, JWT signing, or encryption.
652
+ * @parameters:
653
+ * - filter: JSON structure that defines the filter parameters:
654
+ * - id: [required] The ID of the client for which you want to generate the key
655
+ * - attr: [required] The name of the client attribute where the generated key will be saved
656
+ * - config: JSON structure that defines the configuration parameters
657
+ * - format: [required] Keystore format. Must be "JKS" or "PKCS12"
658
+ * - keyAlias: [required] Alias of the key in the keystore
659
+ * - keyPassword: [required] Password of the key in the keystore
660
+ * - storePassword: [required] keystore password
661
+ * - realmAlias: [optional] Alias of the realm
662
+ * - realmCertificate: [optional] Indicates whether the realm certificate should be added to the keystore. Set to true to include it
663
+ */
664
+ exports.generateAndDownloadKey=function(filter,config){
665
+ return (kcAdminClientHandler.clients.generateAndDownloadKey(filter,config));
666
+ }
667
+
668
+
669
+
670
+
671
+
672
+ /**
673
+ * ***************************** - generateKey - *******************************
674
+ * The method is used to generate a new cryptographic key for a client without automatically downloading it.
675
+ * This is useful for creating new signing or encryption keys associated with a client directly within Keycloak.
676
+ * Unlike clients.generateAndDownloadKey, this method only generates the key and stores it in Keycloak. It does not return the key material to the caller
677
+ * @parameters:
678
+ * - filter: JSON structure that defines the filter parameters:
679
+ * - id: [required] The ID of the client for which you want to generate the key
680
+ * - attr: [required] The name of the client attribute where the generated key will be saved
681
+ */
682
+ exports.generateKey=function(filter){
683
+ return (kcAdminClientHandler.clients.generateKey(filter));
684
+ }
685
+
686
+
687
+ /**
688
+ * ***************************** - getKeyInfo - *******************************
689
+ * The method is used to retrieve metadata about the keys associated with a specific client.
690
+ * It does not return the actual key material but provides information such as the key type, provider, algorithm, and status.
691
+ * @parameters:
692
+ * - filter: JSON structure that defines the filter parameters:
693
+ * - id: [required] The ID of the client whose key information should be retrieved
694
+ * - attr: [optional] The name of the client attribute to get
695
+ */
696
+ exports.getKeyInfo=function(filter){
697
+ return (kcAdminClientHandler.clients.getKeyInfo(filter));
698
+ }
699
+
700
+
701
+
702
+ /**
703
+ * ***************************** - downloadKey - *******************************
704
+ * The method Downloads a client’s cryptographic key (certificate) from Keycloak.
705
+ * This is typically used when you need to retrieve the public certificate of a client for token validation, signing, or encryption purposes.
706
+ * @parameters:
707
+ * - filter: JSON structure that defines the filter parameters:
708
+ * - id: [required] The ID of the client whose key information should be downloaded
709
+ * - attr: [optional] Specifies which key/certificate to download. Common values include:
710
+ * - "jwt.credential": default JWT signing key.
711
+ * - "saml.signing": SAML signing certificate.
712
+ * - "rsa-generated": generated RSA key pair.
713
+ * - config: JSON structure that defines the configuration parameters
714
+ * - format: [required] Keystore format. Must be "JKS" or "PKCS12"
715
+ * - keyAlias: [required] Alias of the key in the keystore
716
+ * - keyPassword: [required] Password of the key in the keystore
717
+ * - storePassword: [required] keystore password
718
+ * - realmAlias: [optional] Alias of the realm
719
+ * - realmCertificate: [optional] Indicates whether the realm certificate should be added to the keystore. Set to true to include it
720
+ */
721
+ exports.downloadKey=function(filter,config){
722
+ return (kcAdminClientHandler.clients.downloadKey(filter,config));
723
+ }
724
+
725
+
726
+
727
+
728
+ /**
729
+ * ***************************** - createAuthorizationScope - *******************************
730
+ * The method in the Keycloak Admin Client is used to create a new authorization scope for a specific client.
731
+ * Authorization scopes are part of Keycloak’s Authorization Services and represent fine-grained permissions
732
+ * that can later be linked to resources and policies.
733
+ * @parameters:
734
+ * - filter: JSON structure that defines the filter parameters:
735
+ * - id: [required] TThe ID of the client for which the scope will be created
736
+ * - scopeRepresentation:[required] The details of the new authorization scope as:
737
+ * - name: [required] The unique name of the scope.
738
+ * - displayName: [optional] A human-friendly name for UI purposes
739
+ * - iconUri [optional] A URI pointing to an icon representing the scope
740
+ * - {other scope representation fields}
741
+ */
742
+ exports.createAuthorizationScope=function(filter,scopeRepresentation){
743
+ return (kcAdminClientHandler.clients.createAuthorizationScope(filter,scopeRepresentation));
744
+ }
745
+
746
+
747
+
748
+ /**
749
+ * ***************************** - listAllScopes - *******************************
750
+ * The method is used to retrieve all available scopes for a specific client.
751
+ * This includes both default scopes and optional scopes that can be assigned to the client.
752
+ * @parameters:
753
+ * - filter: JSON structure that defines the filter parameters:
754
+ * - id: [required] The ID of the client whose scopes you want to list
755
+ */
756
+ exports.listAllScopes=function(filter){
757
+ return (kcAdminClientHandler.clients.listAllScopes(filter));
758
+ }
759
+
760
+
761
+
762
+ /**
763
+ * ***************************** - updateAuthorizationScope - *******************************
764
+ * The method is used to update an existing authorization scope for a specific client.
765
+ * Authorization scopes define permissions that can be used in policies and permissions for the client’s resources.
766
+ * @parameters:
767
+ * - filter: JSON structure that defines the filter parameters:
768
+ * - id: [required] The ID of the client to which the scope belongs
769
+ * - scopeId [required] The ID of the authorization scope to update
770
+ * - AuthorizationScopeRepresentation [required]: JSON structure that defines the authorization scope representation update
771
+ * - name: The new name of the scope
772
+ * - displayName: The human-readable name of the scope
773
+ * - iconUri: Optional URI for an icon representing the scope
774
+ * - {other attributes}: Additional attributes for the scope
775
+ */
776
+ exports.updateAuthorizationScope=function(filter,AuthorizationScopeRepresentation){
777
+ return (kcAdminClientHandler.clients.updateAuthorizationScope(filter,AuthorizationScopeRepresentation));
778
+ }
779
+
780
+
781
+
782
+
783
+
784
+ /**
785
+ * ***************************** - getAuthorizationScope - *******************************
786
+ * The method is used to retrieve the details of a specific authorization scope associated with a client.
787
+ * Authorization scopes define permissions that can be applied to resources and policies in Keycloak.
788
+ * @parameters:
789
+ * - filter: JSON structure that defines the filter parameters:
790
+ * - id: [required] The ID of the client to which the scope belongs
791
+ * - scopeId [required] The ID of the authorization scope to retrieve
792
+ */
793
+ exports.getAuthorizationScope=function(filter){
794
+ return (kcAdminClientHandler.clients.getAuthorizationScope(filter));
795
+ }
796
+
797
+
798
+
799
+ /**
800
+ * ***************************** - listAllResourcesByScope - *******************************
801
+ * The method is used to retrieve all resources associated with a specific authorization scope for a given client.
802
+ * This allows you to see which resources are governed by a particular scope in the client’s authorization settings.
803
+ * @parameters:
804
+ * - filter: JSON structure that defines the filter parameters:
805
+ * - id: [required] The ID of the client to which the scope belongs
806
+ * - scopeId [required] The ID of the authorization scope whose associated resources you want to list.
807
+ */
808
+ exports.listAllResourcesByScope=function(filter){
809
+ return (kcAdminClientHandler.clients.listAllResourcesByScope(filter));
810
+ }
811
+
812
+
813
+
814
+ /**
815
+ * ***************************** - listAllPermissionsByScope - *******************************
816
+ * The method is used to retrieve all permissions associated with a specific authorization scope for a given client.
817
+ * This is helpful for understanding which permissions (policies and rules) are applied when a particular scope is used.
818
+ * @parameters:
819
+ * - filter: JSON structure that defines the filter parameters:
820
+ * - id: [required] The ID of the client to query
821
+ * - scopeId [required] The ID of the authorization scope whose associated permissions you want to list
822
+ */
823
+ exports.listAllPermissionsByScope=function(filter){
824
+ return (kcAdminClientHandler.clients.listAllPermissionsByScope(filter));
825
+ }
826
+
827
+
828
+ /**
829
+ * ***************************** - listPermissionScope - *******************************
830
+ * The method is used to retrieve all scopes associated with a specific permission for a given client.
831
+ * This allows you to see which scopes a permission controls, helping you manage fine-grained access rules
832
+ * in Keycloak’s Authorization Services (UMA 2.0) framework.
833
+ * @parameters:
834
+ * - filter: JSON structure that defines the filter parameters:
835
+ * - id: [required] The ID of the client whose permission scopes you want to list
836
+ * - permissionId [optional] The ID of the permission whose scopes should be retrieved
837
+ * - name: [optional] The name of the permission whose scopes should be retrieved
838
+ */
839
+ exports.listPermissionScope=function(filter){
840
+ return (kcAdminClientHandler.clients.listPermissionScope(filter));
841
+ }
842
+
843
+
844
+
845
+ /**
846
+ * ***************************** - importResource - *******************************
847
+ * The method is used to import a resource into a client.
848
+ * This is part of Keycloak’s Authorization Services (UMA 2.0) and allows you to programmatically define
849
+ * resources that a client can protect with policies and permissions.
850
+ * @parameters:
851
+ * - filter: JSON structure that defines the filter parameters:
852
+ * - id: [required] The ID of the client to which the resource should be imported
853
+ * - resource [required] The resource representation object. This typically includes attributes like name, uris, type, scopes, and other Keycloak resource configuration options.
854
+ */
855
+ exports.importResource=function(filter,resource){
856
+ return (kcAdminClientHandler.clients.importResource(filter,resource));
857
+ }
858
+
859
+
860
+
861
+ /**
862
+ * ***************************** - exportResource - *******************************
863
+ * The method is used to export a resource from a client.
864
+ * This allows you to retrieve the full configuration of a resource, including its URIs, scopes,
865
+ * and associated permissions, which can then be backed up, replicated, or modified externally.
866
+ * @parameters:
867
+ * - filter: JSON structure that defines the filter parameters:
868
+ * - id: [required] The ID of the client from which to export the resource
869
+ * - resourceId: [optional] The ID of the resource you want to export
870
+ */
871
+ exports.exportResource=function(filter){
872
+ return (kcAdminClientHandler.clients.exportResource(filter));
873
+ }
874
+
875
+
876
+
877
+
878
+ /**
879
+ * ***************************** - createResource - *******************************
880
+ * The method is used to create a new resource under a specific client.
881
+ * A resource represents a protected entity in Keycloak’s authorization services, such as a REST endpoint,
882
+ * a document, or any application-specific asset. This allows you to manage fine-grained access control via policies and permissions.
883
+ * @parameters:
884
+ * - filter: JSON structure that defines the filter parameters:
885
+ * - id: [required] The ID of the client where the resource will be created
886
+ * - resourceRepresentation: [required] An object representing the resource configuration. Typical fields defined in https://www.keycloak.org/docs-api/latest/rest-api/index.html#ResourceRepresentation include:
887
+ * - name: [required] The human-readable name of the resource.
888
+ * - uris: [optional] Array of URI patterns or paths representing the resource.
889
+ * - scopes: [optional] Array of scopes associated with the resource.
890
+ * - type: [optional] Type/category of the resource.
891
+ * - owner: [optional] Defines the owner of the resource
892
+ */
893
+ exports.createResource=function(filter,resourceRepresentation){
894
+ return (kcAdminClientHandler.clients.createResource(filter,resourceRepresentation));
895
+ }
896
+
897
+
898
+
899
+
900
+ /**
901
+ * ***************************** - getResource - *******************************
902
+ * The method is used to retrieve a specific resource of a client by its ID.
903
+ * Resources in Keycloak represent protected entities, such as APIs, documents, or any application-specific assets,
904
+ * that can have associated scopes, policies, and permissions for fine-grained access control.
905
+ * @parameters:
906
+ * - filter: JSON structure that defines the filter parameters:
907
+ * - id: [required] The ID of the client that owns the resource
908
+ * - resourceId: [required] The ID of the resource you want to retrieve
909
+ */
910
+ exports.getResource=function(filter){
911
+ return (kcAdminClientHandler.clients.getResource(filter));
912
+ }
913
+
914
+
915
+
916
+ /**
917
+ * ***************************** - getResourceServer - *******************************
918
+ * The method is used to retrieve the resource server settings of a client.
919
+ * A resource server in Keycloak represents a client that is enabled with Authorization Services,
920
+ * meaning it can define resources, scopes, permissions, and policies for fine-grained access control.
921
+ * @parameters:
922
+ * - filter: JSON structure that defines the filter parameters:
923
+ * - id: [required] The ID of the client whose resource server configuration you want to retrieve
924
+ */
925
+ exports.getResourceServer=function(filter){
926
+ return (kcAdminClientHandler.clients.getResourceServer(filter));
927
+ }
928
+
929
+
930
+
931
+ /**
932
+ * ***************************** - updateResourceServer - *******************************
933
+ * The method is used to update the configuration of a client’s resource server.
934
+ * A resource server defines authorization settings such as resources, scopes, permissions,
935
+ * and policies that control fine-grained access to protected assets.
936
+ * @parameters:
937
+ * - filter: JSON structure that defines the filter parameters:
938
+ * - id: [required] The ID of the client whose resource server configuration should be updated
939
+ * - resourceServerRepresentation: [required] An object representing the resource server configuration such as:
940
+ * - policyEnforcementMode: [optional] Defines how authorization policies are enforced (ENFORCING, PERMISSIVE, or DISABLED)
941
+ * - decisionStrategy: [optional] The decision strategy for policies (UNANIMOUS, AFFIRMATIVE, or CONSENSUS)
942
+ * - {Other} : resource server settings depending on your authorization model (resources, scopes, and permissions)
943
+ */
944
+ exports.updateResourceServer=function(filter,resourceServerRepresentation){
945
+ return (kcAdminClientHandler.clients.updateResourceServer(filter,resourceServerRepresentation));
946
+ }
947
+
948
+
949
+
950
+ /**
951
+ * ***************************** - listPermissionsByResource - *******************************
952
+ * The method is used to retrieve all permissions associated with a specific resource within a client’s resource server.
953
+ * This is part of the Keycloak Authorization Services API and helps administrators inspect which permissions are linked to a given protected resource.
954
+ * @parameters:
955
+ * - filter: JSON structure that defines the filter parameters:
956
+ * - id: [required] The ID of the client (the resource server)
957
+ * - resourceId: [required] The ID of the resource for which to list permissions
958
+ */
959
+ exports.listPermissionsByResource=function(filter){
960
+ return (kcAdminClientHandler.clients.listPermissionsByResource(filter));
961
+ }
962
+
963
+
964
+
965
+ /**
966
+ * ***************************** - createPermission - *******************************
967
+ * The method is used to create a new permission for a client.
968
+ * Permissions define which users or roles can access specific resources or scopes within the client,
969
+ * based on policies you configure. This is part of Keycloak’s Authorization Services (UMA 2.0) framework.
970
+ * @parameters:
971
+ * - filter: JSON structure that defines the filter parameters:
972
+ * - id: [required] The ID of the client for which the permission will be created
973
+ * - type: [required] Type of the permission (resource or scope)
974
+ * - permissionRepresentation:[required] An object describing the permission. Common fields include:
975
+ * - name: [required] The name of the permission
976
+ * - resources: [optional] Array of resource IDs this permission applies to (for resource type)
977
+ * - scopes: [optional] Array of scope IDs this permission applies to (for scope type)
978
+ * - policies [required] Array of policy IDs associated with this permission
979
+ */
980
+ exports.createPermission=function(filter,permissionRepresentation){
981
+ return (kcAdminClientHandler.clients.createPermission(filter,permissionRepresentation));
982
+ }
983
+
984
+
985
+
986
+ /**
987
+ * ***************************** - findPermissions - *******************************
988
+ * The method is used to search for permissions within a client’s resource server.
989
+ * Permissions in Keycloak represent rules that define how policies are applied to resources or scopes,
990
+ * and this method allows you to list and filter them based on specific criteria.
991
+ * @parameters:
992
+ * - filter: JSON structure that defines the filter parameters:
993
+ * - id: [required] The ID of the client (the resource server) where permissions are defined
994
+ * - name: [optional] Filter permissions by name
995
+ * - type: [optional] Filter by permission type (e.g., "resource" or "scope")
996
+ * - resource: [optional] Filter by the resource ID
997
+ * - scope: [optional] Filter by scope ID
998
+ * - first: [optional] Index of the first result for pagination
999
+ * - max: [optional] Maximum number of results to return
1000
+ */
1001
+ exports.findPermissions=function(filter){
1002
+ return (kcAdminClientHandler.clients.findPermissions(filter));
1003
+ }
1004
+
1005
+
1006
+
1007
+
1008
+ /**
1009
+ * ***************************** - updateFineGrainPermission - *******************************
1010
+ * The method updates the fine-grained admin permissions configuration for a specific client.
1011
+ * Fine-grained permissions allow you to control which users/roles can manage different aspects of a client
1012
+ * (e.g., who can manage roles, protocol mappers, or scope assignments).
1013
+ * @parameters:
1014
+ * - filter: JSON structure that defines the filter parameters:
1015
+ * - id: [required] The ID of the client (the resource server) where permissions are defined
1016
+ * - status: JSON structure that defines the fine grain permission
1017
+ * - enabled: [required] Whether fine-grained permissions should be enabled or disabled.
1018
+ */
1019
+ exports.updateFineGrainPermission=function(filter,status){
1020
+ return (kcAdminClientHandler.clients.updateFineGrainPermission(filter,status));
1021
+ }
1022
+
1023
+
1024
+ /**
1025
+ * ***************************** - listFineGrainPermissions - *******************************
1026
+ * The method retrieves the current fine-grained admin permission settings for a given client.
1027
+ * This is useful for checking which permissions are configured (e.g., managing roles, protocol mappers, or client scopes).
1028
+ * @parameters:
1029
+ * - filter: JSON structure that defines the filter parameters:
1030
+ * - id: [required] The ID of the client (the resource server) where permissions are defined
1031
+ */
1032
+ exports.listFineGrainPermissions=function(filter){
1033
+ return (kcAdminClientHandler.clients.listFineGrainPermissions(filter));
1034
+ }
1035
+
1036
+
1037
+
1038
+ /**
1039
+ * ***************************** - getAssociatedScopes - *******************************
1040
+ * The method is used to retrieve all scopes associated with a specific permission within a client’s resource server.
1041
+ * In Keycloak’s Authorization Services, permissions can be linked to one or more scopes to define the contexts in which they apply. This method allows you to query those associations.
1042
+ * @parameters:
1043
+ * - filter: JSON structure that defines the filter parameters:
1044
+ * - id: [required] The ID of the client whose permission scopes you want to list
1045
+ * - permissionId: [required] The ID of the permission whose associated scopes you want to retrieve
1046
+ */
1047
+ exports.getAssociatedScopes=function(filter){
1048
+ return (kcAdminClientHandler.clients.getAssociatedScopes(filter));
1049
+ }
1050
+
1051
+
1052
+
1053
+ /**
1054
+ * ***************************** - getAssociatedPolicies - *******************************
1055
+ * The method is used to retrieve all policies associated with a specific permission within a client’s resource server.
1056
+ * In Keycloak Authorization Services, permissions can be tied to one or more policies that define the conditions under which access is granted. This method lets you fetch those policy associations
1057
+ * @parameters:
1058
+ * - filter: JSON structure that defines the filter parameters:
1059
+ * - id: [required] The ID of the client whose permission policies you want to list
1060
+ * - permissionId: [required] The ID of the permission whose associated policies you want to retrieve.
1061
+ */
1062
+ exports.getAssociatedPolicies=function(filter){
1063
+ return (kcAdminClientHandler.clients.getAssociatedPolicies(filter));
1064
+ }
1065
+
1066
+
1067
+
1068
+ /**
1069
+ * ***************************** - getAssociatedResources - *******************************
1070
+ * The method is used to retrieve all resources linked to a specific permission in a client’s resource server.
1071
+ * In Keycloak Authorization Services, permissions can be scoped to one or more resources (such as APIs, endpoints, or domain-specific entities). This method allows you to query those resource associations.
1072
+ * @parameters:
1073
+ * - filter: JSON structure that defines the filter parameters:
1074
+ * - id: [required] The ID of the client whose permission resource you want to list
1075
+ * - permissionId: [required] The ID of the permission for which you want to fetch associated resources
1076
+ */
1077
+ exports.getAssociatedResources=function(filter){
1078
+ return (kcAdminClientHandler.clients.getAssociatedResources(filter));
1079
+ }
1080
+
1081
+
1082
+ /**
1083
+ * ***************************** - listScopesByResource - *******************************
1084
+ * The method is used to list all authorization scopes associated with a specific resource in a client’s resource server.
1085
+ * This allows administrators to understand which scopes are directly linked to a protected resource and therefore which permissions can be applied to it.
1086
+ * @parameters:
1087
+ * - filter: JSON structure that defines the filter parameters:
1088
+ * - id: [required] The ID of the client (the resource server).
1089
+ * - resourceId: [required] The ID of the resource for which to list scopes.
1090
+ */
1091
+ exports.listScopesByResource=function(filter){
1092
+ return (kcAdminClientHandler.clients.listScopesByResource(filter));
1093
+ }
1094
+
1095
+
1096
+
1097
+ /**
1098
+ * ***************************** - listResources - *******************************
1099
+ * The method is used to retrieve all resources defined in a client’s resource server.
1100
+ * Resources represent protected entities (such as APIs, files, or services) that can be associated with scopes and permissions in Keycloak’s authorization services.
1101
+ * @parameters:
1102
+ * - filter: JSON structure that defines the filter parameters:
1103
+ * - id: [required] The ID of the client (the resource server)
1104
+ * - deep: [optional] If true, returns detailed information about each resource
1105
+ * - first: [optional] Index of the first resource to return (for pagination)
1106
+ * - max: [optional] Maximum number of resources to return (for pagination)
1107
+ * - name: [optional] Filters resources by name
1108
+ * - uri: [optional] Filters resources by URI
1109
+ * - owner: [optional] Filters resources by owner
1110
+ */
1111
+ exports.listResources=function(filter){
1112
+ return (kcAdminClientHandler.clients.listResources(filter));
1113
+ }
1114
+
1115
+
1116
+
1117
+ /**
1118
+ * ***************************** - updateResource - *******************************
1119
+ * The method is used to update an existing resource in a client’s resource server.
1120
+ * Resources represent protected entities (APIs, files, services, etc.) that can be secured with scopes and permissions under Keycloak’s Authorization Services
1121
+ * @parameters:
1122
+ * - filter: JSON structure that defines the filter parameters:
1123
+ * - id: [required] The ID of the client (the resource server)
1124
+ * - resourceId: [required] The ID of the resource you want to update.
1125
+ * - resourceRepresentation: JSON structure that defines the resource representation to update
1126
+ * - name: [optional] The updated name of the resource
1127
+ * - displayName: [optional] A human-readable name for the resource
1128
+ * - uris: [optional] Updated list of URIs associated with the resource
1129
+ * - scopes: [optional] Updated list of scopes linked to the resource
1130
+ * - ownerManagedAccess: [optional] Indicates whether the resource is managed by its owner
1131
+ * - {attributes} : [optional] Custom attributes for the resource
1132
+ */
1133
+ exports.updateResource=function(filter,resourceRepresentation){
1134
+ return (kcAdminClientHandler.clients.updateResource(filter,resourceRepresentation));
1135
+ }
1136
+
1137
+
1138
+
1139
+ /**
1140
+ * ***************************** - createPolicy - *******************************
1141
+ * The method is used to create a new policy for a client’s resource server under Keycloak’s Authorization Services.
1142
+ * Policies define the rules that determine whether access should be granted or denied to a given resource, scope, or permission.
1143
+ * They can be based on users, roles, groups, conditions, or custom logic.
1144
+ * @parameters:
1145
+ * - filter: JSON structure that defines the filter parameters:
1146
+ * - id: [required] The ID of the client (the resource server) where the policy will be created.
1147
+ * - type: [required] The policy type. Examples include:
1148
+ * - "role" – grants access based on roles.
1149
+ * - "user" – grants access based on users.
1150
+ * - "group" – grants access based on groups.
1151
+ * - "js" – uses custom JavaScript logic.
1152
+ * - "time" – defines time-based conditions.
1153
+ * - policyRepresentation: JSON structure that defines the policy:
1154
+ * - name: [required] The name of the policy.
1155
+ * - description: [optional] A human-readable description of the policy.
1156
+ * - logic: [optional] Either "POSITIVE" (default, grants access if the condition is met) or "NEGATIVE" (denies access if the condition is met).
1157
+ * - decisionStrategy: [optional] Defines how multiple policies are evaluated: "AFFIRMATIVE", "UNANIMOUS", or "CONSENSUS".
1158
+ * - {Other Config}: [optional] Configuration object depending on the chosen policy type. For example, a role policy requires role details.
1159
+ */
1160
+ exports.createPolicy=function(filter,policyRepresentation){
1161
+ return (kcAdminClientHandler.clients.createPolicy(filter,policyRepresentation));
1162
+ }
1163
+
1164
+
1165
+
1166
+
1167
+ /**
1168
+ * ***************************** - listDependentPolicies - *******************************
1169
+ * The method is used to list all policies that depend on a given policy within a client’s resource server.
1170
+ * This is useful when you want to understand how a policy is referenced by other policies, permissions, or configurations, helping you manage complex authorization structures.
1171
+ * @parameters:
1172
+ * - filter: JSON structure that defines the filter parameters:
1173
+ * - id: [required] The ID of the client (the resource server) where the policy exists.
1174
+ * - policyId: [required] The ID of the policy for which you want to list dependent policies.
1175
+ */
1176
+ exports.listDependentPolicies=function(filter){
1177
+ return (kcAdminClientHandler.clients.listDependentPolicies(filter));
1178
+ }
1179
+
1180
+
1181
+
1182
+
1183
+ /**
1184
+ * ***************************** - evaluateGenerateAccessToken - *******************************
1185
+ * The method is used to generate or simulate an access token for a specific client, typically for testing or evaluating the token
1186
+ * contents without performing a full user login. This can help you verify client roles, scopes, and protocol mappers included in the token
1187
+ * @parameters:
1188
+ * - filter: JSON structure that defines the filter parameters:
1189
+ * - id: [required] ID of the client for which you want to generate or evaluate the access token
1190
+ */
1191
+ exports.evaluateGenerateAccessToken=function(filter){
1192
+ return (kcAdminClientHandler.clients.evaluateGenerateAccessToken(filter));
1193
+ }
1194
+
1195
+
1196
+
1197
+
1198
+ /**
1199
+ * ***************************** - evaluateGenerateIdToken - *******************************
1200
+ * The method is used to generate or simulate an ID token for a specific client, usually for testing or evaluating the token without
1201
+ * performing a full user login. This allows you to verify which claims, scopes, and protocol mappers are included in the ID
1202
+ * token for the client.
1203
+ * @parameters:
1204
+ * - filter: JSON structure that defines the filter parameters:
1205
+ * - id: [required] ID of the client for which you want to generate or evaluate the ID token
1206
+ */
1207
+ exports.evaluateGenerateIdToken=function(filter){
1208
+ return (kcAdminClientHandler.clients.evaluateGenerateIdToken(filter));
1209
+ }
1210
+
1211
+
1212
+
1213
+ /**
1214
+ * ***************************** - evaluateGenerateUserInfo - *******************************
1215
+ * The method is used to generate or simulate a UserInfo response for a specific client, typically for testing or evaluating what
1216
+ * user information would be returned by the UserInfo endpoint for that client. This helps verify which claims are included in the
1217
+ * UserInfo response without performing a full login flow.
1218
+ * @parameters:
1219
+ * - filter: JSON structure that defines the filter parameters:
1220
+ * - id: [required] The ID of the client for which you want to generate the UserInfo response
1221
+ */
1222
+ exports.evaluateGenerateUserInfo=function(filter){
1223
+ return (kcAdminClientHandler.clients.evaluateGenerateUserInfo(filter));
1224
+ }
1225
+
1226
+
1227
+
1228
+
1229
+ /**
1230
+ * ***************************** - evaluateListProtocolMapper - *******************************
1231
+ * The method is used to retrieve or evaluate the protocol mappers associated with a specific client.
1232
+ * Protocol mappers define how user information (claims) is mapped into tokens (like ID tokens or access tokens) for a client.
1233
+ *
1234
+ * @parameters:
1235
+ * - filter: JSON structure that defines the filter parameters:
1236
+ * - id: [required] ID of the client for which you want to list or evaluate protocol mappers.
1237
+ */
1238
+ exports.evaluateListProtocolMapper=function(filter){
1239
+ return (kcAdminClientHandler.clients.evaluateListProtocolMapper(filter));
1240
+ }
1241
+
1242
+
1243
+
1244
+ /**
1245
+ * ***************************** - addProtocolMapper - *******************************
1246
+ * The method allows you to add a single protocol mapper to a specific client.
1247
+ * Protocol mappers define how data from user/client models is added to tokens (e.g., access token, ID token, or SAML assertion)..
1248
+ *
1249
+ * @parameters:
1250
+ * - filter: JSON structure that defines the filter parameters:
1251
+ * - id: [required] The internal client ID of the client
1252
+ * - protocolMapperRepresentation: The protocol mapper definition, typically matching this structure:
1253
+ * - name : protocol mapper name
1254
+ * - protocol (e.g., "openid-connect" or "saml")
1255
+ * - protocolMapper (e.g., "oidc-usermodel-property-mapper")
1256
+ * - consentRequired
1257
+ * - config (object)
1258
+ * - user.attribute
1259
+ * - claim.name
1260
+ * - jsonType.label
1261
+ * - id.token.claim
1262
+ * - access.token.claim
1263
+ * - {others}
1264
+ * - {others}
1265
+ */
1266
+ exports.addProtocolMapper=function(filter,protocolMapperRepresentation){
1267
+ return (kcAdminClientHandler.clients.addProtocolMapper(filter,protocolMapperRepresentation));
1268
+ }
1269
+
1270
+
1271
+
1272
+ /**
1273
+ * ***************************** - updateProtocolMapper - *******************************
1274
+ *The method is used to update an existing protocol mapper for a specific client in Keycloak.
1275
+ * @parameters:
1276
+ * - filter: JSON structure that defines the filter parameters:
1277
+ * - id: [required] The internal client ID of the client
1278
+ * - mapperId: [required] The ID of the protocol mapper to be updated.
1279
+ * - protocolMapperRepresentation: The protocol mapper definition, typically matching this structure:
1280
+ * - name: protocol mapper name
1281
+ * - protocol (e.g., "openid-connect" or "saml")
1282
+ * - protocolMapper (e.g., "oidc-usermodel-property-mapper")
1283
+ * - consentRequired
1284
+ * - config (object)
1285
+ * - user.attribute
1286
+ * - claim.name
1287
+ * - jsonType.label
1288
+ * - id.token.claim
1289
+ * - access.token.claim
1290
+ * - {other}
1291
+ * - {other}
1292
+ */
1293
+ exports.updateProtocolMapper=function(filter,protocolMapperRepresentation){
1294
+ return (kcAdminClientHandler.clients.updateProtocolMapper(filter,protocolMapperRepresentation));
1295
+ }
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+ /**
1302
+ * ***************************** - addMultipleProtocolMappers - *******************************
1303
+ * The method allows you to add several protocol mappers at once to a specific client.
1304
+ * Protocol mappers define how data from the user or client model is transformed and included in tokens
1305
+ * issued by Keycloak (e.g., access tokens, ID tokens, SAML assertions).
1306
+ * This batch operation is efficient when you want to configure multiple mappings without multiple API calls.
1307
+ *
1308
+ * @parameters:
1309
+ * - filter: JSON structure that defines the filter parameters:
1310
+ * - id: [required] The internal client ID of the client
1311
+ * - protocolMapperRepresentation: An array of protocol mapper objects. Each object must conform to the ProtocolMapperRepresentation structure, which typically includes:
1312
+ * - name: protocol mapper name
1313
+ * - protocol (e.g., "openid-connect" or "saml")
1314
+ * - protocolMapper (e.g., "oidc-usermodel-property-mapper")
1315
+ * - consentRequired
1316
+ * - config (object)
1317
+ * - user.attribute
1318
+ * - claim.name
1319
+ * - jsonType.label
1320
+ * - id.token.claim
1321
+ * - access.token.claim
1322
+ * - {other}
1323
+ * - {other}
1324
+ */
1325
+ exports.addMultipleProtocolMappers=function(filter,protocolMapperRepresentation){
1326
+ return (kcAdminClientHandler.clients.addMultipleProtocolMappers(filter,protocolMapperRepresentation));
1327
+ }
1328
+
1329
+
1330
+
1331
+
1332
+
1333
+ /**
1334
+ * ***************************** - findProtocolMapperByName - *******************************
1335
+ * This method helps locate a protocol mapper within a specific client based on its protocol type (e.g. openid-connect) and the mapper name.
1336
+ * It is particularly useful when you want to verify if a mapper exists or fetch its full configuration.
1337
+ *
1338
+ * @parameters:
1339
+ * - filter: JSON structure that defines the filter parameters:
1340
+ * - id: [required] The internal client ID of the client
1341
+ * - name: [required] The name of the protocol mapper to look up. (usually "openid-connect" or "saml").
1342
+ */
1343
+ exports.findProtocolMapperByName=function(filter){
1344
+ return (kcAdminClientHandler.clients.findProtocolMapperByName(filter));
1345
+ }
1346
+
1347
+
1348
+ /**
1349
+ * ***************************** - findProtocolMappersByProtocol - *******************************
1350
+ * The method returns all protocol mappers associated with a client, filtered by a specific protocol (e.g., "openid-connect" or "saml").
1351
+ * @parameters:
1352
+ * - filter: JSON structure that defines the filter parameters:
1353
+ * - id: [required] The internal client ID of the client
1354
+ * - protocol: [required] The protocol for which you want to fetch mappers. Common values:
1355
+ * - "openid-connect"
1356
+ * - "saml"
1357
+ */
1358
+ exports.findProtocolMappersByProtocol=function(filter){
1359
+ return (kcAdminClientHandler.clients.findProtocolMappersByProtocol(filter));
1360
+ }
1361
+
1362
+
1363
+
1364
+ /**
1365
+ * ***************************** - findProtocolMapperById - *******************************
1366
+ * The method retrieves the details of a specific protocol mapper by its ID for a given client.
1367
+ *
1368
+ * @parameters:
1369
+ * - filter: JSON structure that defines the filter parameters:
1370
+ * - id: [required] The internal client ID of the client
1371
+ * - mapperId: [required] The ID of the protocol mapper you want to fetch.
1372
+ */
1373
+ exports.findProtocolMapperById=function(filter){
1374
+ return (kcAdminClientHandler.clients.findProtocolMapperById(filter));
1375
+ }
1376
+
1377
+
1378
+
1379
+
1380
+ /**
1381
+ * ***************************** - listProtocolMappers - *******************************
1382
+ * The method is used to retrieve all protocol mappers associated with a specific client.
1383
+ * Protocol mappers define how user and role information is included in tokens such as access tokens, ID tokens, or SAML assertions.
1384
+ * This method is useful for inspecting or managing the token contents of a client.
1385
+ *
1386
+ * @parameters:
1387
+ * - filter: JSON structure that defines the filter parameters:
1388
+ * - id: [required] The internal ID of the client whose protocol mappers you want to list
1389
+ */
1390
+ exports.listProtocolMappers=function(filter){
1391
+ return (kcAdminClientHandler.clients.listProtocolMappers(filter));
1392
+ }
1393
+
1394
+
1395
+
1396
+
1397
+ /**
1398
+ * ***************************** - delProtocolMapper - *******************************
1399
+ * The method is used to delete a specific protocol mapper from a client.
1400
+ * Protocol mappers are used to include specific user or role information in tokens (e.g. access tokens, ID tokens).
1401
+ * This method is useful when you want to remove an existing mapper from a client configuration.
1402
+ *
1403
+ * @parameters:
1404
+ * - filter: JSON structure that defines the filter parameters:
1405
+ * - id: [required] The internal client ID of the client
1406
+ * - mapperId: [required] The ID of the protocol mapper to delete
1407
+ */
1408
+ exports.delProtocolMapper=function(filter){
1409
+ return (kcAdminClientHandler.clients.delProtocolMapper(filter));
1410
+ }
1411
+