@keycloak/keycloak-admin-client 21.0.2 → 21.1.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.
Files changed (263) hide show
  1. package/README.md +59 -62
  2. package/lib/client.d.ts +22 -25
  3. package/lib/client.js +53 -33
  4. package/lib/defs/AccessTokenAccess.js +0 -1
  5. package/lib/defs/PermissonRepresentation.js +0 -1
  6. package/lib/defs/accessTokenCertConf.d.ts +1 -1
  7. package/lib/defs/accessTokenCertConf.js +0 -1
  8. package/lib/defs/accessTokenRepresentation.d.ts +6 -6
  9. package/lib/defs/accessTokenRepresentation.js +0 -1
  10. package/lib/defs/addressClaimSet.js +0 -1
  11. package/lib/defs/adminEventRepresentation.d.ts +1 -1
  12. package/lib/defs/adminEventRepresentation.js +0 -1
  13. package/lib/defs/authDetailsRepresentation.js +0 -1
  14. package/lib/defs/authenticationExecutionExportRepresentation.d.ts +3 -0
  15. package/lib/defs/authenticationExecutionExportRepresentation.js +0 -1
  16. package/lib/defs/authenticationExecutionInfoRepresentation.d.ts +3 -0
  17. package/lib/defs/authenticationExecutionInfoRepresentation.js +0 -1
  18. package/lib/defs/authenticationFlowRepresentation.d.ts +4 -1
  19. package/lib/defs/authenticationFlowRepresentation.js +0 -1
  20. package/lib/defs/authenticatorConfigInfoRepresentation.d.ts +3 -0
  21. package/lib/defs/authenticatorConfigInfoRepresentation.js +0 -1
  22. package/lib/defs/authenticatorConfigRepresentation.d.ts +3 -0
  23. package/lib/defs/authenticatorConfigRepresentation.js +0 -1
  24. package/lib/defs/certificateRepresentation.d.ts +3 -0
  25. package/lib/defs/certificateRepresentation.js +0 -1
  26. package/lib/defs/clientInitialAccessPresentation.d.ts +3 -0
  27. package/lib/defs/clientInitialAccessPresentation.js +0 -1
  28. package/lib/defs/clientPoliciesRepresentation.d.ts +4 -1
  29. package/lib/defs/clientPoliciesRepresentation.js +0 -1
  30. package/lib/defs/clientPolicyConditionRepresentation.d.ts +3 -0
  31. package/lib/defs/clientPolicyConditionRepresentation.js +0 -1
  32. package/lib/defs/clientPolicyExecutorRepresentation.d.ts +3 -0
  33. package/lib/defs/clientPolicyExecutorRepresentation.js +0 -1
  34. package/lib/defs/clientPolicyRepresentation.d.ts +4 -1
  35. package/lib/defs/clientPolicyRepresentation.js +0 -1
  36. package/lib/defs/clientProfileRepresentation.d.ts +4 -1
  37. package/lib/defs/clientProfileRepresentation.js +0 -1
  38. package/lib/defs/clientProfilesRepresentation.d.ts +4 -1
  39. package/lib/defs/clientProfilesRepresentation.js +0 -1
  40. package/lib/defs/clientRepresentation.d.ts +5 -2
  41. package/lib/defs/clientRepresentation.js +0 -1
  42. package/lib/defs/clientScopeRepresentation.d.ts +4 -1
  43. package/lib/defs/clientScopeRepresentation.js +0 -1
  44. package/lib/defs/clientSessionStat.d.ts +6 -0
  45. package/lib/defs/clientSessionStat.js +1 -0
  46. package/lib/defs/componentExportRepresentation.d.ts +3 -0
  47. package/lib/defs/componentExportRepresentation.js +3 -1
  48. package/lib/defs/componentRepresentation.d.ts +3 -0
  49. package/lib/defs/componentRepresentation.js +3 -1
  50. package/lib/defs/componentTypeRepresentation.d.ts +4 -1
  51. package/lib/defs/componentTypeRepresentation.js +0 -1
  52. package/lib/defs/configPropertyRepresentation.d.ts +3 -0
  53. package/lib/defs/configPropertyRepresentation.js +0 -1
  54. package/lib/defs/credentialRepresentation.d.ts +3 -0
  55. package/lib/defs/credentialRepresentation.js +3 -1
  56. package/lib/defs/evaluationResultRepresentation.d.ts +4 -4
  57. package/lib/defs/evaluationResultRepresentation.js +0 -1
  58. package/lib/defs/eventRepresentation.d.ts +4 -1
  59. package/lib/defs/eventRepresentation.js +0 -1
  60. package/lib/defs/eventTypes.d.ts +1 -1
  61. package/lib/defs/eventTypes.js +0 -1
  62. package/lib/defs/federatedIdentityRepresentation.d.ts +3 -0
  63. package/lib/defs/federatedIdentityRepresentation.js +3 -1
  64. package/lib/defs/globalRequestResult.d.ts +3 -0
  65. package/lib/defs/globalRequestResult.js +0 -1
  66. package/lib/defs/groupRepresentation.d.ts +3 -0
  67. package/lib/defs/groupRepresentation.js +3 -1
  68. package/lib/defs/identityProviderMapperRepresentation.d.ts +3 -0
  69. package/lib/defs/identityProviderMapperRepresentation.js +3 -1
  70. package/lib/defs/identityProviderMapperTypeRepresentation.d.ts +1 -1
  71. package/lib/defs/identityProviderMapperTypeRepresentation.js +0 -1
  72. package/lib/defs/identityProviderRepresentation.d.ts +3 -0
  73. package/lib/defs/identityProviderRepresentation.js +3 -1
  74. package/lib/defs/keyMetadataRepresentation.d.ts +3 -0
  75. package/lib/defs/keyMetadataRepresentation.js +0 -1
  76. package/lib/defs/keystoreConfig.d.ts +3 -0
  77. package/lib/defs/keystoreConfig.js +0 -1
  78. package/lib/defs/managementPermissionReference.js +0 -1
  79. package/lib/defs/mappingsRepresentation.d.ts +4 -1
  80. package/lib/defs/mappingsRepresentation.js +0 -1
  81. package/lib/defs/passwordPolicyTypeRepresentation.d.ts +3 -0
  82. package/lib/defs/passwordPolicyTypeRepresentation.js +0 -1
  83. package/lib/defs/policyEvaluationResponse.d.ts +3 -3
  84. package/lib/defs/policyEvaluationResponse.js +0 -1
  85. package/lib/defs/policyProviderRepresentation.js +0 -1
  86. package/lib/defs/policyRepresentation.d.ts +3 -0
  87. package/lib/defs/policyRepresentation.js +3 -1
  88. package/lib/defs/policyResultRepresentation.d.ts +2 -2
  89. package/lib/defs/policyResultRepresentation.js +0 -1
  90. package/lib/defs/profileInfoRepresentation.d.ts +3 -0
  91. package/lib/defs/profileInfoRepresentation.js +0 -1
  92. package/lib/defs/protocolMapperRepresentation.d.ts +3 -0
  93. package/lib/defs/protocolMapperRepresentation.js +3 -1
  94. package/lib/defs/realmEventsConfigRepresentation.d.ts +3 -0
  95. package/lib/defs/realmEventsConfigRepresentation.js +3 -1
  96. package/lib/defs/realmRepresentation.d.ts +20 -14
  97. package/lib/defs/realmRepresentation.js +0 -1
  98. package/lib/defs/requiredActionProviderRepresentation.d.ts +4 -1
  99. package/lib/defs/requiredActionProviderRepresentation.js +4 -2
  100. package/lib/defs/requiredActionProviderSimpleRepresentation.js +0 -1
  101. package/lib/defs/resourceEvaluation.d.ts +1 -1
  102. package/lib/defs/resourceEvaluation.js +0 -1
  103. package/lib/defs/resourceRepresentation.d.ts +5 -2
  104. package/lib/defs/resourceRepresentation.js +0 -1
  105. package/lib/defs/resourceServerRepresentation.d.ts +10 -7
  106. package/lib/defs/resourceServerRepresentation.js +0 -1
  107. package/lib/defs/roleRepresentation.d.ts +3 -0
  108. package/lib/defs/roleRepresentation.js +3 -1
  109. package/lib/defs/rolesRepresentation.d.ts +4 -1
  110. package/lib/defs/rolesRepresentation.js +3 -1
  111. package/lib/defs/scopeRepresentation.d.ts +5 -2
  112. package/lib/defs/scopeRepresentation.js +0 -1
  113. package/lib/defs/serverInfoRepesentation.d.ts +14 -6
  114. package/lib/defs/serverInfoRepesentation.js +0 -1
  115. package/lib/defs/synchronizationResultRepresentation.d.ts +3 -0
  116. package/lib/defs/synchronizationResultRepresentation.js +3 -1
  117. package/lib/defs/systemInfoRepersantation.d.ts +3 -0
  118. package/lib/defs/systemInfoRepersantation.js +3 -1
  119. package/lib/defs/testLdapConnection.d.ts +3 -0
  120. package/lib/defs/testLdapConnection.js +3 -1
  121. package/lib/defs/userConsentRepresentation.d.ts +3 -0
  122. package/lib/defs/userConsentRepresentation.js +3 -1
  123. package/lib/defs/userProfileConfig.js +0 -1
  124. package/lib/defs/userRepresentation.d.ts +4 -4
  125. package/lib/defs/userRepresentation.js +0 -1
  126. package/lib/defs/userSessionRepresentation.js +0 -1
  127. package/lib/defs/whoAmIRepresentation.d.ts +1 -1
  128. package/lib/defs/whoAmIRepresentation.js +0 -1
  129. package/lib/index.d.ts +4 -2
  130. package/lib/index.js +3 -3
  131. package/lib/resources/agent.d.ts +9 -5
  132. package/lib/resources/agent.js +80 -41
  133. package/lib/resources/attackDetection.d.ts +2 -2
  134. package/lib/resources/attackDetection.js +17 -18
  135. package/lib/resources/authenticationManagement.d.ts +13 -9
  136. package/lib/resources/authenticationManagement.js +165 -154
  137. package/lib/resources/cache.d.ts +2 -2
  138. package/lib/resources/cache.js +6 -7
  139. package/lib/resources/clientPolicies.d.ts +7 -4
  140. package/lib/resources/clientPolicies.js +27 -23
  141. package/lib/resources/clientScopes.d.ts +30 -6
  142. package/lib/resources/clientScopes.js +172 -149
  143. package/lib/resources/clients.d.ts +65 -26
  144. package/lib/resources/clients.js +557 -506
  145. package/lib/resources/components.d.ts +8 -4
  146. package/lib/resources/components.js +35 -32
  147. package/lib/resources/groups.d.ts +29 -8
  148. package/lib/resources/groups.js +132 -111
  149. package/lib/resources/identityProviders.d.ts +10 -6
  150. package/lib/resources/identityProviders.js +83 -80
  151. package/lib/resources/realms.d.ts +40 -17
  152. package/lib/resources/realms.js +227 -204
  153. package/lib/resources/resource.d.ts +3 -3
  154. package/lib/resources/resource.js +9 -8
  155. package/lib/resources/roles.d.ts +17 -5
  156. package/lib/resources/roles.js +96 -85
  157. package/lib/resources/serverInfo.d.ts +3 -3
  158. package/lib/resources/serverInfo.js +6 -7
  159. package/lib/resources/userStorageProvider.d.ts +6 -6
  160. package/lib/resources/userStorageProvider.js +29 -30
  161. package/lib/resources/users.d.ts +78 -18
  162. package/lib/resources/users.js +281 -227
  163. package/lib/resources/whoAmI.d.ts +3 -3
  164. package/lib/resources/whoAmI.js +6 -7
  165. package/lib/utils/auth.d.ts +5 -3
  166. package/lib/utils/auth.js +26 -18
  167. package/lib/utils/constants.d.ts +1 -1
  168. package/lib/utils/constants.js +2 -3
  169. package/lib/utils/fetchWithError.d.ts +11 -0
  170. package/lib/utils/fetchWithError.js +32 -0
  171. package/lib/utils/stringifyQueryParams.js +3 -5
  172. package/package.json +44 -36
  173. package/lib/client.js.map +0 -1
  174. package/lib/defs/AccessTokenAccess.js.map +0 -1
  175. package/lib/defs/PermissonRepresentation.js.map +0 -1
  176. package/lib/defs/accessTokenCertConf.js.map +0 -1
  177. package/lib/defs/accessTokenRepresentation.js.map +0 -1
  178. package/lib/defs/addressClaimSet.js.map +0 -1
  179. package/lib/defs/adminEventRepresentation.js.map +0 -1
  180. package/lib/defs/authDetailsRepresentation.js.map +0 -1
  181. package/lib/defs/authenticationExecutionExportRepresentation.js.map +0 -1
  182. package/lib/defs/authenticationExecutionInfoRepresentation.js.map +0 -1
  183. package/lib/defs/authenticationFlowRepresentation.js.map +0 -1
  184. package/lib/defs/authenticatorConfigInfoRepresentation.js.map +0 -1
  185. package/lib/defs/authenticatorConfigRepresentation.js.map +0 -1
  186. package/lib/defs/certificateRepresentation.js.map +0 -1
  187. package/lib/defs/clientInitialAccessPresentation.js.map +0 -1
  188. package/lib/defs/clientPoliciesRepresentation.js.map +0 -1
  189. package/lib/defs/clientPolicyConditionRepresentation.js.map +0 -1
  190. package/lib/defs/clientPolicyExecutorRepresentation.js.map +0 -1
  191. package/lib/defs/clientPolicyRepresentation.js.map +0 -1
  192. package/lib/defs/clientProfileRepresentation.js.map +0 -1
  193. package/lib/defs/clientProfilesRepresentation.js.map +0 -1
  194. package/lib/defs/clientRepresentation.js.map +0 -1
  195. package/lib/defs/clientScopeRepresentation.js.map +0 -1
  196. package/lib/defs/componentExportRepresentation.js.map +0 -1
  197. package/lib/defs/componentRepresentation.js.map +0 -1
  198. package/lib/defs/componentTypeRepresentation.js.map +0 -1
  199. package/lib/defs/configPropertyRepresentation.js.map +0 -1
  200. package/lib/defs/credentialRepresentation.js.map +0 -1
  201. package/lib/defs/evaluationResultRepresentation.js.map +0 -1
  202. package/lib/defs/eventRepresentation.js.map +0 -1
  203. package/lib/defs/eventTypes.js.map +0 -1
  204. package/lib/defs/federatedIdentityRepresentation.js.map +0 -1
  205. package/lib/defs/globalRequestResult.js.map +0 -1
  206. package/lib/defs/groupRepresentation.js.map +0 -1
  207. package/lib/defs/identityProviderMapperRepresentation.js.map +0 -1
  208. package/lib/defs/identityProviderMapperTypeRepresentation.js.map +0 -1
  209. package/lib/defs/identityProviderRepresentation.js.map +0 -1
  210. package/lib/defs/keyMetadataRepresentation.js.map +0 -1
  211. package/lib/defs/keystoreConfig.js.map +0 -1
  212. package/lib/defs/managementPermissionReference.js.map +0 -1
  213. package/lib/defs/mappingsRepresentation.js.map +0 -1
  214. package/lib/defs/passwordPolicyTypeRepresentation.js.map +0 -1
  215. package/lib/defs/policyEvaluationResponse.js.map +0 -1
  216. package/lib/defs/policyProviderRepresentation.js.map +0 -1
  217. package/lib/defs/policyRepresentation.js.map +0 -1
  218. package/lib/defs/policyResultRepresentation.js.map +0 -1
  219. package/lib/defs/profileInfoRepresentation.js.map +0 -1
  220. package/lib/defs/protocolMapperRepresentation.js.map +0 -1
  221. package/lib/defs/realmEventsConfigRepresentation.js.map +0 -1
  222. package/lib/defs/realmRepresentation.js.map +0 -1
  223. package/lib/defs/requiredActionProviderRepresentation.js.map +0 -1
  224. package/lib/defs/requiredActionProviderSimpleRepresentation.js.map +0 -1
  225. package/lib/defs/resourceEvaluation.js.map +0 -1
  226. package/lib/defs/resourceRepresentation.js.map +0 -1
  227. package/lib/defs/resourceServerRepresentation.js.map +0 -1
  228. package/lib/defs/roleRepresentation.js.map +0 -1
  229. package/lib/defs/rolesRepresentation.js.map +0 -1
  230. package/lib/defs/scopeRepresentation.js.map +0 -1
  231. package/lib/defs/serverInfoRepesentation.js.map +0 -1
  232. package/lib/defs/synchronizationResultRepresentation.js.map +0 -1
  233. package/lib/defs/systemInfoRepersantation.js.map +0 -1
  234. package/lib/defs/testLdapConnection.js.map +0 -1
  235. package/lib/defs/userConsentRepresentation.js.map +0 -1
  236. package/lib/defs/userProfileConfig.js.map +0 -1
  237. package/lib/defs/userRepresentation.js.map +0 -1
  238. package/lib/defs/userSessionRepresentation.js.map +0 -1
  239. package/lib/defs/whoAmIRepresentation.js.map +0 -1
  240. package/lib/index.js.map +0 -1
  241. package/lib/resources/agent.js.map +0 -1
  242. package/lib/resources/attackDetection.js.map +0 -1
  243. package/lib/resources/authenticationManagement.js.map +0 -1
  244. package/lib/resources/cache.js.map +0 -1
  245. package/lib/resources/clientPolicies.js.map +0 -1
  246. package/lib/resources/clientScopes.js.map +0 -1
  247. package/lib/resources/clients.js.map +0 -1
  248. package/lib/resources/components.js.map +0 -1
  249. package/lib/resources/groups.js.map +0 -1
  250. package/lib/resources/identityProviders.js.map +0 -1
  251. package/lib/resources/realms.js.map +0 -1
  252. package/lib/resources/resource.js.map +0 -1
  253. package/lib/resources/roles.js.map +0 -1
  254. package/lib/resources/serverInfo.js.map +0 -1
  255. package/lib/resources/sessions.d.ts +0 -10
  256. package/lib/resources/sessions.js +0 -16
  257. package/lib/resources/sessions.js.map +0 -1
  258. package/lib/resources/userStorageProvider.js.map +0 -1
  259. package/lib/resources/users.js.map +0 -1
  260. package/lib/resources/whoAmI.js.map +0 -1
  261. package/lib/utils/auth.js.map +0 -1
  262. package/lib/utils/constants.js.map +0 -1
  263. package/lib/utils/stringifyQueryParams.js.map +0 -1
package/README.md CHANGED
@@ -1,17 +1,11 @@
1
1
  ## Keycloak Admin Client
2
2
 
3
- > **Warning**
4
- > The Admin Client has been moved to the [Keycloak repository](https://github.com/keycloak/keycloak/tree/main/js/libs/keycloak-admin-client). Please open any new issues and PRs on that repository.
5
-
6
- [![Github Actions](https://github.com/keycloak/keycloak-nodejs-admin-client/workflows/CI/badge.svg)](https://github.com/keycloak/keycloak-nodejs-admin-client/actions/workflows/main.yaml)
7
- [![npm version](https://badge.fury.io/js/%40keycloak%2Fkeycloak-admin-client.svg)](https://badge.fury.io/js/%40keycloak%2Fkeycloak-admin-client)
8
-
9
3
  ## Features
10
4
 
11
5
  - TypeScript supported
12
6
  - Latest Keycloak version supported
13
- - [Complete resource definitions](https://github.com/keycloak/keycloak-nodejs-admin-client/tree/master/src/defs)
14
- - [Well-tested for supported APIs](https://github.com/keycloak/keycloak-nodejs-admin-client/tree/master/test)
7
+ - [Complete resource definitions](./src/defs)
8
+ - [Well-tested for supported APIs](./test)
15
9
 
16
10
  ## Install
17
11
 
@@ -28,8 +22,8 @@ import KcAdminClient from '@keycloak/keycloak-admin-client';
28
22
  // {
29
23
  // baseUrl: 'http://127.0.0.1:8080',
30
24
  // realmName: 'master',
31
- // requestConfig: {
32
- // /* Axios request config options https://github.com/axios/axios#request-config */
25
+ // requestOptions: {
26
+ // /* Fetch request options https://developer.mozilla.org/en-US/docs/Web/API/fetch#options */
33
27
  // },
34
28
  // }
35
29
  const kcAdminClient = new KcAdminClient();
@@ -43,8 +37,11 @@ await kcAdminClient.auth({
43
37
  totp: '123456', // optional Time-based One-time Password if OTP is required in authentication flow
44
38
  });
45
39
 
46
- // List all users
47
- const users = await kcAdminClient.users.find();
40
+ // List first page of users
41
+ const users = await kcAdminClient.users.find({ first: 0, max: 10 });
42
+
43
+ // find users by attributes
44
+ const users = await kcAdminClient.users.find({ q: "phone:123" });
48
45
 
49
46
  // Override client configuration for all further requests:
50
47
  kcAdminClient.setConfig({
@@ -128,9 +125,9 @@ npm test
128
125
 
129
126
  ## Supported APIs
130
127
 
131
- ### [Realm admin](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_realms_admin_resource)
128
+ ### [Realm admin](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_realms_admin_resource)
132
129
 
133
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/realms.spec.ts
130
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/realms.spec.ts
134
131
 
135
132
  - Import a realm from a full representation of that realm (`POST /`)
136
133
  - Get the top-level representation of the realm (`GET /{realm}`)
@@ -148,9 +145,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
148
145
  - Get client policies profiles (`GET /{realm}/client-policies/profiles`)
149
146
  - Update client policies profiles (`PUT /{realm}/client-policies/profiles`)
150
147
  - Get a group by path (`GET /{realm}/group-by-path/{path}`)
151
- ### [Role](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_roles_resource)
148
+ ### [Role](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_roles_resource)
152
149
 
153
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/roles.spec.ts
150
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/roles.spec.ts
154
151
 
155
152
  - Create a new role for the realm (`POST /{realm}/roles`)
156
153
  - Get all roles for the realm (`GET /{realm}/roles`)
@@ -159,7 +156,7 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
159
156
  - Delete a role by name (`DELETE /{realm}/roles/{role-name}`)
160
157
  - Get all users in a role by name for the realm (`GET /{realm}/roles/{role-name}/users`)
161
158
 
162
- ### [Roles (by ID)](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_roles_by_id_resource)
159
+ ### [Roles (by ID)](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_roles_by_id_resource)
163
160
 
164
161
  - Get a specific role (`GET /{realm}/roles-by-id/{role-id}`)
165
162
  - Update the role (`PUT /{realm}/roles-by-id/{role-id}`)
@@ -170,9 +167,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
170
167
  - Get client-level roles for the client that are in the role’s composite (`GET /{realm}/roles-by-id/{role-id}/composites/clients/{client}`)
171
168
  - Get realm-level roles that are in the role’s composite (`GET /{realm}/roles-by-id/{role-id}/composites/realm`)
172
169
 
173
- ### [User](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_users_resource)
170
+ ### [User](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_users_resource)
174
171
 
175
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/users.spec.ts
172
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/users.spec.ts
176
173
 
177
174
  - Create a new user (`POST /{realm}/users`)
178
175
  - Get users Returns a list of users, filtered according to query parameters (`GET /{realm}/users`)
@@ -193,7 +190,7 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
193
190
 
194
191
  ### User group-mapping
195
192
 
196
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/users.spec.ts#L178
193
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/users.spec.ts#L178
197
194
 
198
195
  - Add user to group (`PUT /{id}/groups/{groupId}`)
199
196
  - List all user groups (`GET /{id}/groups`)
@@ -202,7 +199,7 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
202
199
 
203
200
  ### User role-mapping
204
201
 
205
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/users.spec.ts#L143
202
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/users.spec.ts#L352
206
203
 
207
204
  - Get user role-mappings (`GET /{realm}/users/{id}/role-mappings`)
208
205
  - Add realm-level role mappings to the user (`POST /{realm}/users/{id}/role-mappings/realm`)
@@ -211,9 +208,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
211
208
  - Get realm-level roles that can be mapped (`GET /{realm}/users/{id}/role-mappings/realm/available`)
212
209
  - Get effective realm-level role mappings This will recurse all composite roles to get the result. (`GET /{realm}/users/{id}/role-mappings/realm/composite`)
213
210
 
214
- ### [Group](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_groups_resource)
211
+ ### [Group](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_groups_resource)
215
212
 
216
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/groups.spec.ts
213
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/groups.spec.ts
217
214
 
218
215
  - Create (`POST /{realm}/groups`)
219
216
  - List (`GET /{realm}/groups`)
@@ -226,7 +223,7 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
226
223
 
227
224
  ### Group role-mapping
228
225
 
229
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/groups.spec.ts#L76
226
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/groups.spec.ts#L103
230
227
 
231
228
  - Get group role-mappings (`GET /{realm}/groups/{id}/role-mappings`)
232
229
  - Add realm-level role mappings to the group (`POST /{realm}/groups/{id}/role-mappings/realm`)
@@ -235,9 +232,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
235
232
  - Get realm-level roles that can be mapped (`GET /{realm}/groups/{id}/role-mappings/realm/available`)
236
233
  - Get effective realm-level role mappings This will recurse all composite roles to get the result. (`GET /{realm}/groups/{id}/role-mappings/realm/composite`)
237
234
 
238
- ### [Client](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_clients_resource)
235
+ ### [Client](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_clients_resource)
239
236
 
240
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clients.spec.ts
237
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts
241
238
 
242
239
  - Create a new client (`POST /{realm}/clients`)
243
240
  - Get clients belonging to the realm (`GET /{realm}/clients`)
@@ -245,9 +242,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
245
242
  - Update the client (`PUT /{realm}/clients/{id}`)
246
243
  - Delete the client (`DELETE /{realm}/clients/{id}`)
247
244
 
248
- ### [Client roles](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_roles_resource)
245
+ ### [Client roles](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_roles_resource)
249
246
 
250
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clients.spec.ts
247
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts
251
248
 
252
249
  - Create a new role for the client (`POST /{realm}/clients/{id}/roles`)
253
250
  - Get all roles for the client (`GET /{realm}/clients/{id}/roles`)
@@ -255,9 +252,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
255
252
  - Update a role by name (`PUT /{realm}/clients/{id}/roles/{role-name}`)
256
253
  - Delete a role by name (`DELETE /{realm}/clients/{id}/roles/{role-name}`)
257
254
 
258
- ### [Client role-mapping for group](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_client_role_mappings_resource)
255
+ ### [Client role-mapping for group](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_role_mappings_resource)
259
256
 
260
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/groups.spec.ts#L150
257
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/groups.spec.ts#L192
261
258
 
262
259
  - Add client-level roles to the group role mapping (`POST /{realm}/groups/{id}/role-mappings/clients/{client}`)
263
260
  - Get client-level role mappings for the group (`GET /{realm}/groups/{id}/role-mappings/clients/{client}`)
@@ -265,9 +262,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
265
262
  - Get available client-level roles that can be mapped to the group (`GET /{realm}/groups/{id}/role-mappings/clients/{client}/available`)
266
263
  - Get effective client-level role mappings This will recurse all composite roles to get the result. (`GET /{realm}/groups/{id}/role-mappings/clients/{client}/composite`)
267
264
 
268
- ### [Client role-mapping for user](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_client_role_mappings_resource)
265
+ ### [Client role-mapping for user](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_role_mappings_resource)
269
266
 
270
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/users.spec.ts#L217
267
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/users.spec.ts#L352
271
268
 
272
269
  - Add client-level roles to the user role mapping (`POST /{realm}/users/{id}/role-mappings/clients/{client}`)
273
270
  - Get client-level role mappings for the user (`GET /{realm}/users/{id}/role-mappings/clients/{client}`)
@@ -275,7 +272,7 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
275
272
  - Get available client-level roles that can be mapped to the user (`GET /{realm}/users/{id}/role-mappings/clients/{client}/available`)
276
273
  - Get effective client-level role mappings This will recurse all composite roles to get the result. (`GET /{realm}/users/{id}/role-mappings/clients/{client}/composite`)
277
274
 
278
- ### [Client Attribute Certificate](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_client_attribute_certificate_resource)
275
+ ### [Client Attribute Certificate](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_attribute_certificate_resource)
279
276
 
280
277
  - Get key info (`GET /{realm}/clients/{id}/certificates/{attr}`)
281
278
  - Get a keystore file for the client, containing private key and public certificate (`POST /{realm}/clients/{id}/certificates/{attr}/download`)
@@ -284,9 +281,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
284
281
  - Upload certificate and eventually private key (`POST /{realm}/clients/{id}/certificates/{attr}/upload`)
285
282
  - Upload only certificate, not private key (`POST /{realm}/clients/{id}/certificates/{attr}/upload-certificate`)
286
283
 
287
- ### [Identity Providers](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_identity_providers_resource)
284
+ ### [Identity Providers](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_identity_providers_resource)
288
285
 
289
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/idp.spec.ts
286
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/idp.spec.ts
290
287
 
291
288
  - Create a new identity provider (`POST /{realm}/identity-provider/instances`)
292
289
  - Get identity providers (`GET /{realm}/identity-provider/instances`)
@@ -301,9 +298,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
301
298
  - Delete the identity provider mapper (`DELETE /{realm}/identity-provider/instances/{alias}/mappers/{id}`)
302
299
  - Find the identity provider mapper types (`GET /{realm}/identity-provider/instances/{alias}/mapper-types`)
303
300
 
304
- ### [Client Scopes](https://www.keycloak.org/docs-api/6.0/rest-api/index.html#_client_scopes_resource)
301
+ ### [Client Scopes](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_scopes_resource)
305
302
 
306
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clientScopes.spec.ts
303
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts
307
304
 
308
305
  - Create a new client scope (`POST /{realm}/client-scopes`)
309
306
  - Get client scopes belonging to the realm (`GET /{realm}/client-scopes`)
@@ -311,9 +308,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
311
308
  - Update the client scope (`PUT /{realm}/client-scopes/{id}`)
312
309
  - Delete the client scope (`DELETE /{realm}/client-scopes/{id}`)
313
310
 
314
- ### [Client Scopes for realm](https://www.keycloak.org/docs-api/6.0/rest-api/index.html#_client_scopes_resource)
311
+ ### [Client Scopes for realm](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_scopes_resource)
315
312
 
316
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clientScopes.spec.ts
313
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts
317
314
 
318
315
  - Get realm default client scopes (`GET /{realm}/default-default-client-scopes`)
319
316
  - Add realm default client scope (`PUT /{realm}/default-default-client-scopes/{id}`)
@@ -322,9 +319,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
322
319
  - Add realm optional client scope (`PUT /{realm}/default-optional-client-scopes/{id}`)
323
320
  - Delete realm optional client scope (`DELETE /{realm}/default-optional-client-scopes/{id}`)
324
321
 
325
- ### [Client Scopes for client](https://www.keycloak.org/docs-api/6.0/rest-api/index.html#_client_scopes_resource)
322
+ ### [Client Scopes for client](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_scopes_resource)
326
323
 
327
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clientScopes.spec.ts
324
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts
328
325
 
329
326
  - Get default client scopes (`GET /{realm}/clients/{id}/default-client-scopes`)
330
327
  - Add default client scope (`PUT /{realm}/clients/{id}/default-client-scopes/{clientScopeId}`)
@@ -333,9 +330,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
333
330
  - Add optional client scope (`PUT /{realm}/clients/{id}/optional-client-scopes/{clientScopeId}`)
334
331
  - Delete optional client scope (`DELETE /{realm}/clients/{id}/optional-client-scopes/{clientScopeId}`)
335
332
 
336
- ### [Scope Mappings for client scopes](https://www.keycloak.org/docs-api/6.0/rest-api/index.html#_scope_mappings_resource)
333
+ ### [Scope Mappings for client scopes](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_scope_mappings_resource)
337
334
 
338
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clientScopes.spec.ts
335
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts
339
336
 
340
337
  - Get all scope mappings for the client (`GET /{realm}/client-scopes/{id}/scope-mappings`)
341
338
  - Add client-level roles to the client’s scope (`POST /{realm}/client-scopes/{id}/scope-mappings/clients/{client}`)
@@ -349,9 +346,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
349
346
  - Get realm-level roles that are available to attach to this client’s scope (`GET /{realm}/client-scopes/{id}/scope-mappings/realm/available`)
350
347
  - Get effective realm-level roles associated with the client’s scope (`GET /{realm}/client-scopes/{id}/scope-mappings/realm/composite`)
351
348
 
352
- ### [Scope Mappings for clients](https://www.keycloak.org/docs-api/6.0/rest-api/index.html#_scope_mappings_resource)
349
+ ### [Scope Mappings for clients](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_scope_mappings_resource)
353
350
 
354
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clientScopes.spec.ts
351
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts
355
352
 
356
353
  - Get all scope mappings for the client (`GET /{realm}/clients/{id}/scope-mappings`)
357
354
  - Add client-level roles to the client’s scope (`POST /{realm}/clients/{id}/scope-mappings/clients/{client}`)
@@ -365,9 +362,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
365
362
  - Get realm-level roles that are available to attach to this client’s scope (`GET /{realm}/clients/{id}/scope-mappings/realm/available`)
366
363
  - Get effective realm-level roles associated with the client’s scope (`GET /{realm}/clients/{id}/scope-mappings/realm/composite`)
367
364
 
368
- ### [Protocol Mappers for client scopes](https://www.keycloak.org/docs-api/6.0/rest-api/index.html#_protocol_mappers_resource)
365
+ ### [Protocol Mappers for client scopes](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_protocol_mappers_resource)
369
366
 
370
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clientScopes.spec.ts
367
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts
371
368
 
372
369
  - Create multiple mappers (`POST /{realm}/client-scopes/{id}/protocol-mappers/add-models`)
373
370
  - Create a mapper (`POST /{realm}/client-scopes/{id}/protocol-mappers/models`)
@@ -377,9 +374,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
377
374
  - Delete the mapper (`DELETE /{realm}/client-scopes/{id}/protocol-mappers/models/{mapperId}`)
378
375
  - Get mappers by name for a specific protocol (`GET /{realm}/client-scopes/{id}/protocol-mappers/protocol/{protocol}`)
379
376
 
380
- ### [Protocol Mappers for clients](https://www.keycloak.org/docs-api/6.0/rest-api/index.html#_protocol_mappers_resource)
377
+ ### [Protocol Mappers for clients](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_protocol_mappers_resource)
381
378
 
382
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clients.spec.ts
379
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts
383
380
 
384
381
  - Create multiple mappers (`POST /{realm}/clients/{id}/protocol-mappers/add-models`)
385
382
  - Create a mapper (`POST /{realm}/clients/{id}/protocol-mappers/models`)
@@ -391,7 +388,7 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
391
388
 
392
389
  ### [Component]()
393
390
 
394
- Supported for [user federation](https://www.keycloak.org/docs/latest/server_admin/index.html#_user-storage-federation). Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/components.spec.ts
391
+ Supported for [user federation](https://www.keycloak.org/docs/latest/server_admin/index.html#_user-storage-federation). Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/components.spec.ts
395
392
 
396
393
  - Create (`POST /{realm}/components`)
397
394
  - List (`GET /{realm}/components`)
@@ -401,16 +398,16 @@ Supported for [user federation](https://www.keycloak.org/docs/latest/server_admi
401
398
 
402
399
  ### [Sessions for clients]()
403
400
 
404
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clients.spec.ts
401
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts
405
402
 
406
403
  - List user sessions for a specific client (`GET /{realm}/clients/{id}/user-sessions`)
407
404
  - List offline sessions for a specific client (`GET /{realm}/clients/{id}/offline-sessions`)
408
405
  - Get user session count for a specific client (`GET /{realm}/clients/{id}/session-count`)
409
406
  - List offline session count for a specific client (`GET /{realm}/clients/{id}/offline-session-count`)
410
407
 
411
- ### [Authentication Management: Required actions](https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authentication_management_resource)
408
+ ### [Authentication Management: Required actions](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_authentication_management_resource)
412
409
 
413
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/authenticationManagement.spec.ts
410
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/authenticationManagement.spec.ts
414
411
 
415
412
  - Register a new required action (`POST /{realm}/authentication/register-required-action`)
416
413
  - Get required actions. Returns a list of required actions. (`GET /{realm}/authentication/required-actions`)
@@ -423,7 +420,7 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
423
420
 
424
421
  ### [Authorization: Permission](https://www.keycloak.org/docs/8.0/authorization_services/#_overview)
425
422
 
426
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clients.spec.ts
423
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts
427
424
 
428
425
  - Create permission (`POST /{realm}/clients/{id}/authz/resource-server/permission/{type}`)
429
426
  - Get permission (`GET /{realm}/clients/{id}/authz/resource-server/permission/{type}/{permissionId}`)
@@ -432,7 +429,7 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
432
429
 
433
430
  ### [Authorization: Policy](https://www.keycloak.org/docs/8.0/authorization_services/#_overview)
434
431
 
435
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/clients.spec.ts
432
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts
436
433
 
437
434
  - Create policy (`POST /{realm}/clients/{id}/authz/resource-server/policy/{type}`)
438
435
  - Get policy (`GET /{realm}/clients/{id}/authz/resource-server/policy/{type}/{policyId}`)
@@ -440,9 +437,9 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
440
437
  - Update policy (`PUT /{realm}/clients/{id}/authz/resource-server/policy/{type}/{policyId}`)
441
438
  - Delete policy (`DELETE /{realm}/clients/{id}/authz/resource-server/policy/{policyId}`)
442
439
 
443
- ### [Attack Detection](https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_attack_detection_resource)
440
+ ### [Attack Detection](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_attack_detection_resource)
444
441
 
445
- Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/test/attackDetection.spec.ts
442
+ Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/attackDetection.spec.ts
446
443
 
447
444
  - Clear any user login failures for all users This can release temporary disabled users (`DELETE /{realm}/attack-detection/brute-force/users`)
448
445
  - Get status of a username in brute force detection (`GET /{realm}/attack-detection/brute-force/users/{userId}`)
@@ -450,11 +447,11 @@ Demo code: https://github.com/keycloak/keycloak-nodejs-admin-client/blob/master/
450
447
 
451
448
  ## Not yet supported
452
449
 
453
- - [Authentication Management](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_authentication_management_resource)
454
- - [Client Initial Access](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_client_initial_access_resource)
455
- - [Client Registration Policy](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_client_registration_policy_resource)
456
- - [Key](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_key_resource)
457
- - [User Storage Provider](https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_user_storage_provider_resource)
450
+ - [Authentication Management](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_authentication_management_resource)
451
+ - [Client Initial Access](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_initial_access_resource)
452
+ - [Client Registration Policy](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_registration_policy_resource)
453
+ - [Key](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_key_resource)
454
+ - [User Storage Provider](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_user_storage_provider_resource)
458
455
 
459
456
  ## Maintainers
460
457
 
package/lib/client.d.ts CHANGED
@@ -1,30 +1,28 @@
1
- import type { AxiosRequestConfig } from 'axios';
2
- import type { RequestArgs } from './resources/agent.js';
3
- import { AttackDetection } from './resources/attackDetection.js';
4
- import { AuthenticationManagement } from './resources/authenticationManagement.js';
5
- import { Cache } from './resources/cache.js';
6
- import { ClientPolicies } from './resources/clientPolicies.js';
7
- import { Clients } from './resources/clients.js';
8
- import { ClientScopes } from './resources/clientScopes.js';
9
- import { Components } from './resources/components.js';
10
- import { Groups } from './resources/groups.js';
11
- import { IdentityProviders } from './resources/identityProviders.js';
12
- import { Realms } from './resources/realms.js';
13
- import { Roles } from './resources/roles.js';
14
- import { ServerInfo } from './resources/serverInfo.js';
15
- import { Sessions } from './resources/sessions.js';
16
- import { Users } from './resources/users.js';
17
- import { UserStorageProvider } from './resources/userStorageProvider.js';
18
- import { WhoAmI } from './resources/whoAmI.js';
19
- import { Credentials } from './utils/auth.js';
1
+ import type { RequestArgs } from "./resources/agent.js";
2
+ import { AttackDetection } from "./resources/attackDetection.js";
3
+ import { AuthenticationManagement } from "./resources/authenticationManagement.js";
4
+ import { Cache } from "./resources/cache.js";
5
+ import { ClientPolicies } from "./resources/clientPolicies.js";
6
+ import { Clients } from "./resources/clients.js";
7
+ import { ClientScopes } from "./resources/clientScopes.js";
8
+ import { Components } from "./resources/components.js";
9
+ import { Groups } from "./resources/groups.js";
10
+ import { IdentityProviders } from "./resources/identityProviders.js";
11
+ import { Realms } from "./resources/realms.js";
12
+ import { Roles } from "./resources/roles.js";
13
+ import { ServerInfo } from "./resources/serverInfo.js";
14
+ import { Users } from "./resources/users.js";
15
+ import { UserStorageProvider } from "./resources/userStorageProvider.js";
16
+ import { WhoAmI } from "./resources/whoAmI.js";
17
+ import { Credentials } from "./utils/auth.js";
20
18
  export interface TokenProvider {
21
19
  getAccessToken: () => Promise<string | undefined>;
22
20
  }
23
21
  export interface ConnectionConfig {
24
22
  baseUrl?: string;
25
23
  realmName?: string;
26
- requestConfig?: AxiosRequestConfig;
27
- requestArgOptions?: Pick<RequestArgs, 'catchNotFound'>;
24
+ requestOptions?: RequestInit;
25
+ requestArgOptions?: Pick<RequestArgs, "catchNotFound">;
28
26
  }
29
27
  export declare class KeycloakAdminClient {
30
28
  users: Users;
@@ -40,14 +38,13 @@ export declare class KeycloakAdminClient {
40
38
  serverInfo: ServerInfo;
41
39
  whoAmI: WhoAmI;
42
40
  attackDetection: AttackDetection;
43
- sessions: Sessions;
44
41
  authenticationManagement: AuthenticationManagement;
45
42
  cache: Cache;
46
43
  baseUrl: string;
47
44
  realmName: string;
48
45
  accessToken?: string;
49
46
  refreshToken?: string;
50
- private requestConfig?;
47
+ private requestOptions?;
51
48
  private globalRequestArgOptions?;
52
49
  private tokenProvider?;
53
50
  constructor(connectionConfig?: ConnectionConfig);
@@ -55,7 +52,7 @@ export declare class KeycloakAdminClient {
55
52
  registerTokenProvider(provider: TokenProvider): void;
56
53
  setAccessToken(token: string): void;
57
54
  getAccessToken(): Promise<string | undefined>;
58
- getRequestConfig(): AxiosRequestConfig<any> | undefined;
59
- getGlobalRequestArgOptions(): Pick<RequestArgs, 'catchNotFound'> | undefined;
55
+ getRequestOptions(): RequestInit | undefined;
56
+ getGlobalRequestArgOptions(): Pick<RequestArgs, "catchNotFound"> | undefined;
60
57
  setConfig(connectionConfig: ConnectionConfig): void;
61
58
  }
package/lib/client.js CHANGED
@@ -1,29 +1,51 @@
1
- import { AttackDetection } from './resources/attackDetection.js';
2
- import { AuthenticationManagement } from './resources/authenticationManagement.js';
3
- import { Cache } from './resources/cache.js';
4
- import { ClientPolicies } from './resources/clientPolicies.js';
5
- import { Clients } from './resources/clients.js';
6
- import { ClientScopes } from './resources/clientScopes.js';
7
- import { Components } from './resources/components.js';
8
- import { Groups } from './resources/groups.js';
9
- import { IdentityProviders } from './resources/identityProviders.js';
10
- import { Realms } from './resources/realms.js';
11
- import { Roles } from './resources/roles.js';
12
- import { ServerInfo } from './resources/serverInfo.js';
13
- import { Sessions } from './resources/sessions.js';
14
- import { Users } from './resources/users.js';
15
- import { UserStorageProvider } from './resources/userStorageProvider.js';
16
- import { WhoAmI } from './resources/whoAmI.js';
17
- import { getToken } from './utils/auth.js';
18
- import { defaultBaseUrl, defaultRealm } from './utils/constants.js';
1
+ import { AttackDetection } from "./resources/attackDetection.js";
2
+ import { AuthenticationManagement } from "./resources/authenticationManagement.js";
3
+ import { Cache } from "./resources/cache.js";
4
+ import { ClientPolicies } from "./resources/clientPolicies.js";
5
+ import { Clients } from "./resources/clients.js";
6
+ import { ClientScopes } from "./resources/clientScopes.js";
7
+ import { Components } from "./resources/components.js";
8
+ import { Groups } from "./resources/groups.js";
9
+ import { IdentityProviders } from "./resources/identityProviders.js";
10
+ import { Realms } from "./resources/realms.js";
11
+ import { Roles } from "./resources/roles.js";
12
+ import { ServerInfo } from "./resources/serverInfo.js";
13
+ import { Users } from "./resources/users.js";
14
+ import { UserStorageProvider } from "./resources/userStorageProvider.js";
15
+ import { WhoAmI } from "./resources/whoAmI.js";
16
+ import { getToken } from "./utils/auth.js";
17
+ import { defaultBaseUrl, defaultRealm } from "./utils/constants.js";
19
18
  export class KeycloakAdminClient {
19
+ // Resources
20
+ users;
21
+ userStorageProvider;
22
+ groups;
23
+ roles;
24
+ clients;
25
+ realms;
26
+ clientScopes;
27
+ clientPolicies;
28
+ identityProviders;
29
+ components;
30
+ serverInfo;
31
+ whoAmI;
32
+ attackDetection;
33
+ authenticationManagement;
34
+ cache;
35
+ // Members
36
+ baseUrl;
37
+ realmName;
38
+ accessToken;
39
+ refreshToken;
40
+ requestOptions;
41
+ globalRequestArgOptions;
42
+ tokenProvider;
20
43
  constructor(connectionConfig) {
21
- this.baseUrl =
22
- (connectionConfig && connectionConfig.baseUrl) || defaultBaseUrl;
23
- this.realmName =
24
- (connectionConfig && connectionConfig.realmName) || defaultRealm;
25
- this.requestConfig = connectionConfig && connectionConfig.requestConfig;
26
- this.globalRequestArgOptions = connectionConfig && connectionConfig.requestArgOptions;
44
+ this.baseUrl = connectionConfig?.baseUrl || defaultBaseUrl;
45
+ this.realmName = connectionConfig?.realmName || defaultRealm;
46
+ this.requestOptions = connectionConfig?.requestOptions;
47
+ this.globalRequestArgOptions = connectionConfig?.requestArgOptions;
48
+ // Initialize resources
27
49
  this.users = new Users(this);
28
50
  this.userStorageProvider = new UserStorageProvider(this);
29
51
  this.groups = new Groups(this);
@@ -37,7 +59,6 @@ export class KeycloakAdminClient {
37
59
  this.authenticationManagement = new AuthenticationManagement(this);
38
60
  this.serverInfo = new ServerInfo(this);
39
61
  this.whoAmI = new WhoAmI(this);
40
- this.sessions = new Sessions(this);
41
62
  this.attackDetection = new AttackDetection(this);
42
63
  this.cache = new Cache(this);
43
64
  }
@@ -46,14 +67,14 @@ export class KeycloakAdminClient {
46
67
  baseUrl: this.baseUrl,
47
68
  realmName: this.realmName,
48
69
  credentials,
49
- requestConfig: this.requestConfig,
70
+ requestOptions: this.requestOptions,
50
71
  });
51
72
  this.accessToken = accessToken;
52
73
  this.refreshToken = refreshToken;
53
74
  }
54
75
  registerTokenProvider(provider) {
55
76
  if (this.tokenProvider) {
56
- throw new Error('An existing token provider was already registered.');
77
+ throw new Error("An existing token provider was already registered.");
57
78
  }
58
79
  this.tokenProvider = provider;
59
80
  }
@@ -66,22 +87,21 @@ export class KeycloakAdminClient {
66
87
  }
67
88
  return this.accessToken;
68
89
  }
69
- getRequestConfig() {
70
- return this.requestConfig;
90
+ getRequestOptions() {
91
+ return this.requestOptions;
71
92
  }
72
93
  getGlobalRequestArgOptions() {
73
94
  return this.globalRequestArgOptions;
74
95
  }
75
96
  setConfig(connectionConfig) {
76
- if (typeof connectionConfig.baseUrl === 'string' &&
97
+ if (typeof connectionConfig.baseUrl === "string" &&
77
98
  connectionConfig.baseUrl) {
78
99
  this.baseUrl = connectionConfig.baseUrl;
79
100
  }
80
- if (typeof connectionConfig.realmName === 'string' &&
101
+ if (typeof connectionConfig.realmName === "string" &&
81
102
  connectionConfig.realmName) {
82
103
  this.realmName = connectionConfig.realmName;
83
104
  }
84
- this.requestConfig = connectionConfig.requestConfig;
105
+ this.requestOptions = connectionConfig.requestOptions;
85
106
  }
86
107
  }
87
- //# sourceMappingURL=client.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=AccessTokenAccess.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=PermissonRepresentation.js.map
@@ -1,3 +1,3 @@
1
1
  export default interface AccessTokenCertConf {
2
- 'x5t#S256'?: string;
2
+ "x5t#S256"?: string;
3
3
  }
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=accessTokenCertConf.js.map
@@ -1,11 +1,11 @@
1
- import type AccessTokenAccess from './AccessTokenAccess.js';
2
- import type AccessTokenCertConf from './accessTokenCertConf.js';
3
- import type AddressClaimSet from './addressClaimSet.js';
4
- import type { Category } from './resourceServerRepresentation.js';
1
+ import type AccessTokenAccess from "./AccessTokenAccess.js";
2
+ import type AccessTokenCertConf from "./accessTokenCertConf.js";
3
+ import type AddressClaimSet from "./addressClaimSet.js";
4
+ import type { Category } from "./resourceServerRepresentation.js";
5
5
  export default interface AccessTokenRepresentation {
6
6
  acr?: string;
7
7
  address?: AddressClaimSet;
8
- 'allowed-origins'?: string[];
8
+ "allowed-origins"?: string[];
9
9
  at_hash?: string;
10
10
  auth_time?: number;
11
11
  authorization?: AccessTokenRepresentation;
@@ -43,7 +43,7 @@ export default interface AccessTokenRepresentation {
43
43
  scope?: string;
44
44
  session_state?: string;
45
45
  sub?: string;
46
- 'trusted-certs'?: string[];
46
+ "trusted-certs"?: string[];
47
47
  typ?: string;
48
48
  updated_at?: number;
49
49
  website?: string;
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=accessTokenRepresentation.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=addressClaimSet.js.map
@@ -1,4 +1,4 @@
1
- import type AuthDetailsRepresentation from './authDetailsRepresentation.js';
1
+ import type AuthDetailsRepresentation from "./authDetailsRepresentation.js";
2
2
  export default interface AdminEventRepresentation {
3
3
  authDetails?: AuthDetailsRepresentation;
4
4
  error?: string;