keycloak-api-manager 3.0.0 → 3.1.0
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.
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +6 -2
- package/README.md +150 -0
- package/index.js +0 -3
- package/package.json +1 -1
package/.idea/vcs.xml
ADDED
package/.idea/workspace.xml
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="880daed6-aedf-444b-8c4d-611b1320145a" name="Changes" comment=""
|
|
7
|
+
<list default="true" id="880daed6-aedf-444b-8c4d-611b1320145a" name="Changes" comment="">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/index.js" afterDir="false" />
|
|
10
|
+
</list>
|
|
8
11
|
<option name="SHOW_DIALOG" value="false" />
|
|
9
12
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
13
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
@@ -79,7 +82,8 @@
|
|
|
79
82
|
<option name="presentableId" value="Default" />
|
|
80
83
|
<updated>1759849149064</updated>
|
|
81
84
|
<workItem from="1759849150239" duration="1214000" />
|
|
82
|
-
<workItem from="1759917554117" duration="
|
|
85
|
+
<workItem from="1759917554117" duration="69806000" />
|
|
86
|
+
<workItem from="1761132079959" duration="2468000" />
|
|
83
87
|
</task>
|
|
84
88
|
<servers />
|
|
85
89
|
</component>
|
package/README.md
CHANGED
|
@@ -226,6 +226,7 @@ each realm manages its own set of users, roles, groups, and clients independentl
|
|
|
226
226
|
##### `function create(realm-dictionary)`
|
|
227
227
|
create is a method used to create a new realm.
|
|
228
228
|
This method accepts a realm representation object containing details such as is, name
|
|
229
|
+
|
|
229
230
|
**` -- @parameters -- `**
|
|
230
231
|
- realm-dictionary: is a JSON object that accepts filter parameters
|
|
231
232
|
- id:[required] The internal ID of the realm. If omitted, Keycloak uses the realm name as the ID.
|
|
@@ -244,6 +245,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
244
245
|
##### `function update(filter,realm-dictionary)`
|
|
245
246
|
Updates the configuration of an existing realm.
|
|
246
247
|
You can use this method to modify settings such as login behavior, themes, token lifespans, and more.
|
|
248
|
+
|
|
247
249
|
**` -- @parameters -- `**
|
|
248
250
|
- filter:is a JSON object that accepts filter parameters
|
|
249
251
|
- realm:[required] The identifier of the realm you want to update.
|
|
@@ -265,6 +267,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
265
267
|
##### `function del(filter)`
|
|
266
268
|
Deletes a specific realm from the Keycloak server.
|
|
267
269
|
This operation is irreversible and removes all users, clients, roles, groups, and settings associated with the realm.
|
|
270
|
+
|
|
268
271
|
**` -- @parameters -- `**
|
|
269
272
|
- filter: is a JSON object that accepts filter parameters
|
|
270
273
|
- realm:[required] The name of the realm to delete.
|
|
@@ -291,6 +294,7 @@ console.log("Retrieved realms:",realms);
|
|
|
291
294
|
##### `function findOne(filter)`
|
|
292
295
|
Retrieves the full configuration and metadata of a specific realm by its name (realm ID).
|
|
293
296
|
This includes settings like login policies, themes, password policies, etc.
|
|
297
|
+
|
|
294
298
|
**` -- @parameters -- `**
|
|
295
299
|
- filter: is a JSON object that accepts filter parameters
|
|
296
300
|
- realm:[required] The name (ID) of the realm you want to retrieve.
|
|
@@ -309,6 +313,7 @@ console.log("Retrieved realm:",realmConfig);
|
|
|
309
313
|
Performs a partial import of realm configuration into a Keycloak realm.
|
|
310
314
|
This allows you to import users, roles, groups, clients, and other components without replacing the entire realm.
|
|
311
315
|
It’s useful for incremental updates or merging configuration pieces.
|
|
316
|
+
|
|
312
317
|
**` -- @parameters -- `**
|
|
313
318
|
- configuration: is a JSON object that accepts filter parameters
|
|
314
319
|
- realm:[required] The name of the realm where the data should be imported.
|
|
@@ -346,6 +351,7 @@ const result = await KeycloakManager.realms.partialImport({
|
|
|
346
351
|
##### `function export(configuration)`
|
|
347
352
|
Exports the configuration of a specific realm.
|
|
348
353
|
This method returns the full realm representation in JSON format, including roles, users, clients, groups, and other components depending on the provided options.
|
|
354
|
+
|
|
349
355
|
**` -- @parameters -- `**
|
|
350
356
|
- configuration: is a JSON object that accepts filter parameters
|
|
351
357
|
- realm:[required] The name of the realm to export.
|
|
@@ -368,6 +374,7 @@ console.log(JSON.stringify(exportedRealm, null, 2));
|
|
|
368
374
|
##### `function getClientRegistrationPolicyProviders(configuration)`
|
|
369
375
|
Fetches the list of available client registration policy providers for the specified realm.
|
|
370
376
|
These providers define how new clients can be registered and what rules or validations apply (e.g., allowed scopes, required attributes).
|
|
377
|
+
|
|
371
378
|
**` -- @parameters -- `**
|
|
372
379
|
- configuration: is a JSON object that accepts filter parameters
|
|
373
380
|
- realm:[required] The name of the realm where you want to list client registration policy providers.
|
|
@@ -385,6 +392,7 @@ await KeycloakManager.realms.getClientRegistrationPolicyProviders({
|
|
|
385
392
|
##### `function createClientsInitialAccess(realmFilter,options)`
|
|
386
393
|
Creates a new Initial Access Token for dynamic client registration.
|
|
387
394
|
This token allows clients to register themselves with the realm using the Dynamic Client Registration API. Useful when you want to allow programmatic client creation in a controlled way.
|
|
395
|
+
|
|
388
396
|
**` -- @parameters -- `**
|
|
389
397
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
390
398
|
- realm:[required] The name of the realm where the initial access token should be created.
|
|
@@ -414,6 +422,7 @@ console.log("Initial Access Token:", initialAccess.token);
|
|
|
414
422
|
##### `function getClientsInitialAccess(realmFilter)`
|
|
415
423
|
Retrieves all existing Initial Access Tokens for dynamic client registration in a given realm.
|
|
416
424
|
These tokens are used to allow programmatic or automated registration of clients via the Dynamic Client Registration API.
|
|
425
|
+
|
|
417
426
|
**` -- @parameters -- `**
|
|
418
427
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
419
428
|
- realm:[required] The name of the realm from which to list all initial access tokens.
|
|
@@ -437,6 +446,7 @@ console.log("Initial Access Tokens:", tokens);
|
|
|
437
446
|
##### `function delClientsInitialAccess(realmFilter)`
|
|
438
447
|
Deletes a specific Initial Access Token used for dynamic client registration in a given realm.
|
|
439
448
|
This revokes the token, preventing any future use.
|
|
449
|
+
|
|
440
450
|
**` -- @parameters -- `**
|
|
441
451
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
442
452
|
- realm:[required] The name of the realm where the token was created.
|
|
@@ -454,6 +464,7 @@ await KeycloakManager.realms.delClientsInitialAccess({
|
|
|
454
464
|
##### `function addDefaultGroup(realmFilter)`
|
|
455
465
|
Adds an existing group to the list of default groups for a given realm.
|
|
456
466
|
Users created in this realm will automatically be added to all default groups.
|
|
467
|
+
|
|
457
468
|
**` -- @parameters -- `**
|
|
458
469
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
459
470
|
- realm:[required] The name of the realm where the default group will be set.
|
|
@@ -470,6 +481,7 @@ await KeycloakManager.realms.addDefaultGroup({
|
|
|
470
481
|
##### `function removeDefaultGroup(realmFilter)`
|
|
471
482
|
Removes a group from the list of default groups in a realm.
|
|
472
483
|
Default groups are automatically assigned to new users when they are created.
|
|
484
|
+
|
|
473
485
|
**` -- @parameters -- `**
|
|
474
486
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
475
487
|
- realm:[required] The name of the realm from which to remove the default group.
|
|
@@ -487,6 +499,7 @@ await KeycloakManager.realms.removeDefaultGroup({
|
|
|
487
499
|
##### `function getDefaultGroups(realmFilter)`
|
|
488
500
|
Retrieves a list of all default groups for a specified realm.
|
|
489
501
|
These are the groups that new users will automatically be added to upon creation.
|
|
502
|
+
|
|
490
503
|
**` -- @parameters -- `**
|
|
491
504
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
492
505
|
- realm:[required] The name of the realm from which to retrieve default groups.
|
|
@@ -504,6 +517,7 @@ console.log(defaultGroups);
|
|
|
504
517
|
##### `function getGroupByPath(realmFilter)`
|
|
505
518
|
Retrieves a group object by specifying its hierarchical path in a realm.
|
|
506
519
|
This is useful when you know the group’s full path (e.g., /parent/child) but not its ID.
|
|
520
|
+
|
|
507
521
|
**` -- @parameters -- `**
|
|
508
522
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
509
523
|
- realm:[required] The name of the realm where the group is located.
|
|
@@ -526,6 +540,7 @@ console.log(defaultGroups);
|
|
|
526
540
|
Retrieves the event configuration settings for a specific realm.
|
|
527
541
|
This includes settings related to the event listeners, enabled event types, admin events, and more.
|
|
528
542
|
Useful for auditing and tracking activities inside Keycloak.
|
|
543
|
+
|
|
529
544
|
**` -- @parameters -- `**
|
|
530
545
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
531
546
|
- realm:[required] The name of the realm from which to retrieve the event configuration.
|
|
@@ -553,6 +568,7 @@ console.log(config);
|
|
|
553
568
|
Updates the event configuration for a given realm.
|
|
554
569
|
This includes enabling/disabling events, setting specific event types to track,
|
|
555
570
|
enabling admin event logging, and choosing which event listeners to use.
|
|
571
|
+
|
|
556
572
|
**` -- @parameters -- `**
|
|
557
573
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
558
574
|
- realm:[required] The name of the realm where the configuration will be updated.
|
|
@@ -582,6 +598,7 @@ const config= await KeycloakManager.realms.updateConfigEvents(
|
|
|
582
598
|
Retrieves a list of events that occurred in a specified realm.
|
|
583
599
|
You can filter the results by event type, user, date range, and other criteria.
|
|
584
600
|
Useful for auditing login, logout, and other user-related activities.
|
|
601
|
+
|
|
585
602
|
**` -- @parameters -- `**
|
|
586
603
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
587
604
|
- realm: [required] The name of the realm to fetch events from.
|
|
@@ -609,6 +626,7 @@ const config= await KeycloakManager.realms.findEvents({
|
|
|
609
626
|
Retrieves administrative events that occurred in a specific realm.
|
|
610
627
|
Admin events are triggered by actions such as creating users, updating roles, or modifying realm settings.
|
|
611
628
|
This is useful for auditing changes made via the admin API or admin console.
|
|
629
|
+
|
|
612
630
|
**` -- @parameters -- `**
|
|
613
631
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
614
632
|
- realm: [required] The name of the realm to retrieve admin events from.
|
|
@@ -642,6 +660,7 @@ const config= await KeycloakManager.realms.findAdminEvents({
|
|
|
642
660
|
Deletes all user events (not admin events) from the event store of a specific realm.
|
|
643
661
|
Useful for resetting or cleaning up event logs related to user actions such as logins, logouts, failed login attempts, etc.
|
|
644
662
|
This does not clear administrative events. To remove those, use realms.clearAdminEvents().
|
|
663
|
+
|
|
645
664
|
**` -- @parameters -- `**
|
|
646
665
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
647
666
|
- realm: [required] The name of the realm from which to clear user events.
|
|
@@ -659,6 +678,7 @@ const config= await KeycloakManager.realms.clearEvents({
|
|
|
659
678
|
Deletes all admin events from the event store of a specific realm.
|
|
660
679
|
Admin events include actions such as creating users, updating roles, changing client settings, etc.,
|
|
661
680
|
performed by administrators via the Admin Console or Admin REST API.
|
|
681
|
+
|
|
662
682
|
**` -- @parameters -- `**
|
|
663
683
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
664
684
|
- realm: [required] The name of the realm from which to clear administrative events.
|
|
@@ -711,6 +731,7 @@ console.log(permissions.enabled); // true or false
|
|
|
711
731
|
Enables or disables fine-grained user management permissions in a specified realm.
|
|
712
732
|
This controls whether operations on users (such as creating, editing, or deleting users)
|
|
713
733
|
are protected using Keycloak's authorization services.
|
|
734
|
+
|
|
714
735
|
**` -- @parameters -- `**
|
|
715
736
|
- update-parameters: is a JSON object that accepts this parameters
|
|
716
737
|
- realm: [required] The name of the realm for which you want to update the user management permission settings.
|
|
@@ -747,6 +768,7 @@ console.log(permissions.enabled); // true
|
|
|
747
768
|
##### `function getKeys(filter)`
|
|
748
769
|
Retrieves the realm keys metadata, including public keys, certificates, and active key information
|
|
749
770
|
used for token signing, encryption, and other cryptographic operations in the specified realm.
|
|
771
|
+
|
|
750
772
|
**` -- @parameters -- `**
|
|
751
773
|
- filter: is a JSON object that accepts this parameters
|
|
752
774
|
- realm: [required] The name of the realm for which you want to retrieve key metadata.
|
|
@@ -786,6 +808,7 @@ console.log(Keys);
|
|
|
786
808
|
|
|
787
809
|
##### `function getClientSessionStats(filter)`
|
|
788
810
|
Retrieves statistics about active client sessions in the specified realm. This includes the number of active sessions per client.
|
|
811
|
+
|
|
789
812
|
**` -- @parameters -- `**
|
|
790
813
|
- filter: is a JSON object that accepts this parameters
|
|
791
814
|
- realm: [required] The name of the realm for which you want to retrieve client session statistics.
|
|
@@ -814,6 +837,7 @@ console.log(stats);
|
|
|
814
837
|
##### `function pushRevocation(filter)`
|
|
815
838
|
Immediately pushes a revocation policy to all clients in the specified realm.
|
|
816
839
|
This forces clients to revalidate tokens, effectively revoking cached access tokens and enforcing updated policies.
|
|
840
|
+
|
|
817
841
|
**` -- @parameters -- `**
|
|
818
842
|
- filter: is a JSON object that accepts this parameters
|
|
819
843
|
- realm: [required] The name of the realm where the revocation should be pushed.
|
|
@@ -833,6 +857,7 @@ console.log(pushR);
|
|
|
833
857
|
##### `function logoutAll(filter)`
|
|
834
858
|
Logs out all active sessions for all users in the specified realm.
|
|
835
859
|
This invalidates all user sessions, forcing every user to re-authenticate.
|
|
860
|
+
|
|
836
861
|
**` -- @parameters -- `**
|
|
837
862
|
- filter: is a JSON object that accepts this parameters
|
|
838
863
|
- realm: [required] The name of the realm from which to log out all users.
|
|
@@ -853,6 +878,7 @@ console.log('logout results:',logout);
|
|
|
853
878
|
Tests the connection to an LDAP server using the provided configuration parameters.
|
|
854
879
|
This is useful to verify that Keycloak can reach and authenticate with the LDAP server before
|
|
855
880
|
fully integrating it into the realm configuration.
|
|
881
|
+
|
|
856
882
|
**` -- @parameters -- `**
|
|
857
883
|
- filter: is a JSON object that accepts this filter parameters
|
|
858
884
|
- realm: [required] Name of the realm where the LDAP provider is being tested.
|
|
@@ -894,6 +920,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
894
920
|
This function queries the LDAP server configured for a specific realm to retrieve and display its supported capabilities.
|
|
895
921
|
It helps validate the connection and understand which LDAP features are available,
|
|
896
922
|
such as supported controls, extensions, authentication mechanisms, and more.
|
|
923
|
+
|
|
897
924
|
**` -- @parameters -- `**
|
|
898
925
|
- filter: is a JSON object that accepts this filter parameters
|
|
899
926
|
- realm: [required] Name of the realm where the LDAP provider is being tested.
|
|
@@ -935,6 +962,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
935
962
|
Tests the SMTP connection using the provided configuration.
|
|
936
963
|
This allows you to verify that Keycloak can connect and send emails through the configured
|
|
937
964
|
SMTP server before applying the settings to the realm.
|
|
965
|
+
|
|
938
966
|
**` -- @parameters -- `**
|
|
939
967
|
- filter: is a JSON object that accepts this filter parameters
|
|
940
968
|
- realm: [required] The name of the realm where the SMTP server will be tested.
|
|
@@ -974,6 +1002,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
974
1002
|
##### `function getRealmLocalizationTexts(filter)`
|
|
975
1003
|
Retrieves all localization texts (custom messages and labels) defined for a specific realm and locale.
|
|
976
1004
|
Localization texts are used to override default Keycloak UI messages for login forms, error pages, and other user-facing content
|
|
1005
|
+
|
|
977
1006
|
**` -- @parameters -- `**
|
|
978
1007
|
- filter: is a JSON object that accepts this filter parameters
|
|
979
1008
|
- realm: [required] The name of the realm from which to fetch localization texts.
|
|
@@ -994,6 +1023,7 @@ console.log(texts);
|
|
|
994
1023
|
##### `function addLocalization(filter,value)`
|
|
995
1024
|
Adds or updates a localization text (custom UI message or label) for a specific realm and locale in Keycloak.
|
|
996
1025
|
This allows you to override default messages in the login screens and other UI components with custom translations.
|
|
1026
|
+
|
|
997
1027
|
**` -- @parameters -- `**
|
|
998
1028
|
- filter: is a JSON object that accepts this filter parameters
|
|
999
1029
|
- realm: [required] The name of the realm where the localization should be applied.
|
|
@@ -1016,6 +1046,7 @@ await KeycloakManager.realms.addLocalization({
|
|
|
1016
1046
|
##### `function getRealmSpecificLocales(filter)`
|
|
1017
1047
|
Retrieves the list of locales (language codes) for which custom localization texts have been defined in a specific realm.
|
|
1018
1048
|
This function is useful to determine which locales have at least one overridden message.
|
|
1049
|
+
|
|
1019
1050
|
**` -- @parameters -- `**
|
|
1020
1051
|
- filter: is a JSON object that accepts this filter parameters
|
|
1021
1052
|
- realm: [required] The name of the realm for which to fetch the list of custom locales.
|
|
@@ -1046,6 +1077,7 @@ console.log(specificLocales.thekey); // new Value String for key:theKey
|
|
|
1046
1077
|
##### `function deleteRealmLocalizationTexts(filter)`
|
|
1047
1078
|
Deletes a specific custom localization text entry for a given locale and key within a realm.
|
|
1048
1079
|
This is useful when you want to remove a previously added or overridden message from the realm's custom localization.
|
|
1080
|
+
|
|
1049
1081
|
**` -- @parameters -- `**
|
|
1050
1082
|
- filter: is a JSON object that accepts this filter parameters
|
|
1051
1083
|
- realm: [required] The name of the realm where the localization entry exists.
|
|
@@ -1078,6 +1110,7 @@ create is a method used to create a new user in the specified realm.
|
|
|
1078
1110
|
This method accepts a user representation object containing details such as username, email, enabled status,
|
|
1079
1111
|
credentials, and other user attributes that can be get by getProfile function.
|
|
1080
1112
|
It is typically used when you want to programmatically add new users to your Keycloak realm via the Admin API.
|
|
1113
|
+
|
|
1081
1114
|
**` -- @parameters -- `**
|
|
1082
1115
|
- userRepresentation: An object containing the user fields to be updated.
|
|
1083
1116
|
```js
|
|
@@ -1098,6 +1131,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1098
1131
|
##### `function del(filter)`
|
|
1099
1132
|
Deletes a user from the specified realm. Once removed, the user and all associated data (such as credentials,
|
|
1100
1133
|
sessions, and group/role memberships) are permanently deleted.
|
|
1134
|
+
|
|
1101
1135
|
**` -- @parameters -- `**
|
|
1102
1136
|
- id: [Required] the user ID to delete
|
|
1103
1137
|
- realm [Optional] the realm name (defaults to current realm)
|
|
@@ -1112,6 +1146,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1112
1146
|
find method is used to retrieve a list of users in a specific realm.
|
|
1113
1147
|
It supports optional filtering parameters such as username, email, first name, last name, and more.
|
|
1114
1148
|
Searching by attributes is only available from Keycloak > 15
|
|
1149
|
+
|
|
1115
1150
|
**` -- @parameters -- `**
|
|
1116
1151
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
1117
1152
|
- q: A string containing a query filter by custom attributes, such as 'username:admin'.
|
|
@@ -1152,6 +1187,7 @@ count method returns the total number of users in a given realm.
|
|
|
1152
1187
|
It optionally accepts filtering parameters similar to those in users.find() such
|
|
1153
1188
|
as username, email, firstName, lastName and so on to count only users that match specific criteria.
|
|
1154
1189
|
Searching by attributes is only available from Keycloak > 15
|
|
1190
|
+
|
|
1155
1191
|
**` -- @parameters -- `**
|
|
1156
1192
|
- filter is a JSON object that accepts filter parameters, such as { email: 'test@keycloak.org' }
|
|
1157
1193
|
```js
|
|
@@ -1170,6 +1206,7 @@ console.log('User found:', user_count);
|
|
|
1170
1206
|
update method is used to update the details of a specific user in a Keycloak realm.
|
|
1171
1207
|
It requires at least the user’s ID(searchParams) and the updated data(userRepresentation).
|
|
1172
1208
|
You can modify fields like firstName, lastName, email, enabled, and more.
|
|
1209
|
+
|
|
1173
1210
|
**` -- @parameters -- `**
|
|
1174
1211
|
- searchParams: is a JSON object that accepts filter parameters
|
|
1175
1212
|
- id: [Required] the user ID to update
|
|
@@ -1189,6 +1226,7 @@ const user_count = await KeycloakManager.users.update({ id: 'user-Id' }, {
|
|
|
1189
1226
|
resetPassword method is used to set a new password for a specific user.
|
|
1190
1227
|
This action replaces the user's existing credentials. You can also set whether the user is required to
|
|
1191
1228
|
change the password on next login.
|
|
1229
|
+
|
|
1192
1230
|
**` -- @parameters -- `**
|
|
1193
1231
|
- newCredentialsParameters: is a JSON object that accepts filter parameters
|
|
1194
1232
|
- id: [Required] the user ID to update
|
|
@@ -1215,6 +1253,7 @@ getCredentials() method retrieves the list of credentials (e.g., passwords, OTPs
|
|
|
1215
1253
|
currently associated with a given user in a specific realm.
|
|
1216
1254
|
This is useful for auditing, checking what types of credentials a user has set up,
|
|
1217
1255
|
or managing credentials such as password reset, WebAuthn deletion, etc.
|
|
1256
|
+
|
|
1218
1257
|
**` -- @parameters -- `**
|
|
1219
1258
|
- getCredentials: is a JSON object that accepts filter parameters
|
|
1220
1259
|
- id: [Required] the user ID to update
|
|
@@ -1230,6 +1269,7 @@ console.log(ressult);
|
|
|
1230
1269
|
##### `function deleteCredential(accountInfo)`
|
|
1231
1270
|
deleteCredential method allows you to delete a specific credential (e.g., password, OTP, WebAuthn, etc.) from a user.
|
|
1232
1271
|
This is useful when you want to invalidate or remove a credential, forcing the user to reconfigure or reset it.
|
|
1272
|
+
|
|
1233
1273
|
**` -- @parameters -- `**
|
|
1234
1274
|
- accountInfo: is a JSON object that accepts this parameters
|
|
1235
1275
|
- id: [Required] the user ID to update
|
|
@@ -1256,6 +1296,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1256
1296
|
|
|
1257
1297
|
##### `function addToGroup(parameters)`
|
|
1258
1298
|
Adds a user to a specific group within the realm.
|
|
1299
|
+
|
|
1259
1300
|
**` -- @parameters -- `**
|
|
1260
1301
|
- parameters: is a JSON object that accepts this parameters
|
|
1261
1302
|
- id [required]: The user ID of the user you want to add to the group.
|
|
@@ -1271,6 +1312,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1271
1312
|
```
|
|
1272
1313
|
##### `function delFromGroup(parameters)`
|
|
1273
1314
|
Removes a user from a specific group in Keycloak.
|
|
1315
|
+
|
|
1274
1316
|
**` -- @parameters -- `**
|
|
1275
1317
|
- parameters: is a JSON object that accepts this parameters
|
|
1276
1318
|
- id [required]: The user ID of the user you want to remove to the group.
|
|
@@ -1287,6 +1329,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1287
1329
|
|
|
1288
1330
|
##### `function countGroups(filter)`
|
|
1289
1331
|
Retrieves the number of groups that a given user is a member of.
|
|
1332
|
+
|
|
1290
1333
|
**` -- @parameters -- `**
|
|
1291
1334
|
- filter is a JSON object that accepts filter parameters, such as { id: '' }
|
|
1292
1335
|
- id: [required] The user ID of the user whose group membership count you want to retrieve.
|
|
@@ -1300,6 +1343,7 @@ console.log('Groups found:', user_count);
|
|
|
1300
1343
|
```
|
|
1301
1344
|
##### `function listGroups(filter)`
|
|
1302
1345
|
Returns the list of groups that a given user is a member of.
|
|
1346
|
+
|
|
1303
1347
|
**` -- @parameters -- `**
|
|
1304
1348
|
- filter is a JSON object that accepts filter parameters, such as { id: '' }
|
|
1305
1349
|
- id: [required] The user ID of the user whose group membership you want to retrieve.
|
|
@@ -1794,6 +1838,7 @@ Clients represent entities that want to interact with Keycloak for authenticatio
|
|
|
1794
1838
|
|
|
1795
1839
|
##### `function create(client_dictionary)`
|
|
1796
1840
|
Creates a new client with the provided configuration
|
|
1841
|
+
|
|
1797
1842
|
**` -- @parameters -- `**
|
|
1798
1843
|
- client_dictionary: An object(JSON) of type ClientRepresentation, containing the configuration for the new client.
|
|
1799
1844
|
- clientId: [required] string The unique identifier for the client (required).
|
|
@@ -1819,6 +1864,7 @@ console.log("New Client Created:", client);
|
|
|
1819
1864
|
Retrieves a list of all clients in the current realm, optionally filtered by query parameters.
|
|
1820
1865
|
This method is useful for listing all registered applications or services in Keycloak or searching
|
|
1821
1866
|
for a specific one using filters like clientId.
|
|
1867
|
+
|
|
1822
1868
|
**` -- @parameters -- `**
|
|
1823
1869
|
- filter: A JSON structure used to filter results based on specific fields:
|
|
1824
1870
|
- clientId: [optional] string filter to search clients by their clientId.
|
|
@@ -1835,6 +1881,7 @@ console.log("Clients:", clients);
|
|
|
1835
1881
|
##### `function findOne(filter)`
|
|
1836
1882
|
Retrieves detailed information about a specific client within a realm by its unique client ID.
|
|
1837
1883
|
This method fetches the client’s configuration, including its settings, roles, protocols, and other metadata.
|
|
1884
|
+
|
|
1838
1885
|
**` -- @parameters -- `**
|
|
1839
1886
|
- filter: A JSON structure used to filter results based on specific fields:
|
|
1840
1887
|
- id: [optional] The unique identifier of the client to retrieve
|
|
@@ -1849,6 +1896,7 @@ console.log("Clients:", clients);
|
|
|
1849
1896
|
##### `function del(filter)`
|
|
1850
1897
|
Deletes a client from the realm using its internal ID.
|
|
1851
1898
|
This operation is irreversible and will remove the client and all its associated roles, permissions, and configurations.
|
|
1899
|
+
|
|
1852
1900
|
**` -- @parameters -- `**
|
|
1853
1901
|
- filter: A JSON structure used to filter results based on specific fields:
|
|
1854
1902
|
- id: [required] The internal ID of the client to delete (not clientId)
|
|
@@ -1863,6 +1911,7 @@ console.log(`Client successfully deleted.`);
|
|
|
1863
1911
|
##### `function update(filter,clientRepresentation)`
|
|
1864
1912
|
Updates the configuration of an existing client in the realm.
|
|
1865
1913
|
You can modify various attributes such as the client name, redirect URIs, protocol, access type, and more.
|
|
1914
|
+
|
|
1866
1915
|
**` -- @parameters -- `**
|
|
1867
1916
|
- filter: A JSON structure used to filter results based on specific fields:
|
|
1868
1917
|
- id: [required] The unique ID of the client you want to update
|
|
@@ -1888,6 +1937,7 @@ console.log(`Client successfully updated.`);
|
|
|
1888
1937
|
Creates a new client role under a specific client.
|
|
1889
1938
|
Client roles are roles associated with a specific client (application), and are useful
|
|
1890
1939
|
for fine-grained access control within that client.
|
|
1940
|
+
|
|
1891
1941
|
**` -- @parameters -- `**
|
|
1892
1942
|
- role_parameters: JSON structure that defines the role like:
|
|
1893
1943
|
- id: [required] The internal ID of the client where the role will be created.
|
|
@@ -1910,6 +1960,7 @@ console.log("Client role:", role);
|
|
|
1910
1960
|
##### `function findRole(filter)`
|
|
1911
1961
|
Retrieves a specific client role by name from a given client.
|
|
1912
1962
|
This is useful when you want to inspect or verify the properties of a role defined within a particular client.
|
|
1963
|
+
|
|
1913
1964
|
**` -- @parameters -- `**
|
|
1914
1965
|
- filter: JSON structure that defines the filter parameters:
|
|
1915
1966
|
- id: [required] The internal ID of the client (not the clientId string) where the role is defined.
|
|
@@ -1929,6 +1980,7 @@ console.log("Client role:", role);
|
|
|
1929
1980
|
##### `function updateRole(filter,roleRepresentation)`
|
|
1930
1981
|
Updates the attributes of a specific client role in Keycloak.
|
|
1931
1982
|
This includes changing the role's name, description, or any associated metadata.
|
|
1983
|
+
|
|
1932
1984
|
**` -- @parameters -- `**
|
|
1933
1985
|
- filter: JSON structure that defines the filter parameters:
|
|
1934
1986
|
- id: [required] The internal ID of the client (not the clientId string) where the role is defined.
|
|
@@ -1953,6 +2005,7 @@ Deletes a client role by its name for a specific client.
|
|
|
1953
2005
|
This permanently removes the role from the specified client in Keycloak.
|
|
1954
2006
|
A promise that resolves to void if the deletion is successful.
|
|
1955
2007
|
If the role does not exist or the operation fails, an error will be thrown.
|
|
2008
|
+
|
|
1956
2009
|
**` -- @parameters -- `**
|
|
1957
2010
|
- filter: JSON structure that defines the filter parameters:
|
|
1958
2011
|
- id: [required] The internal ID of the client (not the clientId string) where the role is defined.
|
|
@@ -1971,6 +2024,7 @@ const role= await KeycloakManager.clients.delRole({
|
|
|
1971
2024
|
##### `function listRoles(filter)`
|
|
1972
2025
|
Retrieves all roles defined for a specific client within the realm.
|
|
1973
2026
|
These roles can be used to assign permissions to users or groups for the specific client application.
|
|
2027
|
+
|
|
1974
2028
|
**` -- @parameters -- `**
|
|
1975
2029
|
- filter: JSON structure that defines the filter parameters:
|
|
1976
2030
|
- id: [required] The internal ID of the client (not clientId)
|
|
@@ -1988,6 +2042,7 @@ console.log("Client roles:", roles);
|
|
|
1988
2042
|
##### `function getClientSecret(filter)`
|
|
1989
2043
|
Retrieves the client secret associated with a confidential client in Keycloak.
|
|
1990
2044
|
This is typically used for clients using client_credentials or authorization_code flows where the secret is required to authenticate the client.
|
|
2045
|
+
|
|
1991
2046
|
**` -- @parameters -- `**
|
|
1992
2047
|
- filter: JSON structure that defines the filter parameters:
|
|
1993
2048
|
- id: [required] The internal ID of the client (not clientId)
|
|
@@ -2006,6 +2061,7 @@ console.log("Client secret:", secret);
|
|
|
2006
2061
|
##### `function generateNewClientSecret(filter)`
|
|
2007
2062
|
Generates a new client secret for a confidential client in Keycloak. This will overwrite the existing secret and return the newly generated one.
|
|
2008
2063
|
It is useful when rotating credentials or recovering access.
|
|
2064
|
+
|
|
2009
2065
|
**` -- @parameters -- `**
|
|
2010
2066
|
- filter: JSON structure that defines the filter parameters:
|
|
2011
2067
|
- id: [required] The internal ID of the client (not clientId)
|
|
@@ -2024,6 +2080,7 @@ console.log("New client secret:", secret.value);
|
|
|
2024
2080
|
##### `function generateRegistrationAccessToken(filter)`
|
|
2025
2081
|
Generates a new registration access token for a client. This token allows the client to make authorized requests to the client registration REST API.
|
|
2026
2082
|
It’s particularly useful in dynamic client registration workflows or when automating client updates via external systems.
|
|
2083
|
+
|
|
2027
2084
|
**` -- @parameters -- `**
|
|
2028
2085
|
- filter: JSON structure that defines the filter parameters:
|
|
2029
2086
|
- id: [required] The internal ID of the client (not clientId)
|
|
@@ -2318,6 +2375,7 @@ console.log("Roles successfully mapped to client!");
|
|
|
2318
2375
|
##### `function clients.listClientScopeMappings(filter)`
|
|
2319
2376
|
The method is used to list all client role mappings assigned to a client.
|
|
2320
2377
|
It shows which roles from another client (source) are already mapped to the target client.
|
|
2378
|
+
|
|
2321
2379
|
**` -- @parameters -- `**
|
|
2322
2380
|
- filter: JSON structure that defines the filter parameters:
|
|
2323
2381
|
- id: [required] The ID of the target client (where roles are mapped)
|
|
@@ -2340,6 +2398,7 @@ console.log("Mapped roles:", assignedRoles);
|
|
|
2340
2398
|
##### `function clients.listCompositeClientScopeMappings(filter)`
|
|
2341
2399
|
The method is used to list both direct and composite (inherited) client role mappings that are assigned to a target client.
|
|
2342
2400
|
It differs from listClientScopeMappings because it expands composite roles and shows all roles that are effectively available to the client.
|
|
2401
|
+
|
|
2343
2402
|
**` -- @parameters -- `**
|
|
2344
2403
|
- filter: JSON structure that defines the filter parameters:
|
|
2345
2404
|
- id: [required] The ID of the target client (the one receiving the mappings)
|
|
@@ -2362,6 +2421,7 @@ console.log("Effective (composite) role mappings:", effectiveRoles);
|
|
|
2362
2421
|
##### `function clients.delClientScopeMappings(filter)`
|
|
2363
2422
|
The method is used to remove one or more client role mappings from a target client.
|
|
2364
2423
|
It is the reverse of clients.addClientScopeMappings
|
|
2424
|
+
|
|
2365
2425
|
**` -- @parameters -- `**
|
|
2366
2426
|
- filter: JSON structure that defines the filter parameters:
|
|
2367
2427
|
- id: [required] ID of the target client (the client losing the roles)
|
|
@@ -2394,6 +2454,7 @@ console.log("Roles removed from client mappings");
|
|
|
2394
2454
|
##### `function clients.listAvailableRealmScopeMappings(filter)`
|
|
2395
2455
|
The method is used to retrieve all realm-level roles that are available to be assigned to a specific client.
|
|
2396
2456
|
These are roles defined at the realm level that the client does not yet have mapped, allowing you to see what can be added.
|
|
2457
|
+
|
|
2397
2458
|
**` -- @parameters -- `**
|
|
2398
2459
|
- filter: JSON structure that defines the filter parameters:
|
|
2399
2460
|
- id: [required] The ID of the client for which you want to list available realm-level role mappings.
|
|
@@ -2413,6 +2474,7 @@ console.log("Available realm roles for client:", availableRealmRoles);
|
|
|
2413
2474
|
##### `function clients.listAvailableRealmScopeMappings(filter)`
|
|
2414
2475
|
The method is used to retrieve all realm-level roles that are available to be assigned to a specific client.
|
|
2415
2476
|
These are roles defined at the realm level that the client does not yet have mapped, allowing you to see what can be added.
|
|
2477
|
+
|
|
2416
2478
|
**` -- @parameters -- `**
|
|
2417
2479
|
- filter: JSON structure that defines the filter parameters:
|
|
2418
2480
|
- id: [required] The ID of the client for which you want to list available realm-level role mappings.
|
|
@@ -2433,6 +2495,7 @@ console.log("Available realm roles for client:", availableRealmRoles);
|
|
|
2433
2495
|
##### `function clients.listRealmScopeMappings(filter)`
|
|
2434
2496
|
The method retrieves the realm-level roles currently assigned to a client as part of its scope mappings.
|
|
2435
2497
|
This shows which realm roles the client is allowed to request on behalf of users.
|
|
2498
|
+
|
|
2436
2499
|
**` -- @parameters -- `**
|
|
2437
2500
|
- filter: JSON structure that defines the filter parameters:
|
|
2438
2501
|
- id: [required] The client ID whose realm-level scope mappings you want to list
|
|
@@ -2452,6 +2515,7 @@ console.log("Realm roles mapped to client:", roles.map(r => r.name));
|
|
|
2452
2515
|
##### `function clients.listCompositeRealmScopeMappings(filter)`
|
|
2453
2516
|
The method retrieves all composite realm-level roles associated with a client through its scope mappings.
|
|
2454
2517
|
This includes not only the roles directly mapped to the client, but also roles inherited through composite roles.
|
|
2518
|
+
|
|
2455
2519
|
**` -- @parameters -- `**
|
|
2456
2520
|
- filter: JSON structure that defines the filter parameters:
|
|
2457
2521
|
- id: [required] The client ID whose composite realm scope mappings you want to list
|
|
@@ -2472,6 +2536,7 @@ console.log("Realm composite roles mapped to client:", roles.map(r => r.name));
|
|
|
2472
2536
|
##### `function clients.addRealmScopeMappings(filter,roles)`
|
|
2473
2537
|
The method is used to assign realm-level role mappings to a specific client.
|
|
2474
2538
|
This effectively grants the client access to the specified realm roles.
|
|
2539
|
+
|
|
2475
2540
|
**` -- @parameters -- `**
|
|
2476
2541
|
- filter: JSON structure that defines the filter parameters:
|
|
2477
2542
|
- id: [required] The client ID that will receive the new realm-level role mappings.
|
|
@@ -2491,6 +2556,7 @@ await KeycloakManager.clients.addRealmScopeMappings(
|
|
|
2491
2556
|
##### `function clients.delRealmScopeMappings(filter,roles)`
|
|
2492
2557
|
The method removes realm-level roles from a client’s scope mappings.
|
|
2493
2558
|
This is the opposite of clients.addRealmScopeMappings.
|
|
2559
|
+
|
|
2494
2560
|
**` -- @parameters -- `**
|
|
2495
2561
|
- filter: JSON structure that defines the filter parameters:
|
|
2496
2562
|
- id: [required] The client ID whose realm role mapping must be removed.
|
|
@@ -2509,6 +2575,7 @@ await KeycloakManager.clients.delRealmScopeMappings(
|
|
|
2509
2575
|
|
|
2510
2576
|
##### `function clients.listSessions(filter)`
|
|
2511
2577
|
The method retrieves active user sessions for a specific client.
|
|
2578
|
+
|
|
2512
2579
|
**` -- @parameters -- `**
|
|
2513
2580
|
- filter: JSON structure that defines the filter parameters:
|
|
2514
2581
|
- id: [required] The client ID whose session must be retrieved
|
|
@@ -2536,6 +2603,7 @@ sessions.forEach(s =>
|
|
|
2536
2603
|
##### `function clients.listOfflineSessions(filter)`
|
|
2537
2604
|
The method retrieves offline sessions associated with a given client.
|
|
2538
2605
|
Offline sessions are created when a client uses offline tokens (refresh tokens with offline_access scope)
|
|
2606
|
+
|
|
2539
2607
|
**` -- @parameters -- `**
|
|
2540
2608
|
- filter: JSON structure that defines the filter parameters:
|
|
2541
2609
|
- id: [required] The client ID whose session must be retrieved
|
|
@@ -2562,6 +2630,7 @@ sessions.forEach(s =>
|
|
|
2562
2630
|
##### `function clients.getSessionCount(filter)`
|
|
2563
2631
|
The method retrieves the number of active user sessions for a given client.
|
|
2564
2632
|
This includes online sessions, not offline sessions (those are retrieved with listOfflineSessions).
|
|
2633
|
+
|
|
2565
2634
|
**` -- @parameters -- `**
|
|
2566
2635
|
- filter: JSON structure that defines the filter parameters:
|
|
2567
2636
|
- id: [required] The client ID whose session must be retrieved
|
|
@@ -2582,6 +2651,7 @@ console.log(`Client internal-client-id has ${sessionCount.count} active sessions
|
|
|
2582
2651
|
The method retrieves the number of offline sessions associated with a given client.
|
|
2583
2652
|
Offline sessions represent sessions where the user has a valid offline token, typically used for long-lived access
|
|
2584
2653
|
without requiring active login.
|
|
2654
|
+
|
|
2585
2655
|
**` -- @parameters -- `**
|
|
2586
2656
|
- filter: JSON structure that defines the filter parameters:
|
|
2587
2657
|
- id: [required] The ID of the client for which you want to count offline sessions.
|
|
@@ -2602,6 +2672,7 @@ console.log(`Client internal-client-id has ${sessionCount.count} offline session
|
|
|
2602
2672
|
The method is used to register a cluster node for a specific Keycloak client.
|
|
2603
2673
|
This is relevant in scenarios where you are running Keycloak in a clustered environment and want to synchronize
|
|
2604
2674
|
client sessions and node information across multiple instances.
|
|
2675
|
+
|
|
2605
2676
|
**` -- @parameters -- `**
|
|
2606
2677
|
- filter: JSON structure that defines the filter parameters:
|
|
2607
2678
|
- id: [required] The ID of the client for which you want to add a cluster node.
|
|
@@ -2623,6 +2694,7 @@ await KeycloakManager.clients.addClusterNode({
|
|
|
2623
2694
|
The method in Keycloak Admin Client is used to remove a previously registered cluster node for a specific client.
|
|
2624
2695
|
This is useful in clustered environments when a node is no longer active or should be deregistered from the
|
|
2625
2696
|
client session synchronization.
|
|
2697
|
+
|
|
2626
2698
|
**` -- @parameters -- `**
|
|
2627
2699
|
- filter: JSON structure that defines the filter parameters:
|
|
2628
2700
|
- id: [required] The ID of the client for which you want to remove a cluster node.
|
|
@@ -2642,6 +2714,7 @@ await KeycloakManager.clients.deleteClusterNode({
|
|
|
2642
2714
|
##### `function clients.generateAndDownloadKey(filter,config)`
|
|
2643
2715
|
The method is used to generate a new cryptographic key for a client and download it.
|
|
2644
2716
|
This is typically used for clients that require client credentials, JWT signing, or encryption.
|
|
2717
|
+
|
|
2645
2718
|
**` -- @parameters -- `**
|
|
2646
2719
|
- filter: JSON structure that defines the filter parameters:
|
|
2647
2720
|
- id: [required] The ID of the client for which you want to generate the key
|
|
@@ -2686,6 +2759,7 @@ console.log('Keystore saved ad client-keystore.jks');
|
|
|
2686
2759
|
The method is used to generate a new cryptographic key for a client without automatically downloading it.
|
|
2687
2760
|
This is useful for creating new signing or encryption keys associated with a client directly within Keycloak.
|
|
2688
2761
|
Unlike clients.generateAndDownloadKey, this method only generates the key and stores it in Keycloak. It does not return the key material to the caller
|
|
2762
|
+
|
|
2689
2763
|
**` -- @parameters -- `**
|
|
2690
2764
|
- filter: JSON structure that defines the filter parameters:
|
|
2691
2765
|
- id: [required] The ID of the client for which you want to generate the key
|
|
@@ -2711,6 +2785,7 @@ console.log('New RSA key successfully generated for client');
|
|
|
2711
2785
|
##### `function clients.getKeyInfo(filter)`
|
|
2712
2786
|
The method is used to retrieve metadata about the keys associated with a specific client.
|
|
2713
2787
|
It does not return the actual key material but provides information such as the key type, provider, algorithm, and status.
|
|
2788
|
+
|
|
2714
2789
|
**` -- @parameters -- `**
|
|
2715
2790
|
- filter: JSON structure that defines the filter parameters:
|
|
2716
2791
|
- id: [required] The ID of the client whose key information should be retrieved
|
|
@@ -2736,6 +2811,7 @@ console.log("Client key info:", keyInfo);
|
|
|
2736
2811
|
##### `function clients.downloadKey(filter,config)`
|
|
2737
2812
|
The method Downloads a client’s cryptographic key (certificate) from Keycloak.
|
|
2738
2813
|
This is typically used when you need to retrieve the public certificate of a client for token validation, signing, or encryption purposes.
|
|
2814
|
+
|
|
2739
2815
|
**` -- @parameters -- `**
|
|
2740
2816
|
- filter: JSON structure that defines the filter parameters:
|
|
2741
2817
|
- id: [required] The ID of the client whose key information should be downloaded
|
|
@@ -2786,6 +2862,7 @@ console.log(cert);
|
|
|
2786
2862
|
The method in the Keycloak Admin Client is used to create a new authorization scope for a specific client.
|
|
2787
2863
|
Authorization scopes are part of Keycloak’s Authorization Services and represent fine-grained permissions
|
|
2788
2864
|
that can later be linked to resources and policies.
|
|
2865
|
+
|
|
2789
2866
|
**` -- @parameters -- `**
|
|
2790
2867
|
- filter: JSON structure that defines the filter parameters:
|
|
2791
2868
|
- id: [required] TThe ID of the client for which the scope will be created
|
|
@@ -2813,6 +2890,7 @@ await KeycloakManager.clients.createAuthorizationScope(
|
|
|
2813
2890
|
##### `function clients.listAllScopes(filter)`
|
|
2814
2891
|
The method is used to retrieve all available scopes for a specific client.
|
|
2815
2892
|
This includes both default scopes and optional scopes that can be assigned to the client.
|
|
2893
|
+
|
|
2816
2894
|
**` -- @parameters -- `**
|
|
2817
2895
|
- filter: JSON structure that defines the filter parameters:
|
|
2818
2896
|
- id: [required] The ID of the client whose scopes you want to list
|
|
@@ -2833,6 +2911,7 @@ console.log(scopes);
|
|
|
2833
2911
|
##### `function clients.updateAuthorizationScope(filter,AuthorizationScopeRepresentation)`
|
|
2834
2912
|
The method is used to update an existing authorization scope for a specific client.
|
|
2835
2913
|
Authorization scopes define permissions that can be used in policies and permissions for the client’s resources.
|
|
2914
|
+
|
|
2836
2915
|
**` -- @parameters -- `**
|
|
2837
2916
|
- filter: JSON structure that defines the filter parameters:
|
|
2838
2917
|
- id: [required] The ID of the client to which the scope belongs
|
|
@@ -2867,6 +2946,7 @@ console.log('Authorization scope updated successfully');
|
|
|
2867
2946
|
##### `function clients.getAuthorizationScope(filter)`
|
|
2868
2947
|
The method is used to retrieve the details of a specific authorization scope associated with a client.
|
|
2869
2948
|
Authorization scopes define permissions that can be applied to resources and policies in Keycloak.
|
|
2949
|
+
|
|
2870
2950
|
**` -- @parameters -- `**
|
|
2871
2951
|
- filter: JSON structure that defines the filter parameters:
|
|
2872
2952
|
- id: [required] The ID of the client to which the scope belongs
|
|
@@ -2888,6 +2968,7 @@ console.log('Authorization scope details:', scope);
|
|
|
2888
2968
|
##### `function clients.listAllResourcesByScope(filter)`
|
|
2889
2969
|
The method is used to retrieve all resources associated with a specific authorization scope for a given client.
|
|
2890
2970
|
This allows you to see which resources are governed by a particular scope in the client’s authorization settings.
|
|
2971
|
+
|
|
2891
2972
|
**` -- @parameters -- `**
|
|
2892
2973
|
- filter: JSON structure that defines the filter parameters:
|
|
2893
2974
|
- id: [required] The ID of the client to which the scope belongs
|
|
@@ -2910,6 +2991,7 @@ console.log('Resources associated with this scope:', resources);
|
|
|
2910
2991
|
##### `function clients.listAllPermissionsByScope(filter)`
|
|
2911
2992
|
The method is used to retrieve all permissions associated with a specific authorization scope for a given client.
|
|
2912
2993
|
This is helpful for understanding which permissions (policies and rules) are applied when a particular scope is used.
|
|
2994
|
+
|
|
2913
2995
|
**` -- @parameters -- `**
|
|
2914
2996
|
- filter: JSON structure that defines the filter parameters:
|
|
2915
2997
|
- id: [required] The ID of the client to query
|
|
@@ -2935,6 +3017,7 @@ console.log('Permissions associated with this scope:', permissions);
|
|
|
2935
3017
|
The method is used to retrieve all scopes associated with a specific permission for a given client.
|
|
2936
3018
|
This allows you to see which scopes a permission controls, helping you manage fine-grained access rules
|
|
2937
3019
|
in Keycloak’s Authorization Services (UMA 2.0) framework.
|
|
3020
|
+
|
|
2938
3021
|
**` -- @parameters -- `**
|
|
2939
3022
|
- filter: JSON structure that defines the filter parameters:
|
|
2940
3023
|
- id: [required] The ID of the client whose permission scopes you want to list
|
|
@@ -2961,6 +3044,7 @@ console.log('Permission Scopes:', permissionScopes);
|
|
|
2961
3044
|
The method is used to import a resource into a client.
|
|
2962
3045
|
This is part of Keycloak’s Authorization Services (UMA 2.0) and allows you to programmatically define
|
|
2963
3046
|
resources that a client can protect with policies and permissions.
|
|
3047
|
+
|
|
2964
3048
|
**` -- @parameters -- `**
|
|
2965
3049
|
- filter: JSON structure that defines the filter parameters:
|
|
2966
3050
|
- id: [required] The ID of the client to which the resource should be imported
|
|
@@ -2994,6 +3078,7 @@ console.log('Resource imported successfully');
|
|
|
2994
3078
|
The method is used to export a resource from a client.
|
|
2995
3079
|
This allows you to retrieve the full configuration of a resource, including its URIs, scopes,
|
|
2996
3080
|
and associated permissions, which can then be backed up, replicated, or modified externally.
|
|
3081
|
+
|
|
2997
3082
|
**` -- @parameters -- `**
|
|
2998
3083
|
- filter: JSON structure that defines the filter parameters:
|
|
2999
3084
|
- id: [required] The ID of the client from which to export the resource
|
|
@@ -3016,6 +3101,7 @@ console.log('Exported Resource:', exportedResource);
|
|
|
3016
3101
|
The method is used to create a new resource under a specific client.
|
|
3017
3102
|
A resource represents a protected entity in Keycloak’s authorization services, such as a REST endpoint,
|
|
3018
3103
|
a document, or any application-specific asset. This allows you to manage fine-grained access control via policies and permissions.
|
|
3104
|
+
|
|
3019
3105
|
**` -- @parameters -- `**
|
|
3020
3106
|
- filter: JSON structure that defines the filter parameters:
|
|
3021
3107
|
- id: [required] The ID of the client where the resource will be created
|
|
@@ -3050,6 +3136,7 @@ console.log('Created Resource:', createdResource);
|
|
|
3050
3136
|
The method is used to retrieve a specific resource of a client by its ID.
|
|
3051
3137
|
Resources in Keycloak represent protected entities, such as APIs, documents, or any application-specific assets,
|
|
3052
3138
|
that can have associated scopes, policies, and permissions for fine-grained access control.
|
|
3139
|
+
|
|
3053
3140
|
**` -- @parameters -- `**
|
|
3054
3141
|
- filter: JSON structure that defines the filter parameters:
|
|
3055
3142
|
- id: [required] The ID of the client that owns the resource
|
|
@@ -3071,6 +3158,7 @@ console.log('Retrieved Resource:', resource);
|
|
|
3071
3158
|
The method is used to retrieve the resource server settings of a client.
|
|
3072
3159
|
A resource server in Keycloak represents a client that is enabled with Authorization Services,
|
|
3073
3160
|
meaning it can define resources, scopes, permissions, and policies for fine-grained access control.
|
|
3161
|
+
|
|
3074
3162
|
**` -- @parameters -- `**
|
|
3075
3163
|
- filter: JSON structure that defines the filter parameters:
|
|
3076
3164
|
- id: [required] The ID of the client whose resource server configuration you want to retrieve
|
|
@@ -3091,6 +3179,7 @@ console.log('Resource Server:', resourceServer);
|
|
|
3091
3179
|
The method is used to update the configuration of a client’s resource server.
|
|
3092
3180
|
A resource server defines authorization settings such as resources, scopes, permissions,
|
|
3093
3181
|
and policies that control fine-grained access to protected assets.
|
|
3182
|
+
|
|
3094
3183
|
**` -- @parameters -- `**
|
|
3095
3184
|
- filter: JSON structure that defines the filter parameters:
|
|
3096
3185
|
- id: [required] The ID of the client whose resource server configuration should be updated
|
|
@@ -3121,6 +3210,7 @@ console.log("Resource server updated successfully");
|
|
|
3121
3210
|
##### `function clients.listPermissionsByResource(filter)`
|
|
3122
3211
|
The method is used to retrieve all permissions associated with a specific resource within a client’s resource server.
|
|
3123
3212
|
This is part of the Keycloak Authorization Services API and helps administrators inspect which permissions are linked to a given protected resource.
|
|
3213
|
+
|
|
3124
3214
|
**` -- @parameters -- `**
|
|
3125
3215
|
- filter: JSON structure that defines the filter parameters:
|
|
3126
3216
|
- id: [required] The ID of the client (the resource server).
|
|
@@ -3144,6 +3234,7 @@ console.log("Permissions for resource:", permissions);
|
|
|
3144
3234
|
The method is used to create a new permission for a client.
|
|
3145
3235
|
Permissions define which users or roles can access specific resources or scopes within the client,
|
|
3146
3236
|
based on policies you configure. This is part of Keycloak’s Authorization Services (UMA 2.0) framework.
|
|
3237
|
+
|
|
3147
3238
|
**` -- @parameters -- `**
|
|
3148
3239
|
- filter: JSON structure that defines the filter parameters:
|
|
3149
3240
|
- id: [required] The ID of the client for which the permission will be created
|
|
@@ -3181,6 +3272,7 @@ console.log('Permission created');
|
|
|
3181
3272
|
The method is used to search for permissions within a client’s resource server.
|
|
3182
3273
|
Permissions in Keycloak represent rules that define how policies are applied to resources or scopes,
|
|
3183
3274
|
and this method allows you to list and filter them based on specific criteria.
|
|
3275
|
+
|
|
3184
3276
|
**` -- @parameters -- `**
|
|
3185
3277
|
- filter: JSON structure that defines the filter parameters:
|
|
3186
3278
|
- id: [required] The ID of the client (the resource server) where permissions are defined
|
|
@@ -3209,6 +3301,7 @@ console.log("Permissions found:", permissions);
|
|
|
3209
3301
|
The method updates the fine-grained admin permissions configuration for a specific client.
|
|
3210
3302
|
Fine-grained permissions allow you to control which users/roles can manage different aspects of a client
|
|
3211
3303
|
(e.g., who can manage roles, protocol mappers, or scope assignments).
|
|
3304
|
+
|
|
3212
3305
|
**` -- @parameters -- `**
|
|
3213
3306
|
- filter: JSON structure that defines the filter parameters:
|
|
3214
3307
|
- id: [required] The ID of the client (the resource server) where permissions are defined
|
|
@@ -3229,6 +3322,7 @@ console.log("Fine-grained permissions updated successfully");
|
|
|
3229
3322
|
##### `function clients.listFineGrainPermissions(filter)`
|
|
3230
3323
|
The method retrieves the current fine-grained admin permission settings for a given client.
|
|
3231
3324
|
This is useful for checking which permissions are configured (e.g., managing roles, protocol mappers, or client scopes).
|
|
3325
|
+
|
|
3232
3326
|
**` -- @parameters -- `**
|
|
3233
3327
|
- filter: JSON structure that defines the filter parameters:
|
|
3234
3328
|
- id: [required] The ID of the client (the resource server) where permissions are defined
|
|
@@ -3248,6 +3342,7 @@ console.log("Fine-grained permissions for client:", permissions);
|
|
|
3248
3342
|
##### `function clients.getAssociatedScopes(filter)`
|
|
3249
3343
|
The method is used to retrieve all scopes associated with a specific permission within a client’s resource server.
|
|
3250
3344
|
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.
|
|
3345
|
+
|
|
3251
3346
|
**` -- @parameters -- `**
|
|
3252
3347
|
- filter: JSON structure that defines the filter parameters:
|
|
3253
3348
|
- id: [required] The ID of the client whose permission scopes you want to list
|
|
@@ -3268,6 +3363,7 @@ console.log("Associated scopes:", scopes);
|
|
|
3268
3363
|
##### `function clients.getAssociatedPolicies(filter)`
|
|
3269
3364
|
The method is used to retrieve all policies associated with a specific permission within a client’s resource server.
|
|
3270
3365
|
n 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
|
|
3366
|
+
|
|
3271
3367
|
**` -- @parameters -- `**
|
|
3272
3368
|
- filter: JSON structure that defines the filter parameters:
|
|
3273
3369
|
- id: [required] The ID of the client whose permission policies you want to list
|
|
@@ -3290,6 +3386,7 @@ console.log("Associated policies:", policies);
|
|
|
3290
3386
|
##### `function clients.getAssociatedResources(filter)`
|
|
3291
3387
|
The method is used to retrieve all resources linked to a specific permission in a client’s resource server.
|
|
3292
3388
|
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.
|
|
3389
|
+
|
|
3293
3390
|
**` -- @parameters -- `**
|
|
3294
3391
|
- filter: JSON structure that defines the filter parameters:
|
|
3295
3392
|
- id: [required] The ID of the client whose permission resource you want to list
|
|
@@ -3312,6 +3409,7 @@ console.log("Associated resources:", resources);
|
|
|
3312
3409
|
##### `function clients.listScopesByResource(filter)`
|
|
3313
3410
|
The method is used to list all authorization scopes associated with a specific resource in a client’s resource server.
|
|
3314
3411
|
This allows administrators to understand which scopes are directly linked to a protected resource and therefore which permissions can be applied to it.
|
|
3412
|
+
|
|
3315
3413
|
**` -- @parameters -- `**
|
|
3316
3414
|
- filter: JSON structure that defines the filter parameters:
|
|
3317
3415
|
- id: [required] The ID of the client (the resource server).
|
|
@@ -3335,6 +3433,7 @@ console.log("Scopes for resource:", scopes);
|
|
|
3335
3433
|
##### `function clients.listResources(filter)`
|
|
3336
3434
|
The method is used to retrieve all resources defined in a client’s resource server.
|
|
3337
3435
|
Resources represent protected entities (such as APIs, files, or services) that can be associated with scopes and permissions in Keycloak’s authorization services.
|
|
3436
|
+
|
|
3338
3437
|
**` -- @parameters -- `**
|
|
3339
3438
|
- filter: JSON structure that defines the filter parameters:
|
|
3340
3439
|
- id: [required] The ID of the client (the resource server)
|
|
@@ -3362,6 +3461,7 @@ console.log("Resources:", resources);
|
|
|
3362
3461
|
##### `function clients.updateResource(filter,resourceRepresentation)`
|
|
3363
3462
|
The method is used to update an existing resource in a client’s resource server.
|
|
3364
3463
|
Resources represent protected entities (APIs, files, services, etc.) that can be secured with scopes and permissions under Keycloak’s Authorization Services
|
|
3464
|
+
|
|
3365
3465
|
**` -- @parameters -- `**
|
|
3366
3466
|
- filter: JSON structure that defines the filter parameters:
|
|
3367
3467
|
- id: [required] The ID of the client (the resource server)
|
|
@@ -3403,6 +3503,7 @@ console.log("Resource updated successfully");
|
|
|
3403
3503
|
The method is used to create a new policy for a client’s resource server under Keycloak’s Authorization Services.
|
|
3404
3504
|
Policies define the rules that determine whether access should be granted or denied to a given resource, scope, or permission.
|
|
3405
3505
|
They can be based on users, roles, groups, conditions, or custom logic.
|
|
3506
|
+
|
|
3406
3507
|
**` -- @parameters -- `**
|
|
3407
3508
|
- filter: JSON structure that defines the filter parameters:
|
|
3408
3509
|
- id: [required] The ID of the client (the resource server) where the policy will be created.
|
|
@@ -3452,6 +3553,7 @@ console.log("Policy created successfully");
|
|
|
3452
3553
|
##### `function clients.listDependentPolicies(filter)`
|
|
3453
3554
|
The method is used to list all policies that depend on a given policy within a client’s resource server.
|
|
3454
3555
|
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.
|
|
3556
|
+
|
|
3455
3557
|
**` -- @parameters -- `**
|
|
3456
3558
|
- filter: JSON structure that defines the filter parameters:
|
|
3457
3559
|
- id: [required] The ID of the client (the resource server) where the policy exists.
|
|
@@ -3478,6 +3580,7 @@ console.log("Dependent policies:", dependentPolicies);
|
|
|
3478
3580
|
##### `function clients.evaluateGenerateAccessToken(filter)`
|
|
3479
3581
|
The method is used to generate or simulate an access token for a specific client, typically for testing or evaluating the token
|
|
3480
3582
|
contents without performing a full user login. This can help you verify client roles, scopes, and protocol mappers included in the token
|
|
3583
|
+
|
|
3481
3584
|
**` -- @parameters -- `**
|
|
3482
3585
|
- filter: JSON structure that defines the filter parameters:
|
|
3483
3586
|
- id: [required] ID of the client for which you want to generate or evaluate the access token
|
|
@@ -3505,6 +3608,7 @@ console.log("Generated access token:", token);
|
|
|
3505
3608
|
The method is used to generate or simulate an ID token for a specific client, usually for testing or evaluating the token without
|
|
3506
3609
|
performing a full user login. This allows you to verify which claims, scopes, and protocol mappers are included in the ID
|
|
3507
3610
|
token for the client.
|
|
3611
|
+
|
|
3508
3612
|
**` -- @parameters -- `**
|
|
3509
3613
|
- filter: JSON structure that defines the filter parameters:
|
|
3510
3614
|
- id: [required] ID of the client for which you want to generate or evaluate the ID token
|
|
@@ -3531,6 +3635,7 @@ console.log("Generated ID token:", token);
|
|
|
3531
3635
|
The method is used to generate or simulate a UserInfo response for a specific client, typically for testing or evaluating what
|
|
3532
3636
|
user information would be returned by the UserInfo endpoint for that client. This helps verify which claims are included in the
|
|
3533
3637
|
UserInfo response without performing a full login flow.
|
|
3638
|
+
|
|
3534
3639
|
**` -- @parameters -- `**
|
|
3535
3640
|
- filter: JSON structure that defines the filter parameters:
|
|
3536
3641
|
- id: [required] The ID of the client for which you want to generate the UserInfo response
|
|
@@ -4147,6 +4252,7 @@ if (mapper) {
|
|
|
4147
4252
|
##### `function findProtocolMappersByProtocol(filter)`
|
|
4148
4253
|
The method retrieves all protocol mappers of a given protocol (e.g., openid-connect or saml) for a specific client scope in a realm.
|
|
4149
4254
|
This is useful when you want to filter protocol mappers by the authentication protocol they are associated with.
|
|
4255
|
+
|
|
4150
4256
|
**` -- @parameters -- `**
|
|
4151
4257
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4152
4258
|
- id: [required] The ID of the client scope to search within.
|
|
@@ -4174,6 +4280,7 @@ if (mapper) {
|
|
|
4174
4280
|
The method deletes a protocol mapper from a specific client scope in a realm.
|
|
4175
4281
|
Protocol mappers define how user attributes, roles, or other information are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
4176
4282
|
Deleting a mapper removes its configuration from the client scope.
|
|
4283
|
+
|
|
4177
4284
|
**` -- @parameters -- `**
|
|
4178
4285
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4179
4286
|
- id: [required] The ID of the client scope containing the protocol mapper.
|
|
@@ -4197,6 +4304,7 @@ console.log("Protocol mapper deleted successfully");
|
|
|
4197
4304
|
##### `function listProtocolMappers(filter)`
|
|
4198
4305
|
The method retrieves all protocol mappers associated with a specific client scope in a realm.
|
|
4199
4306
|
Protocol mappers define how user attributes, roles, or other data are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
4307
|
+
|
|
4200
4308
|
**` -- @parameters -- `**
|
|
4201
4309
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4202
4310
|
- id: [required] The ID of the client scope to list protocol mappers from.
|
|
@@ -4219,6 +4327,7 @@ console.log("Protocol mappers for client scope:", mappers);
|
|
|
4219
4327
|
The method adds multiple protocol mappers to a specific client scope in a realm.
|
|
4220
4328
|
Protocol mappers define how user attributes, roles, or other data are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
4221
4329
|
With this method, you can configure several mappers in a single request.
|
|
4330
|
+
|
|
4222
4331
|
**` -- @parameters -- `**
|
|
4223
4332
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4224
4333
|
- id: [required] The ID of the client scope where the protocol mappers should be added.
|
|
@@ -4351,6 +4460,7 @@ console.log("Protocol mapper updated successfully");
|
|
|
4351
4460
|
The method retrieves all scope mappings for a given client scope in a realm.
|
|
4352
4461
|
Scope mappings define which roles (from realm roles or client roles) are granted to a client scope.
|
|
4353
4462
|
These roles determine the permissions and access tokens issued for clients using this scope.
|
|
4463
|
+
|
|
4354
4464
|
**` -- @parameters -- `**
|
|
4355
4465
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4356
4466
|
- id: [required] The ID of the client scope to list scope mapping.
|
|
@@ -4690,6 +4800,7 @@ The method is used to create a new Identity Provider (IdP) in a Keycloak realm.
|
|
|
4690
4800
|
An IdP allows users to authenticate via external providers such as Google, Facebook, GitHub,
|
|
4691
4801
|
or another SAML/OIDC provider.
|
|
4692
4802
|
This method requires specifying an alias, the provider type, and configuration settings such as client ID, client secret, and any other provider-specific options.
|
|
4803
|
+
|
|
4693
4804
|
**` -- @parameters -- `**
|
|
4694
4805
|
- identityProvidersRappresentation: parameter provided as a JSON object containing the configuration of the Identity Provider
|
|
4695
4806
|
- alias: [required] Unique name for the IdP within the realm.
|
|
@@ -4725,6 +4836,7 @@ console.log("Created Identity Provider:", newIdP);
|
|
|
4725
4836
|
##### `function identityProviders.createMapper(mapperParams)`
|
|
4726
4837
|
The method creates a new mapper for an existing Identity Provider in the current realm.
|
|
4727
4838
|
The mapper defines how attributes, roles, or claims from the Identity Provider are mapped to the Keycloak user model.
|
|
4839
|
+
|
|
4728
4840
|
**` -- @parameters -- `**
|
|
4729
4841
|
- mapperParams: parameter provided as a JSON object containing the fields to create a new mapper
|
|
4730
4842
|
- alias: [required] The alias of the Identity Provider to which the mapper will be attached.
|
|
@@ -4752,6 +4864,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
4752
4864
|
##### `function identityProviders.findMappers(filter)`
|
|
4753
4865
|
The method retrieves all mappers associated with a specific Identity Provider in the current realm.
|
|
4754
4866
|
These mappers define how attributes, roles, or claims from the external Identity Provider are mapped to the Keycloak user model.
|
|
4867
|
+
|
|
4755
4868
|
**` -- @parameters -- `**
|
|
4756
4869
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4757
4870
|
- alias: [required] TThe alias of the Identity Provider whose mappers you want to fetch.
|
|
@@ -4772,6 +4885,7 @@ console.log(mappers);
|
|
|
4772
4885
|
##### `function identityProviders.delMapper(filter)`
|
|
4773
4886
|
The method deletes a specific mapper associated with an Identity Provider in the current realm.
|
|
4774
4887
|
This is useful when you need to remove a mapping rule that translates attributes, roles, or claims from the external Identity Provider into Keycloak.
|
|
4888
|
+
|
|
4775
4889
|
**` -- @parameters -- `**
|
|
4776
4890
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4777
4891
|
- alias: [required] The alias of the Identity Provider that owns the mapper.
|
|
@@ -4792,6 +4906,7 @@ console.log("Mapper deleted successfully");
|
|
|
4792
4906
|
##### `function identityProviders.findOneMapper(filter)`
|
|
4793
4907
|
The method retrieves the details of a specific mapper associated with an Identity Provider in the current realm.
|
|
4794
4908
|
This allows you to inspect a mapper’s configuration, such as how attributes or claims from the external Identity Provider are mapped into Keycloak.
|
|
4909
|
+
|
|
4795
4910
|
**` -- @parameters -- `**
|
|
4796
4911
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4797
4912
|
- alias: [required] The alias of the Identity Provider.
|
|
@@ -4812,6 +4927,7 @@ console.log("Mapper details:", mapper);
|
|
|
4812
4927
|
The method removes an Identity Provider from the current realm.
|
|
4813
4928
|
This action deletes the provider configuration, including all its associated mappers and settings.
|
|
4814
4929
|
After deletion, users will no longer be able to authenticate using that Identity Provider.
|
|
4930
|
+
|
|
4815
4931
|
**` -- @parameters -- `**
|
|
4816
4932
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4817
4933
|
- alias: [required] The alias of the Identity Provider you want to delete.
|
|
@@ -4829,6 +4945,7 @@ console.log(`Identity Provider deleted successfully`);
|
|
|
4829
4945
|
##### `function identityProviders.findOne(filter)`
|
|
4830
4946
|
The method retrieves the configuration details of a specific Identity Provider in the current realm.
|
|
4831
4947
|
It is useful when you need to inspect the provider’s settings, such as its alias, display name, authentication flow, or other configuration parameters.
|
|
4948
|
+
|
|
4832
4949
|
**` -- @parameters -- `**
|
|
4833
4950
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4834
4951
|
- alias: [required] The alias of the Identity Provider you want to find.
|
|
@@ -4866,6 +4983,7 @@ providers.forEach((provider) => {
|
|
|
4866
4983
|
##### `function identityProviders.update(filter,identityProviderRepresentation)`
|
|
4867
4984
|
The method updates the configuration of a specific Identity Provider in the current realm.
|
|
4868
4985
|
It allows you to modify settings such as client ID, secret, authorization URLs, or any custom configuration fields exposed by the provider.
|
|
4986
|
+
|
|
4869
4987
|
**` -- @parameters -- `**
|
|
4870
4988
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4871
4989
|
- alias: [required] The alias of the Identity Provider to update.
|
|
@@ -4892,6 +5010,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
4892
5010
|
The method retrieves information about a specific Identity Provider factory available in Keycloak.
|
|
4893
5011
|
A factory represents a provider type (e.g., "oidc", "saml", "github") and contains metadata about how that provider can be configured.
|
|
4894
5012
|
This is useful when you want to check what configuration options are supported before creating or updating an Identity Provider.
|
|
5013
|
+
|
|
4895
5014
|
**` -- @parameters -- `**
|
|
4896
5015
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4897
5016
|
- providerId: [required] The ID of the Identity Provider factory to look up (e.g., "oidc", "saml", "google").
|
|
@@ -4912,6 +5031,7 @@ console.log("Factory details:", factory);
|
|
|
4912
5031
|
The method retrieves all mappers associated with a specific Identity Provider in Keycloak.
|
|
4913
5032
|
Mappers define how information from the external Identity Provider (e.g., Google, SAML, GitHub) is mapped into Keycloak attributes, roles, or claims.
|
|
4914
5033
|
This is useful to list all transformations and mappings applied to users authenticating via that provider.
|
|
5034
|
+
|
|
4915
5035
|
**` -- @parameters -- `**
|
|
4916
5036
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4917
5037
|
- alias: [required] The alias of the Identity Provider (set when the provider was created).
|
|
@@ -4929,6 +5049,7 @@ console.log("Mappers for Google IdP:", mappers);
|
|
|
4929
5049
|
##### `function identityProviders.findOneMapper(filter)`
|
|
4930
5050
|
The method retrieves a single mapper associated with a specific Identity Provider in Keycloak.
|
|
4931
5051
|
It’s useful when you need to inspect the configuration of a mapper before updating or deleting it.
|
|
5052
|
+
|
|
4932
5053
|
**` -- @parameters -- `**
|
|
4933
5054
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4934
5055
|
- alias: [required] The alias of the Identity Provider.
|
|
@@ -4953,6 +5074,7 @@ if (mapper) {
|
|
|
4953
5074
|
The method updates an existing mapper for a given Identity Provider in Keycloak.
|
|
4954
5075
|
Mappers define how attributes, roles, or claims from an external Identity Provider (e.g., Google, GitHub, SAML) are mapped into Keycloak user attributes or tokens.
|
|
4955
5076
|
This method allows you to change the configuration of an existing mapper (e.g., modify the claim name, attribute name, or role assignment).
|
|
5077
|
+
|
|
4956
5078
|
**` -- @parameters -- `**
|
|
4957
5079
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4958
5080
|
- alias: [required] The alias of the Identity Provider (set during IdP creation).
|
|
@@ -4991,6 +5113,7 @@ console.log("Mapper updated successfully!");
|
|
|
4991
5113
|
##### `function identityProviders.importFromUrl(filter)`
|
|
4992
5114
|
The method lets you import an Identity Provider configuration directly from a metadata URL (e.g., OIDC discovery document or SAML metadata XML).
|
|
4993
5115
|
This saves you from manually entering configuration details, since Keycloak can auto-fill them from the provided URL.
|
|
5116
|
+
|
|
4994
5117
|
**` -- @parameters -- `**
|
|
4995
5118
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4996
5119
|
- fromUrl : [required] The URL of the IdP metadata (OIDC discovery endpoint or SAML metadata).
|
|
@@ -5014,6 +5137,7 @@ console.log("Imported IdP:", importedIdp);
|
|
|
5014
5137
|
##### `function identityProviders.updatePermission(filter,permissionRepresentation)`
|
|
5015
5138
|
The method allows you to enable or disable fine-grained admin permissions for a specific Identity Provider in Keycloak.
|
|
5016
5139
|
When enabled, Keycloak creates client roles (scopes) that let you define which users or groups can view or manage the Identity Provider.
|
|
5140
|
+
|
|
5017
5141
|
**` -- @parameters -- `**
|
|
5018
5142
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5019
5143
|
- alias: [required] The alias of the Identity Provider.
|
|
@@ -5036,6 +5160,7 @@ console.log("Updated permission:", updatedPermissions);
|
|
|
5036
5160
|
##### `function identityProviders.listPermissions(filter)`
|
|
5037
5161
|
The method retrieves the current fine-grained permission settings for a specific Identity Provider in Keycloak.
|
|
5038
5162
|
It returns whether permissions are enabled and, if so, which scope roles are associated with managing and viewing the Identity Provider.
|
|
5163
|
+
|
|
5039
5164
|
**` -- @parameters -- `**
|
|
5040
5165
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5041
5166
|
- alias: [required] The alias of the Identity Provider.
|
|
@@ -5062,6 +5187,7 @@ Groups help organize users and assign permissions in a scalable way
|
|
|
5062
5187
|
#### `entity groups functions`
|
|
5063
5188
|
##### `function create(groupRappresentation)`
|
|
5064
5189
|
Create a new group in the current realme
|
|
5190
|
+
|
|
5065
5191
|
**` -- @parameters -- `**
|
|
5066
5192
|
- groupRepresentation:An object representing the new state of the group. You can update properties such as:
|
|
5067
5193
|
- name: [optional] New name of the group
|
|
@@ -5082,6 +5208,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5082
5208
|
find method is used to retrieve a list of groups in a specific realm.
|
|
5083
5209
|
It supports optional filtering parameters.
|
|
5084
5210
|
Searching by attributes is only available from Keycloak > 15
|
|
5211
|
+
|
|
5085
5212
|
**` -- @parameters -- `**
|
|
5086
5213
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5087
5214
|
- {builtin attribute}: To find groips by builtin attributes such as name, id
|
|
@@ -5115,6 +5242,7 @@ else console.log('Group not found');
|
|
|
5115
5242
|
##### `function del(filter)`
|
|
5116
5243
|
Deletes a group from the realm.
|
|
5117
5244
|
Return a promise that resolves when the group is successfully deleted. No content is returned on success.
|
|
5245
|
+
|
|
5118
5246
|
**` -- @parameters -- `**
|
|
5119
5247
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5120
5248
|
- id: The ID of the group to delete.
|
|
@@ -5128,6 +5256,7 @@ const group = await KeycloakManager.groups.del({ id: 'group-id' });
|
|
|
5128
5256
|
##### `function count(filter)`
|
|
5129
5257
|
Retrieves the total number of groups present in the specified realm.
|
|
5130
5258
|
This is useful for pagination, reporting, or general statistics regarding group usage in a Keycloak realm.
|
|
5259
|
+
|
|
5131
5260
|
**` -- @parameters -- `**
|
|
5132
5261
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5133
5262
|
- realm: [optional] The name of the realm. If omitted, the default realm is used.
|
|
@@ -5149,6 +5278,7 @@ console.log('Total cool-group groups:', result.count);
|
|
|
5149
5278
|
##### `function update(filter,groupRepresentation)`
|
|
5150
5279
|
Updates an existing group’s information in a Keycloak realm.
|
|
5151
5280
|
You can modify the group’s name, attributes, or hierarchy by providing the group ID and the updated data.
|
|
5281
|
+
|
|
5152
5282
|
**` -- @parameters -- `**
|
|
5153
5283
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5154
5284
|
- id: [required] The unique ID of the group you want to update.
|
|
@@ -5173,6 +5303,7 @@ await KeycloakManager.groups.update(
|
|
|
5173
5303
|
##### `function listSubGroups(filter)`
|
|
5174
5304
|
Retrieves a paginated list of direct subgroups for a specified parent group.
|
|
5175
5305
|
This method is useful when navigating hierarchical group structures within a Keycloak realm.
|
|
5306
|
+
|
|
5176
5307
|
**` -- @parameters -- `**
|
|
5177
5308
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5178
5309
|
- parentId: [required] ID of the parent group whose subgroups you want to list.
|
|
@@ -5196,6 +5327,7 @@ await KeycloakManager.groups.listSubGroups({
|
|
|
5196
5327
|
##### `function addRealmRoleMappings(role_mapping)`
|
|
5197
5328
|
Adds one or more realm-level roles to a specific group.
|
|
5198
5329
|
This operation grants all users within that group the associated realm roles, effectively assigning permissions at a group level.
|
|
5330
|
+
|
|
5199
5331
|
**` -- @parameters -- `**
|
|
5200
5332
|
- role_mapping: parameter provided as a JSON object that accepts the following parameters:
|
|
5201
5333
|
- id: [required] The ID of the group to which roles will be added.
|
|
@@ -5219,6 +5351,7 @@ await KeycloakManager.groups.addRealmRoleMappings({
|
|
|
5219
5351
|
##### `function listAvailableRealmRoleMappings(filters)`
|
|
5220
5352
|
Retrieves all available realm-level roles that can be assigned to a specific group but are not yet assigned.
|
|
5221
5353
|
This helps in identifying which roles are still eligible for addition to the group.
|
|
5354
|
+
|
|
5222
5355
|
**` -- @parameters -- `**
|
|
5223
5356
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5224
5357
|
- id: [required] The ID of the group you want to inspect.
|
|
@@ -5238,6 +5371,7 @@ console.log('Available realm roles for group:', availableRoles);
|
|
|
5238
5371
|
##### `function listRoleMappings(filters)`
|
|
5239
5372
|
Retrieves all role mappings for a specific group, including both realm roles and client roles.
|
|
5240
5373
|
This method is useful for understanding the complete set of roles that are assigned to a group.
|
|
5374
|
+
|
|
5241
5375
|
**` -- @parameters -- `**
|
|
5242
5376
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5243
5377
|
- id: [required] The ID of the group whose roles to fetch
|
|
@@ -5260,6 +5394,7 @@ console.log('Client roles:', roleMappings.clientMappings);
|
|
|
5260
5394
|
##### `function listRealmRoleMappings(filters)`
|
|
5261
5395
|
Returns the list of realm-level roles that are directly assigned to a specific group.
|
|
5262
5396
|
These roles are defined at the realm level and are not tied to any specific client.
|
|
5397
|
+
|
|
5263
5398
|
**` -- @parameters -- `**
|
|
5264
5399
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5265
5400
|
- id: [required] TThe ID of the group to retrieve roles for
|
|
@@ -5279,6 +5414,7 @@ console.log('Realm roles assigned to group:', realmRoles.map(role => role.name))
|
|
|
5279
5414
|
##### `function listCompositeRealmRoleMappings(filters)`
|
|
5280
5415
|
Retrieves all composite realm-level roles assigned to a group.
|
|
5281
5416
|
This includes both directly assigned roles and those inherited through composite roles.
|
|
5417
|
+
|
|
5282
5418
|
**` -- @parameters -- `**
|
|
5283
5419
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5284
5420
|
- id: [required] TThe ID of the group to retrieve roles for
|
|
@@ -5299,6 +5435,7 @@ console.log('All (composite) realm roles for group:', compositeRealmRoles.map(ro
|
|
|
5299
5435
|
Removes one or more realm-level roles from a group's role mappings.
|
|
5300
5436
|
This operation only affects roles that are directly assigned.
|
|
5301
5437
|
Composite roles inherited indirectly will not be removed.
|
|
5438
|
+
|
|
5302
5439
|
**` -- @parameters -- `**
|
|
5303
5440
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5304
5441
|
- id: [required] TThe ID of the group to retrieve roles for
|
|
@@ -5321,6 +5458,7 @@ await KeycloakManager.groups.delRealmRoleMappings({
|
|
|
5321
5458
|
##### `function addClientRoleMappings(filters)`
|
|
5322
5459
|
Assigns one or more client-level roles to a specific group.
|
|
5323
5460
|
This allows all users belonging to that group to inherit the specified roles for a given client.
|
|
5461
|
+
|
|
5324
5462
|
**` -- @parameters -- `**
|
|
5325
5463
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5326
5464
|
- id: [required] The ID of the group
|
|
@@ -5345,6 +5483,7 @@ await KeycloakManager.groups.addClientRoleMappings({
|
|
|
5345
5483
|
##### `function listAvailableClientRoleMappings(filters)`
|
|
5346
5484
|
Retrieves the list of client roles that are available to be assigned to a specific group but are not currently mapped.
|
|
5347
5485
|
This is useful when you want to show assignable roles for a group in a specific client context.
|
|
5486
|
+
|
|
5348
5487
|
**` -- @parameters -- `**
|
|
5349
5488
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5350
5489
|
- id: [required] The ID of the group
|
|
@@ -5364,6 +5503,7 @@ console.log('Available roles:', availableRoles);
|
|
|
5364
5503
|
##### `function listClientRoleMappings(filters)`
|
|
5365
5504
|
Retrieves the list of client roles that are currently assigned (mapped) to a specific group for a given client.
|
|
5366
5505
|
This allows you to see which roles from a client the group already has.
|
|
5506
|
+
|
|
5367
5507
|
**` -- @parameters -- `**
|
|
5368
5508
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5369
5509
|
- id: [required] The ID of the group
|
|
@@ -5383,6 +5523,7 @@ console.log('Assigned client roles:', availableRoles);
|
|
|
5383
5523
|
##### `function listCompositeClientRoleMappings(filters)`
|
|
5384
5524
|
Retrieves the list of composite client roles assigned to a specific group.
|
|
5385
5525
|
Composite roles are roles that aggregate other roles, so this method returns client roles that include one or more roles grouped under a composite role assigned to the group.
|
|
5526
|
+
|
|
5386
5527
|
**` -- @parameters -- `**
|
|
5387
5528
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5388
5529
|
- id: [required] The ID of the group
|
|
@@ -5402,6 +5543,7 @@ console.log('Composite client roles assigned to group:', compositeClientRoles);
|
|
|
5402
5543
|
##### `function delClientRoleMappings(filters)`
|
|
5403
5544
|
Removes specific client role mappings from a group.
|
|
5404
5545
|
This function deletes one or more client roles that were assigned to the group, effectively revoking those client roles from the group.
|
|
5546
|
+
|
|
5405
5547
|
**` -- @parameters -- `**
|
|
5406
5548
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5407
5549
|
- id: [required] The ID of the group
|
|
@@ -5445,6 +5587,7 @@ allowing you to group multiple permissions into a single, higher-level role.
|
|
|
5445
5587
|
A composite role can include roles from the same realm as well
|
|
5446
5588
|
as roles from different clients.
|
|
5447
5589
|
When you assign a composite role to a user, they automatically inherit all the roles it contains.
|
|
5590
|
+
|
|
5448
5591
|
**` -- @parameters -- `**
|
|
5449
5592
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5450
5593
|
- roleId: [required] The id of the role to which composite roles will be added.
|
|
@@ -5478,6 +5621,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5478
5621
|
```
|
|
5479
5622
|
##### `function findOneByName(filters)`
|
|
5480
5623
|
Get a role by name
|
|
5624
|
+
|
|
5481
5625
|
**` -- @parameters -- `**
|
|
5482
5626
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5483
5627
|
- name (string, required) — The exact name of the role to retrieve.
|
|
@@ -5490,6 +5634,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5490
5634
|
|
|
5491
5635
|
##### `function findOneById(filters)`
|
|
5492
5636
|
Get a role by its Id
|
|
5637
|
+
|
|
5493
5638
|
**` -- @parameters -- `**
|
|
5494
5639
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5495
5640
|
- Id (string, required) — The Id of the role to retrieve.
|
|
@@ -5502,6 +5647,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5502
5647
|
|
|
5503
5648
|
##### `function updateByName(filters,role_dictionary)`
|
|
5504
5649
|
Update a role by its name
|
|
5650
|
+
|
|
5505
5651
|
**` -- @parameters -- `**
|
|
5506
5652
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5507
5653
|
- name (string, required) — The exact name of the role to retrieve.
|
|
@@ -5515,6 +5661,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5515
5661
|
|
|
5516
5662
|
##### `function updateById(filters,role_dictionary)`
|
|
5517
5663
|
Update a role by its Id
|
|
5664
|
+
|
|
5518
5665
|
**` -- @parameters -- `**
|
|
5519
5666
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5520
5667
|
- name (string, required) — The exact name of the role to retrieve.
|
|
@@ -5528,6 +5675,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5528
5675
|
|
|
5529
5676
|
##### `function delByName(filters)`
|
|
5530
5677
|
Delete a role by its name
|
|
5678
|
+
|
|
5531
5679
|
**` -- @parameters -- `**
|
|
5532
5680
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5533
5681
|
- name (string, required) — The exact name of the role to retrieve.
|
|
@@ -5570,6 +5718,7 @@ that have been added to the composite role. It requires the roleId of the target
|
|
|
5570
5718
|
parameter and returns an array of RoleRepresentation objects. If the role is not composite
|
|
5571
5719
|
or has no associated realm roles, the result will be an empty array. This method is useful
|
|
5572
5720
|
for understanding and managing hierarchical role structures within a realm in Keycloak.
|
|
5721
|
+
|
|
5573
5722
|
**` -- @parameters -- `**
|
|
5574
5723
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5575
5724
|
- roleId: (string, required) — The Id of the role to retrieve.
|
|
@@ -5589,6 +5738,7 @@ are part of the composite role. It requires the roleId of the composite role
|
|
|
5589
5738
|
and the clientId of the client whose roles you want to retrieve. The function returns an array of
|
|
5590
5739
|
RoleRepresentation objects representing the client roles included in the composite.
|
|
5591
5740
|
This helps manage and inspect client-specific role hierarchies within the composite role structure in Keycloak.
|
|
5741
|
+
|
|
5592
5742
|
**` -- @parameters -- `**
|
|
5593
5743
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5594
5744
|
- roleId: (string, required) — The Id of the role to retrieve
|
package/index.js
CHANGED
|
@@ -113,9 +113,6 @@ exports.auth=async function(credentials){
|
|
|
113
113
|
headers: {'content-type': 'application/www-form-urlencoded', 'Authorization': "Bearer " + kcAdminClient.accessToken },
|
|
114
114
|
form: credentials
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
116
|
return new Promise((resolve, reject) => {
|
|
120
117
|
request.post(options, function (error, response, body) {
|
|
121
118
|
if (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keycloak-api-manager",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Keycloak-api-manager is a lightweight Node.js wrapper for the Keycloak Admin REST API. It provides an easy-to-use functional methods and functions to manage realms, users, roles, clients, groups, and permissions directly from your application code — just like you would from the Keycloak admin console.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|