@keycloak/keycloak-admin-client 19.0.0-dev.2 → 19.0.0-dev.20
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/README.md +1 -1
- package/lib/client.d.ts +24 -22
- package/lib/client.js +68 -181
- package/lib/client.js.map +1 -1
- package/lib/defs/AccessTokenAccess.js +1 -2
- package/lib/defs/PermissonRepresentation.js +1 -2
- package/lib/defs/accessTokenCertConf.js +1 -2
- package/lib/defs/accessTokenRepresentation.d.ts +4 -4
- package/lib/defs/accessTokenRepresentation.js +1 -2
- package/lib/defs/addressClaimSet.js +1 -2
- package/lib/defs/adminEventRepresentation.d.ts +1 -1
- package/lib/defs/adminEventRepresentation.js +1 -2
- package/lib/defs/authDetailsRepresentation.js +1 -2
- package/lib/defs/authenticationExecutionExportRepresentation.js +1 -2
- package/lib/defs/authenticationExecutionInfoRepresentation.js +1 -2
- package/lib/defs/authenticationFlowRepresentation.d.ts +1 -1
- package/lib/defs/authenticationFlowRepresentation.js +1 -2
- package/lib/defs/authenticatorConfigInfoRepresentation.js +1 -2
- package/lib/defs/authenticatorConfigRepresentation.js +1 -2
- package/lib/defs/certificateRepresentation.js +1 -2
- package/lib/defs/clientInitialAccessPresentation.js +1 -2
- package/lib/defs/clientPoliciesRepresentation.d.ts +1 -1
- package/lib/defs/clientPoliciesRepresentation.js +1 -2
- package/lib/defs/clientPolicyConditionRepresentation.js +1 -2
- package/lib/defs/clientPolicyExecutorRepresentation.js +1 -2
- package/lib/defs/clientPolicyRepresentation.d.ts +1 -1
- package/lib/defs/clientPolicyRepresentation.js +1 -2
- package/lib/defs/clientProfileRepresentation.d.ts +1 -1
- package/lib/defs/clientProfileRepresentation.js +1 -2
- package/lib/defs/clientProfilesRepresentation.d.ts +1 -1
- package/lib/defs/clientProfilesRepresentation.js +1 -2
- package/lib/defs/clientRepresentation.d.ts +2 -2
- package/lib/defs/clientRepresentation.js +1 -2
- package/lib/defs/clientScopeRepresentation.d.ts +1 -1
- package/lib/defs/clientScopeRepresentation.js +1 -2
- package/lib/defs/componentExportRepresentation.js +1 -2
- package/lib/defs/componentRepresentation.js +1 -2
- package/lib/defs/componentTypeRepresentation.d.ts +1 -1
- package/lib/defs/componentTypeRepresentation.js +1 -2
- package/lib/defs/configPropertyRepresentation.js +1 -2
- package/lib/defs/credentialRepresentation.js +1 -2
- package/lib/defs/evaluationResultRepresentation.d.ts +4 -4
- package/lib/defs/evaluationResultRepresentation.js +1 -2
- package/lib/defs/eventRepresentation.d.ts +1 -1
- package/lib/defs/eventRepresentation.js +1 -2
- package/lib/defs/eventTypes.js +1 -2
- package/lib/defs/federatedIdentityRepresentation.js +1 -2
- package/lib/defs/globalRequestResult.js +1 -2
- package/lib/defs/groupRepresentation.js +1 -2
- package/lib/defs/identityProviderMapperRepresentation.js +1 -2
- package/lib/defs/identityProviderMapperTypeRepresentation.d.ts +1 -1
- package/lib/defs/identityProviderMapperTypeRepresentation.js +1 -2
- package/lib/defs/identityProviderRepresentation.js +1 -2
- package/lib/defs/keyMetadataRepresentation.js +1 -2
- package/lib/defs/keystoreConfig.js +1 -2
- package/lib/defs/managementPermissionReference.js +1 -2
- package/lib/defs/mappingsRepresentation.d.ts +1 -1
- package/lib/defs/mappingsRepresentation.js +1 -2
- package/lib/defs/passwordPolicyTypeRepresentation.js +1 -2
- package/lib/defs/policyEvaluationResponse.d.ts +3 -3
- package/lib/defs/policyEvaluationResponse.js +1 -2
- package/lib/defs/policyProviderRepresentation.js +1 -2
- package/lib/defs/policyRepresentation.js +6 -9
- package/lib/defs/policyRepresentation.js.map +1 -1
- package/lib/defs/policyResultRepresentation.d.ts +2 -1
- package/lib/defs/policyResultRepresentation.js +1 -2
- package/lib/defs/profileInfoRepresentation.js +1 -2
- package/lib/defs/protocolMapperRepresentation.js +1 -2
- package/lib/defs/realmEventsConfigRepresentation.js +1 -2
- package/lib/defs/realmRepresentation.d.ts +10 -10
- package/lib/defs/realmRepresentation.js +1 -2
- package/lib/defs/requiredActionProviderRepresentation.js +2 -5
- package/lib/defs/requiredActionProviderRepresentation.js.map +1 -1
- package/lib/defs/requiredActionProviderSimpleRepresentation.js +1 -2
- package/lib/defs/resourceEvaluation.d.ts +1 -1
- package/lib/defs/resourceEvaluation.js +1 -2
- package/lib/defs/resourceRepresentation.d.ts +2 -2
- package/lib/defs/resourceRepresentation.js +1 -2
- package/lib/defs/resourceServerRepresentation.d.ts +3 -3
- package/lib/defs/resourceServerRepresentation.js +1 -2
- package/lib/defs/roleRepresentation.js +1 -2
- package/lib/defs/rolesRepresentation.d.ts +1 -1
- package/lib/defs/rolesRepresentation.js +1 -2
- package/lib/defs/scopeRepresentation.d.ts +2 -2
- package/lib/defs/scopeRepresentation.js +1 -2
- package/lib/defs/serverInfoRepesentation.d.ts +6 -6
- package/lib/defs/serverInfoRepesentation.js +1 -2
- package/lib/defs/synchronizationResultRepresentation.js +1 -2
- package/lib/defs/systemInfoRepersantation.js +1 -2
- package/lib/defs/testLdapConnection.js +1 -2
- package/lib/defs/userConsentRepresentation.js +1 -2
- package/lib/defs/userProfileConfig.js +1 -2
- package/lib/defs/userRepresentation.d.ts +4 -4
- package/lib/defs/userRepresentation.js +1 -2
- package/lib/defs/userSessionRepresentation.js +1 -2
- package/lib/defs/whoAmIRepresentation.js +1 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -7
- package/lib/index.js.map +1 -1
- package/lib/resources/agent.d.ts +2 -2
- package/lib/resources/agent.js +115 -193
- package/lib/resources/agent.js.map +1 -1
- package/lib/resources/attackDetection.d.ts +5 -5
- package/lib/resources/attackDetection.js +16 -41
- package/lib/resources/attackDetection.js.map +1 -1
- package/lib/resources/authenticationManagement.d.ts +36 -35
- package/lib/resources/authenticationManagement.js +72 -97
- package/lib/resources/authenticationManagement.js.map +1 -1
- package/lib/resources/cache.d.ts +3 -3
- package/lib/resources/cache.js +12 -37
- package/lib/resources/cache.js.map +1 -1
- package/lib/resources/clientPolicies.d.ts +9 -9
- package/lib/resources/clientPolicies.js +19 -44
- package/lib/resources/clientPolicies.js.map +1 -1
- package/lib/resources/clientScopes.d.ts +27 -27
- package/lib/resources/clientScopes.js +91 -185
- package/lib/resources/clientScopes.js.map +1 -1
- package/lib/resources/clients.d.ts +98 -92
- package/lib/resources/clients.js +228 -309
- package/lib/resources/clients.js.map +1 -1
- package/lib/resources/components.d.ts +9 -9
- package/lib/resources/components.js +22 -47
- package/lib/resources/components.js.map +1 -1
- package/lib/resources/groups.d.ts +26 -25
- package/lib/resources/groups.js +53 -78
- package/lib/resources/groups.js.map +1 -1
- package/lib/resources/identityProviders.d.ts +28 -17
- package/lib/resources/identityProviders.js +46 -61
- package/lib/resources/identityProviders.js.map +1 -1
- package/lib/resources/realms.d.ts +40 -39
- package/lib/resources/realms.js +73 -98
- package/lib/resources/realms.js.map +1 -1
- package/lib/resources/resource.d.ts +3 -3
- package/lib/resources/resource.js +12 -26
- package/lib/resources/resource.js.map +1 -1
- package/lib/resources/roles.d.ts +16 -16
- package/lib/resources/roles.js +42 -67
- package/lib/resources/roles.js.map +1 -1
- package/lib/resources/serverInfo.d.ts +4 -4
- package/lib/resources/serverInfo.js +9 -34
- package/lib/resources/serverInfo.js.map +1 -1
- package/lib/resources/sessions.d.ts +3 -3
- package/lib/resources/sessions.js +12 -37
- package/lib/resources/sessions.js.map +1 -1
- package/lib/resources/userStorageProvider.d.ts +8 -8
- package/lib/resources/userStorageProvider.js +20 -45
- package/lib/resources/userStorageProvider.js.map +1 -1
- package/lib/resources/users.d.ts +51 -50
- package/lib/resources/users.js +95 -120
- package/lib/resources/users.js.map +1 -1
- package/lib/resources/whoAmI.d.ts +4 -4
- package/lib/resources/whoAmI.js +12 -37
- package/lib/resources/whoAmI.js.map +1 -1
- package/lib/utils/auth.js +30 -82
- package/lib/utils/auth.js.map +1 -1
- package/lib/utils/constants.js +2 -5
- package/lib/utils/constants.js.map +1 -1
- package/package.json +17 -16
- package/lib/defs/accessTokenAuthorization.d.ts +0 -4
- package/lib/defs/accessTokenAuthorization.js +0 -3
- package/lib/defs/accessTokenAuthorization.js.map +0 -1
package/lib/resources/users.js
CHANGED
|
@@ -1,130 +1,108 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
exports.__esModule = true;
|
|
21
|
-
exports.Users = void 0;
|
|
22
|
-
var resource_1 = __importDefault(require("./resource"));
|
|
23
|
-
var Users = (function (_super) {
|
|
24
|
-
__extends(Users, _super);
|
|
25
|
-
function Users(client) {
|
|
26
|
-
var _this = _super.call(this, client, {
|
|
1
|
+
import Resource from './resource.js';
|
|
2
|
+
export class Users extends Resource {
|
|
3
|
+
constructor(client) {
|
|
4
|
+
super(client, {
|
|
27
5
|
path: '/admin/realms/{realm}/users',
|
|
28
|
-
getUrlParams:
|
|
29
|
-
realm: client.realmName
|
|
30
|
-
})
|
|
31
|
-
getBaseUrl:
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
method: 'GET'
|
|
35
|
-
});
|
|
36
|
-
|
|
6
|
+
getUrlParams: () => ({
|
|
7
|
+
realm: client.realmName,
|
|
8
|
+
}),
|
|
9
|
+
getBaseUrl: () => client.baseUrl,
|
|
10
|
+
});
|
|
11
|
+
this.find = this.makeRequest({
|
|
12
|
+
method: 'GET',
|
|
13
|
+
});
|
|
14
|
+
this.create = this.makeRequest({
|
|
37
15
|
method: 'POST',
|
|
38
|
-
returnResourceIdInLocationHeader: { field: 'id' }
|
|
16
|
+
returnResourceIdInLocationHeader: { field: 'id' },
|
|
39
17
|
});
|
|
40
|
-
|
|
18
|
+
this.findOne = this.makeRequest({
|
|
41
19
|
method: 'GET',
|
|
42
20
|
path: '/{id}',
|
|
43
21
|
urlParamKeys: ['id'],
|
|
44
|
-
catchNotFound: true
|
|
22
|
+
catchNotFound: true,
|
|
45
23
|
});
|
|
46
|
-
|
|
24
|
+
this.update = this.makeUpdateRequest({
|
|
47
25
|
method: 'PUT',
|
|
48
26
|
path: '/{id}',
|
|
49
|
-
urlParamKeys: ['id']
|
|
27
|
+
urlParamKeys: ['id'],
|
|
50
28
|
});
|
|
51
|
-
|
|
29
|
+
this.del = this.makeRequest({
|
|
52
30
|
method: 'DELETE',
|
|
53
31
|
path: '/{id}',
|
|
54
|
-
urlParamKeys: ['id']
|
|
32
|
+
urlParamKeys: ['id'],
|
|
55
33
|
});
|
|
56
|
-
|
|
34
|
+
this.count = this.makeRequest({
|
|
57
35
|
method: 'GET',
|
|
58
|
-
path: '/count'
|
|
36
|
+
path: '/count',
|
|
59
37
|
});
|
|
60
|
-
|
|
38
|
+
this.getProfile = this.makeRequest({
|
|
61
39
|
method: 'GET',
|
|
62
|
-
path: '/profile'
|
|
40
|
+
path: '/profile',
|
|
63
41
|
});
|
|
64
|
-
|
|
42
|
+
this.updateProfile = this.makeRequest({
|
|
65
43
|
method: 'PUT',
|
|
66
|
-
path: '/profile'
|
|
44
|
+
path: '/profile',
|
|
67
45
|
});
|
|
68
|
-
|
|
46
|
+
this.listRoleMappings = this.makeRequest({
|
|
69
47
|
method: 'GET',
|
|
70
48
|
path: '/{id}/role-mappings',
|
|
71
|
-
urlParamKeys: ['id']
|
|
49
|
+
urlParamKeys: ['id'],
|
|
72
50
|
});
|
|
73
|
-
|
|
51
|
+
this.addRealmRoleMappings = this.makeRequest({
|
|
74
52
|
method: 'POST',
|
|
75
53
|
path: '/{id}/role-mappings/realm',
|
|
76
54
|
urlParamKeys: ['id'],
|
|
77
|
-
payloadKey: 'roles'
|
|
55
|
+
payloadKey: 'roles',
|
|
78
56
|
});
|
|
79
|
-
|
|
57
|
+
this.listRealmRoleMappings = this.makeRequest({
|
|
80
58
|
method: 'GET',
|
|
81
59
|
path: '/{id}/role-mappings/realm',
|
|
82
|
-
urlParamKeys: ['id']
|
|
60
|
+
urlParamKeys: ['id'],
|
|
83
61
|
});
|
|
84
|
-
|
|
62
|
+
this.delRealmRoleMappings = this.makeRequest({
|
|
85
63
|
method: 'DELETE',
|
|
86
64
|
path: '/{id}/role-mappings/realm',
|
|
87
65
|
urlParamKeys: ['id'],
|
|
88
|
-
payloadKey: 'roles'
|
|
66
|
+
payloadKey: 'roles',
|
|
89
67
|
});
|
|
90
|
-
|
|
68
|
+
this.listAvailableRealmRoleMappings = this.makeRequest({
|
|
91
69
|
method: 'GET',
|
|
92
70
|
path: '/{id}/role-mappings/realm/available',
|
|
93
|
-
urlParamKeys: ['id']
|
|
71
|
+
urlParamKeys: ['id'],
|
|
94
72
|
});
|
|
95
|
-
|
|
73
|
+
this.listCompositeRealmRoleMappings = this.makeRequest({
|
|
96
74
|
method: 'GET',
|
|
97
75
|
path: '/{id}/role-mappings/realm/composite',
|
|
98
|
-
urlParamKeys: ['id']
|
|
76
|
+
urlParamKeys: ['id'],
|
|
99
77
|
});
|
|
100
|
-
|
|
78
|
+
this.listClientRoleMappings = this.makeRequest({
|
|
101
79
|
method: 'GET',
|
|
102
80
|
path: '/{id}/role-mappings/clients/{clientUniqueId}',
|
|
103
|
-
urlParamKeys: ['id', 'clientUniqueId']
|
|
81
|
+
urlParamKeys: ['id', 'clientUniqueId'],
|
|
104
82
|
});
|
|
105
|
-
|
|
83
|
+
this.addClientRoleMappings = this.makeRequest({
|
|
106
84
|
method: 'POST',
|
|
107
85
|
path: '/{id}/role-mappings/clients/{clientUniqueId}',
|
|
108
86
|
urlParamKeys: ['id', 'clientUniqueId'],
|
|
109
|
-
payloadKey: 'roles'
|
|
87
|
+
payloadKey: 'roles',
|
|
110
88
|
});
|
|
111
|
-
|
|
89
|
+
this.delClientRoleMappings = this.makeRequest({
|
|
112
90
|
method: 'DELETE',
|
|
113
91
|
path: '/{id}/role-mappings/clients/{clientUniqueId}',
|
|
114
92
|
urlParamKeys: ['id', 'clientUniqueId'],
|
|
115
|
-
payloadKey: 'roles'
|
|
93
|
+
payloadKey: 'roles',
|
|
116
94
|
});
|
|
117
|
-
|
|
95
|
+
this.listAvailableClientRoleMappings = this.makeRequest({
|
|
118
96
|
method: 'GET',
|
|
119
97
|
path: '/{id}/role-mappings/clients/{clientUniqueId}/available',
|
|
120
|
-
urlParamKeys: ['id', 'clientUniqueId']
|
|
98
|
+
urlParamKeys: ['id', 'clientUniqueId'],
|
|
121
99
|
});
|
|
122
|
-
|
|
100
|
+
this.listCompositeClientRoleMappings = this.makeRequest({
|
|
123
101
|
method: 'GET',
|
|
124
102
|
path: '/{id}/role-mappings/clients/{clientUniqueId}/composite',
|
|
125
|
-
urlParamKeys: ['id', 'clientUniqueId']
|
|
103
|
+
urlParamKeys: ['id', 'clientUniqueId'],
|
|
126
104
|
});
|
|
127
|
-
|
|
105
|
+
this.executeActionsEmail = this.makeRequest({
|
|
128
106
|
method: 'PUT',
|
|
129
107
|
path: '/{id}/execute-actions-email',
|
|
130
108
|
urlParamKeys: ['id'],
|
|
@@ -133,125 +111,122 @@ var Users = (function (_super) {
|
|
|
133
111
|
headers: { 'content-type': 'application/json' },
|
|
134
112
|
keyTransform: {
|
|
135
113
|
clientId: 'client_id',
|
|
136
|
-
redirectUri: 'redirect_uri'
|
|
137
|
-
}
|
|
114
|
+
redirectUri: 'redirect_uri',
|
|
115
|
+
},
|
|
138
116
|
});
|
|
139
|
-
|
|
117
|
+
this.listGroups = this.makeRequest({
|
|
140
118
|
method: 'GET',
|
|
141
119
|
path: '/{id}/groups',
|
|
142
|
-
urlParamKeys: ['id']
|
|
120
|
+
urlParamKeys: ['id'],
|
|
143
121
|
});
|
|
144
|
-
|
|
122
|
+
this.addToGroup = this.makeRequest({
|
|
145
123
|
method: 'PUT',
|
|
146
124
|
path: '/{id}/groups/{groupId}',
|
|
147
|
-
urlParamKeys: ['id', 'groupId']
|
|
125
|
+
urlParamKeys: ['id', 'groupId'],
|
|
148
126
|
});
|
|
149
|
-
|
|
127
|
+
this.delFromGroup = this.makeRequest({
|
|
150
128
|
method: 'DELETE',
|
|
151
129
|
path: '/{id}/groups/{groupId}',
|
|
152
|
-
urlParamKeys: ['id', 'groupId']
|
|
130
|
+
urlParamKeys: ['id', 'groupId'],
|
|
153
131
|
});
|
|
154
|
-
|
|
132
|
+
this.countGroups = this.makeRequest({
|
|
155
133
|
method: 'GET',
|
|
156
134
|
path: '/{id}/groups/count',
|
|
157
|
-
urlParamKeys: ['id']
|
|
135
|
+
urlParamKeys: ['id'],
|
|
158
136
|
});
|
|
159
|
-
|
|
137
|
+
this.listFederatedIdentities = this.makeRequest({
|
|
160
138
|
method: 'GET',
|
|
161
139
|
path: '/{id}/federated-identity',
|
|
162
|
-
urlParamKeys: ['id']
|
|
140
|
+
urlParamKeys: ['id'],
|
|
163
141
|
});
|
|
164
|
-
|
|
142
|
+
this.addToFederatedIdentity = this.makeRequest({
|
|
165
143
|
method: 'POST',
|
|
166
144
|
path: '/{id}/federated-identity/{federatedIdentityId}',
|
|
167
145
|
urlParamKeys: ['id', 'federatedIdentityId'],
|
|
168
|
-
payloadKey: 'federatedIdentity'
|
|
146
|
+
payloadKey: 'federatedIdentity',
|
|
169
147
|
});
|
|
170
|
-
|
|
148
|
+
this.delFromFederatedIdentity = this.makeRequest({
|
|
171
149
|
method: 'DELETE',
|
|
172
150
|
path: '/{id}/federated-identity/{federatedIdentityId}',
|
|
173
|
-
urlParamKeys: ['id', 'federatedIdentityId']
|
|
151
|
+
urlParamKeys: ['id', 'federatedIdentityId'],
|
|
174
152
|
});
|
|
175
|
-
|
|
153
|
+
this.removeTotp = this.makeRequest({
|
|
176
154
|
method: 'PUT',
|
|
177
155
|
path: '/{id}/remove-totp',
|
|
178
|
-
urlParamKeys: ['id']
|
|
156
|
+
urlParamKeys: ['id'],
|
|
179
157
|
});
|
|
180
|
-
|
|
158
|
+
this.resetPassword = this.makeRequest({
|
|
181
159
|
method: 'PUT',
|
|
182
160
|
path: '/{id}/reset-password',
|
|
183
161
|
urlParamKeys: ['id'],
|
|
184
|
-
payloadKey: 'credential'
|
|
162
|
+
payloadKey: 'credential',
|
|
185
163
|
});
|
|
186
|
-
|
|
164
|
+
this.getCredentials = this.makeRequest({
|
|
187
165
|
method: 'GET',
|
|
188
166
|
path: '/{id}/credentials',
|
|
189
|
-
urlParamKeys: ['id']
|
|
167
|
+
urlParamKeys: ['id'],
|
|
190
168
|
});
|
|
191
|
-
|
|
169
|
+
this.deleteCredential = this.makeRequest({
|
|
192
170
|
method: 'DELETE',
|
|
193
171
|
path: '/{id}/credentials/{credentialId}',
|
|
194
|
-
urlParamKeys: ['id', 'credentialId']
|
|
172
|
+
urlParamKeys: ['id', 'credentialId'],
|
|
195
173
|
});
|
|
196
|
-
|
|
174
|
+
this.updateCredentialLabel = this.makeUpdateRequest({
|
|
197
175
|
method: 'PUT',
|
|
198
176
|
path: '/{id}/credentials/{credentialId}/userLabel',
|
|
199
177
|
urlParamKeys: ['id', 'credentialId'],
|
|
200
|
-
headers: { 'content-type': 'text/plain' }
|
|
178
|
+
headers: { 'content-type': 'text/plain' },
|
|
201
179
|
});
|
|
202
|
-
|
|
180
|
+
this.moveCredentialPositionDown = this.makeRequest({
|
|
203
181
|
method: 'POST',
|
|
204
182
|
path: '/{id}/credentials/{credentialId}/moveAfter/{newPreviousCredentialId}',
|
|
205
|
-
urlParamKeys: ['id', 'credentialId', 'newPreviousCredentialId']
|
|
183
|
+
urlParamKeys: ['id', 'credentialId', 'newPreviousCredentialId'],
|
|
206
184
|
});
|
|
207
|
-
|
|
185
|
+
this.moveCredentialPositionUp = this.makeRequest({
|
|
208
186
|
method: 'POST',
|
|
209
187
|
path: '/{id}/credentials/{credentialId}/moveToFirst',
|
|
210
|
-
urlParamKeys: ['id', 'credentialId']
|
|
188
|
+
urlParamKeys: ['id', 'credentialId'],
|
|
211
189
|
});
|
|
212
|
-
|
|
190
|
+
this.sendVerifyEmail = this.makeRequest({
|
|
213
191
|
method: 'PUT',
|
|
214
192
|
path: '/{id}/send-verify-email',
|
|
215
193
|
urlParamKeys: ['id'],
|
|
216
194
|
queryParamKeys: ['clientId', 'redirectUri'],
|
|
217
195
|
keyTransform: {
|
|
218
196
|
clientId: 'client_id',
|
|
219
|
-
redirectUri: 'redirect_uri'
|
|
220
|
-
}
|
|
197
|
+
redirectUri: 'redirect_uri',
|
|
198
|
+
},
|
|
221
199
|
});
|
|
222
|
-
|
|
200
|
+
this.listSessions = this.makeRequest({
|
|
223
201
|
method: 'GET',
|
|
224
202
|
path: '/{id}/sessions',
|
|
225
|
-
urlParamKeys: ['id']
|
|
203
|
+
urlParamKeys: ['id'],
|
|
226
204
|
});
|
|
227
|
-
|
|
205
|
+
this.listOfflineSessions = this.makeRequest({
|
|
228
206
|
method: 'GET',
|
|
229
207
|
path: '/{id}/offline-sessions/{clientId}',
|
|
230
|
-
urlParamKeys: ['id', 'clientId']
|
|
208
|
+
urlParamKeys: ['id', 'clientId'],
|
|
231
209
|
});
|
|
232
|
-
|
|
210
|
+
this.logout = this.makeRequest({
|
|
233
211
|
method: 'POST',
|
|
234
212
|
path: '/{id}/logout',
|
|
235
|
-
urlParamKeys: ['id']
|
|
213
|
+
urlParamKeys: ['id'],
|
|
236
214
|
});
|
|
237
|
-
|
|
215
|
+
this.listConsents = this.makeRequest({
|
|
238
216
|
method: 'GET',
|
|
239
217
|
path: '/{id}/consents',
|
|
240
|
-
urlParamKeys: ['id']
|
|
218
|
+
urlParamKeys: ['id'],
|
|
241
219
|
});
|
|
242
|
-
|
|
220
|
+
this.impersonation = this.makeUpdateRequest({
|
|
243
221
|
method: 'POST',
|
|
244
222
|
path: '/{id}/impersonation',
|
|
245
|
-
urlParamKeys: ['id']
|
|
223
|
+
urlParamKeys: ['id'],
|
|
246
224
|
});
|
|
247
|
-
|
|
225
|
+
this.revokeConsent = this.makeRequest({
|
|
248
226
|
method: 'DELETE',
|
|
249
227
|
path: '/{id}/consents/{clientId}',
|
|
250
|
-
urlParamKeys: ['id', 'clientId']
|
|
228
|
+
urlParamKeys: ['id', 'clientId'],
|
|
251
229
|
});
|
|
252
|
-
return _this;
|
|
253
230
|
}
|
|
254
|
-
|
|
255
|
-
}(resource_1["default"]));
|
|
256
|
-
exports.Users = Users;
|
|
231
|
+
}
|
|
257
232
|
//# sourceMappingURL=users.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/resources/users.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/resources/users.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AA0BrC,MAAM,OAAO,KAAM,SAAQ,QAA0B;IAkbnD,YAAY,MAA2B;QACrC,KAAK,CAAC,MAAM,EAAE;YACZ,IAAI,EAAE,6BAA6B;YACnC,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC;gBACnB,KAAK,EAAE,MAAM,CAAC,SAAS;aACxB,CAAC;YACF,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO;SACjC,CAAC,CAAC;QAxbE,SAAI,GAAG,IAAI,CAAC,WAAW,CAAkC;YAC9D,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QAEI,WAAM,GAAG,IAAI,CAAC,WAAW,CAAmC;YACjE,MAAM,EAAE,MAAM;YACd,gCAAgC,EAAE,EAAC,KAAK,EAAE,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G,IAAI,CAAC,iBAAiB,CAI3C;YACA,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,qBAAqB;YAC3B,YAAY,EAAE,CAAC,IAAI,CAAC;SACrB,CAAC,CAAC;QAKI,kBAAa,GAAG,IAAI,CAAC,WAAW,CACrC;YACE,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,2BAA2B;YACjC,YAAY,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC;SACjC,CACF,CAAC;IAUF,CAAC;CACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import WhoAmIRepresentation from '../defs/whoAmIRepresentation';
|
|
2
|
-
import KeycloakAdminClient from '
|
|
3
|
-
import Resource from './resource';
|
|
1
|
+
import type WhoAmIRepresentation from '../defs/whoAmIRepresentation.js';
|
|
2
|
+
import type KeycloakAdminClient from '../index.js';
|
|
3
|
+
import Resource from './resource.js';
|
|
4
4
|
export declare class WhoAmI extends Resource<{
|
|
5
5
|
realm?: string;
|
|
6
6
|
}> {
|
|
7
7
|
constructor(client: KeycloakAdminClient);
|
|
8
8
|
find: (payload?: {
|
|
9
9
|
realm?: string | undefined;
|
|
10
|
-
} | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<WhoAmIRepresentation>;
|
|
10
|
+
} | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<WhoAmIRepresentation>;
|
|
11
11
|
}
|
package/lib/resources/whoAmI.js
CHANGED
|
@@ -1,42 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
exports.__esModule = true;
|
|
21
|
-
exports.WhoAmI = void 0;
|
|
22
|
-
var resource_1 = __importDefault(require("./resource"));
|
|
23
|
-
var WhoAmI = (function (_super) {
|
|
24
|
-
__extends(WhoAmI, _super);
|
|
25
|
-
function WhoAmI(client) {
|
|
26
|
-
var _this = _super.call(this, client, {
|
|
1
|
+
import Resource from './resource.js';
|
|
2
|
+
export class WhoAmI extends Resource {
|
|
3
|
+
constructor(client) {
|
|
4
|
+
super(client, {
|
|
27
5
|
path: '/admin/{realm}/console',
|
|
28
|
-
getUrlParams:
|
|
29
|
-
realm: client.realmName
|
|
30
|
-
})
|
|
31
|
-
getBaseUrl:
|
|
32
|
-
})
|
|
33
|
-
|
|
6
|
+
getUrlParams: () => ({
|
|
7
|
+
realm: client.realmName,
|
|
8
|
+
}),
|
|
9
|
+
getBaseUrl: () => client.baseUrl,
|
|
10
|
+
});
|
|
11
|
+
this.find = this.makeRequest({
|
|
34
12
|
method: 'GET',
|
|
35
|
-
path: '/whoami'
|
|
13
|
+
path: '/whoami',
|
|
36
14
|
});
|
|
37
|
-
return _this;
|
|
38
15
|
}
|
|
39
|
-
|
|
40
|
-
}(resource_1["default"]));
|
|
41
|
-
exports.WhoAmI = WhoAmI;
|
|
16
|
+
}
|
|
42
17
|
//# sourceMappingURL=whoAmI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whoAmI.js","sourceRoot":"","sources":["../../src/resources/whoAmI.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"whoAmI.js","sourceRoot":"","sources":["../../src/resources/whoAmI.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,MAAM,OAAO,MAAO,SAAQ,QAA0B;IACpD,YAAY,MAA2B;QACrC,KAAK,CAAC,MAAM,EAAE;YACZ,IAAI,EAAE,wBAAwB;YAC9B,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC;gBACnB,KAAK,EAAE,MAAM,CAAC,SAAS;aACxB,CAAC;YACF,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO;SACjC,CAAC,CAAC;QAGE,SAAI,GAAG,IAAI,CAAC,WAAW,CAA2B;YACvD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;IALH,CAAC;CAMF"}
|
package/lib/utils/auth.js
CHANGED
|
@@ -1,86 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import camelize from 'camelize-ts';
|
|
3
|
+
import querystring from 'query-string';
|
|
4
|
+
import { defaultBaseUrl, defaultRealm } from './constants.js';
|
|
5
|
+
export const getToken = async (settings) => {
|
|
6
|
+
const baseUrl = settings.baseUrl || defaultBaseUrl;
|
|
7
|
+
const realmName = settings.realmName || defaultRealm;
|
|
8
|
+
const url = `${baseUrl}/realms/${realmName}/protocol/openid-connect/token`;
|
|
9
|
+
const credentials = settings.credentials || {};
|
|
10
|
+
const payload = querystring.stringify({
|
|
11
|
+
username: credentials.username,
|
|
12
|
+
password: credentials.password,
|
|
13
|
+
grant_type: credentials.grantType,
|
|
14
|
+
client_id: credentials.clientId,
|
|
15
|
+
totp: credentials.totp,
|
|
16
|
+
...(credentials.offlineToken ? { scope: 'offline_access' } : {}),
|
|
17
|
+
...(credentials.refreshToken ? {
|
|
18
|
+
refresh_token: credentials.refreshToken,
|
|
19
|
+
client_secret: credentials.clientSecret,
|
|
20
|
+
} : {}),
|
|
20
21
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
22
|
+
const config = {
|
|
23
|
+
...settings.requestConfig,
|
|
24
|
+
};
|
|
25
|
+
if (credentials.clientSecret) {
|
|
26
|
+
config.auth = {
|
|
27
|
+
username: credentials.clientId,
|
|
28
|
+
password: credentials.clientSecret,
|
|
29
|
+
};
|
|
47
30
|
}
|
|
31
|
+
const { data } = await axios.default.post(url, payload, config);
|
|
32
|
+
return camelize(data);
|
|
48
33
|
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
exports.__esModule = true;
|
|
53
|
-
exports.getToken = void 0;
|
|
54
|
-
var axios_1 = __importDefault(require("axios"));
|
|
55
|
-
var camelize_ts_1 = __importDefault(require("camelize-ts"));
|
|
56
|
-
var query_string_1 = __importDefault(require("query-string"));
|
|
57
|
-
var constants_1 = require("./constants");
|
|
58
|
-
var getToken = function (settings) { return __awaiter(void 0, void 0, void 0, function () {
|
|
59
|
-
var baseUrl, realmName, url, credentials, payload, config, data;
|
|
60
|
-
return __generator(this, function (_a) {
|
|
61
|
-
switch (_a.label) {
|
|
62
|
-
case 0:
|
|
63
|
-
baseUrl = settings.baseUrl || constants_1.defaultBaseUrl;
|
|
64
|
-
realmName = settings.realmName || constants_1.defaultRealm;
|
|
65
|
-
url = "".concat(baseUrl, "/realms/").concat(realmName, "/protocol/openid-connect/token");
|
|
66
|
-
credentials = settings.credentials || {};
|
|
67
|
-
payload = query_string_1["default"].stringify(__assign(__assign({ username: credentials.username, password: credentials.password, grant_type: credentials.grantType, client_id: credentials.clientId, totp: credentials.totp }, (credentials.offlineToken ? { scope: 'offline_access' } : {})), (credentials.refreshToken ? {
|
|
68
|
-
refresh_token: credentials.refreshToken,
|
|
69
|
-
client_secret: credentials.clientSecret
|
|
70
|
-
} : {})));
|
|
71
|
-
config = __assign({}, settings.requestConfig);
|
|
72
|
-
if (credentials.clientSecret) {
|
|
73
|
-
config.auth = {
|
|
74
|
-
username: credentials.clientId,
|
|
75
|
-
password: credentials.clientSecret
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return [4, axios_1["default"].post(url, payload, config)];
|
|
79
|
-
case 1:
|
|
80
|
-
data = (_a.sent()).data;
|
|
81
|
-
return [2, (0, camelize_ts_1["default"])(data)];
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}); };
|
|
85
|
-
exports.getToken = getToken;
|
|
86
34
|
//# sourceMappingURL=auth.js.map
|
package/lib/utils/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAC/D,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAC;AA4C5D,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAkB,EAA0B,EAAE;IAE3E,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,IAAI,cAAc,CAAC;IACnD,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,IAAI,YAAY,CAAC;IACrD,MAAM,GAAG,GAAG,GAAG,OAAO,WAAW,SAAS,gCAAgC,CAAC;IAI3E,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,IAAK,EAAU,CAAC;IACxD,MAAM,OAAO,GAAG,WAAW,CAAC,SAAS,CAAC;QACpC,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,UAAU,EAAE,WAAW,CAAC,SAAS;QACjC,SAAS,EAAE,WAAW,CAAC,QAAQ;QAC/B,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,gBAAgB,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;YAC7B,aAAa,EAAE,WAAW,CAAC,YAAY;YACvC,aAAa,EAAE,WAAW,CAAC,YAAY;SACxC,CAAC,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;IAEH,MAAM,MAAM,GAAuB;QACjC,GAAG,QAAQ,CAAC,aAAa;KAC1B,CAAC;IAEF,IAAI,WAAW,CAAC,YAAY,EAAE;QAC5B,MAAM,CAAC,IAAI,GAAG;YACZ,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,QAAQ,EAAE,WAAW,CAAC,YAAY;SACnC,CAAC;KACH;IAED,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAuC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACpG,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC,CAAC"}
|
package/lib/utils/constants.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.defaultRealm = exports.defaultBaseUrl = void 0;
|
|
4
|
-
exports.defaultBaseUrl = 'http://127.0.0.1:8080/auth';
|
|
5
|
-
exports.defaultRealm = 'master';
|
|
1
|
+
export const defaultBaseUrl = 'http://127.0.0.1:8080/auth';
|
|
2
|
+
export const defaultRealm = 'master';
|
|
6
3
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,4BAA4B,CAAC;AAE3D,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC"}
|