keycloak-api-manager 1.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,575 @@
1
+
2
+ /**
3
+ * **************************************************************************************************
4
+ * **************************************************************************************************
5
+ * The realms property provides access to all administrative operations related to Keycloak realms.
6
+ * A realm in Keycloak is a fundamental concept that acts as an isolated tenant:
7
+ * each realm manages its own set of users, roles, groups, and clients independently.
8
+ * **************************************************************************************************
9
+ * **************************************************************************************************
10
+ */
11
+ let kcAdminClientHandler=null;
12
+ exports.setKcAdminClient=function(kcAdminClient){
13
+ kcAdminClientHandler=kcAdminClient;
14
+ }
15
+
16
+
17
+ /**
18
+ * ***************************** - CREATE - *******************************
19
+ * Create is a method used to create a new realm.
20
+ * This method accepts a realm representation object containing details such as is, name
21
+ * @param {JSON} realmDictionary: is a JSON object that accepts filter parameters
22
+ * - id:[required] The internal ID of the realm. If omitted, Keycloak uses the realm name as the ID.
23
+ * - realm:[required] The name of the realm to create.
24
+ * - Additional optional properties can be passed to configure the realm (e.g., enabled, displayName, etc.).
25
+ */
26
+ exports.create=function(realmDictionary){
27
+ return (kcAdminClientHandler.realms.create(realmDictionary));
28
+ }
29
+
30
+
31
+ /**
32
+ * ***************************** - UPDATE - *******************************
33
+ * Updates the configuration of an existing realm.
34
+ * You can use this method to modify settings such as login behavior, themes, token lifespans, and more.
35
+ * @param {JSON} filter: is a JSON object that accepts filter parameters:
36
+ * - realm:[required] The identifier of the realm you want to update.
37
+ * @param {JSON} realmDictionary: An object containing the updated realm configuration. Only the fields you want to change need to be included.
38
+ */
39
+ exports.update=function(filter,realmDictionary){
40
+ return(kcAdminClientHandler.realms.update(filter,realmDictionary));
41
+ }
42
+
43
+
44
+ /**
45
+ * ***************************** - DEL - *******************************
46
+ * Deletes a specific realm from the Keycloak server.
47
+ * This operation is irreversible and removes all users, clients, roles, groups, and settings associated with the realm.
48
+ * @param {JSON} filter: is a JSON object that accepts filter parameters
49
+ * - realm:[required] The name of the realm to delete.
50
+ */
51
+ exports.del=function(filter){
52
+ return(kcAdminClientHandler.realms.del(filter));
53
+ }
54
+
55
+ /**
56
+ * ***************************** - FIND - *******************************
57
+ * Retrieves a list of all realms configured in the Keycloak server.
58
+ *This includes basic metadata for each realm such as ID and display name, but not the full configuration details.
59
+ *This method does not take any parameters.
60
+ */
61
+ exports.find=function(){
62
+ return(kcAdminClientHandler.realms.find());
63
+ }
64
+
65
+
66
+ /**
67
+ * ***************************** - findOne - *******************************
68
+ * Retrieves the full configuration and metadata of a specific realm by its name (realm ID).
69
+ * This includes settings like login policies, themes, password policies, etc.
70
+ * @parameters:
71
+ * - filter: is a JSON object that accepts filter parameters
72
+ * - realm:[required] The name (ID) of the realm you want to retrieve.
73
+ */
74
+ exports.findOne=function(filter){
75
+ return(kcAdminClientHandler.realms.findOne(filter));
76
+ }
77
+
78
+ /**
79
+ * ***************************** - partialImport - *******************************
80
+ * Performs a partial import of realm configuration into a Keycloak realm.
81
+ * This allows you to import users, roles, groups, clients, and other components without replacing the entire realm.
82
+ * It’s useful for incremental updates or merging configuration pieces.
83
+ * @parameters:
84
+ * - configuration: is a JSON object that accepts filter parameters
85
+ * - realm:[required] The name of the realm where the data should be imported.
86
+ * - rep:[required] A JSON object representing part of the realm configuration to be imported(can include users, roles, groups, clients, etc.).
87
+ * - ifResourceExists:[required] Defines the behavior when an imported resource already exists in the target realm.
88
+ * Options are:
89
+ * - 'FAIL' – the operation fails if a resource already exists.
90
+ * - 'SKIP' – existing resources are skipped.
91
+ * - 'OVERWRITE' – existing resources are overwritten.
92
+ * - other configuration to be imported like users, roles, groups ...
93
+ */
94
+ exports.partialImport=function(configuration){
95
+ return(kcAdminClientHandler.realms.partialImport(configuration));
96
+ }
97
+
98
+
99
+
100
+ /**
101
+ * ***************************** - export - *******************************
102
+ * Exports the configuration of a specific realm.
103
+ * This method returns the full realm representation in JSON format, including roles, users, clients, groups, and other components depending on the provided options.
104
+ * @parameters:
105
+ * - configuration: is a JSON object that accepts filter parameters
106
+ * - realm:[required] The name of the realm to export.
107
+ * - exportClients: [optional] boolean, Whether to include clients in the export. Default: true.
108
+ * - exportGroupsAndRoles: [optional] boolean, Whether to include groups and roles in the export. Default: true.
109
+ */
110
+ exports.export=function(configuration){
111
+ return(kcAdminClientHandler.realms.export(configuration));
112
+ }
113
+
114
+
115
+ /**
116
+ * ***************************** - getClientRegistrationPolicyProviders - *******************************
117
+ * Fetches the list of available client registration policy providers for the specified realm.
118
+ *These providers define how new clients can be registered and what rules or validations apply (e.g., allowed scopes, required attributes).
119
+ * @parameters:
120
+ * - configuration: is a JSON object that accepts filter parameters
121
+ * - realm:[required] The name of the realm where you want to list client registration policy providers.
122
+ */
123
+ exports.getClientRegistrationPolicyProviders=function(configuration){
124
+ return(kcAdminClientHandler.realms.getClientRegistrationPolicyProviders(configuration));
125
+ }
126
+
127
+
128
+ /**
129
+ * ***************************** - createClientsInitialAccess - *******************************
130
+ *
131
+ * Creates a new Initial Access Token for dynamic client registration.
132
+ * 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.
133
+ * @parameters:
134
+ * - realmFilter: is a JSON object that accepts filter parameters
135
+ * - realm:[required] The name of the realm where the initial access token should be created.
136
+ * - options: is a JSON object that accepts filter parameters
137
+ * - count [required] Number of times this token can be used to register new clients.
138
+ * - expiration [required] Time (in seconds) after which the token expires. 0 is unlimited
139
+ *
140
+ *
141
+ * @return - Returns an object containing:
142
+ * - id: internal ID of the token
143
+ * - token: the actual token string to be used during dynamic registration
144
+ * - timestamp: Creation timestamp
145
+ * - expiration: Expiration time in seconds
146
+ * - count: Maximum allowed uses
147
+ * - remainingCount: How many uses are left
148
+ */
149
+ exports.createClientsInitialAccess=function(realmFilter,options){
150
+ return(kcAdminClientHandler.realms.createClientsInitialAccess(realmFilter,options));
151
+ }
152
+
153
+
154
+
155
+
156
+ /**
157
+ * ***************************** - getClientsInitialAccess - *******************************
158
+ * Retrieves all existing Initial Access Tokens for dynamic client registration in a given realm.
159
+ * These tokens are used to allow programmatic or automated registration of clients via the Dynamic Client Registration API.
160
+ * @parameters:
161
+ * - realmFilter: is a JSON object that accepts filter parameters
162
+ * - realm:[required] The name of the realm from which to list all initial access tokens.
163
+ *
164
+ * @return - An array of objects representing each initial access token. Each object contains:
165
+ * - id: internal ID of the token
166
+ * - token: the actual token string to be used during dynamic registration
167
+ * - timestamp: Creation timestamp
168
+ * - expiration: Expiration time in seconds
169
+ * - count: Maximum allowed uses
170
+ * - remainingCount: How many uses are left
171
+ */
172
+
173
+ exports.getClientsInitialAccess=function(realmFilter){
174
+ return(kcAdminClientHandler.realms.getClientsInitialAccess(realmFilter));
175
+ }
176
+
177
+
178
+
179
+
180
+ /**
181
+ * ***************************** - delClientsInitialAccess - *******************************
182
+ * Deletes a specific Initial Access Token used for dynamic client registration in a given realm.
183
+ * This revokes the token, preventing any future use.
184
+ * @parameters:
185
+ * - realmFilter: is a JSON object that accepts filter parameters
186
+ * - realm:[required] The name of the realm where the token was created.
187
+ * - id:[required] The ID of the initial access token you want to delete.
188
+ */
189
+
190
+ exports.delClientsInitialAccess=function(realmFilter){
191
+ return(kcAdminClientHandler.realms.delClientsInitialAccess(realmFilter));
192
+ }
193
+
194
+ /**
195
+ * ***************************** - addDefaultGroup - *******************************
196
+ * Adds an existing group to the list of default groups for a given realm.
197
+ * Users created in this realm will automatically be added to all default groups.
198
+ * @parameters:
199
+ * - realmFilter: is a JSON object that accepts filter parameters
200
+ * - realm:[required] The name of the realm where the default group will be set.
201
+ * - id:[required] The ID of the group to be added as a default group
202
+ */
203
+
204
+ exports.addDefaultGroup=function(realmFilter){
205
+ return(kcAdminClientHandler.realms.addDefaultGroup(realmFilter));
206
+ }
207
+
208
+
209
+ /**
210
+ * ***************************** - removeDefaultGroup - *******************************
211
+ * Removes a group from the list of default groups in a realm.
212
+ * Default groups are automatically assigned to new users when they are created.
213
+ * @parameters:
214
+ * - realmFilter: is a JSON object that accepts filter parameters
215
+ * - realm:[required] The name of the realm from which to remove the default group.
216
+ * - id:[required] The ID of the group you want to remove from the default list.
217
+ */
218
+
219
+ exports.removeDefaultGroup=function(realmFilter){
220
+ return(kcAdminClientHandler.realms.removeDefaultGroup(realmFilter));
221
+ }
222
+
223
+ /**
224
+ * ***************************** - getDefaultGroups - *******************************
225
+ * Retrieves a list of all default groups for a specified realm.
226
+ * These are the groups that new users will automatically be added to upon creation.
227
+ * @parameters:
228
+ * - realmFilter: is a JSON object that accepts filter parameters
229
+ * - realm:[required] The name of the realm from which to retrieve default groups.
230
+ */
231
+ exports.getDefaultGroups=function(realmFilter){
232
+ return(kcAdminClientHandler.realms.getDefaultGroups(realmFilter));
233
+ }
234
+
235
+ /**
236
+ * ***************************** - getGroupByPath - *******************************
237
+ * Retrieves a group object by specifying its hierarchical path in a realm.
238
+ * This is useful when you know the group’s full path (e.g., /parent/child) but not its ID.
239
+ * @parameters:
240
+ * - realmFilter: is a JSON object that accepts filter parameters
241
+ * - realm:[required] The name of the realm where the group is located.
242
+ * - path:[required] TThe full hierarchical path to the group, starting with a slash (/). For example: /developers/frontend.
243
+ */
244
+ exports.getGroupByPath=function(realmFilter){
245
+ return(kcAdminClientHandler.realms.getGroupByPath(realmFilter));
246
+ }
247
+
248
+ /**
249
+ * ***************************** - getConfigEvents - *******************************
250
+ * Retrieves the event configuration settings for a specific realm.
251
+ * This includes settings related to the event listeners, enabled event types, admin events, and more.
252
+ * Useful for auditing and tracking activities inside Keycloak.
253
+ * @parameters:
254
+ * - realmFilter: is a JSON object that accepts filter parameters
255
+ * - realm:[required] The name of the realm from which to retrieve the event configuration.
256
+ */
257
+ exports.getConfigEvents=function(realmFilter){
258
+ return(kcAdminClientHandler.realms.getConfigEvents(realmFilter));
259
+ }
260
+
261
+
262
+ /**
263
+ * ***************************** - updateConfigEvents - *******************************
264
+ * Updates the event configuration for a given realm.
265
+ * This includes enabling/disabling events, setting specific event types to track,
266
+ * enabling admin event logging, and choosing which event listeners to use.
267
+ * @parameters:
268
+ * - realmFilter: is a JSON object that accepts filter parameters
269
+ * - realm:[required] The name of the realm where the configuration will be updated.
270
+ * - configurationEvents:is a config events JSON object dictionary like this:
271
+ * - eventsEnabled: Enables or disables event logging.
272
+ * - eventsListeners: List of event listener IDs to use (e.g., ["jboss-logging"]).
273
+ * - enabledEventTypes: List of event types to track (e.g., ["LOGIN", "LOGOUT", "REGISTER"]).
274
+ * - adminEventsEnabled: Enables logging for admin events.
275
+ * - adminEventsDetailsEnabled: Includes full details in admin event logs if set to true.
276
+ */
277
+ exports.updateConfigEvents=function(realmFilter,configurationEvents){
278
+ return(kcAdminClientHandler.realms.updateConfigEvents(realmFilter,configurationEvents));
279
+ }
280
+
281
+
282
+ /**
283
+ * ***************************** - findEvents - *******************************
284
+ * Retrieves a list of events that occurred in a specified realm.
285
+ * You can filter the results by event type, user, date range, and other criteria.
286
+ * Useful for auditing login, logout, and other user-related activities.
287
+ * @parameters:
288
+ * - realmFilter: is a JSON object that accepts filter parameters
289
+ * - realm: [required] The name of the realm to fetch events from.
290
+ * - client: [optional] Client ID to filter events for a specific client.
291
+ * - type: [optional] Event type to filter (e.g., LOGIN, REGISTER).
292
+ * - user: [optional] User ID to filter events related to a specific user.
293
+ * - dateFrom: [optional] Start date in ISO 8601 format to filter events.
294
+ * - dateTo: [optional] End date in ISO 8601 format to filter events.
295
+ * - first: [optional] Pagination offset.
296
+ * - max: [optional] Maximum number of events to return.
297
+ */
298
+ exports.findEvents=function(realmFilter){
299
+ return(kcAdminClientHandler.realms.findEvents(realmFilter));
300
+ }
301
+
302
+ /**
303
+ * ***************************** - findAdminEvents - *******************************
304
+ * Retrieves administrative events that occurred in a specific realm.
305
+ * Admin events are triggered by actions such as creating users, updating roles, or modifying realm settings.
306
+ * This is useful for auditing changes made via the admin API or admin console.
307
+ * @parameters:
308
+ * - realmFilter: is a JSON object that accepts filter parameters
309
+ * - realm: [required] The name of the realm to retrieve admin events from.
310
+ * - authClient: [optional] Client ID used to perform the action.
311
+ * - authIpAddress: [optional] IP address of the actor who triggered the event.
312
+ * - authRealm: [optional] Realm of the actor.
313
+ * - authUser: [optional] User ID of the admin who performed the action.
314
+ * - dateFrom: [optional] Start date in ISO 8601 format.
315
+ * - dateTo: [optional] End date in ISO 8601 format.
316
+ * - first: [optional] Pagination offset.
317
+ * - max: [optional] Maximum number of events to retrieve.
318
+ * - operationTypes: [optional] Filter by operation type (e.g., CREATE, UPDATE, DELETE).
319
+ * - resourcePath: [optional] Filter events by resource path.
320
+ * - resourceTypes: [optional] Filter events by resource type (e.g., USER, REALM_ROLE, CLIENT).
321
+ */
322
+ exports.findAdminEvents=function(realmFilter){
323
+ return(kcAdminClientHandler.realms.findAdminEvents(realmFilter));
324
+ }
325
+
326
+
327
+ /**
328
+ * ***************************** - clearEvents - *******************************
329
+ * Deletes all user events (not admin events) from the event store of a specific realm.
330
+ * Useful for resetting or cleaning up event logs related to user actions such as logins, logouts, failed login attempts, etc.
331
+ * This does not clear administrative events. To remove those, use realms.clearAdminEvents().
332
+ * @parameters:
333
+ * - realmFilter: is a JSON object that accepts filter parameters
334
+ * - realm: [required] The name of the realm from which to clear user events.
335
+ */
336
+ exports.clearEvents=function(realmFilter){
337
+ return(kcAdminClientHandler.realms.clearEvents(realmFilter));
338
+ }
339
+
340
+
341
+
342
+ /**
343
+ * ***************************** - clearAdminEvents - *******************************
344
+ * Deletes all admin events from the event store of a specific realm.
345
+ * Admin events include actions such as creating users, updating roles, changing client settings, etc.,
346
+ * performed by administrators via the Admin Console or Admin REST API.
347
+ * @parameters:
348
+ * - realmFilter: is a JSON object that accepts filter parameters
349
+ * - realm: [required] The name of the realm from which to clear administrative events.
350
+ */
351
+ exports.clearAdminEvents=function(realmFilter){
352
+ return(kcAdminClientHandler.realms.clearAdminEvents(realmFilter));
353
+ }
354
+
355
+
356
+ /**
357
+ * ***************************** - getUsersManagementPermissions - *******************************
358
+ * Retrieves the status and configuration of user management permissions (also known as fine-grained permissions) in a specific realm.
359
+ * This allows you to check whether user management operations (like creating, updating, or deleting users) are protected by specific roles or policies.
360
+ *
361
+ * @parameters:
362
+ * - realmFilter: is a JSON object that accepts filter parameters
363
+ * - realm: [required] The name of the realm for which you want to retrieve the user management permission settings.
364
+ */
365
+ exports.getUsersManagementPermissions=function(realmFilter){
366
+ return(kcAdminClientHandler.realms.getUsersManagementPermissions(realmFilter));
367
+ }
368
+
369
+
370
+ /**
371
+ * ***************************** - updateUsersManagementPermissions - *******************************
372
+ * Enables or disables fine-grained user management permissions in a specified realm.
373
+ * This controls whether operations on users (such as creating, editing, or deleting users)
374
+ * are protected using Keycloak's authorization services.
375
+ * @parameters:
376
+ * - update-parameters: is a JSON object that accepts this parameters
377
+ * - realm: [required] The name of the realm for which you want to update the user management permission settings.
378
+ * - enabled: [required] boolean value to enable or disable permission
379
+ * - true: Activates fine-grained permissions for user management.
380
+ * - false: Disables fine-grained permissions and falls back to standard admin roles.
381
+ */
382
+ exports.updateUsersManagementPermissions=function(updateParameters){
383
+ return(kcAdminClientHandler.realms.updateUsersManagementPermissions(updateParameters));
384
+ }
385
+
386
+ /**
387
+ * ***************************** - getKeys - *******************************
388
+ * Retrieves the realm keys metadata, including public keys, certificates, and active key information
389
+ * used for token signing, encryption, and other cryptographic operations in the specified realm.
390
+ * @parameters:
391
+ * - filter: is a JSON object that accepts this parameters
392
+ * - realm: [required] The name of the realm for which you want to retrieve key metadata.
393
+ *
394
+ * Returns a list of keys and related information:
395
+ */
396
+ exports.getKeys=function(filter){
397
+ return(kcAdminClientHandler.realms.getKeys(filter));
398
+ }
399
+
400
+
401
+
402
+
403
+ /**
404
+ * ***************************** - getClientSessionStats - *******************************
405
+ * Retrieves statistics about active client sessions in the specified realm. This includes the number of active sessions per client.
406
+ * @parameters:
407
+ * - filter: is a JSON object that accepts this parameters
408
+ * - realm: [required] The name of the realm for which you want to retrieve client session statistics.
409
+ *
410
+ * Returns an array of objects, each representing a client with active sessions
411
+ */
412
+ exports.getClientSessionStats=function(filter){
413
+ return(kcAdminClientHandler.realms.getClientSessionStats(filter));
414
+ }
415
+
416
+
417
+ /**
418
+ * ***************************** - pushRevocation - *******************************
419
+ * Immediately pushes a revocation policy to all clients in the specified realm.
420
+ * This forces clients to revalidate tokens, effectively revoking cached access tokens and enforcing updated policies.
421
+ * @parameters:
422
+ * - filter: is a JSON object that accepts this parameters
423
+ * - realm: [required] The name of the realm where the revocation should be pushed.
424
+ */
425
+ exports.pushRevocation=function(filter){
426
+ return(kcAdminClientHandler.realms.pushRevocation(filter));
427
+ }
428
+
429
+ /**
430
+ * ***************************** - logoutAll - *******************************
431
+ * Logs out all active sessions for all users in the specified realm.
432
+ * This invalidates all user sessions, forcing every user to re-authenticate.
433
+ * @parameters:
434
+ * - filter: is a JSON object that accepts this parameters
435
+ * - realm: [required] The name of the realm from which to log out all users.
436
+ */
437
+ exports.logoutAll=function(filter){
438
+ return(kcAdminClientHandler.realms.logoutAll(filter));
439
+ }
440
+
441
+ /**
442
+ * ***************************** - testLDAPConnection - *******************************
443
+ * Tests the connection to an LDAP server using the provided configuration parameters.
444
+ * This is useful to verify that Keycloak can reach and authenticate with the LDAP server before
445
+ * fully integrating it into the realm configuration.
446
+ * @parameters:
447
+ * - filter: is a JSON object that accepts this filter parameters
448
+ * - realm: [required] Name of the realm where the LDAP provider is being tested.
449
+ * - options: is a JSON object that accepts this parameters
450
+ * - action: [required] Specifies the test type. Use "testConnection" to verify the connection, or "testAuthentication" to verify bind credentials.
451
+ * - connectionUrl: [required] URL of the LDAP server (e.g., ldap://ldap.example.com:389).
452
+ * - bindDn: [required] Distinguished Name (DN) used to bind to the LDAP server.
453
+ * - bindCredential: [required] Password or secret associated with the bind DN.
454
+ * - useTruststoreSpi: [optional] Whether to use the truststore ("ldapsOnly", "always", etc.).
455
+ * - connectionTimeout: [optional] Timeout value for the connection (in milliseconds).
456
+ * - authType: [optional] Type of authentication; usually "simple" or "none".
457
+ */
458
+ exports.testLDAPConnection=function(filter,options){
459
+ return(kcAdminClientHandler.realms.testLDAPConnection(filter,options));
460
+ }
461
+
462
+
463
+
464
+ /**
465
+ * ***************************** - ldapServerCapabilities - *******************************
466
+ * This function queries the LDAP server configured for a specific realm to retrieve and display its supported capabilities.
467
+ * It helps validate the connection and understand which LDAP features are available,
468
+ * such as supported controls, extensions, authentication mechanisms, and more.
469
+ * @parameters:
470
+ * - filter: is a JSON object that accepts this filter parameters
471
+ * - realm: [required] Name of the realm where the LDAP provider is being tested.
472
+ * - options: is a JSON object that accepts this parameters
473
+ * - action: [required] Specifies the test type. Use "testConnection" to verify the connection, or "testAuthentication" to verify bind credentials.
474
+ * - connectionUrl: [required] URL of the LDAP server (e.g., ldap://ldap.example.com:389).
475
+ * - bindDn: [required] Distinguished Name (DN) used to bind to the LDAP server.
476
+ * - bindCredential: [required] Password or secret associated with the bind DN.
477
+ * - useTruststoreSpi: [optional] Whether to use the truststore ("ldapsOnly", "always", etc.).
478
+ * - connectionTimeout: [optional] Timeout value for the connection (in milliseconds).
479
+ * - authType: [optional] Type of authentication; usually "simple" or "none".
480
+ */
481
+ exports.ldapServerCapabilities=function(filter,options){
482
+ return(kcAdminClientHandler.realms.ldapServerCapabilities(filter,options));
483
+ }
484
+
485
+
486
+
487
+ /**
488
+ * ***************************** - testSMTPConnection - *******************************
489
+ * Tests the SMTP connection using the provided configuration.
490
+ * This allows you to verify that Keycloak can connect and send emails through the configured
491
+ * SMTP server before applying the settings to the realm.
492
+ * @parameters:
493
+ * - filter: is a JSON object that accepts this filter parameters
494
+ * - realm: [required] The name of the realm where the SMTP server will be tested.
495
+ * - config: An object containing the SMTP server configuration:
496
+ * - from: [required] The sender email address.
497
+ * - host: [required] The SMTP server host (e.g., smtp.example.com).
498
+ * - port: [required] The SMTP server port (usually 587, 465, or 25).
499
+ * - auth: [optional] Whether authentication is required ("true" or "false").
500
+ * - user [optional] The username for SMTP authentication.
501
+ * - password [optional] The password for SMTP authentication.
502
+ * - replyTo [optional] The reply-to email address.
503
+ * - starttls [optional] Enable STARTTLS ("true" or "false").
504
+ * - ssl [optional] Enable SSL ("true" or "false").
505
+ * - envelopeFrom [optional] Envelope sender address.
506
+ */
507
+ exports.testSMTPConnection=function(filter,config){
508
+ return(kcAdminClientHandler.realms.testSMTPConnection(filter,config));
509
+ }
510
+
511
+ /**
512
+ * ***************************** - getRealmLocalizationTexts - *******************************
513
+ * Retrieves all localization texts (custom messages and labels) defined for a specific realm and locale.
514
+ * Localization texts are used to override default Keycloak UI messages for login forms, error pages, and other user-facing content
515
+ * @parameters:
516
+ * - filter: is a JSON object that accepts this filter parameters
517
+ * - realm: [required] The name of the realm from which to fetch localization texts.
518
+ * - selectedLocale: [required] The locale code (e.g., 'en', 'it', 'fr', etc.) for which you want to retrieve the translations.
519
+ */
520
+ exports.getRealmLocalizationTexts=function(filter){
521
+ return(kcAdminClientHandler.realms.getRealmLocalizationTexts(filter));
522
+ }
523
+
524
+
525
+
526
+ /**
527
+ * ***************************** - addLocalization - *******************************
528
+ * Adds or updates a localization text (custom UI message or label) for a specific realm and locale in Keycloak.
529
+ * This allows you to override default messages in the login screens and other UI components with custom translations.
530
+ * @parameters:
531
+ * - filter: is a JSON object that accepts this filter parameters
532
+ * - realm: [required] The name of the realm where the localization should be applied.
533
+ * - selectedLocale: [required] The locale code (e.g., 'en', 'fr', 'it') for which the translation is being added.
534
+ * - key: [required] The message key or identifier to override (e.g., loginAccountTitle, errorInvalidUsername).
535
+ * - value: [required] The actual translated text to associate with the key for the given locale.
536
+ */
537
+ exports.addLocalization=function(filter,value){
538
+ return(kcAdminClientHandler.realms.addLocalization(filter,value));
539
+ }
540
+
541
+
542
+
543
+ /**
544
+ * ***************************** - getRealmSpecificLocales - *******************************
545
+ * Retrieves the list of locales (language codes) for which custom localization texts have been defined in a specific realm.
546
+ * This function is useful to determine which locales have at least one overridden message.
547
+ * @parameters:
548
+ * - filter: is a JSON object that accepts this filter parameters
549
+ * - realm: [required] The name of the realm for which to fetch the list of custom locales.
550
+ * - selectedLocale: [optional] The locale code (e.g., 'en', 'fr', 'it').
551
+ *
552
+ * Return An array of locale codes (e.g., ["en", "it", "fr"]) representing the languages that have at least
553
+ * one customized localization entry in the given realm.
554
+ */
555
+ exports.getRealmSpecificLocales=function(filter){
556
+ return(kcAdminClientHandler.realms.getRealmSpecificLocales(filter));
557
+ }
558
+
559
+
560
+
561
+ /**
562
+ * ***************************** - deleteRealmLocalizationTexts - *******************************
563
+ * Deletes a specific custom localization text entry for a given locale and key within a realm.
564
+ * This is useful when you want to remove a previously added or overridden message from the realm's custom localization.
565
+ * @parameters:
566
+ * - filter: is a JSON object that accepts this filter parameters
567
+ * - realm: [required] The name of the realm where the localization entry exists.
568
+ * - selectedLocale: [required] The locale code (e.g., 'en', 'fr', 'it').
569
+ * - key: [optional] The key identifying the message you want to remove. If no key is specified, all keys will be removed
570
+ *
571
+ * Returns void if the deletion is successful. Will throw an error if the entry does not exist or if parameters are invalid.
572
+ */
573
+ exports.deleteRealmLocalizationTexts=function(filter){
574
+ return(kcAdminClientHandler.realms.deleteRealmLocalizationTexts(filter));
575
+ }