keycloak-api-manager 5.0.0 → 5.0.2
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/Handlers/groupsHandler.js +0 -1
- package/Handlers/rolesHandler.js +0 -1
- package/README.md +17 -1
- package/docs/api/attack-detection.md +42 -0
- package/docs/api/authentication-management.md +160 -0
- package/docs/api/client-policies.md +66 -0
- package/docs/api/client-scopes.md +194 -0
- package/docs/api/clients.md +450 -0
- package/docs/api/components.md +57 -0
- package/docs/api/configuration.md +447 -0
- package/docs/api/groups.md +129 -0
- package/docs/api/identity-providers.md +98 -0
- package/docs/api/organizations.md +615 -0
- package/docs/api/realms.md +277 -0
- package/docs/api/roles.md +102 -0
- package/docs/api/server-info.md +38 -0
- package/docs/api/user-profile.md +63 -0
- package/docs/api/users.md +1563 -0
- package/docs/api-reference.md +163 -0
- package/package.json +2 -16
- package/test/package-lock.json +2 -16
package/Handlers/rolesHandler.js
CHANGED
package/README.md
CHANGED
|
@@ -89,6 +89,22 @@ Configured handler namespaces:
|
|
|
89
89
|
|
|
90
90
|
All documentation is centralized under `docs/`.
|
|
91
91
|
|
|
92
|
+
- [API Reference (Index)](docs/api-reference.md)
|
|
93
|
+
- [API - Configuration](docs/api/configuration.md)
|
|
94
|
+
- [API - Realms](docs/api/realms.md)
|
|
95
|
+
- [API - Users](docs/api/users.md)
|
|
96
|
+
- [API - Clients](docs/api/clients.md)
|
|
97
|
+
- [API - Client Scopes](docs/api/client-scopes.md)
|
|
98
|
+
- [API - Groups](docs/api/groups.md)
|
|
99
|
+
- [API - Roles](docs/api/roles.md)
|
|
100
|
+
- [API - Identity Providers](docs/api/identity-providers.md)
|
|
101
|
+
- [API - Components](docs/api/components.md)
|
|
102
|
+
- [API - Authentication Management](docs/api/authentication-management.md)
|
|
103
|
+
- [API - Attack Detection](docs/api/attack-detection.md)
|
|
104
|
+
- [API - Organizations](docs/api/organizations.md)
|
|
105
|
+
- [API - User Profile](docs/api/user-profile.md)
|
|
106
|
+
- [API - Client Policies](docs/api/client-policies.md)
|
|
107
|
+
- [API - Server Info](docs/api/server-info.md)
|
|
92
108
|
- [Architecture and Runtime](docs/architecture.md)
|
|
93
109
|
- [Keycloak Setup and Feature Flags](docs/keycloak-setup.md)
|
|
94
110
|
- [Testing Guide](docs/testing.md)
|
|
@@ -125,7 +141,7 @@ docs/ # Centralized documentation
|
|
|
125
141
|
|
|
126
142
|
## Versioning and Compatibility
|
|
127
143
|
|
|
128
|
-
- Package version: `
|
|
144
|
+
- Package version: `5.0.1`
|
|
129
145
|
- Keycloak Admin client dependency: `@keycloak/keycloak-admin-client`
|
|
130
146
|
- Main compatibility target: Keycloak 25/26
|
|
131
147
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Attack Detection API
|
|
2
|
+
|
|
3
|
+
Brute-force and login-failure management endpoints.
|
|
4
|
+
|
|
5
|
+
**Namespace:** `KeycloakManager.attackDetection`
|
|
6
|
+
|
|
7
|
+
## Methods
|
|
8
|
+
|
|
9
|
+
### getBruteForceStatus(filter)
|
|
10
|
+
Get brute-force status for all users or query context depending on endpoint wrapper.
|
|
11
|
+
|
|
12
|
+
- **Optional**: realm context fields
|
|
13
|
+
- **Returns**: Promise<object>
|
|
14
|
+
|
|
15
|
+
### getUserBruteForceStatus(filter)
|
|
16
|
+
Get brute-force status for one user.
|
|
17
|
+
|
|
18
|
+
- **Required**: `filter.userId` (or `filter.id` based on wrapper usage)
|
|
19
|
+
- **Returns**: Promise<object>
|
|
20
|
+
|
|
21
|
+
### clearUserLoginFailures(filter)
|
|
22
|
+
Clear failed login attempts for one user.
|
|
23
|
+
|
|
24
|
+
- **Required**: `filter.userId` (or equivalent id field)
|
|
25
|
+
- **Returns**: Promise<void>
|
|
26
|
+
|
|
27
|
+
### clearAllLoginFailures(filter)
|
|
28
|
+
Clear failed login attempts for all users in realm.
|
|
29
|
+
|
|
30
|
+
- **Optional**: realm context fields
|
|
31
|
+
- **Returns**: Promise<void>
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
const status = await KeycloakManager.attackDetection.getUserBruteForceStatus({ userId });
|
|
37
|
+
await KeycloakManager.attackDetection.clearUserLoginFailures({ userId });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## See Also
|
|
41
|
+
- [API Reference](../api-reference.md)
|
|
42
|
+
- [Users](users.md)
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Authentication Management API
|
|
2
|
+
|
|
3
|
+
Manage required actions, authentication flows, executions, and execution configs.
|
|
4
|
+
|
|
5
|
+
**Namespace:** `KeycloakManager.authenticationManagement`
|
|
6
|
+
|
|
7
|
+
## 1) Required Actions
|
|
8
|
+
|
|
9
|
+
### getRequiredActions()
|
|
10
|
+
- **Returns**: Promise<Array<object>>
|
|
11
|
+
|
|
12
|
+
### getUnregisteredRequiredActions()
|
|
13
|
+
- **Returns**: Promise<Array<object>>
|
|
14
|
+
|
|
15
|
+
### registerRequiredAction(actionRepresentation)
|
|
16
|
+
- **Required**: `alias`, `name`, `providerId`
|
|
17
|
+
- **Optional**: `defaultAction`, `enabled`, `priority`, `config`
|
|
18
|
+
- **Returns**: Promise<void>
|
|
19
|
+
|
|
20
|
+
### getRequiredActionForAlias(filter)
|
|
21
|
+
- **Required**: `filter.alias`
|
|
22
|
+
- **Returns**: Promise<object>
|
|
23
|
+
|
|
24
|
+
### updateRequiredAction(filter, actionRepresentation)
|
|
25
|
+
- **Required**: `filter.alias`
|
|
26
|
+
- **Required**: updated representation
|
|
27
|
+
- **Returns**: Promise<void>
|
|
28
|
+
|
|
29
|
+
### deleteRequiredAction(filter)
|
|
30
|
+
- **Required**: `filter.alias`
|
|
31
|
+
- **Returns**: Promise<void>
|
|
32
|
+
|
|
33
|
+
### raiseRequiredActionPriority(filter)
|
|
34
|
+
### lowerRequiredActionPriority(filter)
|
|
35
|
+
- **Required**: `filter.alias`
|
|
36
|
+
- **Returns**: Promise<void>
|
|
37
|
+
|
|
38
|
+
### getRequiredActionConfigDescription(filter)
|
|
39
|
+
- **Required**: `filter.alias`
|
|
40
|
+
- **Returns**: Promise<object>
|
|
41
|
+
|
|
42
|
+
### getRequiredActionConfig(filter)
|
|
43
|
+
- **Required**: `filter.alias`
|
|
44
|
+
- **Returns**: Promise<object>
|
|
45
|
+
|
|
46
|
+
### updateRequiredActionConfig(filter, actionConfigRepresentation)
|
|
47
|
+
- **Required**: `filter.alias`
|
|
48
|
+
- **Required**: config representation
|
|
49
|
+
- **Returns**: Promise<void>
|
|
50
|
+
|
|
51
|
+
### removeRequiredActionConfig(filter)
|
|
52
|
+
- **Required**: `filter.alias`
|
|
53
|
+
- **Returns**: Promise<void>
|
|
54
|
+
|
|
55
|
+
## 2) Authenticator / Provider Discovery
|
|
56
|
+
|
|
57
|
+
### getClientAuthenticatorProviders()
|
|
58
|
+
### getFormActionProviders()
|
|
59
|
+
### getAuthenticatorProviders()
|
|
60
|
+
### getFormProviders()
|
|
61
|
+
- **Params**: none
|
|
62
|
+
- **Returns**: Promise<Array<object>>
|
|
63
|
+
|
|
64
|
+
## 3) Authentication Flows
|
|
65
|
+
|
|
66
|
+
### getFlows()
|
|
67
|
+
- **Returns**: Promise<Array<object>>
|
|
68
|
+
|
|
69
|
+
### createFlow(flowRepresentation)
|
|
70
|
+
- **Required**: `alias`, `providerId`, `topLevel`, `builtIn`
|
|
71
|
+
- **Optional**: `description`
|
|
72
|
+
- **Returns**: Promise<void>
|
|
73
|
+
|
|
74
|
+
### updateFlow(filter, flowRepresentation)
|
|
75
|
+
- **Required**: `filter.id` or `filter.alias` (as expected by endpoint)
|
|
76
|
+
- **Required**: representation
|
|
77
|
+
- **Returns**: Promise<void>
|
|
78
|
+
|
|
79
|
+
### deleteFlow(filter)
|
|
80
|
+
- **Required**: flow identifier (`id` or `alias`, per endpoint)
|
|
81
|
+
- **Returns**: Promise<void>
|
|
82
|
+
|
|
83
|
+
### copyFlow(filter)
|
|
84
|
+
- **Required**: source flow id/alias
|
|
85
|
+
- **Required**: `filter.newName`
|
|
86
|
+
- **Returns**: Promise<void>
|
|
87
|
+
|
|
88
|
+
### getFlow(filter)
|
|
89
|
+
- **Required**: flow identifier
|
|
90
|
+
- **Returns**: Promise<object>
|
|
91
|
+
|
|
92
|
+
## 4) Flow Executions
|
|
93
|
+
|
|
94
|
+
### getExecutions(filter)
|
|
95
|
+
- **Required**: `filter.flowAlias`
|
|
96
|
+
- **Returns**: Promise<Array<object>>
|
|
97
|
+
|
|
98
|
+
### addExecutionToFlow(filter)
|
|
99
|
+
- **Required**: `filter.flowAlias`
|
|
100
|
+
- **Required**: `filter.provider`
|
|
101
|
+
- **Returns**: Promise<void>
|
|
102
|
+
|
|
103
|
+
### addFlowToFlow(filter)
|
|
104
|
+
- **Required**: `filter.flowAlias`
|
|
105
|
+
- **Required**: nested flow payload
|
|
106
|
+
- **Returns**: Promise<void>
|
|
107
|
+
|
|
108
|
+
### updateExecution(filter, executionRepresentation)
|
|
109
|
+
- **Required**: execution reference fields
|
|
110
|
+
- **Required**: execution representation
|
|
111
|
+
- **Returns**: Promise<void>
|
|
112
|
+
|
|
113
|
+
### delExecution(filter)
|
|
114
|
+
- **Required**: execution id reference
|
|
115
|
+
- **Returns**: Promise<void>
|
|
116
|
+
|
|
117
|
+
### raisePriorityExecution(filter)
|
|
118
|
+
### lowerPriorityExecution(filter)
|
|
119
|
+
- **Required**: execution reference fields
|
|
120
|
+
- **Returns**: Promise<void>
|
|
121
|
+
|
|
122
|
+
## 5) Execution Config
|
|
123
|
+
|
|
124
|
+
### createConfig(filter)
|
|
125
|
+
- **Required**: execution reference + config payload
|
|
126
|
+
- **Returns**: Promise<object>
|
|
127
|
+
|
|
128
|
+
### getConfig(filter)
|
|
129
|
+
- **Required**: `filter.id` (config id)
|
|
130
|
+
- **Returns**: Promise<object>
|
|
131
|
+
|
|
132
|
+
### updateConfig(filter)
|
|
133
|
+
- **Required**: config id + updated payload
|
|
134
|
+
- **Returns**: Promise<void>
|
|
135
|
+
|
|
136
|
+
### delConfig(filter)
|
|
137
|
+
- **Required**: `filter.id` (config id)
|
|
138
|
+
- **Returns**: Promise<void>
|
|
139
|
+
|
|
140
|
+
### getConfigDescription(filter)
|
|
141
|
+
- **Required**: provider id / execution reference as required by endpoint
|
|
142
|
+
- **Returns**: Promise<object>
|
|
143
|
+
|
|
144
|
+
## Example
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
const flows = await KeycloakManager.authenticationManagement.getFlows();
|
|
148
|
+
|
|
149
|
+
await KeycloakManager.authenticationManagement.createFlow({
|
|
150
|
+
alias: 'custom-browser',
|
|
151
|
+
description: 'Custom browser flow',
|
|
152
|
+
providerId: 'basic-flow',
|
|
153
|
+
topLevel: true,
|
|
154
|
+
builtIn: false
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## See Also
|
|
159
|
+
- [API Reference](../api-reference.md)
|
|
160
|
+
- [Realms](realms.md)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Client Policies API
|
|
2
|
+
|
|
3
|
+
Manage Client Policies and Client Profiles.
|
|
4
|
+
|
|
5
|
+
**Namespace:** `KeycloakManager.clientPolicies`
|
|
6
|
+
**Required Feature Flag:** `client-policies`
|
|
7
|
+
|
|
8
|
+
## Methods
|
|
9
|
+
|
|
10
|
+
### getPolicies(filter)
|
|
11
|
+
Get current client policies configuration.
|
|
12
|
+
|
|
13
|
+
- **Optional**: realm context fields
|
|
14
|
+
- **Returns**: Promise<object>
|
|
15
|
+
|
|
16
|
+
### updatePolicies(filter, policiesRepresentation)
|
|
17
|
+
Update client policies.
|
|
18
|
+
|
|
19
|
+
- **Optional**: realm context fields
|
|
20
|
+
- **Required**: `policiesRepresentation` (full/partial policies object)
|
|
21
|
+
- **Returns**: Promise<void|object>
|
|
22
|
+
|
|
23
|
+
### getProfiles(filter)
|
|
24
|
+
Get current client profiles configuration.
|
|
25
|
+
|
|
26
|
+
- **Optional**: realm context fields
|
|
27
|
+
- **Returns**: Promise<object>
|
|
28
|
+
|
|
29
|
+
### updateProfiles(filter, profilesRepresentation)
|
|
30
|
+
Update client profiles.
|
|
31
|
+
|
|
32
|
+
- **Optional**: realm context fields
|
|
33
|
+
- **Required**: `profilesRepresentation`
|
|
34
|
+
- **Returns**: Promise<void|object>
|
|
35
|
+
|
|
36
|
+
## Feature Enablement
|
|
37
|
+
|
|
38
|
+
Run Keycloak with:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
--features=client-policies
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Example
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
const policies = await KeycloakManager.clientPolicies.getPolicies();
|
|
48
|
+
|
|
49
|
+
await KeycloakManager.clientPolicies.updatePolicies({}, {
|
|
50
|
+
...policies,
|
|
51
|
+
policies: [
|
|
52
|
+
...(policies.policies || []),
|
|
53
|
+
{
|
|
54
|
+
name: 'enforce-pkce',
|
|
55
|
+
description: 'Require PKCE',
|
|
56
|
+
enabled: true,
|
|
57
|
+
conditions: [{ condition: 'client-access-type', configuration: { type: ['PUBLIC'] } }],
|
|
58
|
+
profiles: ['pkce-profile']
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## See Also
|
|
65
|
+
- [API Reference](../api-reference.md)
|
|
66
|
+
- [Clients](clients.md)
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Client Scopes API
|
|
2
|
+
|
|
3
|
+
Manage client scopes, protocol mappers, and role scope mappings.
|
|
4
|
+
|
|
5
|
+
**Namespace:** `KeycloakManager.clientScopes`
|
|
6
|
+
|
|
7
|
+
## Scope CRUD
|
|
8
|
+
|
|
9
|
+
### create(scopeRepresentation)
|
|
10
|
+
- **Required**: `scopeRepresentation.name` (string)
|
|
11
|
+
- **Optional**: `description`, `protocol` (`openid-connect` or `saml`), `attributes`
|
|
12
|
+
- **Returns**: Promise<object>
|
|
13
|
+
|
|
14
|
+
### find(filter)
|
|
15
|
+
- **Optional**: `search`, `first`, `max`
|
|
16
|
+
- **Returns**: Promise<Array<ClientScopeRepresentation>>
|
|
17
|
+
|
|
18
|
+
### findOne(filter)
|
|
19
|
+
- **Required**: `filter.id` (scope id)
|
|
20
|
+
- **Returns**: Promise<ClientScopeRepresentation>
|
|
21
|
+
|
|
22
|
+
### findOneByName(filter)
|
|
23
|
+
- **Required**: `filter.name` (scope name)
|
|
24
|
+
- **Returns**: Promise<ClientScopeRepresentation|null>
|
|
25
|
+
|
|
26
|
+
### update(filter, scopeRepresentation)
|
|
27
|
+
- **Required**: `filter.id` (scope id)
|
|
28
|
+
- **Required**: `scopeRepresentation` (partial)
|
|
29
|
+
- **Returns**: Promise<void>
|
|
30
|
+
|
|
31
|
+
### del(filter)
|
|
32
|
+
- **Required**: `filter.id` (scope id)
|
|
33
|
+
- **Returns**: Promise<void>
|
|
34
|
+
|
|
35
|
+
### delByName(filter)
|
|
36
|
+
- **Required**: `filter.name` (scope name)
|
|
37
|
+
- **Returns**: Promise<void>
|
|
38
|
+
|
|
39
|
+
## Realm Default Scopes
|
|
40
|
+
|
|
41
|
+
### listDefaultClientScopes(filter)
|
|
42
|
+
- **Optional**: `filter.realm`
|
|
43
|
+
- **Returns**: Promise<Array<ClientScopeRepresentation>>
|
|
44
|
+
|
|
45
|
+
### addDefaultClientScope(filter)
|
|
46
|
+
- **Required**: `filter.id` (scope id)
|
|
47
|
+
- **Returns**: Promise<void>
|
|
48
|
+
|
|
49
|
+
### delDefaultClientScope(filter)
|
|
50
|
+
- **Required**: `filter.id` (scope id)
|
|
51
|
+
- **Returns**: Promise<void>
|
|
52
|
+
|
|
53
|
+
### listDefaultOptionalClientScopes(filter)
|
|
54
|
+
- **Optional**: `filter.realm`
|
|
55
|
+
- **Returns**: Promise<Array<ClientScopeRepresentation>>
|
|
56
|
+
|
|
57
|
+
### addDefaultOptionalClientScope(filter)
|
|
58
|
+
- **Required**: `filter.id` (scope id)
|
|
59
|
+
- **Returns**: Promise<void>
|
|
60
|
+
|
|
61
|
+
### delDefaultOptionalClientScope(filter)
|
|
62
|
+
- **Required**: `filter.id` (scope id)
|
|
63
|
+
- **Returns**: Promise<void>
|
|
64
|
+
|
|
65
|
+
## Protocol Mappers
|
|
66
|
+
|
|
67
|
+
### listProtocolMappers(filter)
|
|
68
|
+
- **Required**: `filter.id` (scope id)
|
|
69
|
+
- **Returns**: Promise<Array<ProtocolMapperRepresentation>>
|
|
70
|
+
|
|
71
|
+
### findProtocolMapper(filter)
|
|
72
|
+
- **Required**: `filter.id` (scope id)
|
|
73
|
+
- **Required**: `filter.mapperId` (mapper id)
|
|
74
|
+
- **Returns**: Promise<ProtocolMapperRepresentation>
|
|
75
|
+
|
|
76
|
+
### findProtocolMapperByName(filter)
|
|
77
|
+
- **Required**: `filter.id` (scope id)
|
|
78
|
+
- **Required**: `filter.name` (mapper name)
|
|
79
|
+
- **Returns**: Promise<ProtocolMapperRepresentation>
|
|
80
|
+
|
|
81
|
+
### findProtocolMappersByProtocol(filter)
|
|
82
|
+
- **Required**: `filter.id` (scope id)
|
|
83
|
+
- **Required**: `filter.protocol` (`openid-connect` or `saml`)
|
|
84
|
+
- **Returns**: Promise<Array<ProtocolMapperRepresentation>>
|
|
85
|
+
|
|
86
|
+
### addProtocolMapper(filter, protocolMapper)
|
|
87
|
+
- **Required**: `filter.id` (scope id)
|
|
88
|
+
- **Required**: `protocolMapper.name`
|
|
89
|
+
- **Required**: `protocolMapper.protocol`
|
|
90
|
+
- **Required**: `protocolMapper.protocolMapper`
|
|
91
|
+
- **Optional**: `protocolMapper.config`
|
|
92
|
+
- **Returns**: Promise<object>
|
|
93
|
+
|
|
94
|
+
### addMultipleProtocolMappers(filter, protocolMappers)
|
|
95
|
+
- **Required**: `filter.id` (scope id)
|
|
96
|
+
- **Required**: `protocolMappers` (Array<ProtocolMapperRepresentation>)
|
|
97
|
+
- **Returns**: Promise<void>
|
|
98
|
+
|
|
99
|
+
### updateProtocolMapper(filter, protocolMapper)
|
|
100
|
+
- **Required**: `filter.id` (scope id)
|
|
101
|
+
- **Required**: `filter.mapperId` (mapper id)
|
|
102
|
+
- **Required**: `protocolMapper` (updated representation)
|
|
103
|
+
- **Returns**: Promise<void>
|
|
104
|
+
|
|
105
|
+
### delProtocolMapper(filter)
|
|
106
|
+
- **Required**: `filter.id` (scope id)
|
|
107
|
+
- **Required**: `filter.mapperId` (mapper id)
|
|
108
|
+
- **Returns**: Promise<void>
|
|
109
|
+
|
|
110
|
+
## Client Scope Role Mappings (for one client scope)
|
|
111
|
+
|
|
112
|
+
### listScopeMappings(filter)
|
|
113
|
+
- **Required**: `filter.id` (scope id)
|
|
114
|
+
- **Returns**: Promise<object>
|
|
115
|
+
|
|
116
|
+
### listAvailableClientScopeMappings(filter)
|
|
117
|
+
- **Required**: `filter.id` (scope id)
|
|
118
|
+
- **Required**: `filter.clientUniqueId` (client UUID)
|
|
119
|
+
- **Returns**: Promise<Array<RoleRepresentation>>
|
|
120
|
+
|
|
121
|
+
### addClientScopeMappings(filter, roleRepresentation)
|
|
122
|
+
- **Required**: `filter.id` (scope id)
|
|
123
|
+
- **Required**: `filter.clientUniqueId` (client UUID)
|
|
124
|
+
- **Required**: `roleRepresentation` (Array<{id,name}> or role-like object depending on endpoint)
|
|
125
|
+
- **Returns**: Promise<void>
|
|
126
|
+
|
|
127
|
+
### delClientScopeMappings(filter, roleRepresentation)
|
|
128
|
+
- **Required**: `filter.id` (scope id)
|
|
129
|
+
- **Required**: `filter.clientUniqueId` (client UUID)
|
|
130
|
+
- **Required**: `roleRepresentation`
|
|
131
|
+
- **Returns**: Promise<void>
|
|
132
|
+
|
|
133
|
+
### listClientScopeMappings(filter)
|
|
134
|
+
- **Required**: `filter.id` (scope id)
|
|
135
|
+
- **Required**: `filter.clientUniqueId` (client UUID)
|
|
136
|
+
- **Returns**: Promise<Array<RoleRepresentation>>
|
|
137
|
+
|
|
138
|
+
### listCompositeClientScopeMappings(filter)
|
|
139
|
+
- **Required**: `filter.id` (scope id)
|
|
140
|
+
- **Required**: `filter.clientUniqueId` (client UUID)
|
|
141
|
+
- **Returns**: Promise<Array<RoleRepresentation>>
|
|
142
|
+
|
|
143
|
+
## Realm Scope Mappings (for one client scope)
|
|
144
|
+
|
|
145
|
+
### listAvailableRealmScopeMappings(filter)
|
|
146
|
+
- **Required**: `filter.id` (scope id)
|
|
147
|
+
- **Returns**: Promise<Array<RoleRepresentation>>
|
|
148
|
+
|
|
149
|
+
### addRealmScopeMappings(filter, roleRepresentation)
|
|
150
|
+
- **Required**: `filter.id` (scope id)
|
|
151
|
+
- **Required**: `roleRepresentation`
|
|
152
|
+
- **Returns**: Promise<void>
|
|
153
|
+
|
|
154
|
+
### delRealmScopeMappings(filter, RoleRepresentation)
|
|
155
|
+
- **Required**: `filter.id` (scope id)
|
|
156
|
+
- **Required**: `RoleRepresentation`
|
|
157
|
+
- **Returns**: Promise<void>
|
|
158
|
+
|
|
159
|
+
### listRealmScopeMappings(filter)
|
|
160
|
+
- **Required**: `filter.id` (scope id)
|
|
161
|
+
- **Returns**: Promise<Array<RoleRepresentation>>
|
|
162
|
+
|
|
163
|
+
### listCompositeRealmScopeMappings(filter)
|
|
164
|
+
- **Required**: `filter.id` (scope id)
|
|
165
|
+
- **Returns**: Promise<Array<RoleRepresentation>>
|
|
166
|
+
|
|
167
|
+
## Example
|
|
168
|
+
|
|
169
|
+
```js
|
|
170
|
+
const scope = await KeycloakManager.clientScopes.create({
|
|
171
|
+
name: 'profile-extended',
|
|
172
|
+
protocol: 'openid-connect'
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
await KeycloakManager.clientScopes.addProtocolMapper(
|
|
176
|
+
{ id: scope.id },
|
|
177
|
+
{
|
|
178
|
+
name: 'department',
|
|
179
|
+
protocol: 'openid-connect',
|
|
180
|
+
protocolMapper: 'oidc-usermodel-attribute-mapper',
|
|
181
|
+
config: {
|
|
182
|
+
'user.attribute': 'department',
|
|
183
|
+
'claim.name': 'department',
|
|
184
|
+
'jsonType.label': 'String',
|
|
185
|
+
'id.token.claim': 'true',
|
|
186
|
+
'access.token.claim': 'true'
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## See Also
|
|
193
|
+
- [API Reference](../api-reference.md)
|
|
194
|
+
- [Clients](clients.md)
|