keycloak-api-manager 1.0.0 → 2.0.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/workspace.xml +19 -2
- package/Handlers/authenticationManagementHandler.js +602 -0
- package/Handlers/clientScopesHandler.js +567 -0
- package/Handlers/clientsHandler.js +1411 -0
- package/Handlers/componentsHandler.js +130 -0
- package/Handlers/groupsHandler.js +293 -0
- package/Handlers/identityProvidersHandler.js +255 -0
- package/Handlers/realmsHandler.js +575 -0
- package/Handlers/rolesHandler.js +196 -0
- package/Handlers/usersHandler.js +559 -0
- package/README.md +158 -67
- package/index.js +35 -1148
- package/package.json +1 -1
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **************************************************************************************************
|
|
3
|
+
* **************************************************************************************************
|
|
4
|
+
* The clientScopes resource allows you to manage client scopes in Keycloak.
|
|
5
|
+
* Client scopes are reusable sets of protocol mappers and role scope mappings which
|
|
6
|
+
* can be assigned to clients to define what information about the user is included in tokens and
|
|
7
|
+
* what roles are available
|
|
8
|
+
* **************************************************************************************************
|
|
9
|
+
* **************************************************************************************************
|
|
10
|
+
*/
|
|
11
|
+
let kcAdminClientHandler=null;
|
|
12
|
+
exports.setKcAdminClient=function(kcAdminClient){
|
|
13
|
+
kcAdminClientHandler=kcAdminClient;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* ***************************** - CREATE - *******************************
|
|
19
|
+
* create method is used to create a new client scope in a Keycloak realm.
|
|
20
|
+
* A client scope defines a set of protocol mappers and roles that can be applied to clients,
|
|
21
|
+
* such as during login or token generation.
|
|
22
|
+
*/
|
|
23
|
+
exports.create=function(scopeRappresentation){
|
|
24
|
+
return (kcAdminClientHandler.clientScopes.create(scopeRappresentation ));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ***************************** - update - *******************************
|
|
31
|
+
* The method updates the configuration of an existing client scope in a realm.
|
|
32
|
+
* You can modify properties such as the scope’s name, description, attributes, or protocol mappers.
|
|
33
|
+
*
|
|
34
|
+
* @parameters:
|
|
35
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
36
|
+
* - id: [required] The unique ID of the client scope to update.
|
|
37
|
+
* - realm: [optional] The realm where the client scope exists.
|
|
38
|
+
* - scopeRappresentation: The updated client scope object.
|
|
39
|
+
* - name: [optional] The name of the scope
|
|
40
|
+
* - description: [optional] The scope description
|
|
41
|
+
* - {other scope fields}
|
|
42
|
+
*/
|
|
43
|
+
exports.update=function(filter,scopeRappresentation){
|
|
44
|
+
return (kcAdminClientHandler.clientScopes.update(filter,scopeRappresentation ));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* ***************************** - del - *******************************
|
|
51
|
+
* The method deletes a client scope from a realm in Keycloak.
|
|
52
|
+
* Once deleted, the client scope will no longer be available for assignment to clients (either as default, optional, or manually).
|
|
53
|
+
* @parameters:
|
|
54
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
55
|
+
* - id: [required] The unique ID of the client scope to delete.
|
|
56
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
57
|
+
*/
|
|
58
|
+
exports.del=function(filter){
|
|
59
|
+
return (kcAdminClientHandler.clientScopes.del(filter));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* ***************************** - delByName - *******************************
|
|
65
|
+
* This method removes a client scope from the realm using its unique name.
|
|
66
|
+
* It's an alternative to deleting by ID when the scope's name is known.
|
|
67
|
+
*
|
|
68
|
+
* @parameters:
|
|
69
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
70
|
+
* - name: [required] The name of the client scope to delete. This must match exactly with the registered name in the realm.
|
|
71
|
+
*/
|
|
72
|
+
exports.delByName=function(filter){
|
|
73
|
+
return (kcAdminClientHandler.clientScopes.delByName(filter));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* ***************************** - find - *******************************
|
|
80
|
+
* The method retrieves the list of client scopes defined in a realm.
|
|
81
|
+
* Client scopes represent a set of protocol mappers and roles that can be assigned to clients, either as default, optional, or manually added.
|
|
82
|
+
*
|
|
83
|
+
* @parameters:
|
|
84
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
85
|
+
* - realm: [optional] The realm where client scopes are defined.
|
|
86
|
+
* - search: [optional] A search string to filter client scopes by name.
|
|
87
|
+
* - first: [optional] Index of the first result (for pagination).
|
|
88
|
+
* - max: [optional] Maximum number of results to return
|
|
89
|
+
*/
|
|
90
|
+
exports.find=function(filter){
|
|
91
|
+
return (kcAdminClientHandler.clientScopes.find(filter));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* ***************************** - findOne - *******************************
|
|
96
|
+
* The method retrieves the details of a specific client scope in a realm by its unique identifier (ID).
|
|
97
|
+
* It’s useful when you need the full configuration of a particular client scope, including protocol mappers and assigned roles.
|
|
98
|
+
*
|
|
99
|
+
* @parameters:
|
|
100
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
101
|
+
* - id: [required] The unique ID of the client scope.
|
|
102
|
+
* - realm: [optional] The realm where the client scope is defined
|
|
103
|
+
*/
|
|
104
|
+
exports.findOne=function(filter){
|
|
105
|
+
return (kcAdminClientHandler.clientScopes.findOne(filter));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* ***************************** - findOneByName - *******************************
|
|
111
|
+
* The method is used to retrieve a specific client scope by its name.
|
|
112
|
+
* This is useful when you know the name of a client scope and want to fetch its full details,
|
|
113
|
+
* including its ID, protocol, and other settings.
|
|
114
|
+
*
|
|
115
|
+
* @parameters:
|
|
116
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
117
|
+
* - name: [required] The name of the client scope you're searching for.
|
|
118
|
+
*/
|
|
119
|
+
exports.findOneByName=function(filter){
|
|
120
|
+
return (kcAdminClientHandler.clientScopes.findOneByName(filter));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* ***************************** - listDefaultClientScopes - *******************************
|
|
126
|
+
* The method retrieves the list of default client scopes configured in a realm.
|
|
127
|
+
* Default client scopes are automatically assigned to newly created clients
|
|
128
|
+
* in that realm (for example, profile, email, roles)
|
|
129
|
+
*
|
|
130
|
+
* @parameters:
|
|
131
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
132
|
+
* - realm: [optional] The realm where the client scopes are defined.
|
|
133
|
+
* - first: [optional] Index of the first result (for pagination).
|
|
134
|
+
* - max: [optional] Maximum number of results to return.
|
|
135
|
+
*/
|
|
136
|
+
exports.listDefaultClientScopes=function(filter){
|
|
137
|
+
return (kcAdminClientHandler.clientScopes.listDefaultClientScopes(filter));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* ***************************** - addDefaultClientScope - *******************************
|
|
144
|
+
* The method adds a client scope to the list of default client scopes of a realm in Keycloak.
|
|
145
|
+
* Default client scopes are automatically assigned to all newly created clients within the realm.
|
|
146
|
+
*
|
|
147
|
+
* @parameters:
|
|
148
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
149
|
+
* - id: [required] The ID of the client scope to add as a default.
|
|
150
|
+
* - realm: [optional] The realm where the client scopes are defined.
|
|
151
|
+
*/
|
|
152
|
+
exports.addDefaultClientScope=function(filter){
|
|
153
|
+
return (kcAdminClientHandler.clientScopes.addDefaultClientScope(filter));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* ***************************** - delDefaultClientScope - *******************************
|
|
159
|
+
* The method removes a client scope from the list of default client scopes of a realm in Keycloak.
|
|
160
|
+
* Default client scopes are automatically assigned to newly created clients in that realm.
|
|
161
|
+
* Removing one prevents it from being included by default.
|
|
162
|
+
*
|
|
163
|
+
* @parameters:
|
|
164
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
165
|
+
* - id: [required] The ID of the client scope to remove from the default list.
|
|
166
|
+
* - realm:: [optional] The realm where the client scope is defined.
|
|
167
|
+
*/
|
|
168
|
+
exports.delDefaultClientScope=function(filter){
|
|
169
|
+
return (kcAdminClientHandler.clientScopes.delDefaultClientScope(filter));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* ***************************** - listDefaultOptionalClientScopes - *******************************
|
|
175
|
+
* The method retrieves the list of default optional client scopes in a realm.
|
|
176
|
+
* Optional client scopes are available for clients to select but are not automatically applied when a new client is created.
|
|
177
|
+
*
|
|
178
|
+
* @parameters:
|
|
179
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
180
|
+
* - realm:: [optional] The realm where the client scope is defined
|
|
181
|
+
*/
|
|
182
|
+
exports.listDefaultOptionalClientScopes=function(filter){
|
|
183
|
+
return (kcAdminClientHandler.clientScopes.listDefaultOptionalClientScopes(filter));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* ***************************** - addDefaultOptionalClientScope - *******************************
|
|
188
|
+
* The method adds a client scope to the list of default optional client scopes in a realm.
|
|
189
|
+
* Optional client scopes are available to clients for selection but are not automatically applied when a new client is created.
|
|
190
|
+
*
|
|
191
|
+
* @parameters:
|
|
192
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
193
|
+
* - id: [required] The ID of the client scope to add as a default optional scope.
|
|
194
|
+
* - realm:: [optional] The realm where the client scope is defined
|
|
195
|
+
*/
|
|
196
|
+
exports.addDefaultOptionalClientScope=function(filter){
|
|
197
|
+
return (kcAdminClientHandler.clientScopes.addDefaultOptionalClientScope(filter));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* ***************************** - delDefaultOptionalClientScope - *******************************
|
|
203
|
+
* The method removes a client scope from the list of default optional client scopes of a realm in Keycloak.
|
|
204
|
+
* Optional client scopes are scopes that can be assigned to clients on demand.
|
|
205
|
+
* By default, they are available to clients but not automatically applied unless explicitly selected.
|
|
206
|
+
* Removing one prevents it from being listed as optional for new clients.
|
|
207
|
+
*
|
|
208
|
+
* @parameters:
|
|
209
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
210
|
+
* - id: [required] The ID of the client scope to remove from the optional list.
|
|
211
|
+
* - realm:: [optional] The realm where the client scope is defined.
|
|
212
|
+
*/
|
|
213
|
+
exports.delDefaultOptionalClientScope=function(filter){
|
|
214
|
+
return (kcAdminClientHandler.clientScopes.delDefaultOptionalClientScope(filter));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* ***************************** - findProtocolMapperByName - *******************************
|
|
220
|
+
* The method retrieves a protocol mapper from a specific client scope by its name.
|
|
221
|
+
* Protocol mappers define how user attributes, roles, or other data are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
222
|
+
*
|
|
223
|
+
* @parameters:
|
|
224
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
225
|
+
* - id: [required] The ID of the client scope to search within.
|
|
226
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
227
|
+
* - name: [optional] The name of the protocol mapper to find
|
|
228
|
+
*/
|
|
229
|
+
exports.findProtocolMapperByName=function(filter){
|
|
230
|
+
return (kcAdminClientHandler.clientScopes.findProtocolMapperByName(filter));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* ***************************** - findProtocolMapper - *******************************
|
|
235
|
+
* The method retrieves a specific protocol mapper from a client scope in a realm, using its mapper ID.
|
|
236
|
+
* Protocol mappers define how user attributes, roles, or other information are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
237
|
+
*
|
|
238
|
+
* @parameters:
|
|
239
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
240
|
+
* - id: [required] The ID of the client scope containing the protocol mapper.
|
|
241
|
+
* - mapperId: [required] The ID of the protocol mapper to retrieve.
|
|
242
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
243
|
+
*/
|
|
244
|
+
exports.findProtocolMapper=function(filter){
|
|
245
|
+
return (kcAdminClientHandler.clientScopes.findProtocolMapper(filter));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* ***************************** - findProtocolMappersByProtocol - *******************************
|
|
250
|
+
* The method retrieves all protocol mappers of a given protocol (e.g., openid-connect or saml) for a specific client scope in a realm.
|
|
251
|
+
* This is useful when you want to filter protocol mappers by the authentication protocol they are associated with.
|
|
252
|
+
* @parameters:
|
|
253
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
254
|
+
* - id: [required] The ID of the client scope to search within.
|
|
255
|
+
* - protocol: [required] The protocol to filter by (e.g., "openid-connect", "saml").
|
|
256
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
257
|
+
*/
|
|
258
|
+
exports.findProtocolMappersByProtocol=function(filter){
|
|
259
|
+
return (kcAdminClientHandler.clientScopes.findProtocolMappersByProtocol(filter));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* ***************************** - delProtocolMapper - *******************************
|
|
265
|
+
* The method deletes a protocol mapper from a specific client scope in a realm.
|
|
266
|
+
* Protocol mappers define how user attributes, roles, or other information are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
267
|
+
* Deleting a mapper removes its configuration from the client scope.
|
|
268
|
+
* @parameters:
|
|
269
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
270
|
+
* - id: [required] The ID of the client scope containing the protocol mapper
|
|
271
|
+
* - mapperId: [required] The ID of the protocol mapper to delete
|
|
272
|
+
* - realm: [optional] The realm where the client scope is defined
|
|
273
|
+
*/
|
|
274
|
+
exports.delProtocolMapper=function(filter){
|
|
275
|
+
return (kcAdminClientHandler.clientScopes.delProtocolMapper(filter));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* ***************************** - listProtocolMappers - *******************************
|
|
280
|
+
* The method retrieves all protocol mappers associated with a specific client scope in a realm.
|
|
281
|
+
* Protocol mappers define how user attributes, roles, or other data are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
282
|
+
* @parameters:
|
|
283
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
284
|
+
* - id: [required] The ID of the client scope to list protocol mappers from.
|
|
285
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
286
|
+
*/
|
|
287
|
+
exports.listProtocolMappers=function(filter){
|
|
288
|
+
return (kcAdminClientHandler.clientScopes.listProtocolMappers(filter));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* ***************************** - addMultipleProtocolMappers - *******************************
|
|
295
|
+
* The method adds multiple protocol mappers to a specific client scope in a realm.
|
|
296
|
+
* Protocol mappers define how user attributes, roles, or other data are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
297
|
+
* With this method, you can configure several mappers in a single request.
|
|
298
|
+
* @parameters:
|
|
299
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
300
|
+
* - id: [required] The ID of the client scope where the protocol mappers should be added.
|
|
301
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
302
|
+
* - protocolMappers: An array of protocol mapper definitions to add. Each ProtocolMapperRepresentation typically includes:
|
|
303
|
+
* - name: [required] The mapper’s name.
|
|
304
|
+
* - protocol: [required] Usually "openid-connect" or "saml".
|
|
305
|
+
* - protocolMapper: [required] The mapper type, e.g., "oidc-usermodel-property-mapper".
|
|
306
|
+
* - config: [optional] Mapper-specific configuration (e.g., user attribute, claim name, JSON type). example:
|
|
307
|
+
* - "user.attribute": "email"
|
|
308
|
+
* - "claim.name": "email"
|
|
309
|
+
* - "jsonType.label": "String"
|
|
310
|
+
* - consentRequired: [optional] Whether user consent is required
|
|
311
|
+
*/
|
|
312
|
+
exports.addMultipleProtocolMappers=function(filter,protocolMappers){
|
|
313
|
+
return (kcAdminClientHandler.clientScopes.addMultipleProtocolMappers(filter,protocolMappers));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* ***************************** - addProtocolMapper - *******************************
|
|
321
|
+
* The method adds a single protocol mapper to a specific client scope in a realm.
|
|
322
|
+
* Protocol mappers define how user attributes, roles, or other information are mapped into tokens (ID token, access token, or user info) in Keycloak.
|
|
323
|
+
*
|
|
324
|
+
* @parameters:
|
|
325
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
326
|
+
* - id: [required] The ID of the client scope where the protocol mapper should be added.
|
|
327
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
328
|
+
* - protocolMapper: A protocol mapper definitions to add.
|
|
329
|
+
* - name: [required] The mapper’s name.
|
|
330
|
+
* - protocol: [required] Usually "openid-connect" or "saml".
|
|
331
|
+
* - protocolMapper: [required] The mapper type, e.g., "oidc-usermodel-property-mapper".
|
|
332
|
+
* - config: [optional] Mapper-specific configuration (e.g., user attribute, claim name, JSON type). example:
|
|
333
|
+
* - "user.attribute": "email"
|
|
334
|
+
* - "claim.name": "email"
|
|
335
|
+
* - "jsonType.label": "String"
|
|
336
|
+
* - consentRequired: [optional] Whether user consent is required.
|
|
337
|
+
*/
|
|
338
|
+
exports.addProtocolMapper=function(filter,protocolMapper){
|
|
339
|
+
return (kcAdminClientHandler.clientScopes.addProtocolMapper(filter,protocolMapper));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* ***************************** - updateProtocolMapper - *******************************
|
|
345
|
+
* The method updates an existing protocol mapper in a specific client scope of a realm.
|
|
346
|
+
* Protocol mappers define how user attributes, roles, or other information are mapped into tokens (ID token, access token, or user info).
|
|
347
|
+
* With this method, you can modify an existing mapper’s configuration.
|
|
348
|
+
*
|
|
349
|
+
* @parameters:
|
|
350
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
351
|
+
* - id: [required] The ID of the client scope where the protocol mapper should be updated.
|
|
352
|
+
* - mapperId: [required] The ID of the protocol mapper to update.
|
|
353
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
354
|
+
* - protocolMapper: The updated definition of the protocol mapper.
|
|
355
|
+
* - name: [required] The mapper’s name.
|
|
356
|
+
* - protocol: [required] Usually "openid-connect" or "saml".
|
|
357
|
+
* - protocolMapper: [required] The mapper type, e.g., "oidc-usermodel-property-mapper".
|
|
358
|
+
* - config: [optional] Mapper-specific configuration (e.g., user attribute, claim name, JSON type). example:
|
|
359
|
+
* - "user.attribute": "email"
|
|
360
|
+
* - "claim.name": "email"
|
|
361
|
+
* - "jsonType.label": "String"
|
|
362
|
+
* - consentRequired: [optional] Whether user consent is required.
|
|
363
|
+
*/
|
|
364
|
+
exports.updateProtocolMapper=function(filter,protocolMapper){
|
|
365
|
+
return (kcAdminClientHandler.clientScopes.updateProtocolMapper(filter,protocolMapper));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* ***************************** - listScopeMappings - *******************************
|
|
371
|
+
* The method retrieves all scope mappings for a given client scope in a realm.
|
|
372
|
+
* Scope mappings define which roles (from realm roles or client roles) are granted to a client scope.
|
|
373
|
+
* These roles determine the permissions and access tokens issued for clients using this scope.
|
|
374
|
+
* @parameters:
|
|
375
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
376
|
+
* - id: [required] The ID of the client scope to list scope mapping.
|
|
377
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
378
|
+
*/
|
|
379
|
+
exports.listScopeMappings=function(filter){
|
|
380
|
+
return (kcAdminClientHandler.clientScopes.listScopeMappings(filter));
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* ***************************** - listAvailableClientScopeMappings - *******************************
|
|
386
|
+
* The method retrieves the list of available client roles that can be mapped to a given client scope but are not yet assigned.
|
|
387
|
+
* This helps identify which roles from a specific client are still available to be added to the client scope.
|
|
388
|
+
*
|
|
389
|
+
* @parameters:
|
|
390
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
391
|
+
* - id: [required] The ID of the client scope to list available scope mapping.
|
|
392
|
+
* - client: [required] The client ID (client UUID or client identifier) from which to list available roles
|
|
393
|
+
* - realm: [optional] The realm where the client scope is defined
|
|
394
|
+
*/
|
|
395
|
+
exports.listAvailableClientScopeMappings=function(filter){
|
|
396
|
+
return (kcAdminClientHandler.clientScopes.listAvailableClientScopeMappings(filter));
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* ***************************** - addClientScopeMappings - *******************************
|
|
402
|
+
* The method adds one or more client roles from a specific client to a given client scope in a realm.
|
|
403
|
+
* This means the client scope will include the selected roles, and any client using this scope will inherit these permissions in its tokens.
|
|
404
|
+
*
|
|
405
|
+
* @parameters:
|
|
406
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
407
|
+
* - id: [required] ID of the client scope.
|
|
408
|
+
* - client: [required] The client ID (client UUID or client identifier) whose roles are being mapped.
|
|
409
|
+
* - realm : [optional] The realm where the client scope is defined.
|
|
410
|
+
* - RoleRepresentation: An array of role definitions to add. Each RoleRepresentation typically includes(or at least their id and/or name):
|
|
411
|
+
* - id : [optional] The role ID.
|
|
412
|
+
* - name : [optional] The role name.
|
|
413
|
+
* - description: [optional] A description of the role.
|
|
414
|
+
* - clientRole: [optional]: Whether this role belongs to a client.
|
|
415
|
+
* - containerId: [optional] The ID of the client containing the role.
|
|
416
|
+
*/
|
|
417
|
+
exports.addClientScopeMappings=function(filter,roleRepresentation){
|
|
418
|
+
return (kcAdminClientHandler.clientScopes.addClientScopeMappings(filter,roleRepresentation));
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* ***************************** - delClientScopeMappings - *******************************
|
|
425
|
+
* The method removes one or more client role mappings from a given client scope in a realm.
|
|
426
|
+
* This allows you to revoke previously assigned client roles so they are no longer included in the client scope.
|
|
427
|
+
*
|
|
428
|
+
* @parameters:
|
|
429
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
430
|
+
* - id: [required] ID of the client scope.
|
|
431
|
+
* - client: [required] The client ID (client UUID or client identifier) from which the roles are being removed.
|
|
432
|
+
* - realm : [optional] The realm where the client scope is defined.
|
|
433
|
+
* - roleRepresentation: An array of role objects (or at least their id and/or name) to be removed from the client scope.
|
|
434
|
+
* - id : [optional] The role ID
|
|
435
|
+
* - name : [optional] The role name
|
|
436
|
+
* - description: [optional] A description of the role
|
|
437
|
+
* - clientRole: [optional]: Whether this role belongs to a client
|
|
438
|
+
* - containerId: [optional] The ID of the client containing the role
|
|
439
|
+
*/
|
|
440
|
+
exports.delClientScopeMappings=function(filter,roleRepresentation){
|
|
441
|
+
return (kcAdminClientHandler.clientScopes.delClientScopeMappings(filter,roleRepresentation));
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* ***************************** - listClientScopeMappings - *******************************
|
|
448
|
+
* The method retrieves all client roles from a specific client that are currently mapped to a given client scope in a realm.
|
|
449
|
+
* This allows you to check which roles from a particular client are already included in the client scope.
|
|
450
|
+
*
|
|
451
|
+
* @parameters:
|
|
452
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
453
|
+
* - id: [required] The ID of the client scope
|
|
454
|
+
* - client: [required]: The client ID (client UUID or client identifier) whose mapped roles you want to list
|
|
455
|
+
* - realm: [optional] The realm where the client scope is defined
|
|
456
|
+
*/
|
|
457
|
+
exports.listClientScopeMappings=function(filter){
|
|
458
|
+
return (kcAdminClientHandler.clientScopes.listClientScopeMappings(filter));
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* ***************************** - listCompositeClientScopeMappings - *******************************
|
|
464
|
+
* The method retrieves all effective client roles mapped to a given client scope, including both directly assigned roles and those inherited via composite roles.
|
|
465
|
+
* This is useful when you want to see the final set of roles available in a client scope, not just the ones explicitly mapped.
|
|
466
|
+
*
|
|
467
|
+
* @parameters:
|
|
468
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
469
|
+
* - id: [required] The ID of the client scope.
|
|
470
|
+
* - client: [required]: The client ID (client UUID or client identifier) whose mapped roles you want to list.
|
|
471
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
472
|
+
*/
|
|
473
|
+
exports.listCompositeClientScopeMappings=function(filter){
|
|
474
|
+
return (kcAdminClientHandler.clientScopes.listCompositeClientScopeMappings(filter));
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* ***************************** - listAvailableRealmScopeMappings - *******************************
|
|
481
|
+
* The method retrieves the list of realm roles that are available to be mapped to a given client scope but are not yet assigned.
|
|
482
|
+
* This helps you determine which realm-level roles can still be added to the client scope.
|
|
483
|
+
*
|
|
484
|
+
* @parameters:
|
|
485
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
486
|
+
* - id: [required] The ID of the client scope.
|
|
487
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
488
|
+
*/
|
|
489
|
+
exports.listAvailableRealmScopeMappings=function(filter){
|
|
490
|
+
return (kcAdminClientHandler.clientScopes.listAvailableRealmScopeMappings(filter));
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* ***************************** - addRealmScopeMappings - *******************************
|
|
496
|
+
* The method adds one or more realm roles to a given client scope in a realm.
|
|
497
|
+
* This means that any client using this client scope will inherit the specified realm-level roles in its tokens.
|
|
498
|
+
*
|
|
499
|
+
* @parameters:
|
|
500
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
501
|
+
* - id: [required] The ID of the client scope.
|
|
502
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
503
|
+
* - roleRepresentation: An array of realm role objects to add. Each RoleRepresentation typically includes:
|
|
504
|
+
* - id: [required] The role ID.
|
|
505
|
+
* - name: [required] The role name.
|
|
506
|
+
* - description: [optional] Description of the role.
|
|
507
|
+
* - clientRole: [optional] Should be false for realm roles.
|
|
508
|
+
* - containerId: [optional] The ID of the realm containing the role.
|
|
509
|
+
*/
|
|
510
|
+
exports.addRealmScopeMappings=function(filter,roleRepresentation){
|
|
511
|
+
return (kcAdminClientHandler.clientScopes.addRealmScopeMappings(filter,roleRepresentation));
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* ***************************** - delRealmScopeMappings - *******************************
|
|
518
|
+
* The method removes one or more realm role mappings from a given client scope in a realm.
|
|
519
|
+
* This revokes previously assigned realm roles, so clients using this scope will no longer inherit these permissions.
|
|
520
|
+
*
|
|
521
|
+
* @parameters:
|
|
522
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
523
|
+
* - id: [required] The ID of the client scope.
|
|
524
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
525
|
+
* - RoleRepresentation: Each role should include at least its id and/or name
|
|
526
|
+
* - id: [required] The role ID.
|
|
527
|
+
* - name: [required] The role name.
|
|
528
|
+
* - description: [optional] Description of the role.
|
|
529
|
+
* - clientRole: [optional] Should be false for realm roles.
|
|
530
|
+
* - containerId: [optional] The ID of the realm containing the role.
|
|
531
|
+
*/
|
|
532
|
+
exports.delRealmScopeMappings=function(filter,RoleRepresentation){
|
|
533
|
+
return (kcAdminClientHandler.clientScopes.delRealmScopeMappings(filter,RoleRepresentation));
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* ***************************** - listRealmScopeMappings - *******************************
|
|
542
|
+
* The method retrieves all realm roles that are currently mapped to a given client scope in a realm.
|
|
543
|
+
* This allows you to see which realm-level permissions are already assigned to the client scope.
|
|
544
|
+
*
|
|
545
|
+
* @parameters:
|
|
546
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
547
|
+
* - id: [required] The ID of the client scope.
|
|
548
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
549
|
+
*/
|
|
550
|
+
exports.listRealmScopeMappings=function(filter){
|
|
551
|
+
return (kcAdminClientHandler.clientScopes.listRealmScopeMappings(filter));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* ***************************** - listCompositeRealmScopeMappings - *******************************
|
|
557
|
+
* The method retrieves all effective realm roles mapped to a given client scope, including both directly assigned roles and those inherited via composite roles.
|
|
558
|
+
* This is useful to see the complete set of realm-level permissions a client scope provides.
|
|
559
|
+
*
|
|
560
|
+
* @parameters:
|
|
561
|
+
* - filter: parameter provided as a JSON object that accepts the following filter:
|
|
562
|
+
* - id: [required] The ID of the client scope.
|
|
563
|
+
* - realm: [optional] The realm where the client scope is defined.
|
|
564
|
+
*/
|
|
565
|
+
exports.listCompositeRealmScopeMappings=function(filter){
|
|
566
|
+
return (kcAdminClientHandler.clientScopes.listCompositeRealmScopeMappings(filter));
|
|
567
|
+
}
|