keycloak-api-manager 3.0.0 β 3.2.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 +7 -2
- package/README.md +245 -0
- package/index.js +1 -4
- 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,9 @@
|
|
|
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="3320000" />
|
|
87
|
+
<workItem from="1762186403063" duration="2616000" />
|
|
83
88
|
</task>
|
|
84
89
|
<servers />
|
|
85
90
|
</component>
|
package/README.md
CHANGED
|
@@ -200,6 +200,101 @@ Parameters:
|
|
|
200
200
|
- refreshToken: [Optional] string containing a valid refresh token to request a new access token when using the refresh_token grant type.
|
|
201
201
|
---
|
|
202
202
|
|
|
203
|
+
## π§° Available Helper Functions
|
|
204
|
+
|
|
205
|
+
### `function setConfig(config)`
|
|
206
|
+
This function updates the runtime configuration of the Keycloak-api-manager Admin Client instance.
|
|
207
|
+
It allows switching the target realm, base URL, or HTTP request options without reinitializing the client or re-authenticating.
|
|
208
|
+
Itβs useful when you need to interact with multiple realms or environments dynamically using the same admin client instance.
|
|
209
|
+
|
|
210
|
+
**` -- @parameters -- `**
|
|
211
|
+
- config: is a JSON object that accepts the following parameters:
|
|
212
|
+
- realmName: [optional] The name of the target realm for subsequent API requests.
|
|
213
|
+
- baseUrl: [optional] The base URL of the Keycloak server (e.g., https://auth.example.com).
|
|
214
|
+
- requestOptions: [optional] Custom HTTP options (headers, timeout, etc.) applied to API calls.
|
|
215
|
+
- realmPath: [optional] A custom realm path if your Keycloak instance uses a non-standard realm route.
|
|
216
|
+
- other fields
|
|
217
|
+
|
|
218
|
+
**` -- @notes -- `**
|
|
219
|
+
Calling setConfig does not perform authentication
|
|
220
|
+
- it only changes configuration values in memory.
|
|
221
|
+
- The authentication token already stored in the admin client remains active until it expires.
|
|
222
|
+
- Only the properties explicitly passed in the config object are updated; all others remain unchanged.
|
|
223
|
+
|
|
224
|
+
If the authenticated user does not have permissions in the new realmName, subsequent calls may fail with a 403 or 404.
|
|
225
|
+
|
|
226
|
+
Typically used in multi-realm or multi-environment management scripts.
|
|
227
|
+
|
|
228
|
+
```js
|
|
229
|
+
const KcAdminClient = require('keycloak-api-manager');
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
// Switch context to another realm dynamically
|
|
233
|
+
kcAdminClient.setConfig({
|
|
234
|
+
realmName: 'customer-realm',
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// All subsequent API calls will target "customer-realm"
|
|
238
|
+
const users = await kcAdminClient.users.find();
|
|
239
|
+
console.log(users);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### `function getToken()`
|
|
243
|
+
This function retrieves the current authentication tokens used by the Keycloak-api-manager Admin Client to communicate with the Keycloak REST API.
|
|
244
|
+
It returns both the access token (used for API authorization) and the refresh token (used to renew the session when the access token expires).
|
|
245
|
+
|
|
246
|
+
**` -- @returns -- `**
|
|
247
|
+
A JSON object containing:
|
|
248
|
+
- accessToken: The active access token string currently held by the Keycloak Admin Client.
|
|
249
|
+
- refreshToken: The corresponding refresh token string, if available, used to request a new access token without re-authentication.
|
|
250
|
+
|
|
251
|
+
**` -- @notes -- `**
|
|
252
|
+
The tokens are managed internally by the Keycloak Admin Client after successful authentication via kcAdminClient.auth().
|
|
253
|
+
The accessToken typically expires after a short period (e.g., 60 seconds by default).
|
|
254
|
+
You can use these tokens to call Keycloak REST endpoints manually or to debug authorization issues.
|
|
255
|
+
If the client is not authenticated or the session has expired, both values may be undefined.
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
const KcAdminClient = require('keycloak-api-manager');
|
|
259
|
+
|
|
260
|
+
// Example: retrieve and print current tokens
|
|
261
|
+
try {
|
|
262
|
+
const tokens = KcAdminClient.getToken();
|
|
263
|
+
console.log('Access Token:', tokens.accessToken);
|
|
264
|
+
console.log('Refresh Token:', tokens.refreshToken);
|
|
265
|
+
} catch (error) {
|
|
266
|
+
console.error('Failed to retrieve tokens:', error);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
### `function auth(credentials)`
|
|
271
|
+
This function allows a user or client to authenticate against a Keycloak realm and obtain an access token (and optionally a refresh token).
|
|
272
|
+
It sends a direct HTTP POST request to the Keycloak OpenID Connect token endpoint using the provided credentials.
|
|
273
|
+
|
|
274
|
+
**` -- @parameters -- `**
|
|
275
|
+
credentials: a JSON object containing authentication details. Supported fields include:
|
|
276
|
+
- username: [optional] Username of the user (required for password grant).
|
|
277
|
+
- password: [optional] Password of the user (required for password grant).
|
|
278
|
+
- grant_type: [required] The OAuth2 grant type (e.g. "password", "client_credentials", "refresh_token").
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
```js
|
|
282
|
+
const KeycloakManager = require('keycloak-api-manager');
|
|
283
|
+
|
|
284
|
+
// Example: authenticate a user via password grant
|
|
285
|
+
try {
|
|
286
|
+
const tokenResponse = await KeycloakManager.auth({
|
|
287
|
+
username: "demo",
|
|
288
|
+
password: "demo123",
|
|
289
|
+
grant_type: "password",
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
console.log("Access Token:", tokenResponse.access_token);
|
|
293
|
+
} catch (error) {
|
|
294
|
+
console.error("Authentication failed:", error);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
```
|
|
203
298
|
|
|
204
299
|
## π§ Available Admin Functions
|
|
205
300
|
All administrative functions that rely on Keycloak's Admin API must be invoked using the
|
|
@@ -226,6 +321,7 @@ each realm manages its own set of users, roles, groups, and clients independentl
|
|
|
226
321
|
##### `function create(realm-dictionary)`
|
|
227
322
|
create is a method used to create a new realm.
|
|
228
323
|
This method accepts a realm representation object containing details such as is, name
|
|
324
|
+
|
|
229
325
|
**` -- @parameters -- `**
|
|
230
326
|
- realm-dictionary: is a JSON object that accepts filter parameters
|
|
231
327
|
- id:[required] The internal ID of the realm. If omitted, Keycloak uses the realm name as the ID.
|
|
@@ -244,6 +340,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
244
340
|
##### `function update(filter,realm-dictionary)`
|
|
245
341
|
Updates the configuration of an existing realm.
|
|
246
342
|
You can use this method to modify settings such as login behavior, themes, token lifespans, and more.
|
|
343
|
+
|
|
247
344
|
**` -- @parameters -- `**
|
|
248
345
|
- filter:is a JSON object that accepts filter parameters
|
|
249
346
|
- realm:[required] The identifier of the realm you want to update.
|
|
@@ -265,6 +362,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
265
362
|
##### `function del(filter)`
|
|
266
363
|
Deletes a specific realm from the Keycloak server.
|
|
267
364
|
This operation is irreversible and removes all users, clients, roles, groups, and settings associated with the realm.
|
|
365
|
+
|
|
268
366
|
**` -- @parameters -- `**
|
|
269
367
|
- filter: is a JSON object that accepts filter parameters
|
|
270
368
|
- realm:[required] The name of the realm to delete.
|
|
@@ -291,6 +389,7 @@ console.log("Retrieved realms:",realms);
|
|
|
291
389
|
##### `function findOne(filter)`
|
|
292
390
|
Retrieves the full configuration and metadata of a specific realm by its name (realm ID).
|
|
293
391
|
This includes settings like login policies, themes, password policies, etc.
|
|
392
|
+
|
|
294
393
|
**` -- @parameters -- `**
|
|
295
394
|
- filter: is a JSON object that accepts filter parameters
|
|
296
395
|
- realm:[required] The name (ID) of the realm you want to retrieve.
|
|
@@ -309,6 +408,7 @@ console.log("Retrieved realm:",realmConfig);
|
|
|
309
408
|
Performs a partial import of realm configuration into a Keycloak realm.
|
|
310
409
|
This allows you to import users, roles, groups, clients, and other components without replacing the entire realm.
|
|
311
410
|
Itβs useful for incremental updates or merging configuration pieces.
|
|
411
|
+
|
|
312
412
|
**` -- @parameters -- `**
|
|
313
413
|
- configuration: is a JSON object that accepts filter parameters
|
|
314
414
|
- realm:[required] The name of the realm where the data should be imported.
|
|
@@ -346,6 +446,7 @@ const result = await KeycloakManager.realms.partialImport({
|
|
|
346
446
|
##### `function export(configuration)`
|
|
347
447
|
Exports the configuration of a specific realm.
|
|
348
448
|
This method returns the full realm representation in JSON format, including roles, users, clients, groups, and other components depending on the provided options.
|
|
449
|
+
|
|
349
450
|
**` -- @parameters -- `**
|
|
350
451
|
- configuration: is a JSON object that accepts filter parameters
|
|
351
452
|
- realm:[required] The name of the realm to export.
|
|
@@ -368,6 +469,7 @@ console.log(JSON.stringify(exportedRealm, null, 2));
|
|
|
368
469
|
##### `function getClientRegistrationPolicyProviders(configuration)`
|
|
369
470
|
Fetches the list of available client registration policy providers for the specified realm.
|
|
370
471
|
These providers define how new clients can be registered and what rules or validations apply (e.g., allowed scopes, required attributes).
|
|
472
|
+
|
|
371
473
|
**` -- @parameters -- `**
|
|
372
474
|
- configuration: is a JSON object that accepts filter parameters
|
|
373
475
|
- realm:[required] The name of the realm where you want to list client registration policy providers.
|
|
@@ -385,6 +487,7 @@ await KeycloakManager.realms.getClientRegistrationPolicyProviders({
|
|
|
385
487
|
##### `function createClientsInitialAccess(realmFilter,options)`
|
|
386
488
|
Creates a new Initial Access Token for dynamic client registration.
|
|
387
489
|
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.
|
|
490
|
+
|
|
388
491
|
**` -- @parameters -- `**
|
|
389
492
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
390
493
|
- realm:[required] The name of the realm where the initial access token should be created.
|
|
@@ -414,6 +517,7 @@ console.log("Initial Access Token:", initialAccess.token);
|
|
|
414
517
|
##### `function getClientsInitialAccess(realmFilter)`
|
|
415
518
|
Retrieves all existing Initial Access Tokens for dynamic client registration in a given realm.
|
|
416
519
|
These tokens are used to allow programmatic or automated registration of clients via the Dynamic Client Registration API.
|
|
520
|
+
|
|
417
521
|
**` -- @parameters -- `**
|
|
418
522
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
419
523
|
- realm:[required] The name of the realm from which to list all initial access tokens.
|
|
@@ -437,6 +541,7 @@ console.log("Initial Access Tokens:", tokens);
|
|
|
437
541
|
##### `function delClientsInitialAccess(realmFilter)`
|
|
438
542
|
Deletes a specific Initial Access Token used for dynamic client registration in a given realm.
|
|
439
543
|
This revokes the token, preventing any future use.
|
|
544
|
+
|
|
440
545
|
**` -- @parameters -- `**
|
|
441
546
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
442
547
|
- realm:[required] The name of the realm where the token was created.
|
|
@@ -454,6 +559,7 @@ await KeycloakManager.realms.delClientsInitialAccess({
|
|
|
454
559
|
##### `function addDefaultGroup(realmFilter)`
|
|
455
560
|
Adds an existing group to the list of default groups for a given realm.
|
|
456
561
|
Users created in this realm will automatically be added to all default groups.
|
|
562
|
+
|
|
457
563
|
**` -- @parameters -- `**
|
|
458
564
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
459
565
|
- realm:[required] The name of the realm where the default group will be set.
|
|
@@ -470,6 +576,7 @@ await KeycloakManager.realms.addDefaultGroup({
|
|
|
470
576
|
##### `function removeDefaultGroup(realmFilter)`
|
|
471
577
|
Removes a group from the list of default groups in a realm.
|
|
472
578
|
Default groups are automatically assigned to new users when they are created.
|
|
579
|
+
|
|
473
580
|
**` -- @parameters -- `**
|
|
474
581
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
475
582
|
- realm:[required] The name of the realm from which to remove the default group.
|
|
@@ -487,6 +594,7 @@ await KeycloakManager.realms.removeDefaultGroup({
|
|
|
487
594
|
##### `function getDefaultGroups(realmFilter)`
|
|
488
595
|
Retrieves a list of all default groups for a specified realm.
|
|
489
596
|
These are the groups that new users will automatically be added to upon creation.
|
|
597
|
+
|
|
490
598
|
**` -- @parameters -- `**
|
|
491
599
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
492
600
|
- realm:[required] The name of the realm from which to retrieve default groups.
|
|
@@ -504,6 +612,7 @@ console.log(defaultGroups);
|
|
|
504
612
|
##### `function getGroupByPath(realmFilter)`
|
|
505
613
|
Retrieves a group object by specifying its hierarchical path in a realm.
|
|
506
614
|
This is useful when you know the groupβs full path (e.g., /parent/child) but not its ID.
|
|
615
|
+
|
|
507
616
|
**` -- @parameters -- `**
|
|
508
617
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
509
618
|
- realm:[required] The name of the realm where the group is located.
|
|
@@ -526,6 +635,7 @@ console.log(defaultGroups);
|
|
|
526
635
|
Retrieves the event configuration settings for a specific realm.
|
|
527
636
|
This includes settings related to the event listeners, enabled event types, admin events, and more.
|
|
528
637
|
Useful for auditing and tracking activities inside Keycloak.
|
|
638
|
+
|
|
529
639
|
**` -- @parameters -- `**
|
|
530
640
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
531
641
|
- realm:[required] The name of the realm from which to retrieve the event configuration.
|
|
@@ -553,6 +663,7 @@ console.log(config);
|
|
|
553
663
|
Updates the event configuration for a given realm.
|
|
554
664
|
This includes enabling/disabling events, setting specific event types to track,
|
|
555
665
|
enabling admin event logging, and choosing which event listeners to use.
|
|
666
|
+
|
|
556
667
|
**` -- @parameters -- `**
|
|
557
668
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
558
669
|
- realm:[required] The name of the realm where the configuration will be updated.
|
|
@@ -582,6 +693,7 @@ const config= await KeycloakManager.realms.updateConfigEvents(
|
|
|
582
693
|
Retrieves a list of events that occurred in a specified realm.
|
|
583
694
|
You can filter the results by event type, user, date range, and other criteria.
|
|
584
695
|
Useful for auditing login, logout, and other user-related activities.
|
|
696
|
+
|
|
585
697
|
**` -- @parameters -- `**
|
|
586
698
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
587
699
|
- realm: [required] The name of the realm to fetch events from.
|
|
@@ -609,6 +721,7 @@ const config= await KeycloakManager.realms.findEvents({
|
|
|
609
721
|
Retrieves administrative events that occurred in a specific realm.
|
|
610
722
|
Admin events are triggered by actions such as creating users, updating roles, or modifying realm settings.
|
|
611
723
|
This is useful for auditing changes made via the admin API or admin console.
|
|
724
|
+
|
|
612
725
|
**` -- @parameters -- `**
|
|
613
726
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
614
727
|
- realm: [required] The name of the realm to retrieve admin events from.
|
|
@@ -642,6 +755,7 @@ const config= await KeycloakManager.realms.findAdminEvents({
|
|
|
642
755
|
Deletes all user events (not admin events) from the event store of a specific realm.
|
|
643
756
|
Useful for resetting or cleaning up event logs related to user actions such as logins, logouts, failed login attempts, etc.
|
|
644
757
|
This does not clear administrative events. To remove those, use realms.clearAdminEvents().
|
|
758
|
+
|
|
645
759
|
**` -- @parameters -- `**
|
|
646
760
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
647
761
|
- realm: [required] The name of the realm from which to clear user events.
|
|
@@ -659,6 +773,7 @@ const config= await KeycloakManager.realms.clearEvents({
|
|
|
659
773
|
Deletes all admin events from the event store of a specific realm.
|
|
660
774
|
Admin events include actions such as creating users, updating roles, changing client settings, etc.,
|
|
661
775
|
performed by administrators via the Admin Console or Admin REST API.
|
|
776
|
+
|
|
662
777
|
**` -- @parameters -- `**
|
|
663
778
|
- realmFilter: is a JSON object that accepts filter parameters
|
|
664
779
|
- realm: [required] The name of the realm from which to clear administrative events.
|
|
@@ -711,6 +826,7 @@ console.log(permissions.enabled); // true or false
|
|
|
711
826
|
Enables or disables fine-grained user management permissions in a specified realm.
|
|
712
827
|
This controls whether operations on users (such as creating, editing, or deleting users)
|
|
713
828
|
are protected using Keycloak's authorization services.
|
|
829
|
+
|
|
714
830
|
**` -- @parameters -- `**
|
|
715
831
|
- update-parameters: is a JSON object that accepts this parameters
|
|
716
832
|
- realm: [required] The name of the realm for which you want to update the user management permission settings.
|
|
@@ -747,6 +863,7 @@ console.log(permissions.enabled); // true
|
|
|
747
863
|
##### `function getKeys(filter)`
|
|
748
864
|
Retrieves the realm keys metadata, including public keys, certificates, and active key information
|
|
749
865
|
used for token signing, encryption, and other cryptographic operations in the specified realm.
|
|
866
|
+
|
|
750
867
|
**` -- @parameters -- `**
|
|
751
868
|
- filter: is a JSON object that accepts this parameters
|
|
752
869
|
- realm: [required] The name of the realm for which you want to retrieve key metadata.
|
|
@@ -786,6 +903,7 @@ console.log(Keys);
|
|
|
786
903
|
|
|
787
904
|
##### `function getClientSessionStats(filter)`
|
|
788
905
|
Retrieves statistics about active client sessions in the specified realm. This includes the number of active sessions per client.
|
|
906
|
+
|
|
789
907
|
**` -- @parameters -- `**
|
|
790
908
|
- filter: is a JSON object that accepts this parameters
|
|
791
909
|
- realm: [required] The name of the realm for which you want to retrieve client session statistics.
|
|
@@ -814,6 +932,7 @@ console.log(stats);
|
|
|
814
932
|
##### `function pushRevocation(filter)`
|
|
815
933
|
Immediately pushes a revocation policy to all clients in the specified realm.
|
|
816
934
|
This forces clients to revalidate tokens, effectively revoking cached access tokens and enforcing updated policies.
|
|
935
|
+
|
|
817
936
|
**` -- @parameters -- `**
|
|
818
937
|
- filter: is a JSON object that accepts this parameters
|
|
819
938
|
- realm: [required] The name of the realm where the revocation should be pushed.
|
|
@@ -833,6 +952,7 @@ console.log(pushR);
|
|
|
833
952
|
##### `function logoutAll(filter)`
|
|
834
953
|
Logs out all active sessions for all users in the specified realm.
|
|
835
954
|
This invalidates all user sessions, forcing every user to re-authenticate.
|
|
955
|
+
|
|
836
956
|
**` -- @parameters -- `**
|
|
837
957
|
- filter: is a JSON object that accepts this parameters
|
|
838
958
|
- realm: [required] The name of the realm from which to log out all users.
|
|
@@ -853,6 +973,7 @@ console.log('logout results:',logout);
|
|
|
853
973
|
Tests the connection to an LDAP server using the provided configuration parameters.
|
|
854
974
|
This is useful to verify that Keycloak can reach and authenticate with the LDAP server before
|
|
855
975
|
fully integrating it into the realm configuration.
|
|
976
|
+
|
|
856
977
|
**` -- @parameters -- `**
|
|
857
978
|
- filter: is a JSON object that accepts this filter parameters
|
|
858
979
|
- realm: [required] Name of the realm where the LDAP provider is being tested.
|
|
@@ -894,6 +1015,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
894
1015
|
This function queries the LDAP server configured for a specific realm to retrieve and display its supported capabilities.
|
|
895
1016
|
It helps validate the connection and understand which LDAP features are available,
|
|
896
1017
|
such as supported controls, extensions, authentication mechanisms, and more.
|
|
1018
|
+
|
|
897
1019
|
**` -- @parameters -- `**
|
|
898
1020
|
- filter: is a JSON object that accepts this filter parameters
|
|
899
1021
|
- realm: [required] Name of the realm where the LDAP provider is being tested.
|
|
@@ -935,6 +1057,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
935
1057
|
Tests the SMTP connection using the provided configuration.
|
|
936
1058
|
This allows you to verify that Keycloak can connect and send emails through the configured
|
|
937
1059
|
SMTP server before applying the settings to the realm.
|
|
1060
|
+
|
|
938
1061
|
**` -- @parameters -- `**
|
|
939
1062
|
- filter: is a JSON object that accepts this filter parameters
|
|
940
1063
|
- realm: [required] The name of the realm where the SMTP server will be tested.
|
|
@@ -974,6 +1097,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
974
1097
|
##### `function getRealmLocalizationTexts(filter)`
|
|
975
1098
|
Retrieves all localization texts (custom messages and labels) defined for a specific realm and locale.
|
|
976
1099
|
Localization texts are used to override default Keycloak UI messages for login forms, error pages, and other user-facing content
|
|
1100
|
+
|
|
977
1101
|
**` -- @parameters -- `**
|
|
978
1102
|
- filter: is a JSON object that accepts this filter parameters
|
|
979
1103
|
- realm: [required] The name of the realm from which to fetch localization texts.
|
|
@@ -994,6 +1118,7 @@ console.log(texts);
|
|
|
994
1118
|
##### `function addLocalization(filter,value)`
|
|
995
1119
|
Adds or updates a localization text (custom UI message or label) for a specific realm and locale in Keycloak.
|
|
996
1120
|
This allows you to override default messages in the login screens and other UI components with custom translations.
|
|
1121
|
+
|
|
997
1122
|
**` -- @parameters -- `**
|
|
998
1123
|
- filter: is a JSON object that accepts this filter parameters
|
|
999
1124
|
- realm: [required] The name of the realm where the localization should be applied.
|
|
@@ -1016,6 +1141,7 @@ await KeycloakManager.realms.addLocalization({
|
|
|
1016
1141
|
##### `function getRealmSpecificLocales(filter)`
|
|
1017
1142
|
Retrieves the list of locales (language codes) for which custom localization texts have been defined in a specific realm.
|
|
1018
1143
|
This function is useful to determine which locales have at least one overridden message.
|
|
1144
|
+
|
|
1019
1145
|
**` -- @parameters -- `**
|
|
1020
1146
|
- filter: is a JSON object that accepts this filter parameters
|
|
1021
1147
|
- realm: [required] The name of the realm for which to fetch the list of custom locales.
|
|
@@ -1046,6 +1172,7 @@ console.log(specificLocales.thekey); // new Value String for key:theKey
|
|
|
1046
1172
|
##### `function deleteRealmLocalizationTexts(filter)`
|
|
1047
1173
|
Deletes a specific custom localization text entry for a given locale and key within a realm.
|
|
1048
1174
|
This is useful when you want to remove a previously added or overridden message from the realm's custom localization.
|
|
1175
|
+
|
|
1049
1176
|
**` -- @parameters -- `**
|
|
1050
1177
|
- filter: is a JSON object that accepts this filter parameters
|
|
1051
1178
|
- realm: [required] The name of the realm where the localization entry exists.
|
|
@@ -1078,6 +1205,7 @@ create is a method used to create a new user in the specified realm.
|
|
|
1078
1205
|
This method accepts a user representation object containing details such as username, email, enabled status,
|
|
1079
1206
|
credentials, and other user attributes that can be get by getProfile function.
|
|
1080
1207
|
It is typically used when you want to programmatically add new users to your Keycloak realm via the Admin API.
|
|
1208
|
+
|
|
1081
1209
|
**` -- @parameters -- `**
|
|
1082
1210
|
- userRepresentation: An object containing the user fields to be updated.
|
|
1083
1211
|
```js
|
|
@@ -1098,6 +1226,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1098
1226
|
##### `function del(filter)`
|
|
1099
1227
|
Deletes a user from the specified realm. Once removed, the user and all associated data (such as credentials,
|
|
1100
1228
|
sessions, and group/role memberships) are permanently deleted.
|
|
1229
|
+
|
|
1101
1230
|
**` -- @parameters -- `**
|
|
1102
1231
|
- id: [Required] the user ID to delete
|
|
1103
1232
|
- realm [Optional] the realm name (defaults to current realm)
|
|
@@ -1112,6 +1241,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1112
1241
|
find method is used to retrieve a list of users in a specific realm.
|
|
1113
1242
|
It supports optional filtering parameters such as username, email, first name, last name, and more.
|
|
1114
1243
|
Searching by attributes is only available from Keycloak > 15
|
|
1244
|
+
|
|
1115
1245
|
**` -- @parameters -- `**
|
|
1116
1246
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
1117
1247
|
- q: A string containing a query filter by custom attributes, such as 'username:admin'.
|
|
@@ -1152,6 +1282,7 @@ count method returns the total number of users in a given realm.
|
|
|
1152
1282
|
It optionally accepts filtering parameters similar to those in users.find() such
|
|
1153
1283
|
as username, email, firstName, lastName and so on to count only users that match specific criteria.
|
|
1154
1284
|
Searching by attributes is only available from Keycloak > 15
|
|
1285
|
+
|
|
1155
1286
|
**` -- @parameters -- `**
|
|
1156
1287
|
- filter is a JSON object that accepts filter parameters, such as { email: 'test@keycloak.org' }
|
|
1157
1288
|
```js
|
|
@@ -1170,6 +1301,7 @@ console.log('User found:', user_count);
|
|
|
1170
1301
|
update method is used to update the details of a specific user in a Keycloak realm.
|
|
1171
1302
|
It requires at least the userβs ID(searchParams) and the updated data(userRepresentation).
|
|
1172
1303
|
You can modify fields like firstName, lastName, email, enabled, and more.
|
|
1304
|
+
|
|
1173
1305
|
**` -- @parameters -- `**
|
|
1174
1306
|
- searchParams: is a JSON object that accepts filter parameters
|
|
1175
1307
|
- id: [Required] the user ID to update
|
|
@@ -1189,6 +1321,7 @@ const user_count = await KeycloakManager.users.update({ id: 'user-Id' }, {
|
|
|
1189
1321
|
resetPassword method is used to set a new password for a specific user.
|
|
1190
1322
|
This action replaces the user's existing credentials. You can also set whether the user is required to
|
|
1191
1323
|
change the password on next login.
|
|
1324
|
+
|
|
1192
1325
|
**` -- @parameters -- `**
|
|
1193
1326
|
- newCredentialsParameters: is a JSON object that accepts filter parameters
|
|
1194
1327
|
- id: [Required] the user ID to update
|
|
@@ -1215,6 +1348,7 @@ getCredentials() method retrieves the list of credentials (e.g., passwords, OTPs
|
|
|
1215
1348
|
currently associated with a given user in a specific realm.
|
|
1216
1349
|
This is useful for auditing, checking what types of credentials a user has set up,
|
|
1217
1350
|
or managing credentials such as password reset, WebAuthn deletion, etc.
|
|
1351
|
+
|
|
1218
1352
|
**` -- @parameters -- `**
|
|
1219
1353
|
- getCredentials: is a JSON object that accepts filter parameters
|
|
1220
1354
|
- id: [Required] the user ID to update
|
|
@@ -1230,6 +1364,7 @@ console.log(ressult);
|
|
|
1230
1364
|
##### `function deleteCredential(accountInfo)`
|
|
1231
1365
|
deleteCredential method allows you to delete a specific credential (e.g., password, OTP, WebAuthn, etc.) from a user.
|
|
1232
1366
|
This is useful when you want to invalidate or remove a credential, forcing the user to reconfigure or reset it.
|
|
1367
|
+
|
|
1233
1368
|
**` -- @parameters -- `**
|
|
1234
1369
|
- accountInfo: is a JSON object that accepts this parameters
|
|
1235
1370
|
- id: [Required] the user ID to update
|
|
@@ -1256,6 +1391,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1256
1391
|
|
|
1257
1392
|
##### `function addToGroup(parameters)`
|
|
1258
1393
|
Adds a user to a specific group within the realm.
|
|
1394
|
+
|
|
1259
1395
|
**` -- @parameters -- `**
|
|
1260
1396
|
- parameters: is a JSON object that accepts this parameters
|
|
1261
1397
|
- id [required]: The user ID of the user you want to add to the group.
|
|
@@ -1271,6 +1407,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1271
1407
|
```
|
|
1272
1408
|
##### `function delFromGroup(parameters)`
|
|
1273
1409
|
Removes a user from a specific group in Keycloak.
|
|
1410
|
+
|
|
1274
1411
|
**` -- @parameters -- `**
|
|
1275
1412
|
- parameters: is a JSON object that accepts this parameters
|
|
1276
1413
|
- id [required]: The user ID of the user you want to remove to the group.
|
|
@@ -1287,6 +1424,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
1287
1424
|
|
|
1288
1425
|
##### `function countGroups(filter)`
|
|
1289
1426
|
Retrieves the number of groups that a given user is a member of.
|
|
1427
|
+
|
|
1290
1428
|
**` -- @parameters -- `**
|
|
1291
1429
|
- filter is a JSON object that accepts filter parameters, such as { id: '' }
|
|
1292
1430
|
- id: [required] The user ID of the user whose group membership count you want to retrieve.
|
|
@@ -1300,6 +1438,7 @@ console.log('Groups found:', user_count);
|
|
|
1300
1438
|
```
|
|
1301
1439
|
##### `function listGroups(filter)`
|
|
1302
1440
|
Returns the list of groups that a given user is a member of.
|
|
1441
|
+
|
|
1303
1442
|
**` -- @parameters -- `**
|
|
1304
1443
|
- filter is a JSON object that accepts filter parameters, such as { id: '' }
|
|
1305
1444
|
- id: [required] The user ID of the user whose group membership you want to retrieve.
|
|
@@ -1794,6 +1933,7 @@ Clients represent entities that want to interact with Keycloak for authenticatio
|
|
|
1794
1933
|
|
|
1795
1934
|
##### `function create(client_dictionary)`
|
|
1796
1935
|
Creates a new client with the provided configuration
|
|
1936
|
+
|
|
1797
1937
|
**` -- @parameters -- `**
|
|
1798
1938
|
- client_dictionary: An object(JSON) of type ClientRepresentation, containing the configuration for the new client.
|
|
1799
1939
|
- clientId: [required] string The unique identifier for the client (required).
|
|
@@ -1819,6 +1959,7 @@ console.log("New Client Created:", client);
|
|
|
1819
1959
|
Retrieves a list of all clients in the current realm, optionally filtered by query parameters.
|
|
1820
1960
|
This method is useful for listing all registered applications or services in Keycloak or searching
|
|
1821
1961
|
for a specific one using filters like clientId.
|
|
1962
|
+
|
|
1822
1963
|
**` -- @parameters -- `**
|
|
1823
1964
|
- filter: A JSON structure used to filter results based on specific fields:
|
|
1824
1965
|
- clientId: [optional] string filter to search clients by their clientId.
|
|
@@ -1835,6 +1976,7 @@ console.log("Clients:", clients);
|
|
|
1835
1976
|
##### `function findOne(filter)`
|
|
1836
1977
|
Retrieves detailed information about a specific client within a realm by its unique client ID.
|
|
1837
1978
|
This method fetches the clientβs configuration, including its settings, roles, protocols, and other metadata.
|
|
1979
|
+
|
|
1838
1980
|
**` -- @parameters -- `**
|
|
1839
1981
|
- filter: A JSON structure used to filter results based on specific fields:
|
|
1840
1982
|
- id: [optional] The unique identifier of the client to retrieve
|
|
@@ -1849,6 +1991,7 @@ console.log("Clients:", clients);
|
|
|
1849
1991
|
##### `function del(filter)`
|
|
1850
1992
|
Deletes a client from the realm using its internal ID.
|
|
1851
1993
|
This operation is irreversible and will remove the client and all its associated roles, permissions, and configurations.
|
|
1994
|
+
|
|
1852
1995
|
**` -- @parameters -- `**
|
|
1853
1996
|
- filter: A JSON structure used to filter results based on specific fields:
|
|
1854
1997
|
- id: [required] The internal ID of the client to delete (not clientId)
|
|
@@ -1863,6 +2006,7 @@ console.log(`Client successfully deleted.`);
|
|
|
1863
2006
|
##### `function update(filter,clientRepresentation)`
|
|
1864
2007
|
Updates the configuration of an existing client in the realm.
|
|
1865
2008
|
You can modify various attributes such as the client name, redirect URIs, protocol, access type, and more.
|
|
2009
|
+
|
|
1866
2010
|
**` -- @parameters -- `**
|
|
1867
2011
|
- filter: A JSON structure used to filter results based on specific fields:
|
|
1868
2012
|
- id: [required] The unique ID of the client you want to update
|
|
@@ -1888,6 +2032,7 @@ console.log(`Client successfully updated.`);
|
|
|
1888
2032
|
Creates a new client role under a specific client.
|
|
1889
2033
|
Client roles are roles associated with a specific client (application), and are useful
|
|
1890
2034
|
for fine-grained access control within that client.
|
|
2035
|
+
|
|
1891
2036
|
**` -- @parameters -- `**
|
|
1892
2037
|
- role_parameters: JSON structure that defines the role like:
|
|
1893
2038
|
- id: [required] The internal ID of the client where the role will be created.
|
|
@@ -1910,6 +2055,7 @@ console.log("Client role:", role);
|
|
|
1910
2055
|
##### `function findRole(filter)`
|
|
1911
2056
|
Retrieves a specific client role by name from a given client.
|
|
1912
2057
|
This is useful when you want to inspect or verify the properties of a role defined within a particular client.
|
|
2058
|
+
|
|
1913
2059
|
**` -- @parameters -- `**
|
|
1914
2060
|
- filter: JSON structure that defines the filter parameters:
|
|
1915
2061
|
- id: [required] The internal ID of the client (not the clientId string) where the role is defined.
|
|
@@ -1929,6 +2075,7 @@ console.log("Client role:", role);
|
|
|
1929
2075
|
##### `function updateRole(filter,roleRepresentation)`
|
|
1930
2076
|
Updates the attributes of a specific client role in Keycloak.
|
|
1931
2077
|
This includes changing the role's name, description, or any associated metadata.
|
|
2078
|
+
|
|
1932
2079
|
**` -- @parameters -- `**
|
|
1933
2080
|
- filter: JSON structure that defines the filter parameters:
|
|
1934
2081
|
- id: [required] The internal ID of the client (not the clientId string) where the role is defined.
|
|
@@ -1953,6 +2100,7 @@ Deletes a client role by its name for a specific client.
|
|
|
1953
2100
|
This permanently removes the role from the specified client in Keycloak.
|
|
1954
2101
|
A promise that resolves to void if the deletion is successful.
|
|
1955
2102
|
If the role does not exist or the operation fails, an error will be thrown.
|
|
2103
|
+
|
|
1956
2104
|
**` -- @parameters -- `**
|
|
1957
2105
|
- filter: JSON structure that defines the filter parameters:
|
|
1958
2106
|
- id: [required] The internal ID of the client (not the clientId string) where the role is defined.
|
|
@@ -1971,6 +2119,7 @@ const role= await KeycloakManager.clients.delRole({
|
|
|
1971
2119
|
##### `function listRoles(filter)`
|
|
1972
2120
|
Retrieves all roles defined for a specific client within the realm.
|
|
1973
2121
|
These roles can be used to assign permissions to users or groups for the specific client application.
|
|
2122
|
+
|
|
1974
2123
|
**` -- @parameters -- `**
|
|
1975
2124
|
- filter: JSON structure that defines the filter parameters:
|
|
1976
2125
|
- id: [required] The internal ID of the client (not clientId)
|
|
@@ -1988,6 +2137,7 @@ console.log("Client roles:", roles);
|
|
|
1988
2137
|
##### `function getClientSecret(filter)`
|
|
1989
2138
|
Retrieves the client secret associated with a confidential client in Keycloak.
|
|
1990
2139
|
This is typically used for clients using client_credentials or authorization_code flows where the secret is required to authenticate the client.
|
|
2140
|
+
|
|
1991
2141
|
**` -- @parameters -- `**
|
|
1992
2142
|
- filter: JSON structure that defines the filter parameters:
|
|
1993
2143
|
- id: [required] The internal ID of the client (not clientId)
|
|
@@ -2006,6 +2156,7 @@ console.log("Client secret:", secret);
|
|
|
2006
2156
|
##### `function generateNewClientSecret(filter)`
|
|
2007
2157
|
Generates a new client secret for a confidential client in Keycloak. This will overwrite the existing secret and return the newly generated one.
|
|
2008
2158
|
It is useful when rotating credentials or recovering access.
|
|
2159
|
+
|
|
2009
2160
|
**` -- @parameters -- `**
|
|
2010
2161
|
- filter: JSON structure that defines the filter parameters:
|
|
2011
2162
|
- id: [required] The internal ID of the client (not clientId)
|
|
@@ -2024,6 +2175,7 @@ console.log("New client secret:", secret.value);
|
|
|
2024
2175
|
##### `function generateRegistrationAccessToken(filter)`
|
|
2025
2176
|
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
2177
|
Itβs particularly useful in dynamic client registration workflows or when automating client updates via external systems.
|
|
2178
|
+
|
|
2027
2179
|
**` -- @parameters -- `**
|
|
2028
2180
|
- filter: JSON structure that defines the filter parameters:
|
|
2029
2181
|
- id: [required] The internal ID of the client (not clientId)
|
|
@@ -2318,6 +2470,7 @@ console.log("Roles successfully mapped to client!");
|
|
|
2318
2470
|
##### `function clients.listClientScopeMappings(filter)`
|
|
2319
2471
|
The method is used to list all client role mappings assigned to a client.
|
|
2320
2472
|
It shows which roles from another client (source) are already mapped to the target client.
|
|
2473
|
+
|
|
2321
2474
|
**` -- @parameters -- `**
|
|
2322
2475
|
- filter: JSON structure that defines the filter parameters:
|
|
2323
2476
|
- id: [required] The ID of the target client (where roles are mapped)
|
|
@@ -2340,6 +2493,7 @@ console.log("Mapped roles:", assignedRoles);
|
|
|
2340
2493
|
##### `function clients.listCompositeClientScopeMappings(filter)`
|
|
2341
2494
|
The method is used to list both direct and composite (inherited) client role mappings that are assigned to a target client.
|
|
2342
2495
|
It differs from listClientScopeMappings because it expands composite roles and shows all roles that are effectively available to the client.
|
|
2496
|
+
|
|
2343
2497
|
**` -- @parameters -- `**
|
|
2344
2498
|
- filter: JSON structure that defines the filter parameters:
|
|
2345
2499
|
- id: [required] The ID of the target client (the one receiving the mappings)
|
|
@@ -2362,6 +2516,7 @@ console.log("Effective (composite) role mappings:", effectiveRoles);
|
|
|
2362
2516
|
##### `function clients.delClientScopeMappings(filter)`
|
|
2363
2517
|
The method is used to remove one or more client role mappings from a target client.
|
|
2364
2518
|
It is the reverse of clients.addClientScopeMappings
|
|
2519
|
+
|
|
2365
2520
|
**` -- @parameters -- `**
|
|
2366
2521
|
- filter: JSON structure that defines the filter parameters:
|
|
2367
2522
|
- id: [required] ID of the target client (the client losing the roles)
|
|
@@ -2394,6 +2549,7 @@ console.log("Roles removed from client mappings");
|
|
|
2394
2549
|
##### `function clients.listAvailableRealmScopeMappings(filter)`
|
|
2395
2550
|
The method is used to retrieve all realm-level roles that are available to be assigned to a specific client.
|
|
2396
2551
|
These are roles defined at the realm level that the client does not yet have mapped, allowing you to see what can be added.
|
|
2552
|
+
|
|
2397
2553
|
**` -- @parameters -- `**
|
|
2398
2554
|
- filter: JSON structure that defines the filter parameters:
|
|
2399
2555
|
- id: [required] The ID of the client for which you want to list available realm-level role mappings.
|
|
@@ -2413,6 +2569,7 @@ console.log("Available realm roles for client:", availableRealmRoles);
|
|
|
2413
2569
|
##### `function clients.listAvailableRealmScopeMappings(filter)`
|
|
2414
2570
|
The method is used to retrieve all realm-level roles that are available to be assigned to a specific client.
|
|
2415
2571
|
These are roles defined at the realm level that the client does not yet have mapped, allowing you to see what can be added.
|
|
2572
|
+
|
|
2416
2573
|
**` -- @parameters -- `**
|
|
2417
2574
|
- filter: JSON structure that defines the filter parameters:
|
|
2418
2575
|
- id: [required] The ID of the client for which you want to list available realm-level role mappings.
|
|
@@ -2433,6 +2590,7 @@ console.log("Available realm roles for client:", availableRealmRoles);
|
|
|
2433
2590
|
##### `function clients.listRealmScopeMappings(filter)`
|
|
2434
2591
|
The method retrieves the realm-level roles currently assigned to a client as part of its scope mappings.
|
|
2435
2592
|
This shows which realm roles the client is allowed to request on behalf of users.
|
|
2593
|
+
|
|
2436
2594
|
**` -- @parameters -- `**
|
|
2437
2595
|
- filter: JSON structure that defines the filter parameters:
|
|
2438
2596
|
- id: [required] The client ID whose realm-level scope mappings you want to list
|
|
@@ -2452,6 +2610,7 @@ console.log("Realm roles mapped to client:", roles.map(r => r.name));
|
|
|
2452
2610
|
##### `function clients.listCompositeRealmScopeMappings(filter)`
|
|
2453
2611
|
The method retrieves all composite realm-level roles associated with a client through its scope mappings.
|
|
2454
2612
|
This includes not only the roles directly mapped to the client, but also roles inherited through composite roles.
|
|
2613
|
+
|
|
2455
2614
|
**` -- @parameters -- `**
|
|
2456
2615
|
- filter: JSON structure that defines the filter parameters:
|
|
2457
2616
|
- id: [required] The client ID whose composite realm scope mappings you want to list
|
|
@@ -2472,6 +2631,7 @@ console.log("Realm composite roles mapped to client:", roles.map(r => r.name));
|
|
|
2472
2631
|
##### `function clients.addRealmScopeMappings(filter,roles)`
|
|
2473
2632
|
The method is used to assign realm-level role mappings to a specific client.
|
|
2474
2633
|
This effectively grants the client access to the specified realm roles.
|
|
2634
|
+
|
|
2475
2635
|
**` -- @parameters -- `**
|
|
2476
2636
|
- filter: JSON structure that defines the filter parameters:
|
|
2477
2637
|
- id: [required] The client ID that will receive the new realm-level role mappings.
|
|
@@ -2491,6 +2651,7 @@ await KeycloakManager.clients.addRealmScopeMappings(
|
|
|
2491
2651
|
##### `function clients.delRealmScopeMappings(filter,roles)`
|
|
2492
2652
|
The method removes realm-level roles from a clientβs scope mappings.
|
|
2493
2653
|
This is the opposite of clients.addRealmScopeMappings.
|
|
2654
|
+
|
|
2494
2655
|
**` -- @parameters -- `**
|
|
2495
2656
|
- filter: JSON structure that defines the filter parameters:
|
|
2496
2657
|
- id: [required] The client ID whose realm role mapping must be removed.
|
|
@@ -2509,6 +2670,7 @@ await KeycloakManager.clients.delRealmScopeMappings(
|
|
|
2509
2670
|
|
|
2510
2671
|
##### `function clients.listSessions(filter)`
|
|
2511
2672
|
The method retrieves active user sessions for a specific client.
|
|
2673
|
+
|
|
2512
2674
|
**` -- @parameters -- `**
|
|
2513
2675
|
- filter: JSON structure that defines the filter parameters:
|
|
2514
2676
|
- id: [required] The client ID whose session must be retrieved
|
|
@@ -2536,6 +2698,7 @@ sessions.forEach(s =>
|
|
|
2536
2698
|
##### `function clients.listOfflineSessions(filter)`
|
|
2537
2699
|
The method retrieves offline sessions associated with a given client.
|
|
2538
2700
|
Offline sessions are created when a client uses offline tokens (refresh tokens with offline_access scope)
|
|
2701
|
+
|
|
2539
2702
|
**` -- @parameters -- `**
|
|
2540
2703
|
- filter: JSON structure that defines the filter parameters:
|
|
2541
2704
|
- id: [required] The client ID whose session must be retrieved
|
|
@@ -2562,6 +2725,7 @@ sessions.forEach(s =>
|
|
|
2562
2725
|
##### `function clients.getSessionCount(filter)`
|
|
2563
2726
|
The method retrieves the number of active user sessions for a given client.
|
|
2564
2727
|
This includes online sessions, not offline sessions (those are retrieved with listOfflineSessions).
|
|
2728
|
+
|
|
2565
2729
|
**` -- @parameters -- `**
|
|
2566
2730
|
- filter: JSON structure that defines the filter parameters:
|
|
2567
2731
|
- id: [required] The client ID whose session must be retrieved
|
|
@@ -2582,6 +2746,7 @@ console.log(`Client internal-client-id has ${sessionCount.count} active sessions
|
|
|
2582
2746
|
The method retrieves the number of offline sessions associated with a given client.
|
|
2583
2747
|
Offline sessions represent sessions where the user has a valid offline token, typically used for long-lived access
|
|
2584
2748
|
without requiring active login.
|
|
2749
|
+
|
|
2585
2750
|
**` -- @parameters -- `**
|
|
2586
2751
|
- filter: JSON structure that defines the filter parameters:
|
|
2587
2752
|
- id: [required] The ID of the client for which you want to count offline sessions.
|
|
@@ -2602,6 +2767,7 @@ console.log(`Client internal-client-id has ${sessionCount.count} offline session
|
|
|
2602
2767
|
The method is used to register a cluster node for a specific Keycloak client.
|
|
2603
2768
|
This is relevant in scenarios where you are running Keycloak in a clustered environment and want to synchronize
|
|
2604
2769
|
client sessions and node information across multiple instances.
|
|
2770
|
+
|
|
2605
2771
|
**` -- @parameters -- `**
|
|
2606
2772
|
- filter: JSON structure that defines the filter parameters:
|
|
2607
2773
|
- id: [required] The ID of the client for which you want to add a cluster node.
|
|
@@ -2623,6 +2789,7 @@ await KeycloakManager.clients.addClusterNode({
|
|
|
2623
2789
|
The method in Keycloak Admin Client is used to remove a previously registered cluster node for a specific client.
|
|
2624
2790
|
This is useful in clustered environments when a node is no longer active or should be deregistered from the
|
|
2625
2791
|
client session synchronization.
|
|
2792
|
+
|
|
2626
2793
|
**` -- @parameters -- `**
|
|
2627
2794
|
- filter: JSON structure that defines the filter parameters:
|
|
2628
2795
|
- id: [required] The ID of the client for which you want to remove a cluster node.
|
|
@@ -2642,6 +2809,7 @@ await KeycloakManager.clients.deleteClusterNode({
|
|
|
2642
2809
|
##### `function clients.generateAndDownloadKey(filter,config)`
|
|
2643
2810
|
The method is used to generate a new cryptographic key for a client and download it.
|
|
2644
2811
|
This is typically used for clients that require client credentials, JWT signing, or encryption.
|
|
2812
|
+
|
|
2645
2813
|
**` -- @parameters -- `**
|
|
2646
2814
|
- filter: JSON structure that defines the filter parameters:
|
|
2647
2815
|
- id: [required] The ID of the client for which you want to generate the key
|
|
@@ -2686,6 +2854,7 @@ console.log('Keystore saved ad client-keystore.jks');
|
|
|
2686
2854
|
The method is used to generate a new cryptographic key for a client without automatically downloading it.
|
|
2687
2855
|
This is useful for creating new signing or encryption keys associated with a client directly within Keycloak.
|
|
2688
2856
|
Unlike clients.generateAndDownloadKey, this method only generates the key and stores it in Keycloak. It does not return the key material to the caller
|
|
2857
|
+
|
|
2689
2858
|
**` -- @parameters -- `**
|
|
2690
2859
|
- filter: JSON structure that defines the filter parameters:
|
|
2691
2860
|
- id: [required] The ID of the client for which you want to generate the key
|
|
@@ -2711,6 +2880,7 @@ console.log('New RSA key successfully generated for client');
|
|
|
2711
2880
|
##### `function clients.getKeyInfo(filter)`
|
|
2712
2881
|
The method is used to retrieve metadata about the keys associated with a specific client.
|
|
2713
2882
|
It does not return the actual key material but provides information such as the key type, provider, algorithm, and status.
|
|
2883
|
+
|
|
2714
2884
|
**` -- @parameters -- `**
|
|
2715
2885
|
- filter: JSON structure that defines the filter parameters:
|
|
2716
2886
|
- id: [required] The ID of the client whose key information should be retrieved
|
|
@@ -2736,6 +2906,7 @@ console.log("Client key info:", keyInfo);
|
|
|
2736
2906
|
##### `function clients.downloadKey(filter,config)`
|
|
2737
2907
|
The method Downloads a clientβs cryptographic key (certificate) from Keycloak.
|
|
2738
2908
|
This is typically used when you need to retrieve the public certificate of a client for token validation, signing, or encryption purposes.
|
|
2909
|
+
|
|
2739
2910
|
**` -- @parameters -- `**
|
|
2740
2911
|
- filter: JSON structure that defines the filter parameters:
|
|
2741
2912
|
- id: [required] The ID of the client whose key information should be downloaded
|
|
@@ -2786,6 +2957,7 @@ console.log(cert);
|
|
|
2786
2957
|
The method in the Keycloak Admin Client is used to create a new authorization scope for a specific client.
|
|
2787
2958
|
Authorization scopes are part of Keycloakβs Authorization Services and represent fine-grained permissions
|
|
2788
2959
|
that can later be linked to resources and policies.
|
|
2960
|
+
|
|
2789
2961
|
**` -- @parameters -- `**
|
|
2790
2962
|
- filter: JSON structure that defines the filter parameters:
|
|
2791
2963
|
- id: [required] TThe ID of the client for which the scope will be created
|
|
@@ -2813,6 +2985,7 @@ await KeycloakManager.clients.createAuthorizationScope(
|
|
|
2813
2985
|
##### `function clients.listAllScopes(filter)`
|
|
2814
2986
|
The method is used to retrieve all available scopes for a specific client.
|
|
2815
2987
|
This includes both default scopes and optional scopes that can be assigned to the client.
|
|
2988
|
+
|
|
2816
2989
|
**` -- @parameters -- `**
|
|
2817
2990
|
- filter: JSON structure that defines the filter parameters:
|
|
2818
2991
|
- id: [required] The ID of the client whose scopes you want to list
|
|
@@ -2833,6 +3006,7 @@ console.log(scopes);
|
|
|
2833
3006
|
##### `function clients.updateAuthorizationScope(filter,AuthorizationScopeRepresentation)`
|
|
2834
3007
|
The method is used to update an existing authorization scope for a specific client.
|
|
2835
3008
|
Authorization scopes define permissions that can be used in policies and permissions for the clientβs resources.
|
|
3009
|
+
|
|
2836
3010
|
**` -- @parameters -- `**
|
|
2837
3011
|
- filter: JSON structure that defines the filter parameters:
|
|
2838
3012
|
- id: [required] The ID of the client to which the scope belongs
|
|
@@ -2867,6 +3041,7 @@ console.log('Authorization scope updated successfully');
|
|
|
2867
3041
|
##### `function clients.getAuthorizationScope(filter)`
|
|
2868
3042
|
The method is used to retrieve the details of a specific authorization scope associated with a client.
|
|
2869
3043
|
Authorization scopes define permissions that can be applied to resources and policies in Keycloak.
|
|
3044
|
+
|
|
2870
3045
|
**` -- @parameters -- `**
|
|
2871
3046
|
- filter: JSON structure that defines the filter parameters:
|
|
2872
3047
|
- id: [required] The ID of the client to which the scope belongs
|
|
@@ -2888,6 +3063,7 @@ console.log('Authorization scope details:', scope);
|
|
|
2888
3063
|
##### `function clients.listAllResourcesByScope(filter)`
|
|
2889
3064
|
The method is used to retrieve all resources associated with a specific authorization scope for a given client.
|
|
2890
3065
|
This allows you to see which resources are governed by a particular scope in the clientβs authorization settings.
|
|
3066
|
+
|
|
2891
3067
|
**` -- @parameters -- `**
|
|
2892
3068
|
- filter: JSON structure that defines the filter parameters:
|
|
2893
3069
|
- id: [required] The ID of the client to which the scope belongs
|
|
@@ -2910,6 +3086,7 @@ console.log('Resources associated with this scope:', resources);
|
|
|
2910
3086
|
##### `function clients.listAllPermissionsByScope(filter)`
|
|
2911
3087
|
The method is used to retrieve all permissions associated with a specific authorization scope for a given client.
|
|
2912
3088
|
This is helpful for understanding which permissions (policies and rules) are applied when a particular scope is used.
|
|
3089
|
+
|
|
2913
3090
|
**` -- @parameters -- `**
|
|
2914
3091
|
- filter: JSON structure that defines the filter parameters:
|
|
2915
3092
|
- id: [required] The ID of the client to query
|
|
@@ -2935,6 +3112,7 @@ console.log('Permissions associated with this scope:', permissions);
|
|
|
2935
3112
|
The method is used to retrieve all scopes associated with a specific permission for a given client.
|
|
2936
3113
|
This allows you to see which scopes a permission controls, helping you manage fine-grained access rules
|
|
2937
3114
|
in Keycloakβs Authorization Services (UMA 2.0) framework.
|
|
3115
|
+
|
|
2938
3116
|
**` -- @parameters -- `**
|
|
2939
3117
|
- filter: JSON structure that defines the filter parameters:
|
|
2940
3118
|
- id: [required] The ID of the client whose permission scopes you want to list
|
|
@@ -2961,6 +3139,7 @@ console.log('Permission Scopes:', permissionScopes);
|
|
|
2961
3139
|
The method is used to import a resource into a client.
|
|
2962
3140
|
This is part of Keycloakβs Authorization Services (UMA 2.0) and allows you to programmatically define
|
|
2963
3141
|
resources that a client can protect with policies and permissions.
|
|
3142
|
+
|
|
2964
3143
|
**` -- @parameters -- `**
|
|
2965
3144
|
- filter: JSON structure that defines the filter parameters:
|
|
2966
3145
|
- id: [required] The ID of the client to which the resource should be imported
|
|
@@ -2994,6 +3173,7 @@ console.log('Resource imported successfully');
|
|
|
2994
3173
|
The method is used to export a resource from a client.
|
|
2995
3174
|
This allows you to retrieve the full configuration of a resource, including its URIs, scopes,
|
|
2996
3175
|
and associated permissions, which can then be backed up, replicated, or modified externally.
|
|
3176
|
+
|
|
2997
3177
|
**` -- @parameters -- `**
|
|
2998
3178
|
- filter: JSON structure that defines the filter parameters:
|
|
2999
3179
|
- id: [required] The ID of the client from which to export the resource
|
|
@@ -3016,6 +3196,7 @@ console.log('Exported Resource:', exportedResource);
|
|
|
3016
3196
|
The method is used to create a new resource under a specific client.
|
|
3017
3197
|
A resource represents a protected entity in Keycloakβs authorization services, such as a REST endpoint,
|
|
3018
3198
|
a document, or any application-specific asset. This allows you to manage fine-grained access control via policies and permissions.
|
|
3199
|
+
|
|
3019
3200
|
**` -- @parameters -- `**
|
|
3020
3201
|
- filter: JSON structure that defines the filter parameters:
|
|
3021
3202
|
- id: [required] The ID of the client where the resource will be created
|
|
@@ -3050,6 +3231,7 @@ console.log('Created Resource:', createdResource);
|
|
|
3050
3231
|
The method is used to retrieve a specific resource of a client by its ID.
|
|
3051
3232
|
Resources in Keycloak represent protected entities, such as APIs, documents, or any application-specific assets,
|
|
3052
3233
|
that can have associated scopes, policies, and permissions for fine-grained access control.
|
|
3234
|
+
|
|
3053
3235
|
**` -- @parameters -- `**
|
|
3054
3236
|
- filter: JSON structure that defines the filter parameters:
|
|
3055
3237
|
- id: [required] The ID of the client that owns the resource
|
|
@@ -3071,6 +3253,7 @@ console.log('Retrieved Resource:', resource);
|
|
|
3071
3253
|
The method is used to retrieve the resource server settings of a client.
|
|
3072
3254
|
A resource server in Keycloak represents a client that is enabled with Authorization Services,
|
|
3073
3255
|
meaning it can define resources, scopes, permissions, and policies for fine-grained access control.
|
|
3256
|
+
|
|
3074
3257
|
**` -- @parameters -- `**
|
|
3075
3258
|
- filter: JSON structure that defines the filter parameters:
|
|
3076
3259
|
- id: [required] The ID of the client whose resource server configuration you want to retrieve
|
|
@@ -3091,6 +3274,7 @@ console.log('Resource Server:', resourceServer);
|
|
|
3091
3274
|
The method is used to update the configuration of a clientβs resource server.
|
|
3092
3275
|
A resource server defines authorization settings such as resources, scopes, permissions,
|
|
3093
3276
|
and policies that control fine-grained access to protected assets.
|
|
3277
|
+
|
|
3094
3278
|
**` -- @parameters -- `**
|
|
3095
3279
|
- filter: JSON structure that defines the filter parameters:
|
|
3096
3280
|
- id: [required] The ID of the client whose resource server configuration should be updated
|
|
@@ -3121,6 +3305,7 @@ console.log("Resource server updated successfully");
|
|
|
3121
3305
|
##### `function clients.listPermissionsByResource(filter)`
|
|
3122
3306
|
The method is used to retrieve all permissions associated with a specific resource within a clientβs resource server.
|
|
3123
3307
|
This is part of the Keycloak Authorization Services API and helps administrators inspect which permissions are linked to a given protected resource.
|
|
3308
|
+
|
|
3124
3309
|
**` -- @parameters -- `**
|
|
3125
3310
|
- filter: JSON structure that defines the filter parameters:
|
|
3126
3311
|
- id: [required] The ID of the client (the resource server).
|
|
@@ -3144,6 +3329,7 @@ console.log("Permissions for resource:", permissions);
|
|
|
3144
3329
|
The method is used to create a new permission for a client.
|
|
3145
3330
|
Permissions define which users or roles can access specific resources or scopes within the client,
|
|
3146
3331
|
based on policies you configure. This is part of Keycloakβs Authorization Services (UMA 2.0) framework.
|
|
3332
|
+
|
|
3147
3333
|
**` -- @parameters -- `**
|
|
3148
3334
|
- filter: JSON structure that defines the filter parameters:
|
|
3149
3335
|
- id: [required] The ID of the client for which the permission will be created
|
|
@@ -3181,6 +3367,7 @@ console.log('Permission created');
|
|
|
3181
3367
|
The method is used to search for permissions within a clientβs resource server.
|
|
3182
3368
|
Permissions in Keycloak represent rules that define how policies are applied to resources or scopes,
|
|
3183
3369
|
and this method allows you to list and filter them based on specific criteria.
|
|
3370
|
+
|
|
3184
3371
|
**` -- @parameters -- `**
|
|
3185
3372
|
- filter: JSON structure that defines the filter parameters:
|
|
3186
3373
|
- id: [required] The ID of the client (the resource server) where permissions are defined
|
|
@@ -3209,6 +3396,7 @@ console.log("Permissions found:", permissions);
|
|
|
3209
3396
|
The method updates the fine-grained admin permissions configuration for a specific client.
|
|
3210
3397
|
Fine-grained permissions allow you to control which users/roles can manage different aspects of a client
|
|
3211
3398
|
(e.g., who can manage roles, protocol mappers, or scope assignments).
|
|
3399
|
+
|
|
3212
3400
|
**` -- @parameters -- `**
|
|
3213
3401
|
- filter: JSON structure that defines the filter parameters:
|
|
3214
3402
|
- id: [required] The ID of the client (the resource server) where permissions are defined
|
|
@@ -3229,6 +3417,7 @@ console.log("Fine-grained permissions updated successfully");
|
|
|
3229
3417
|
##### `function clients.listFineGrainPermissions(filter)`
|
|
3230
3418
|
The method retrieves the current fine-grained admin permission settings for a given client.
|
|
3231
3419
|
This is useful for checking which permissions are configured (e.g., managing roles, protocol mappers, or client scopes).
|
|
3420
|
+
|
|
3232
3421
|
**` -- @parameters -- `**
|
|
3233
3422
|
- filter: JSON structure that defines the filter parameters:
|
|
3234
3423
|
- id: [required] The ID of the client (the resource server) where permissions are defined
|
|
@@ -3248,6 +3437,7 @@ console.log("Fine-grained permissions for client:", permissions);
|
|
|
3248
3437
|
##### `function clients.getAssociatedScopes(filter)`
|
|
3249
3438
|
The method is used to retrieve all scopes associated with a specific permission within a clientβs resource server.
|
|
3250
3439
|
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.
|
|
3440
|
+
|
|
3251
3441
|
**` -- @parameters -- `**
|
|
3252
3442
|
- filter: JSON structure that defines the filter parameters:
|
|
3253
3443
|
- id: [required] The ID of the client whose permission scopes you want to list
|
|
@@ -3268,6 +3458,7 @@ console.log("Associated scopes:", scopes);
|
|
|
3268
3458
|
##### `function clients.getAssociatedPolicies(filter)`
|
|
3269
3459
|
The method is used to retrieve all policies associated with a specific permission within a clientβs resource server.
|
|
3270
3460
|
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
|
|
3461
|
+
|
|
3271
3462
|
**` -- @parameters -- `**
|
|
3272
3463
|
- filter: JSON structure that defines the filter parameters:
|
|
3273
3464
|
- id: [required] The ID of the client whose permission policies you want to list
|
|
@@ -3290,6 +3481,7 @@ console.log("Associated policies:", policies);
|
|
|
3290
3481
|
##### `function clients.getAssociatedResources(filter)`
|
|
3291
3482
|
The method is used to retrieve all resources linked to a specific permission in a clientβs resource server.
|
|
3292
3483
|
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.
|
|
3484
|
+
|
|
3293
3485
|
**` -- @parameters -- `**
|
|
3294
3486
|
- filter: JSON structure that defines the filter parameters:
|
|
3295
3487
|
- id: [required] The ID of the client whose permission resource you want to list
|
|
@@ -3312,6 +3504,7 @@ console.log("Associated resources:", resources);
|
|
|
3312
3504
|
##### `function clients.listScopesByResource(filter)`
|
|
3313
3505
|
The method is used to list all authorization scopes associated with a specific resource in a clientβs resource server.
|
|
3314
3506
|
This allows administrators to understand which scopes are directly linked to a protected resource and therefore which permissions can be applied to it.
|
|
3507
|
+
|
|
3315
3508
|
**` -- @parameters -- `**
|
|
3316
3509
|
- filter: JSON structure that defines the filter parameters:
|
|
3317
3510
|
- id: [required] The ID of the client (the resource server).
|
|
@@ -3335,6 +3528,7 @@ console.log("Scopes for resource:", scopes);
|
|
|
3335
3528
|
##### `function clients.listResources(filter)`
|
|
3336
3529
|
The method is used to retrieve all resources defined in a clientβs resource server.
|
|
3337
3530
|
Resources represent protected entities (such as APIs, files, or services) that can be associated with scopes and permissions in Keycloakβs authorization services.
|
|
3531
|
+
|
|
3338
3532
|
**` -- @parameters -- `**
|
|
3339
3533
|
- filter: JSON structure that defines the filter parameters:
|
|
3340
3534
|
- id: [required] The ID of the client (the resource server)
|
|
@@ -3362,6 +3556,7 @@ console.log("Resources:", resources);
|
|
|
3362
3556
|
##### `function clients.updateResource(filter,resourceRepresentation)`
|
|
3363
3557
|
The method is used to update an existing resource in a clientβs resource server.
|
|
3364
3558
|
Resources represent protected entities (APIs, files, services, etc.) that can be secured with scopes and permissions under Keycloakβs Authorization Services
|
|
3559
|
+
|
|
3365
3560
|
**` -- @parameters -- `**
|
|
3366
3561
|
- filter: JSON structure that defines the filter parameters:
|
|
3367
3562
|
- id: [required] The ID of the client (the resource server)
|
|
@@ -3403,6 +3598,7 @@ console.log("Resource updated successfully");
|
|
|
3403
3598
|
The method is used to create a new policy for a clientβs resource server under Keycloakβs Authorization Services.
|
|
3404
3599
|
Policies define the rules that determine whether access should be granted or denied to a given resource, scope, or permission.
|
|
3405
3600
|
They can be based on users, roles, groups, conditions, or custom logic.
|
|
3601
|
+
|
|
3406
3602
|
**` -- @parameters -- `**
|
|
3407
3603
|
- filter: JSON structure that defines the filter parameters:
|
|
3408
3604
|
- id: [required] The ID of the client (the resource server) where the policy will be created.
|
|
@@ -3452,6 +3648,7 @@ console.log("Policy created successfully");
|
|
|
3452
3648
|
##### `function clients.listDependentPolicies(filter)`
|
|
3453
3649
|
The method is used to list all policies that depend on a given policy within a clientβs resource server.
|
|
3454
3650
|
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.
|
|
3651
|
+
|
|
3455
3652
|
**` -- @parameters -- `**
|
|
3456
3653
|
- filter: JSON structure that defines the filter parameters:
|
|
3457
3654
|
- id: [required] The ID of the client (the resource server) where the policy exists.
|
|
@@ -3478,6 +3675,7 @@ console.log("Dependent policies:", dependentPolicies);
|
|
|
3478
3675
|
##### `function clients.evaluateGenerateAccessToken(filter)`
|
|
3479
3676
|
The method is used to generate or simulate an access token for a specific client, typically for testing or evaluating the token
|
|
3480
3677
|
contents without performing a full user login. This can help you verify client roles, scopes, and protocol mappers included in the token
|
|
3678
|
+
|
|
3481
3679
|
**` -- @parameters -- `**
|
|
3482
3680
|
- filter: JSON structure that defines the filter parameters:
|
|
3483
3681
|
- id: [required] ID of the client for which you want to generate or evaluate the access token
|
|
@@ -3505,6 +3703,7 @@ console.log("Generated access token:", token);
|
|
|
3505
3703
|
The method is used to generate or simulate an ID token for a specific client, usually for testing or evaluating the token without
|
|
3506
3704
|
performing a full user login. This allows you to verify which claims, scopes, and protocol mappers are included in the ID
|
|
3507
3705
|
token for the client.
|
|
3706
|
+
|
|
3508
3707
|
**` -- @parameters -- `**
|
|
3509
3708
|
- filter: JSON structure that defines the filter parameters:
|
|
3510
3709
|
- id: [required] ID of the client for which you want to generate or evaluate the ID token
|
|
@@ -3531,6 +3730,7 @@ console.log("Generated ID token:", token);
|
|
|
3531
3730
|
The method is used to generate or simulate a UserInfo response for a specific client, typically for testing or evaluating what
|
|
3532
3731
|
user information would be returned by the UserInfo endpoint for that client. This helps verify which claims are included in the
|
|
3533
3732
|
UserInfo response without performing a full login flow.
|
|
3733
|
+
|
|
3534
3734
|
**` -- @parameters -- `**
|
|
3535
3735
|
- filter: JSON structure that defines the filter parameters:
|
|
3536
3736
|
- id: [required] The ID of the client for which you want to generate the UserInfo response
|
|
@@ -4147,6 +4347,7 @@ if (mapper) {
|
|
|
4147
4347
|
##### `function findProtocolMappersByProtocol(filter)`
|
|
4148
4348
|
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
4349
|
This is useful when you want to filter protocol mappers by the authentication protocol they are associated with.
|
|
4350
|
+
|
|
4150
4351
|
**` -- @parameters -- `**
|
|
4151
4352
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4152
4353
|
- id: [required] The ID of the client scope to search within.
|
|
@@ -4174,6 +4375,7 @@ if (mapper) {
|
|
|
4174
4375
|
The method deletes a protocol mapper from a specific client scope in a realm.
|
|
4175
4376
|
Protocol mappers define how user attributes, roles, or other information are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
4176
4377
|
Deleting a mapper removes its configuration from the client scope.
|
|
4378
|
+
|
|
4177
4379
|
**` -- @parameters -- `**
|
|
4178
4380
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4179
4381
|
- id: [required] The ID of the client scope containing the protocol mapper.
|
|
@@ -4197,6 +4399,7 @@ console.log("Protocol mapper deleted successfully");
|
|
|
4197
4399
|
##### `function listProtocolMappers(filter)`
|
|
4198
4400
|
The method retrieves all protocol mappers associated with a specific client scope in a realm.
|
|
4199
4401
|
Protocol mappers define how user attributes, roles, or other data are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
4402
|
+
|
|
4200
4403
|
**` -- @parameters -- `**
|
|
4201
4404
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4202
4405
|
- id: [required] The ID of the client scope to list protocol mappers from.
|
|
@@ -4219,6 +4422,7 @@ console.log("Protocol mappers for client scope:", mappers);
|
|
|
4219
4422
|
The method adds multiple protocol mappers to a specific client scope in a realm.
|
|
4220
4423
|
Protocol mappers define how user attributes, roles, or other data are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
4221
4424
|
With this method, you can configure several mappers in a single request.
|
|
4425
|
+
|
|
4222
4426
|
**` -- @parameters -- `**
|
|
4223
4427
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4224
4428
|
- id: [required] The ID of the client scope where the protocol mappers should be added.
|
|
@@ -4351,6 +4555,7 @@ console.log("Protocol mapper updated successfully");
|
|
|
4351
4555
|
The method retrieves all scope mappings for a given client scope in a realm.
|
|
4352
4556
|
Scope mappings define which roles (from realm roles or client roles) are granted to a client scope.
|
|
4353
4557
|
These roles determine the permissions and access tokens issued for clients using this scope.
|
|
4558
|
+
|
|
4354
4559
|
**` -- @parameters -- `**
|
|
4355
4560
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4356
4561
|
- id: [required] The ID of the client scope to list scope mapping.
|
|
@@ -4690,6 +4895,7 @@ The method is used to create a new Identity Provider (IdP) in a Keycloak realm.
|
|
|
4690
4895
|
An IdP allows users to authenticate via external providers such as Google, Facebook, GitHub,
|
|
4691
4896
|
or another SAML/OIDC provider.
|
|
4692
4897
|
This method requires specifying an alias, the provider type, and configuration settings such as client ID, client secret, and any other provider-specific options.
|
|
4898
|
+
|
|
4693
4899
|
**` -- @parameters -- `**
|
|
4694
4900
|
- identityProvidersRappresentation: parameter provided as a JSON object containing the configuration of the Identity Provider
|
|
4695
4901
|
- alias: [required] Unique name for the IdP within the realm.
|
|
@@ -4725,6 +4931,7 @@ console.log("Created Identity Provider:", newIdP);
|
|
|
4725
4931
|
##### `function identityProviders.createMapper(mapperParams)`
|
|
4726
4932
|
The method creates a new mapper for an existing Identity Provider in the current realm.
|
|
4727
4933
|
The mapper defines how attributes, roles, or claims from the Identity Provider are mapped to the Keycloak user model.
|
|
4934
|
+
|
|
4728
4935
|
**` -- @parameters -- `**
|
|
4729
4936
|
- mapperParams: parameter provided as a JSON object containing the fields to create a new mapper
|
|
4730
4937
|
- alias: [required] The alias of the Identity Provider to which the mapper will be attached.
|
|
@@ -4752,6 +4959,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
4752
4959
|
##### `function identityProviders.findMappers(filter)`
|
|
4753
4960
|
The method retrieves all mappers associated with a specific Identity Provider in the current realm.
|
|
4754
4961
|
These mappers define how attributes, roles, or claims from the external Identity Provider are mapped to the Keycloak user model.
|
|
4962
|
+
|
|
4755
4963
|
**` -- @parameters -- `**
|
|
4756
4964
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4757
4965
|
- alias: [required] TThe alias of the Identity Provider whose mappers you want to fetch.
|
|
@@ -4772,6 +4980,7 @@ console.log(mappers);
|
|
|
4772
4980
|
##### `function identityProviders.delMapper(filter)`
|
|
4773
4981
|
The method deletes a specific mapper associated with an Identity Provider in the current realm.
|
|
4774
4982
|
This is useful when you need to remove a mapping rule that translates attributes, roles, or claims from the external Identity Provider into Keycloak.
|
|
4983
|
+
|
|
4775
4984
|
**` -- @parameters -- `**
|
|
4776
4985
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4777
4986
|
- alias: [required] The alias of the Identity Provider that owns the mapper.
|
|
@@ -4792,6 +5001,7 @@ console.log("Mapper deleted successfully");
|
|
|
4792
5001
|
##### `function identityProviders.findOneMapper(filter)`
|
|
4793
5002
|
The method retrieves the details of a specific mapper associated with an Identity Provider in the current realm.
|
|
4794
5003
|
This allows you to inspect a mapperβs configuration, such as how attributes or claims from the external Identity Provider are mapped into Keycloak.
|
|
5004
|
+
|
|
4795
5005
|
**` -- @parameters -- `**
|
|
4796
5006
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4797
5007
|
- alias: [required] The alias of the Identity Provider.
|
|
@@ -4812,6 +5022,7 @@ console.log("Mapper details:", mapper);
|
|
|
4812
5022
|
The method removes an Identity Provider from the current realm.
|
|
4813
5023
|
This action deletes the provider configuration, including all its associated mappers and settings.
|
|
4814
5024
|
After deletion, users will no longer be able to authenticate using that Identity Provider.
|
|
5025
|
+
|
|
4815
5026
|
**` -- @parameters -- `**
|
|
4816
5027
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4817
5028
|
- alias: [required] The alias of the Identity Provider you want to delete.
|
|
@@ -4829,6 +5040,7 @@ console.log(`Identity Provider deleted successfully`);
|
|
|
4829
5040
|
##### `function identityProviders.findOne(filter)`
|
|
4830
5041
|
The method retrieves the configuration details of a specific Identity Provider in the current realm.
|
|
4831
5042
|
It is useful when you need to inspect the providerβs settings, such as its alias, display name, authentication flow, or other configuration parameters.
|
|
5043
|
+
|
|
4832
5044
|
**` -- @parameters -- `**
|
|
4833
5045
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4834
5046
|
- alias: [required] The alias of the Identity Provider you want to find.
|
|
@@ -4866,6 +5078,7 @@ providers.forEach((provider) => {
|
|
|
4866
5078
|
##### `function identityProviders.update(filter,identityProviderRepresentation)`
|
|
4867
5079
|
The method updates the configuration of a specific Identity Provider in the current realm.
|
|
4868
5080
|
It allows you to modify settings such as client ID, secret, authorization URLs, or any custom configuration fields exposed by the provider.
|
|
5081
|
+
|
|
4869
5082
|
**` -- @parameters -- `**
|
|
4870
5083
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4871
5084
|
- alias: [required] The alias of the Identity Provider to update.
|
|
@@ -4892,6 +5105,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
4892
5105
|
The method retrieves information about a specific Identity Provider factory available in Keycloak.
|
|
4893
5106
|
A factory represents a provider type (e.g., "oidc", "saml", "github") and contains metadata about how that provider can be configured.
|
|
4894
5107
|
This is useful when you want to check what configuration options are supported before creating or updating an Identity Provider.
|
|
5108
|
+
|
|
4895
5109
|
**` -- @parameters -- `**
|
|
4896
5110
|
- filter: pparameter provided as a JSON object that accepts the following filter:
|
|
4897
5111
|
- providerId: [required] The ID of the Identity Provider factory to look up (e.g., "oidc", "saml", "google").
|
|
@@ -4912,6 +5126,7 @@ console.log("Factory details:", factory);
|
|
|
4912
5126
|
The method retrieves all mappers associated with a specific Identity Provider in Keycloak.
|
|
4913
5127
|
Mappers define how information from the external Identity Provider (e.g., Google, SAML, GitHub) is mapped into Keycloak attributes, roles, or claims.
|
|
4914
5128
|
This is useful to list all transformations and mappings applied to users authenticating via that provider.
|
|
5129
|
+
|
|
4915
5130
|
**` -- @parameters -- `**
|
|
4916
5131
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4917
5132
|
- alias: [required] The alias of the Identity Provider (set when the provider was created).
|
|
@@ -4929,6 +5144,7 @@ console.log("Mappers for Google IdP:", mappers);
|
|
|
4929
5144
|
##### `function identityProviders.findOneMapper(filter)`
|
|
4930
5145
|
The method retrieves a single mapper associated with a specific Identity Provider in Keycloak.
|
|
4931
5146
|
Itβs useful when you need to inspect the configuration of a mapper before updating or deleting it.
|
|
5147
|
+
|
|
4932
5148
|
**` -- @parameters -- `**
|
|
4933
5149
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4934
5150
|
- alias: [required] The alias of the Identity Provider.
|
|
@@ -4953,6 +5169,7 @@ if (mapper) {
|
|
|
4953
5169
|
The method updates an existing mapper for a given Identity Provider in Keycloak.
|
|
4954
5170
|
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
5171
|
This method allows you to change the configuration of an existing mapper (e.g., modify the claim name, attribute name, or role assignment).
|
|
5172
|
+
|
|
4956
5173
|
**` -- @parameters -- `**
|
|
4957
5174
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4958
5175
|
- alias: [required] The alias of the Identity Provider (set during IdP creation).
|
|
@@ -4991,6 +5208,7 @@ console.log("Mapper updated successfully!");
|
|
|
4991
5208
|
##### `function identityProviders.importFromUrl(filter)`
|
|
4992
5209
|
The method lets you import an Identity Provider configuration directly from a metadata URL (e.g., OIDC discovery document or SAML metadata XML).
|
|
4993
5210
|
This saves you from manually entering configuration details, since Keycloak can auto-fill them from the provided URL.
|
|
5211
|
+
|
|
4994
5212
|
**` -- @parameters -- `**
|
|
4995
5213
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
4996
5214
|
- fromUrl : [required] The URL of the IdP metadata (OIDC discovery endpoint or SAML metadata).
|
|
@@ -5014,6 +5232,7 @@ console.log("Imported IdP:", importedIdp);
|
|
|
5014
5232
|
##### `function identityProviders.updatePermission(filter,permissionRepresentation)`
|
|
5015
5233
|
The method allows you to enable or disable fine-grained admin permissions for a specific Identity Provider in Keycloak.
|
|
5016
5234
|
When enabled, Keycloak creates client roles (scopes) that let you define which users or groups can view or manage the Identity Provider.
|
|
5235
|
+
|
|
5017
5236
|
**` -- @parameters -- `**
|
|
5018
5237
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5019
5238
|
- alias: [required] The alias of the Identity Provider.
|
|
@@ -5036,6 +5255,7 @@ console.log("Updated permission:", updatedPermissions);
|
|
|
5036
5255
|
##### `function identityProviders.listPermissions(filter)`
|
|
5037
5256
|
The method retrieves the current fine-grained permission settings for a specific Identity Provider in Keycloak.
|
|
5038
5257
|
It returns whether permissions are enabled and, if so, which scope roles are associated with managing and viewing the Identity Provider.
|
|
5258
|
+
|
|
5039
5259
|
**` -- @parameters -- `**
|
|
5040
5260
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5041
5261
|
- alias: [required] The alias of the Identity Provider.
|
|
@@ -5062,6 +5282,7 @@ Groups help organize users and assign permissions in a scalable way
|
|
|
5062
5282
|
#### `entity groups functions`
|
|
5063
5283
|
##### `function create(groupRappresentation)`
|
|
5064
5284
|
Create a new group in the current realme
|
|
5285
|
+
|
|
5065
5286
|
**` -- @parameters -- `**
|
|
5066
5287
|
- groupRepresentation:An object representing the new state of the group. You can update properties such as:
|
|
5067
5288
|
- name: [optional] New name of the group
|
|
@@ -5082,6 +5303,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5082
5303
|
find method is used to retrieve a list of groups in a specific realm.
|
|
5083
5304
|
It supports optional filtering parameters.
|
|
5084
5305
|
Searching by attributes is only available from Keycloak > 15
|
|
5306
|
+
|
|
5085
5307
|
**` -- @parameters -- `**
|
|
5086
5308
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5087
5309
|
- {builtin attribute}: To find groips by builtin attributes such as name, id
|
|
@@ -5115,6 +5337,7 @@ else console.log('Group not found');
|
|
|
5115
5337
|
##### `function del(filter)`
|
|
5116
5338
|
Deletes a group from the realm.
|
|
5117
5339
|
Return a promise that resolves when the group is successfully deleted. No content is returned on success.
|
|
5340
|
+
|
|
5118
5341
|
**` -- @parameters -- `**
|
|
5119
5342
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5120
5343
|
- id: The ID of the group to delete.
|
|
@@ -5128,6 +5351,7 @@ const group = await KeycloakManager.groups.del({ id: 'group-id' });
|
|
|
5128
5351
|
##### `function count(filter)`
|
|
5129
5352
|
Retrieves the total number of groups present in the specified realm.
|
|
5130
5353
|
This is useful for pagination, reporting, or general statistics regarding group usage in a Keycloak realm.
|
|
5354
|
+
|
|
5131
5355
|
**` -- @parameters -- `**
|
|
5132
5356
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5133
5357
|
- realm: [optional] The name of the realm. If omitted, the default realm is used.
|
|
@@ -5149,6 +5373,7 @@ console.log('Total cool-group groups:', result.count);
|
|
|
5149
5373
|
##### `function update(filter,groupRepresentation)`
|
|
5150
5374
|
Updates an existing groupβs information in a Keycloak realm.
|
|
5151
5375
|
You can modify the groupβs name, attributes, or hierarchy by providing the group ID and the updated data.
|
|
5376
|
+
|
|
5152
5377
|
**` -- @parameters -- `**
|
|
5153
5378
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5154
5379
|
- id: [required] The unique ID of the group you want to update.
|
|
@@ -5173,6 +5398,7 @@ await KeycloakManager.groups.update(
|
|
|
5173
5398
|
##### `function listSubGroups(filter)`
|
|
5174
5399
|
Retrieves a paginated list of direct subgroups for a specified parent group.
|
|
5175
5400
|
This method is useful when navigating hierarchical group structures within a Keycloak realm.
|
|
5401
|
+
|
|
5176
5402
|
**` -- @parameters -- `**
|
|
5177
5403
|
- filter: parameter provided as a JSON object that accepts the following filter:
|
|
5178
5404
|
- parentId: [required] ID of the parent group whose subgroups you want to list.
|
|
@@ -5196,6 +5422,7 @@ await KeycloakManager.groups.listSubGroups({
|
|
|
5196
5422
|
##### `function addRealmRoleMappings(role_mapping)`
|
|
5197
5423
|
Adds one or more realm-level roles to a specific group.
|
|
5198
5424
|
This operation grants all users within that group the associated realm roles, effectively assigning permissions at a group level.
|
|
5425
|
+
|
|
5199
5426
|
**` -- @parameters -- `**
|
|
5200
5427
|
- role_mapping: parameter provided as a JSON object that accepts the following parameters:
|
|
5201
5428
|
- id: [required] The ID of the group to which roles will be added.
|
|
@@ -5219,6 +5446,7 @@ await KeycloakManager.groups.addRealmRoleMappings({
|
|
|
5219
5446
|
##### `function listAvailableRealmRoleMappings(filters)`
|
|
5220
5447
|
Retrieves all available realm-level roles that can be assigned to a specific group but are not yet assigned.
|
|
5221
5448
|
This helps in identifying which roles are still eligible for addition to the group.
|
|
5449
|
+
|
|
5222
5450
|
**` -- @parameters -- `**
|
|
5223
5451
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5224
5452
|
- id: [required] The ID of the group you want to inspect.
|
|
@@ -5238,6 +5466,7 @@ console.log('Available realm roles for group:', availableRoles);
|
|
|
5238
5466
|
##### `function listRoleMappings(filters)`
|
|
5239
5467
|
Retrieves all role mappings for a specific group, including both realm roles and client roles.
|
|
5240
5468
|
This method is useful for understanding the complete set of roles that are assigned to a group.
|
|
5469
|
+
|
|
5241
5470
|
**` -- @parameters -- `**
|
|
5242
5471
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5243
5472
|
- id: [required] The ID of the group whose roles to fetch
|
|
@@ -5260,6 +5489,7 @@ console.log('Client roles:', roleMappings.clientMappings);
|
|
|
5260
5489
|
##### `function listRealmRoleMappings(filters)`
|
|
5261
5490
|
Returns the list of realm-level roles that are directly assigned to a specific group.
|
|
5262
5491
|
These roles are defined at the realm level and are not tied to any specific client.
|
|
5492
|
+
|
|
5263
5493
|
**` -- @parameters -- `**
|
|
5264
5494
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5265
5495
|
- id: [required] TThe ID of the group to retrieve roles for
|
|
@@ -5279,6 +5509,7 @@ console.log('Realm roles assigned to group:', realmRoles.map(role => role.name))
|
|
|
5279
5509
|
##### `function listCompositeRealmRoleMappings(filters)`
|
|
5280
5510
|
Retrieves all composite realm-level roles assigned to a group.
|
|
5281
5511
|
This includes both directly assigned roles and those inherited through composite roles.
|
|
5512
|
+
|
|
5282
5513
|
**` -- @parameters -- `**
|
|
5283
5514
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5284
5515
|
- id: [required] TThe ID of the group to retrieve roles for
|
|
@@ -5299,6 +5530,7 @@ console.log('All (composite) realm roles for group:', compositeRealmRoles.map(ro
|
|
|
5299
5530
|
Removes one or more realm-level roles from a group's role mappings.
|
|
5300
5531
|
This operation only affects roles that are directly assigned.
|
|
5301
5532
|
Composite roles inherited indirectly will not be removed.
|
|
5533
|
+
|
|
5302
5534
|
**` -- @parameters -- `**
|
|
5303
5535
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5304
5536
|
- id: [required] TThe ID of the group to retrieve roles for
|
|
@@ -5321,6 +5553,7 @@ await KeycloakManager.groups.delRealmRoleMappings({
|
|
|
5321
5553
|
##### `function addClientRoleMappings(filters)`
|
|
5322
5554
|
Assigns one or more client-level roles to a specific group.
|
|
5323
5555
|
This allows all users belonging to that group to inherit the specified roles for a given client.
|
|
5556
|
+
|
|
5324
5557
|
**` -- @parameters -- `**
|
|
5325
5558
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5326
5559
|
- id: [required] The ID of the group
|
|
@@ -5345,6 +5578,7 @@ await KeycloakManager.groups.addClientRoleMappings({
|
|
|
5345
5578
|
##### `function listAvailableClientRoleMappings(filters)`
|
|
5346
5579
|
Retrieves the list of client roles that are available to be assigned to a specific group but are not currently mapped.
|
|
5347
5580
|
This is useful when you want to show assignable roles for a group in a specific client context.
|
|
5581
|
+
|
|
5348
5582
|
**` -- @parameters -- `**
|
|
5349
5583
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5350
5584
|
- id: [required] The ID of the group
|
|
@@ -5364,6 +5598,7 @@ console.log('Available roles:', availableRoles);
|
|
|
5364
5598
|
##### `function listClientRoleMappings(filters)`
|
|
5365
5599
|
Retrieves the list of client roles that are currently assigned (mapped) to a specific group for a given client.
|
|
5366
5600
|
This allows you to see which roles from a client the group already has.
|
|
5601
|
+
|
|
5367
5602
|
**` -- @parameters -- `**
|
|
5368
5603
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5369
5604
|
- id: [required] The ID of the group
|
|
@@ -5383,6 +5618,7 @@ console.log('Assigned client roles:', availableRoles);
|
|
|
5383
5618
|
##### `function listCompositeClientRoleMappings(filters)`
|
|
5384
5619
|
Retrieves the list of composite client roles assigned to a specific group.
|
|
5385
5620
|
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.
|
|
5621
|
+
|
|
5386
5622
|
**` -- @parameters -- `**
|
|
5387
5623
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5388
5624
|
- id: [required] The ID of the group
|
|
@@ -5402,6 +5638,7 @@ console.log('Composite client roles assigned to group:', compositeClientRoles);
|
|
|
5402
5638
|
##### `function delClientRoleMappings(filters)`
|
|
5403
5639
|
Removes specific client role mappings from a group.
|
|
5404
5640
|
This function deletes one or more client roles that were assigned to the group, effectively revoking those client roles from the group.
|
|
5641
|
+
|
|
5405
5642
|
**` -- @parameters -- `**
|
|
5406
5643
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5407
5644
|
- id: [required] The ID of the group
|
|
@@ -5445,6 +5682,7 @@ allowing you to group multiple permissions into a single, higher-level role.
|
|
|
5445
5682
|
A composite role can include roles from the same realm as well
|
|
5446
5683
|
as roles from different clients.
|
|
5447
5684
|
When you assign a composite role to a user, they automatically inherit all the roles it contains.
|
|
5685
|
+
|
|
5448
5686
|
**` -- @parameters -- `**
|
|
5449
5687
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5450
5688
|
- roleId: [required] The id of the role to which composite roles will be added.
|
|
@@ -5478,6 +5716,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5478
5716
|
```
|
|
5479
5717
|
##### `function findOneByName(filters)`
|
|
5480
5718
|
Get a role by name
|
|
5719
|
+
|
|
5481
5720
|
**` -- @parameters -- `**
|
|
5482
5721
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5483
5722
|
- name (string, required) β The exact name of the role to retrieve.
|
|
@@ -5490,6 +5729,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5490
5729
|
|
|
5491
5730
|
##### `function findOneById(filters)`
|
|
5492
5731
|
Get a role by its Id
|
|
5732
|
+
|
|
5493
5733
|
**` -- @parameters -- `**
|
|
5494
5734
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5495
5735
|
- Id (string, required) β The Id of the role to retrieve.
|
|
@@ -5502,6 +5742,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5502
5742
|
|
|
5503
5743
|
##### `function updateByName(filters,role_dictionary)`
|
|
5504
5744
|
Update a role by its name
|
|
5745
|
+
|
|
5505
5746
|
**` -- @parameters -- `**
|
|
5506
5747
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5507
5748
|
- name (string, required) β The exact name of the role to retrieve.
|
|
@@ -5515,6 +5756,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5515
5756
|
|
|
5516
5757
|
##### `function updateById(filters,role_dictionary)`
|
|
5517
5758
|
Update a role by its Id
|
|
5759
|
+
|
|
5518
5760
|
**` -- @parameters -- `**
|
|
5519
5761
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5520
5762
|
- name (string, required) β The exact name of the role to retrieve.
|
|
@@ -5528,6 +5770,7 @@ const KeycloakManager = require('keycloak-api-manager');
|
|
|
5528
5770
|
|
|
5529
5771
|
##### `function delByName(filters)`
|
|
5530
5772
|
Delete a role by its name
|
|
5773
|
+
|
|
5531
5774
|
**` -- @parameters -- `**
|
|
5532
5775
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5533
5776
|
- name (string, required) β The exact name of the role to retrieve.
|
|
@@ -5570,6 +5813,7 @@ that have been added to the composite role. It requires the roleId of the target
|
|
|
5570
5813
|
parameter and returns an array of RoleRepresentation objects. If the role is not composite
|
|
5571
5814
|
or has no associated realm roles, the result will be an empty array. This method is useful
|
|
5572
5815
|
for understanding and managing hierarchical role structures within a realm in Keycloak.
|
|
5816
|
+
|
|
5573
5817
|
**` -- @parameters -- `**
|
|
5574
5818
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5575
5819
|
- roleId: (string, required) β The Id of the role to retrieve.
|
|
@@ -5589,6 +5833,7 @@ are part of the composite role. It requires the roleId of the composite role
|
|
|
5589
5833
|
and the clientId of the client whose roles you want to retrieve. The function returns an array of
|
|
5590
5834
|
RoleRepresentation objects representing the client roles included in the composite.
|
|
5591
5835
|
This helps manage and inspect client-specific role hierarchies within the composite role structure in Keycloak.
|
|
5836
|
+
|
|
5592
5837
|
**` -- @parameters -- `**
|
|
5593
5838
|
- filters: parameter provided as a JSON object that accepts the following parameters:
|
|
5594
5839
|
- roleId: (string, required) β The Id of the role to retrieve
|
package/index.js
CHANGED
|
@@ -96,7 +96,7 @@ exports.setConfig=function(configToOverride){
|
|
|
96
96
|
}
|
|
97
97
|
//TODO: Remove da documentare
|
|
98
98
|
// restituisce il token utilizzato dalla libreria per comunicare con la keycloak API
|
|
99
|
-
exports.getToken=function(
|
|
99
|
+
exports.getToken=function(){
|
|
100
100
|
return({
|
|
101
101
|
accessToken:kcAdminClient.accessToken,
|
|
102
102
|
refreshToken:kcAdminClient.refreshToken,
|
|
@@ -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.2.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": {
|