diff --git a/components/sidebar.tsx b/components/sidebar.tsx index 2e20b026..0e616c5a 100644 --- a/components/sidebar.tsx +++ b/components/sidebar.tsx @@ -212,7 +212,7 @@ export function Sidebar({ isOpen, onClose }: SidebarProps) { icon: Building2, href: "/mediation", iframe: process.env.NEXT_PUBLIC_IFRAME_MEDIATIONS_URL, - requiredRole: ["mediation", "expression"], + requiredRole: "mediation", }, ]; diff --git a/lib/keycloak.ts b/lib/keycloak.ts new file mode 100644 index 00000000..2095c89d --- /dev/null +++ b/lib/keycloak.ts @@ -0,0 +1,105 @@ +import KcAdminClient from '@keycloak/keycloak-admin-client'; +import { Credentials } from '@keycloak/keycloak-admin-client/lib/utils/auth'; + +// Cache the admin client to avoid creating a new one for each request +let adminClient: KcAdminClient | null = null; + +/** + * Get a Keycloak admin client instance + * @returns KcAdminClient instance + */ +export async function getKeycloakAdminClient(): Promise { + if (adminClient) { + try { + // Check if the token is still valid by making a simple request + await adminClient.users.find({ max: 1 }); + return adminClient; + } catch (error) { + // Token expired, create a new client + console.log('Keycloak token expired, creating new admin client'); + adminClient = null; + } + } + + const kcAdminClient = new KcAdminClient({ + baseUrl: process.env.NEXT_PUBLIC_KEYCLOAK_ISSUER || 'http://localhost:8080', + realmName: 'master', // Use master realm to manage other realms + }); + + // Authenticate admin client + await kcAdminClient.auth({ + clientId: process.env.KEYCLOAK_ADMIN_CLIENT_ID || 'admin-cli', + username: process.env.KEYCLOAK_ADMIN_USERNAME || 'admin', + password: process.env.KEYCLOAK_ADMIN_PASSWORD || 'admin', + grantType: 'password', + } as Credentials); + + // Set the target realm to work with + kcAdminClient.setConfig({ + realmName: process.env.KEYCLOAK_REALM || 'cercle', + }); + + // Cache the admin client + adminClient = kcAdminClient; + return kcAdminClient; +} + +/** + * Get a user by ID + * @param userId - Keycloak user ID + * @returns User representation or null if not found + */ +export async function getUserById(userId: string) { + try { + const kcAdminClient = await getKeycloakAdminClient(); + return await kcAdminClient.users.findOne({ id: userId }); + } catch (error) { + console.error('Error getting user by ID:', error); + return null; + } +} + +/** + * Get a user by email + * @param email - User email + * @returns User representation or null if not found + */ +export async function getUserByEmail(email: string) { + try { + const kcAdminClient = await getKeycloakAdminClient(); + const users = await kcAdminClient.users.find({ email: email }); + return users?.[0] || null; + } catch (error) { + console.error('Error getting user by email:', error); + return null; + } +} + +/** + * Get all available roles in the realm + * @returns Array of role representations + */ +export async function getAllRoles() { + try { + const kcAdminClient = await getKeycloakAdminClient(); + return await kcAdminClient.roles.find(); + } catch (error) { + console.error('Error getting roles:', error); + return []; + } +} + +/** + * Get user roles for a specific user + * @param userId - Keycloak user ID + * @returns User role mappings + */ +export async function getUserRoles(userId: string) { + try { + const kcAdminClient = await getKeycloakAdminClient(); + return await kcAdminClient.users.listRoleMappings({ id: userId }); + } catch (error) { + console.error('Error getting user roles:', error); + return null; + } +} \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index bc5a27b0..294c4437 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -175,6 +175,23 @@ "node": ">=18" } }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.0.tgz", + "integrity": "sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@floating-ui/core": { "version": "1.6.9", "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.9.tgz", @@ -351,6 +368,82 @@ "url": "https://opencollective.com/libvips" } }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.1.0.tgz", + "integrity": "sha512-IVfGJa7gjChDET1dK9SekxFFdflarnUB8PwW8aGwEoF3oAsSDuNUTYS+SKDOyOJxQyDC1aPFMuRYLoDInyV9Ew==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.1.0.tgz", + "integrity": "sha512-jYZdG+whg0MDK+q2COKbYidaqW/WTz0cc1E+tMAusiDygrM4ypmSCjOJPmFTvHHJ8j/6cAGyeDWZOsK06tP33w==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.1.tgz", + "integrity": "sha512-kX2c+vbvaXC6vly1RDf/IWNXxrlxLNpBVWkdpRq5Ka7OOKj6nr66etKy2IENf6FtOgklkg9ZdGpEu9kwdlcwOQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.1.0" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.1.tgz", + "integrity": "sha512-DfvyxzHxw4WGdPiTF0SOHnm11Xv4aQexvqhRDAoD00MzHekAj9a/jADXeXYCDFH/DzYruwHbXU7uz+H+nWmSOQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.1.0" + } + }, "node_modules/@ioredis/commands": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz", @@ -416,6 +509,20 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@keycloak/keycloak-admin-client": { + "version": "26.2.2", + "resolved": "https://registry.npmjs.org/@keycloak/keycloak-admin-client/-/keycloak-admin-client-26.2.2.tgz", + "integrity": "sha512-H0U3jjkXRHR0zU9xVcv5+GzWpDCAEab4NHKCbilVZSjrSLzqbGLMTEiGAo81NpHilseTiFpzEkz2qFm6/Hm0BA==", + "license": "Apache-2.0", + "dependencies": { + "camelize-ts": "^3.0.0", + "url-join": "^5.0.0", + "url-template": "^3.1.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@next/env": { "version": "15.3.1", "resolved": "https://registry.npmjs.org/@next/env/-/env-15.3.1.tgz", @@ -438,6 +545,38 @@ "node": ">= 10" } }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "15.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.3.1.tgz", + "integrity": "sha512-wBQ+jGUI3N0QZyWmmvRHjXjTWFy8o+zPFLSOyAyGFI94oJi+kK/LIZFJXeykvgXUk1NLDAEFDZw/NVINhdk9FQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "15.3.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.3.1.tgz", + "integrity": "sha512-IIxXEXRti/AulO9lWRHiCpUUR8AR/ZYLPALgiIg/9ENzMzLn3l0NSxVdva7R/VDcuSEBo0eGVCe3evSIHNz0Hg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@nextcloud/files": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@nextcloud/files/-/files-2.1.0.tgz", @@ -2892,6 +3031,15 @@ "node": ">= 6" } }, + "node_modules/camelize-ts": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelize-ts/-/camelize-ts-3.0.0.tgz", + "integrity": "sha512-cgRwKKavoDKLTjO4FQTs3dRBePZp/2Y9Xpud0FhuCOTE86M2cniKN4CCXgRnsyXNMmQMifVHcv6SPaMtTx6ofQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001692", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001692.tgz", @@ -6941,6 +7089,15 @@ "requires-port": "^1.0.0" } }, + "node_modules/url-template": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-3.1.1.tgz", + "integrity": "sha512-4oszoaEKE/mQOtAmdMWqIRHmkxWkUZMnXFnjQ5i01CuRSK3uluxcH1MRVVVWmhlnzT1SCDfKxxficm2G37qzCA==", + "license": "BSD-3-Clause", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/use-callback-ref": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz", diff --git a/node_modules/@keycloak/keycloak-admin-client/LICENSE b/node_modules/@keycloak/keycloak-admin-client/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@keycloak/keycloak-admin-client/README.md b/node_modules/@keycloak/keycloak-admin-client/README.md new file mode 100644 index 00000000..c9da5d9d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/README.md @@ -0,0 +1,459 @@ +## Keycloak Admin Client + +## Features + +- TypeScript supported +- Latest Keycloak version supported +- [Complete resource definitions](./src/defs) +- [Well-tested for supported APIs](./test) + +## Install + +```sh +npm install @keycloak/keycloak-admin-client +``` + +## Usage + +```js +import KcAdminClient from '@keycloak/keycloak-admin-client'; + +// To configure the client, pass an object to override any of these options: +// { +// baseUrl: 'http://127.0.0.1:8080', +// realmName: 'master', +// requestOptions: { +// /* Fetch request options https://developer.mozilla.org/en-US/docs/Web/API/fetch#options */ +// }, +// } +const kcAdminClient = new KcAdminClient(); + +// Authorize with username / password +await kcAdminClient.auth({ + username: 'admin', + password: 'admin', + grantType: 'password', + clientId: 'admin-cli', + totp: '123456', // optional Time-based One-time Password if OTP is required in authentication flow +}); + +// List first page of users +const users = await kcAdminClient.users.find({ first: 0, max: 10 }); + +// find users by attributes +const users = await kcAdminClient.users.find({ q: "phone:123" }); + +// Override client configuration for all further requests: +kcAdminClient.setConfig({ + realmName: 'another-realm', +}); + +// This operation will now be performed in 'another-realm' if the user has access. +const groups = await kcAdminClient.groups.find(); + +// Set a `realm` property to override the realm for only a single operation. +// For example, creating a user in another realm: +await kcAdminClient.users.create({ + realm: 'a-third-realm', + username: 'username', + email: 'user@example.com', +}); +``` + +To refresh the access token provided by Keycloak, an OpenID client like [panva/node-openid-client](https://github.com/panva/node-openid-client) can be used like this: + +```js +import {Issuer} from 'openid-client'; + +const keycloakIssuer = await Issuer.discover( + 'http://localhost:8080/realms/master', +); + +const client = new keycloakIssuer.Client({ + client_id: 'admin-cli', // Same as `clientId` passed to client.auth() + token_endpoint_auth_method: 'none', // to send only client_id in the header +}); + +// Use the grant type 'password' +let tokenSet = await client.grant({ + grant_type: 'password', + username: 'admin', + password: 'admin', +}); + +// Periodically using refresh_token grant flow to get new access token here +setInterval(async () => { + const refreshToken = tokenSet.refresh_token; + tokenSet = await client.refresh(refreshToken); + kcAdminClient.setAccessToken(tokenSet.access_token); +}, 58 * 1000); // 58 seconds +``` + +In cases where you don't have a refresh token, eg. in a client credentials flow, you can simply call `kcAdminClient.auth` to get a new access token, like this: + +```js +const credentials = { + grantType: 'client_credentials', + clientId: 'clientId', + clientSecret: 'some-client-secret-uuid', +}; +await kcAdminClient.auth(credentials); + +setInterval(() => kcAdminClient.auth(credentials), 58 * 1000); // 58 seconds +``` + +## Building and running the tests + +To build the source do a build: + +```bash +pnpm build +``` + +Start the Keycloak server: + +```bash +pnpm server:start +``` + +If you started your container manually make sure there is an admin user named 'admin' with password 'admin'. +Then start the tests with: + +```bash +pnpm test +``` + +## Supported APIs + +### [Realm admin](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_realms_admin_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/realms.spec.ts + +- Import a realm from a full representation of that realm (`POST /`) +- Get the top-level representation of the realm (`GET /{realm}`) +- Update the top-level information of the realm (`PUT /{realm}`) +- Delete the realm (`DELETE /{realm}`) +- Partial export of existing realm into a JSON file (`POST /{realm}/partial-export`) +- Get users management permissions (`GET /{realm}/users-management-permissions`) +- Enable users management permissions (`PUT /{realm}/users-management-permissions`) +- Get events (`GET /{realm}/events`) +- Get admin events (`GET /{realm}/admin-events`) +- Remove all user sessions (`POST /{realm}/logout-all`) +- Remove a specific user session (`DELETE /{realm}/sessions/{session}`) +- Get client policies policies (`GET /{realm}/client-policies/policies`) +- Update client policies policies (`PUT /{realm}/client-policies/policies`) +- Get client policies profiles (`GET /{realm}/client-policies/profiles`) +- Update client policies profiles (`PUT /{realm}/client-policies/profiles`) +- Get a group by path (`GET /{realm}/group-by-path/{path}`) +### [Role](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_roles_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/roles.spec.ts + +- Create a new role for the realm (`POST /{realm}/roles`) +- Get all roles for the realm (`GET /{realm}/roles`) +- Get a role by name (`GET /{realm}/roles/{role-name}`) +- Update a role by name (`PUT /{realm}/roles/{role-name}`) +- Delete a role by name (`DELETE /{realm}/roles/{role-name}`) +- Get all users in a role by name for the realm (`GET /{realm}/roles/{role-name}/users`) + +### [Roles (by ID)](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_roles_by_id_resource) + +- Get a specific role (`GET /{realm}/roles-by-id/{role-id}`) +- Update the role (`PUT /{realm}/roles-by-id/{role-id}`) +- Delete the role (`DELETE /{realm}/roles-by-id/{role-id}`) +- Make the role a composite role by associating some child roles(`POST /{realm}/roles-by-id/{role-id}/composites`) +- Get role’s children Returns a set of role’s children provided the role is a composite. (`GET /{realm}/roles-by-id/{role-id}/composites`) +- Remove a set of roles from the role’s composite (`DELETE /{realm}/roles-by-id/{role-id}/composites`) +- Get client-level roles for the client that are in the role’s composite (`GET /{realm}/roles-by-id/{role-id}/composites/clients/{client}`) +- Get realm-level roles that are in the role’s composite (`GET /{realm}/roles-by-id/{role-id}/composites/realm`) + +### [User](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_users_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/users.spec.ts + +- Create a new user (`POST /{realm}/users`) +- Get users Returns a list of users, filtered according to query parameters (`GET /{realm}/users`) +- Get representation of the user (`GET /{realm}/users/{id}`) +- Update the user (`PUT /{realm}/users/{id}`) +- Delete the user (`DELETE /{realm}/users/{id}`) +- Count users (`GET /{realm}/users/count`) +- Send a update account email to the user An email contains a link the user can click to perform a set of required actions. (`PUT /{realm}/users/{id}/execute-actions-email`) +- Get user groups (`GET /{realm}/users/{id}/groups`) +- Add user to group (`PUT /{realm}/users/{id}/groups/{groupId}`) +- Delete user from group (`DELETE /{realm}/users/{id}/groups/{groupId}`) +- Remove TOTP from the user (`PUT /{realm}/users/{id}/remove-totp`) +- Set up a temporary password for the user User will have to reset the temporary password next time they log in. (`PUT /{realm}/users/{id}/reset-password`) +- Send an email-verification email to the user An email contains a link the user can click to verify their email address. (`PUT /{realm}/users/{id}/send-verify-email`) +- Update a credential label for a user (`PUT /{realm}/users/{id}/credentials/{credentialId}/userLabel`) +- Move a credential to a position behind another credential (`POST /{realm}/users/{id}/credentials/{credentialId}/moveAfter/{newPreviousCredentialId}`) +- Move a credential to a first position in the credentials list of the user (`PUT /{realm}/users/{id}/credentials/{credentialId}/moveToFirst`) + +### User group-mapping + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/users.spec.ts#L178 + +- Add user to group (`PUT /{id}/groups/{groupId}`) +- List all user groups (`GET /{id}/groups`) +- Count user groups (`GET /{id}/groups/count`) +- Remove user from group (`DELETE /{id}/groups/{groupId}`) + +### User role-mapping + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/users.spec.ts#L352 + +- Get user role-mappings (`GET /{realm}/users/{id}/role-mappings`) +- Add realm-level role mappings to the user (`POST /{realm}/users/{id}/role-mappings/realm`) +- Get realm-level role mappings (`GET /{realm}/users/{id}/role-mappings/realm`) +- Delete realm-level role mappings (`DELETE /{realm}/users/{id}/role-mappings/realm`) +- Get realm-level roles that can be mapped (`GET /{realm}/users/{id}/role-mappings/realm/available`) +- Get effective realm-level role mappings This will recurse all composite roles to get the result. (`GET /{realm}/users/{id}/role-mappings/realm/composite`) + +### [Group](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_groups_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/groups.spec.ts + +- Create (`POST /{realm}/groups`) +- List (`GET /{realm}/groups`) +- Get one (`GET /{realm}/groups/{id}`) +- Update (`PUT /{realm}/groups/{id}`) +- Delete (`DELETE /{realm}/groups/{id}`) +- Count (`GET /{realm}/groups/count`) +- List members (`GET /{realm}/groups/{id}/members`) +- Set or create child (`POST /{realm}/groups/{id}/children`) +- Get children (`GET /{realm}/groups/{id}/children`) + +### Group role-mapping + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/groups.spec.ts#L103 + +- Get group role-mappings (`GET /{realm}/groups/{id}/role-mappings`) +- Add realm-level role mappings to the group (`POST /{realm}/groups/{id}/role-mappings/realm`) +- Get realm-level role mappings (`GET /{realm}/groups/{id}/role-mappings/realm`) +- Delete realm-level role mappings (`DELETE /{realm}/groups/{id}/role-mappings/realm`) +- Get realm-level roles that can be mapped (`GET /{realm}/groups/{id}/role-mappings/realm/available`) +- Get effective realm-level role mappings This will recurse all composite roles to get the result. (`GET /{realm}/groups/{id}/role-mappings/realm/composite`) + +### [Client](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_clients_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts + +- Create a new client (`POST /{realm}/clients`) +- Get clients belonging to the realm (`GET /{realm}/clients`) +- Get representation of the client (`GET /{realm}/clients/{id}`) +- Update the client (`PUT /{realm}/clients/{id}`) +- Delete the client (`DELETE /{realm}/clients/{id}`) + +### [Client roles](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_roles_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts + +- Create a new role for the client (`POST /{realm}/clients/{id}/roles`) +- Get all roles for the client (`GET /{realm}/clients/{id}/roles`) +- Get a role by name (`GET /{realm}/clients/{id}/roles/{role-name}`) +- Update a role by name (`PUT /{realm}/clients/{id}/roles/{role-name}`) +- Delete a role by name (`DELETE /{realm}/clients/{id}/roles/{role-name}`) + +### [Client role-mapping for group](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_role_mappings_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/groups.spec.ts#L192 + +- Add client-level roles to the group role mapping (`POST /{realm}/groups/{id}/role-mappings/clients/{client}`) +- Get client-level role mappings for the group (`GET /{realm}/groups/{id}/role-mappings/clients/{client}`) +- Delete client-level roles from group role mapping (`DELETE /{realm}/groups/{id}/role-mappings/clients/{client}`) +- Get available client-level roles that can be mapped to the group (`GET /{realm}/groups/{id}/role-mappings/clients/{client}/available`) +- 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`) + +### [Client role-mapping for user](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_role_mappings_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/users.spec.ts#L352 + +- Add client-level roles to the user role mapping (`POST /{realm}/users/{id}/role-mappings/clients/{client}`) +- Get client-level role mappings for the user (`GET /{realm}/users/{id}/role-mappings/clients/{client}`) +- Delete client-level roles from user role mapping (`DELETE /{realm}/users/{id}/role-mappings/clients/{client}`) +- Get available client-level roles that can be mapped to the user (`GET /{realm}/users/{id}/role-mappings/clients/{client}/available`) +- 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`) + +### [Client Attribute Certificate](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_attribute_certificate_resource) + +- Get key info (`GET /{realm}/clients/{id}/certificates/{attr}`) +- Get a keystore file for the client, containing private key and public certificate (`POST /{realm}/clients/{id}/certificates/{attr}/download`) +- Generate a new certificate with new key pair (`POST /{realm}/clients/{id}/certificates/{attr}/generate`) +- Generate a new keypair and certificate, and get the private key file Generates a keypair and certificate and serves the private key in a specified keystore format. (`POST /{realm}/clients/{id}/certificates/{attr}/generate-and-download`) +- Upload certificate and eventually private key (`POST /{realm}/clients/{id}/certificates/{attr}/upload`) +- Upload only certificate, not private key (`POST /{realm}/clients/{id}/certificates/{attr}/upload-certificate`) + +### [Identity Providers](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_identity_providers_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/idp.spec.ts + +- Create a new identity provider (`POST /{realm}/identity-provider/instances`) +- Get identity providers (`GET /{realm}/identity-provider/instances`) +- Get the identity provider (`GET /{realm}/identity-provider/instances/{alias}`) +- Update the identity provider (`PUT /{realm}/identity-provider/instances/{alias}`) +- Delete the identity provider (`DELETE /{realm}/identity-provider/instances/{alias}`) +- Find identity provider factory (`GET /{realm}/identity-provider/providers/{providerId}`) +- Create a new identity provider mapper (`POST /{realm}/identity-provider/instances/{alias}/mappers`) +- Get identity provider mappers (`GET /{realm}/identity-provider/instances/{alias}/mappers`) +- Get the identity provider mapper (`GET /{realm}/identity-provider/instances/{alias}/mappers/{id}`) +- Update the identity provider mapper (`PUT /{realm}/identity-provider/instances/{alias}/mappers/{id}`) +- Delete the identity provider mapper (`DELETE /{realm}/identity-provider/instances/{alias}/mappers/{id}`) +- Find the identity provider mapper types (`GET /{realm}/identity-provider/instances/{alias}/mapper-types`) + +### [Client Scopes](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_scopes_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts + +- Create a new client scope (`POST /{realm}/client-scopes`) +- Get client scopes belonging to the realm (`GET /{realm}/client-scopes`) +- Get representation of the client scope (`GET /{realm}/client-scopes/{id}`) +- Update the client scope (`PUT /{realm}/client-scopes/{id}`) +- Delete the client scope (`DELETE /{realm}/client-scopes/{id}`) + +### [Client Scopes for realm](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_scopes_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts + +- Get realm default client scopes (`GET /{realm}/default-default-client-scopes`) +- Add realm default client scope (`PUT /{realm}/default-default-client-scopes/{id}`) +- Delete realm default client scope (`DELETE /{realm}/default-default-client-scopes/{id}`) +- Get realm optional client scopes (`GET /{realm}/default-optional-client-scopes`) +- Add realm optional client scope (`PUT /{realm}/default-optional-client-scopes/{id}`) +- Delete realm optional client scope (`DELETE /{realm}/default-optional-client-scopes/{id}`) + +### [Client Scopes for client](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_scopes_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts + +- Get default client scopes (`GET /{realm}/clients/{id}/default-client-scopes`) +- Add default client scope (`PUT /{realm}/clients/{id}/default-client-scopes/{clientScopeId}`) +- Delete default client scope (`DELETE /{realm}/clients/{id}/default-client-scopes/{clientScopeId}`) +- Get optional client scopes (`GET /{realm}/clients/{id}/optional-client-scopes`) +- Add optional client scope (`PUT /{realm}/clients/{id}/optional-client-scopes/{clientScopeId}`) +- Delete optional client scope (`DELETE /{realm}/clients/{id}/optional-client-scopes/{clientScopeId}`) + +### [Scope Mappings for client scopes](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_scope_mappings_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts + +- Get all scope mappings for the client (`GET /{realm}/client-scopes/{id}/scope-mappings`) +- Add client-level roles to the client’s scope (`POST /{realm}/client-scopes/{id}/scope-mappings/clients/{client}`) +- Get the roles associated with a client’s scope (`GET /{realm}/client-scopes/{id}/scope-mappings/clients/{client}`) +- The available client-level roles (`GET /{realm}/client-scopes/{id}/scope-mappings/clients/{client}/available`) +- Get effective client roles (`GET /{realm}/client-scopes/{id}/scope-mappings/clients/{client}/composite`) +- Remove client-level roles from the client’s scope. (`DELETE /{realm}/client-scopes/{id}/scope-mappings/clients/{client}`) +- Add a set of realm-level roles to the client’s scope (`POST /{realm}/client-scopes/{id}/scope-mappings/realm`) +- Get realm-level roles associated with the client’s scope (`GET /{realm}/client-scopes/{id}/scope-mappings/realm`) +- Remove a set of realm-level roles from the client’s scope (`DELETE /{realm}/client-scopes/{id}/scope-mappings/realm`) +- Get realm-level roles that are available to attach to this client’s scope (`GET /{realm}/client-scopes/{id}/scope-mappings/realm/available`) +- Get effective realm-level roles associated with the client’s scope (`GET /{realm}/client-scopes/{id}/scope-mappings/realm/composite`) + +### [Scope Mappings for clients](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_scope_mappings_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts + +- Get all scope mappings for the client (`GET /{realm}/clients/{id}/scope-mappings`) +- Add client-level roles to the client’s scope (`POST /{realm}/clients/{id}/scope-mappings/clients/{client}`) +- Get the roles associated with a client’s scope (`GET /{realm}/clients/{id}/scope-mappings/clients/{client}`) +- Remove client-level roles from the client’s scope. (`DELETE /{realm}/clients/{id}/scope-mappings/clients/{client}`) +- The available client-level roles (`GET /{realm}/clients/{id}/scope-mappings/clients/{client}/available`) +- Get effective client roles (`GET /{realm}/clients/{id}/scope-mappings/clients/{client}/composite`) +- Add a set of realm-level roles to the client’s scope (`POST /{realm}/clients/{id}/scope-mappings/realm`) +- Get realm-level roles associated with the client’s scope (`GET /{realm}/clients/{id}/scope-mappings/realm`) +- Remove a set of realm-level roles from the client’s scope (`DELETE /{realm}/clients/{id}/scope-mappings/realm`) +- Get realm-level roles that are available to attach to this client’s scope (`GET /{realm}/clients/{id}/scope-mappings/realm/available`) +- Get effective realm-level roles associated with the client’s scope (`GET /{realm}/clients/{id}/scope-mappings/realm/composite`) + +### [Protocol Mappers for client scopes](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_protocol_mappers_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clientScopes.spec.ts + +- Create multiple mappers (`POST /{realm}/client-scopes/{id}/protocol-mappers/add-models`) +- Create a mapper (`POST /{realm}/client-scopes/{id}/protocol-mappers/models`) +- Get mappers (`GET /{realm}/client-scopes/{id}/protocol-mappers/models`) +- Get mapper by id (`GET /{realm}/client-scopes/{id}/protocol-mappers/models/{mapperId}`) +- Update the mapper (`PUT /{realm}/client-scopes/{id}/protocol-mappers/models/{mapperId}`) +- Delete the mapper (`DELETE /{realm}/client-scopes/{id}/protocol-mappers/models/{mapperId}`) +- Get mappers by name for a specific protocol (`GET /{realm}/client-scopes/{id}/protocol-mappers/protocol/{protocol}`) + +### [Protocol Mappers for clients](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_protocol_mappers_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts + +- Create multiple mappers (`POST /{realm}/clients/{id}/protocol-mappers/add-models`) +- Create a mapper (`POST /{realm}/clients/{id}/protocol-mappers/models`) +- Get mappers (`GET /{realm}/clients/{id}/protocol-mappers/models`) +- Get mapper by id (`GET /{realm}/clients/{id}/protocol-mappers/models/{mapperId}`) +- Update the mapper (`PUT /{realm}/clients/{id}/protocol-mappers/models/{mapperId}`) +- Delete the mapper (`DELETE /{realm}/clients/{id}/protocol-mappers/models/{mapperId}`) +- Get mappers by name for a specific protocol (`GET /{realm}/clients/{id}/protocol-mappers/protocol/{protocol}`) + +### [Component]() + +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 + +- Create (`POST /{realm}/components`) +- List (`GET /{realm}/components`) +- Get (`GET /{realm}/components/{id}`) +- Update (`PUT /{realm}/components/{id}`) +- Delete (`DELETE /{realm}/components/{id}`) + +### [Sessions for clients]() + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts + +- List user sessions for a specific client (`GET /{realm}/clients/{id}/user-sessions`) +- List offline sessions for a specific client (`GET /{realm}/clients/{id}/offline-sessions`) +- Get user session count for a specific client (`GET /{realm}/clients/{id}/session-count`) +- List offline session count for a specific client (`GET /{realm}/clients/{id}/offline-session-count`) + +### [Authentication Management: Required actions](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_authentication_management_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/authenticationManagement.spec.ts + +- Register a new required action (`POST /{realm}/authentication/register-required-action`) +- Get required actions. Returns a list of required actions. (`GET /{realm}/authentication/required-actions`) +- Get required action for alias (`GET /{realm}/authentication/required-actions/{alias}`) +- Update required action (`PUT /{realm}/authentication/required-actions/{alias}`) +- Delete required action (`DELETE /{realm}/authentication/required-actions/{alias}`) +- Lower required action’s priority (`POST /{realm}/authentication/required-actions/{alias}/lower-priority`) +- Raise required action’s priority (`POST /{realm}/authentication/required-actions/{alias}/raise-priority`) +- Get unregistered required actions Returns a list of unregistered required actions. (`GET /{realm}/authentication/unregistered-required-actions`) + +### [Authorization: Permission](https://www.keycloak.org/docs/8.0/authorization_services/#_overview) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts + +- Create permission (`POST /{realm}/clients/{id}/authz/resource-server/permission/{type}`) +- Get permission (`GET /{realm}/clients/{id}/authz/resource-server/permission/{type}/{permissionId}`) +- Update permission (`PUT /{realm}/clients/{id}/authz/resource-server/permission/{type}/{permissionId}`) +- Delete permission (`DELETE /{realm}/clients/{id}/authz/resource-server/permission/{type}/{permissionId}`) + +### [Authorization: Policy](https://www.keycloak.org/docs/8.0/authorization_services/#_overview) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/clients.spec.ts + +- Create policy (`POST /{realm}/clients/{id}/authz/resource-server/policy/{type}`) +- Get policy (`GET /{realm}/clients/{id}/authz/resource-server/policy/{type}/{policyId}`) +- Get policy by name (`GET /{realm}/clients/{id}/authz/resource-server/policy/search`) +- Update policy (`PUT /{realm}/clients/{id}/authz/resource-server/policy/{type}/{policyId}`) +- Delete policy (`DELETE /{realm}/clients/{id}/authz/resource-server/policy/{policyId}`) + +### [Attack Detection](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_attack_detection_resource) + +Demo code: https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/test/attackDetection.spec.ts + +- Clear any user login failures for all users This can release temporary disabled users (`DELETE /{realm}/attack-detection/brute-force/users`) +- Get status of a username in brute force detection (`GET /{realm}/attack-detection/brute-force/users/{userId}`) +- Clear any user login failures for the user This can release temporary disabled user (`DELETE /{realm}/attack-detection/brute-force/users/{userId}`) + +## Not yet supported + +- [Authentication Management](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_authentication_management_resource) +- [Client Initial Access](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_initial_access_resource) +- [Client Registration Policy](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_client_registration_policy_resource) +- [Key](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_key_resource) +- [User Storage Provider](https://www.keycloak.org/docs-api/20.0.2/rest-api/index.html#_user_storage_provider_resource) + +## Maintainers + +This repo is originally developed by [Canner](https://www.cannercms.com) and [InfuseAI](https://infuseai.io) before being transferred under keycloak organization. diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/client.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/client.d.ts new file mode 100644 index 00000000..7e396d17 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/client.d.ts @@ -0,0 +1,59 @@ +import type { RequestArgs } from "./resources/agent.js"; +import { AttackDetection } from "./resources/attackDetection.js"; +import { AuthenticationManagement } from "./resources/authenticationManagement.js"; +import { Cache } from "./resources/cache.js"; +import { ClientPolicies } from "./resources/clientPolicies.js"; +import { Clients } from "./resources/clients.js"; +import { ClientScopes } from "./resources/clientScopes.js"; +import { Components } from "./resources/components.js"; +import { Groups } from "./resources/groups.js"; +import { IdentityProviders } from "./resources/identityProviders.js"; +import { Realms } from "./resources/realms.js"; +import { Organizations } from "./resources/organizations.js"; +import { Roles } from "./resources/roles.js"; +import { ServerInfo } from "./resources/serverInfo.js"; +import { Users } from "./resources/users.js"; +import { UserStorageProvider } from "./resources/userStorageProvider.js"; +import { WhoAmI } from "./resources/whoAmI.js"; +import { Credentials } from "./utils/auth.js"; +export interface TokenProvider { + getAccessToken: () => Promise; +} +export interface ConnectionConfig { + baseUrl?: string; + realmName?: string; + requestOptions?: RequestInit; + requestArgOptions?: Pick; +} +export declare class KeycloakAdminClient { + #private; + users: Users; + userStorageProvider: UserStorageProvider; + groups: Groups; + roles: Roles; + organizations: Organizations; + clients: Clients; + realms: Realms; + clientScopes: ClientScopes; + clientPolicies: ClientPolicies; + identityProviders: IdentityProviders; + components: Components; + serverInfo: ServerInfo; + whoAmI: WhoAmI; + attackDetection: AttackDetection; + authenticationManagement: AuthenticationManagement; + cache: Cache; + baseUrl: string; + realmName: string; + scope?: string; + accessToken?: string; + refreshToken?: string; + constructor(connectionConfig?: ConnectionConfig); + auth(credentials: Credentials): Promise; + registerTokenProvider(provider: TokenProvider): void; + setAccessToken(token: string): void; + getAccessToken(): Promise; + getRequestOptions(): RequestInit | undefined; + getGlobalRequestArgOptions(): Pick | undefined; + setConfig(connectionConfig: ConnectionConfig): void; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/client.js b/node_modules/@keycloak/keycloak-admin-client/lib/client.js new file mode 100644 index 00000000..47fd03a3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/client.js @@ -0,0 +1,112 @@ +import { AttackDetection } from "./resources/attackDetection.js"; +import { AuthenticationManagement } from "./resources/authenticationManagement.js"; +import { Cache } from "./resources/cache.js"; +import { ClientPolicies } from "./resources/clientPolicies.js"; +import { Clients } from "./resources/clients.js"; +import { ClientScopes } from "./resources/clientScopes.js"; +import { Components } from "./resources/components.js"; +import { Groups } from "./resources/groups.js"; +import { IdentityProviders } from "./resources/identityProviders.js"; +import { Realms } from "./resources/realms.js"; +import { Organizations } from "./resources/organizations.js"; +import { Roles } from "./resources/roles.js"; +import { ServerInfo } from "./resources/serverInfo.js"; +import { Users } from "./resources/users.js"; +import { UserStorageProvider } from "./resources/userStorageProvider.js"; +import { WhoAmI } from "./resources/whoAmI.js"; +import { getToken } from "./utils/auth.js"; +import { defaultBaseUrl, defaultRealm } from "./utils/constants.js"; +export class KeycloakAdminClient { + // Resources + users; + userStorageProvider; + groups; + roles; + organizations; + clients; + realms; + clientScopes; + clientPolicies; + identityProviders; + components; + serverInfo; + whoAmI; + attackDetection; + authenticationManagement; + cache; + // Members + baseUrl; + realmName; + scope; + accessToken; + refreshToken; + #requestOptions; + #globalRequestArgOptions; + #tokenProvider; + constructor(connectionConfig) { + this.baseUrl = connectionConfig?.baseUrl || defaultBaseUrl; + this.realmName = connectionConfig?.realmName || defaultRealm; + this.#requestOptions = connectionConfig?.requestOptions; + this.#globalRequestArgOptions = connectionConfig?.requestArgOptions; + // Initialize resources + this.users = new Users(this); + this.userStorageProvider = new UserStorageProvider(this); + this.groups = new Groups(this); + this.roles = new Roles(this); + this.organizations = new Organizations(this); + this.clients = new Clients(this); + this.realms = new Realms(this); + this.clientScopes = new ClientScopes(this); + this.clientPolicies = new ClientPolicies(this); + this.identityProviders = new IdentityProviders(this); + this.components = new Components(this); + this.authenticationManagement = new AuthenticationManagement(this); + this.serverInfo = new ServerInfo(this); + this.whoAmI = new WhoAmI(this); + this.attackDetection = new AttackDetection(this); + this.cache = new Cache(this); + } + async auth(credentials) { + const { accessToken, refreshToken } = await getToken({ + baseUrl: this.baseUrl, + realmName: this.realmName, + scope: this.scope, + credentials, + requestOptions: this.#requestOptions, + }); + this.accessToken = accessToken; + this.refreshToken = refreshToken; + } + registerTokenProvider(provider) { + if (this.#tokenProvider) { + throw new Error("An existing token provider was already registered."); + } + this.#tokenProvider = provider; + } + setAccessToken(token) { + this.accessToken = token; + } + async getAccessToken() { + if (this.#tokenProvider) { + return this.#tokenProvider.getAccessToken(); + } + return this.accessToken; + } + getRequestOptions() { + return this.#requestOptions; + } + getGlobalRequestArgOptions() { + return this.#globalRequestArgOptions; + } + setConfig(connectionConfig) { + if (typeof connectionConfig.baseUrl === "string" && + connectionConfig.baseUrl) { + this.baseUrl = connectionConfig.baseUrl; + } + if (typeof connectionConfig.realmName === "string" && + connectionConfig.realmName) { + this.realmName = connectionConfig.realmName; + } + this.#requestOptions = connectionConfig.requestOptions; + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/AccessTokenAccess.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/AccessTokenAccess.d.ts new file mode 100644 index 00000000..6995d2d6 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/AccessTokenAccess.d.ts @@ -0,0 +1,4 @@ +export default interface AccessTokenAccess { + roles?: string[]; + verify_caller?: boolean; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/AccessTokenAccess.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/AccessTokenAccess.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/AccessTokenAccess.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/PermissonRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/PermissonRepresentation.d.ts new file mode 100644 index 00000000..23c44fa7 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/PermissonRepresentation.d.ts @@ -0,0 +1,8 @@ +export default interface PermissionRepresentation { + claims?: { + [index: string]: string; + }; + rsid?: string; + rsname?: string; + scopes?: string[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/PermissonRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/PermissonRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/PermissonRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenCertConf.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenCertConf.d.ts new file mode 100644 index 00000000..45ddc57d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenCertConf.d.ts @@ -0,0 +1,3 @@ +export default interface AccessTokenCertConf { + "x5t#S256"?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenCertConf.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenCertConf.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenCertConf.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenRepresentation.d.ts new file mode 100644 index 00000000..b42a07a7 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenRepresentation.d.ts @@ -0,0 +1,51 @@ +import type AccessTokenAccess from "./AccessTokenAccess.js"; +import type AccessTokenCertConf from "./accessTokenCertConf.js"; +import type AddressClaimSet from "./addressClaimSet.js"; +import type { Category } from "./resourceServerRepresentation.js"; +export default interface AccessTokenRepresentation { + acr?: string; + address?: AddressClaimSet; + "allowed-origins"?: string[]; + at_hash?: string; + auth_time?: number; + authorization?: AccessTokenRepresentation; + azp?: string; + birthdate?: string; + c_hash?: string; + category?: Category; + claims_locales?: string; + cnf?: AccessTokenCertConf; + email?: string; + email_verified?: boolean; + exp?: number; + family_name?: string; + gender: string; + given_name?: string; + iat?: number; + iss?: string; + jti?: string; + locale?: string; + middle_name?: string; + name?: string; + nbf?: number; + nickname?: string; + nonce?: string; + otherClaims?: { + [index: string]: string; + }; + phone_number?: string; + phone_number_verified?: boolean; + picture?: string; + preferred_username?: string; + profile?: string; + realm_access?: AccessTokenAccess; + s_hash?: string; + scope?: string; + session_state?: string; + sub?: string; + "trusted-certs"?: string[]; + typ?: string; + updated_at?: number; + website?: string; + zoneinfo?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/accessTokenRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/addressClaimSet.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/addressClaimSet.d.ts new file mode 100644 index 00000000..2ee29d7d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/addressClaimSet.d.ts @@ -0,0 +1,8 @@ +export default interface AddressClaimSet { + country?: string; + formatted?: string; + locality?: string; + postal_code?: string; + region?: string; + street_address?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/addressClaimSet.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/addressClaimSet.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/addressClaimSet.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/adminEventRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/adminEventRepresentation.d.ts new file mode 100644 index 00000000..4b8040bd --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/adminEventRepresentation.d.ts @@ -0,0 +1,12 @@ +import type AuthDetailsRepresentation from "./authDetailsRepresentation.js"; +export default interface AdminEventRepresentation { + authDetails?: AuthDetailsRepresentation; + error?: string; + operationType?: string; + realmId?: string; + representation?: string; + resourcePath?: string; + resourceType?: string; + time?: number; + details?: Record; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/adminEventRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/adminEventRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/adminEventRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authDetailsRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authDetailsRepresentation.d.ts new file mode 100644 index 00000000..0a916e00 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authDetailsRepresentation.d.ts @@ -0,0 +1,6 @@ +export default interface AuthDetailsRepresentation { + clientId?: string; + ipAddress?: string; + realmId?: string; + userId?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authDetailsRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authDetailsRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authDetailsRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionExportRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionExportRepresentation.d.ts new file mode 100644 index 00000000..c677e52f --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionExportRepresentation.d.ts @@ -0,0 +1,12 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_authenticationexecutionexportrepresentation + */ +export default interface AuthenticationExecutionExportRepresentation { + flowAlias?: string; + userSetupAllowed?: boolean; + authenticatorConfig?: string; + authenticator?: string; + requirement?: string; + priority?: number; + autheticatorFlow?: boolean; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionExportRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionExportRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionExportRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionInfoRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionInfoRepresentation.d.ts new file mode 100644 index 00000000..a12f5964 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionInfoRepresentation.d.ts @@ -0,0 +1,18 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_authenticationexecutioninforepresentation + */ +export default interface AuthenticationExecutionInfoRepresentation { + id?: string; + requirement?: string; + displayName?: string; + alias?: string; + description?: string; + requirementChoices?: string[]; + configurable?: boolean; + authenticationFlow?: boolean; + providerId?: string; + authenticationConfig?: string; + flowId?: string; + level?: number; + index?: number; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionInfoRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionInfoRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationExecutionInfoRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationFlowRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationFlowRepresentation.d.ts new file mode 100644 index 00000000..47842544 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationFlowRepresentation.d.ts @@ -0,0 +1,13 @@ +import type AuthenticationExecutionExportRepresentation from "./authenticationExecutionExportRepresentation.js"; +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_authenticationflowrepresentation + */ +export default interface AuthenticationFlowRepresentation { + id?: string; + alias?: string; + description?: string; + providerId?: string; + topLevel?: boolean; + builtIn?: boolean; + authenticationExecutions?: AuthenticationExecutionExportRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationFlowRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationFlowRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticationFlowRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation.d.ts new file mode 100644 index 00000000..523e9c45 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation.d.ts @@ -0,0 +1,20 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_authenticatorconfiginforepresentation + */ +export default interface AuthenticatorConfigInfoRepresentation { + name?: string; + providerId?: string; + helpText?: string; + properties?: ConfigPropertyRepresentation[]; +} +export interface ConfigPropertyRepresentation { + name?: string; + label?: string; + helpText?: string; + type?: string; + defaultValue?: any; + options?: string[]; + secret?: boolean; + required?: boolean; + placeholder?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigRepresentation.d.ts new file mode 100644 index 00000000..8db2730c --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigRepresentation.d.ts @@ -0,0 +1,16 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_authenticatorconfigrepresentation + */ +export default interface AuthenticatorConfigRepresentation { + id?: string; + alias?: string; + config?: { + [index: string]: string; + }; +} +export interface AuthenticationProviderRepresentation { + id?: string; + displayName?: string; + description?: string; + supportsSecret?: boolean; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/certificateRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/certificateRepresentation.d.ts new file mode 100644 index 00000000..2fc265db --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/certificateRepresentation.d.ts @@ -0,0 +1,9 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/#_certificaterepresentation + */ +export default interface CertificateRepresentation { + privateKey?: string; + publicKey?: string; + certificate?: string; + kid?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/certificateRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/certificateRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/certificateRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientInitialAccessPresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientInitialAccessPresentation.d.ts new file mode 100644 index 00000000..a41c7687 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientInitialAccessPresentation.d.ts @@ -0,0 +1,11 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_clientinitialaccesspresentation + */ +export default interface ClientInitialAccessPresentation { + id?: string; + token?: string; + timestamp?: number; + expiration?: number; + count?: number; + remainingCount?: number; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientInitialAccessPresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientInitialAccessPresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientInitialAccessPresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPoliciesRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPoliciesRepresentation.d.ts new file mode 100644 index 00000000..f8cab091 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPoliciesRepresentation.d.ts @@ -0,0 +1,8 @@ +import type ClientPolicyRepresentation from "./clientPolicyRepresentation.js"; +/** + * https://www.keycloak.org/docs-api/15.0/rest-api/#_clientpoliciesrepresentation + */ +export default interface ClientPoliciesRepresentation { + globalPolicies?: ClientPolicyRepresentation[]; + policies?: ClientPolicyRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPoliciesRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPoliciesRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPoliciesRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyConditionRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyConditionRepresentation.d.ts new file mode 100644 index 00000000..f03322af --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyConditionRepresentation.d.ts @@ -0,0 +1,7 @@ +/** + * https://www.keycloak.org/docs-api/15.0/rest-api/#_clientpolicyconditionrepresentation + */ +export default interface ClientPolicyConditionRepresentation { + condition?: string; + configuration?: object; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyConditionRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyConditionRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyConditionRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyExecutorRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyExecutorRepresentation.d.ts new file mode 100644 index 00000000..bf443ff9 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyExecutorRepresentation.d.ts @@ -0,0 +1,7 @@ +/** + * https://www.keycloak.org/docs-api/15.0/rest-api/#_clientpolicyexecutorrepresentation + */ +export default interface ClientPolicyExecutorRepresentation { + configuration?: object; + executor?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyExecutorRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyExecutorRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyExecutorRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation.d.ts new file mode 100644 index 00000000..30127cfe --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation.d.ts @@ -0,0 +1,11 @@ +import type ClientPolicyConditionRepresentation from "./clientPolicyConditionRepresentation.js"; +/** + * https://www.keycloak.org/docs-api/15.0/rest-api/#_clientpolicyrepresentation + */ +export default interface ClientPolicyRepresentation { + conditions?: ClientPolicyConditionRepresentation[]; + description?: string; + enabled?: boolean; + name?: string; + profiles?: string[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation.d.ts new file mode 100644 index 00000000..431dcb4a --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation.d.ts @@ -0,0 +1,9 @@ +import type ClientPolicyExecutorRepresentation from "./clientPolicyExecutorRepresentation.js"; +/** + * https://www.keycloak.org/docs-api/15.0/rest-api/#_clientprofilerepresentation + */ +export default interface ClientProfileRepresentation { + description?: string; + executors?: ClientPolicyExecutorRepresentation[]; + name?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfilesRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfilesRepresentation.d.ts new file mode 100644 index 00000000..7c2b98c6 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfilesRepresentation.d.ts @@ -0,0 +1,8 @@ +import type ClientProfileRepresentation from "./clientProfileRepresentation.js"; +/** + * https://www.keycloak.org/docs-api/15.0/rest-api/#_clientprofilesrepresentation + */ +export default interface ClientProfilesRepresentation { + globalProfiles?: ClientProfileRepresentation[]; + profiles?: ClientProfileRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfilesRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfilesRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientProfilesRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientRepresentation.d.ts new file mode 100644 index 00000000..85631367 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientRepresentation.d.ts @@ -0,0 +1,45 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_clientrepresentation + */ +import type ResourceServerRepresentation from "./resourceServerRepresentation.js"; +import type ProtocolMapperRepresentation from "./protocolMapperRepresentation.js"; +export default interface ClientRepresentation { + access?: Record; + adminUrl?: string; + attributes?: Record; + authenticationFlowBindingOverrides?: Record; + authorizationServicesEnabled?: boolean; + authorizationSettings?: ResourceServerRepresentation; + baseUrl?: string; + bearerOnly?: boolean; + clientAuthenticatorType?: string; + clientId?: string; + consentRequired?: boolean; + defaultClientScopes?: string[]; + defaultRoles?: string[]; + description?: string; + directAccessGrantsEnabled?: boolean; + enabled?: boolean; + alwaysDisplayInConsole?: boolean; + frontchannelLogout?: boolean; + fullScopeAllowed?: boolean; + id?: string; + implicitFlowEnabled?: boolean; + name?: string; + nodeReRegistrationTimeout?: number; + notBefore?: number; + optionalClientScopes?: string[]; + origin?: string; + protocol?: string; + protocolMappers?: ProtocolMapperRepresentation[]; + publicClient?: boolean; + redirectUris?: string[]; + registeredNodes?: Record; + registrationAccessToken?: string; + rootUrl?: string; + secret?: string; + serviceAccountsEnabled?: boolean; + standardFlowEnabled?: boolean; + surrogateAuthRequired?: boolean; + webOrigins?: string[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientScopeRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientScopeRepresentation.d.ts new file mode 100644 index 00000000..a4bac691 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientScopeRepresentation.d.ts @@ -0,0 +1,12 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_clientscoperepresentation + */ +import type ProtocolMapperRepresentation from "./protocolMapperRepresentation.js"; +export default interface ClientScopeRepresentation { + attributes?: Record; + description?: string; + id?: string; + name?: string; + protocol?: string; + protocolMappers?: ProtocolMapperRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientScopeRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientScopeRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientScopeRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientSessionStat.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientSessionStat.d.ts new file mode 100644 index 00000000..e1f3eae6 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientSessionStat.d.ts @@ -0,0 +1,6 @@ +export interface ClientSessionStat { + id: string; + clientId: string; + active: string; + offline: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientSessionStat.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientSessionStat.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/clientSessionStat.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentExportRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentExportRepresentation.d.ts new file mode 100644 index 00000000..d7709ab6 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentExportRepresentation.d.ts @@ -0,0 +1,15 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_componentexportrepresentation + */ +export default interface ComponentExportRepresentation { + id?: string; + name?: string; + providerId?: string; + subType?: string; + subComponents?: { + [index: string]: ComponentExportRepresentation; + }; + config?: { + [index: string]: string; + }; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentExportRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentExportRepresentation.js new file mode 100644 index 00000000..ad9c2e10 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentExportRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_componentexportrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentRepresentation.d.ts new file mode 100644 index 00000000..8011e9cd --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentRepresentation.d.ts @@ -0,0 +1,14 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_componentrepresentation + */ +export default interface ComponentRepresentation { + id?: string; + name?: string; + providerId?: string; + providerType?: string; + parentId?: string; + subType?: string; + config?: { + [index: string]: string | string[]; + }; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentRepresentation.js new file mode 100644 index 00000000..99430529 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_componentrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation.d.ts new file mode 100644 index 00000000..a1b16e6b --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation.d.ts @@ -0,0 +1,12 @@ +import type { ConfigPropertyRepresentation } from "./configPropertyRepresentation.js"; +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_componenttyperepresentation + */ +export default interface ComponentTypeRepresentation { + id: string; + helpText: string; + properties: ConfigPropertyRepresentation[]; + metadata: { + [index: string]: any; + }; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/configPropertyRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/configPropertyRepresentation.d.ts new file mode 100644 index 00000000..98e83774 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/configPropertyRepresentation.d.ts @@ -0,0 +1,13 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_configpropertyrepresentation + */ +export interface ConfigPropertyRepresentation { + name?: string; + label?: string; + helpText?: string; + type?: string; + defaultValue?: object; + options?: string[]; + secret?: boolean; + required?: boolean; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/configPropertyRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/configPropertyRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/configPropertyRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation.d.ts new file mode 100644 index 00000000..2bc5a7de --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation.d.ts @@ -0,0 +1,15 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_credentialrepresentation + */ +export default interface CredentialRepresentation { + createdDate?: number; + credentialData?: string; + id?: string; + priority?: number; + secretData?: string; + temporary?: boolean; + type?: string; + userLabel?: string; + value?: string; + federationLink?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation.js new file mode 100644 index 00000000..7dffc8a3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/credentialRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_credentialrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/effectiveMessageBundleRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/effectiveMessageBundleRepresentation.d.ts new file mode 100644 index 00000000..168935de --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/effectiveMessageBundleRepresentation.d.ts @@ -0,0 +1,5 @@ +export default interface EffectiveMessageBundleRepresentation { + key: string; + value: string; + source: "THEME" | "REALM"; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/effectiveMessageBundleRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/effectiveMessageBundleRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/effectiveMessageBundleRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/evaluationResultRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/evaluationResultRepresentation.d.ts new file mode 100644 index 00000000..c14c7e53 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/evaluationResultRepresentation.d.ts @@ -0,0 +1,12 @@ +import type { DecisionEffect } from "./policyRepresentation.js"; +import type PolicyResultRepresentation from "./policyResultRepresentation.js"; +import type ResourceRepresentation from "./resourceRepresentation.js"; +import type ScopeRepresentation from "./scopeRepresentation.js"; +export default interface EvaluationResultRepresentation { + resource?: ResourceRepresentation; + scopes?: ScopeRepresentation[]; + policies?: PolicyResultRepresentation[]; + status?: DecisionEffect; + allowedScopes?: ScopeRepresentation[]; + deniedScopes?: ScopeRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/evaluationResultRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/evaluationResultRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/evaluationResultRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventRepresentation.d.ts new file mode 100644 index 00000000..ab56a60a --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventRepresentation.d.ts @@ -0,0 +1,15 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_eventrepresentation + */ +import type EventType from "./eventTypes.js"; +export default interface EventRepresentation { + clientId?: string; + details?: Record; + error?: string; + ipAddress?: string; + realmId?: string; + sessionId?: string; + time?: number; + type?: EventType; + userId?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventTypes.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventTypes.d.ts new file mode 100644 index 00000000..354f6221 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventTypes.d.ts @@ -0,0 +1,2 @@ +type EventType = "LOGIN" | "LOGIN_ERROR" | "REGISTER" | "REGISTER_ERROR" | "LOGOUT" | "LOGOUT_ERROR" | "CODE_TO_TOKEN" | "CODE_TO_TOKEN_ERROR" | "CLIENT_LOGIN" | "CLIENT_LOGIN_ERROR" | "REFRESH_TOKEN" | "REFRESH_TOKEN_ERROR" | "VALIDATE_ACCESS_TOKEN" | "VALIDATE_ACCESS_TOKEN_ERROR" | "INTROSPECT_TOKEN" | "INTROSPECT_TOKEN_ERROR" | "FEDERATED_IDENTITY_LINK" | "FEDERATED_IDENTITY_LINK_ERROR" | "REMOVE_FEDERATED_IDENTITY" | "REMOVE_FEDERATED_IDENTITY_ERROR" | "UPDATE_EMAIL" | "UPDATE_EMAIL_ERROR" | "UPDATE_PROFILE" | "UPDATE_PROFILE_ERROR" | "UPDATE_PASSWORD" | "UPDATE_PASSWORD_ERROR" | "UPDATE_TOTP" | "UPDATE_TOTP_ERROR" | "VERIFY_EMAIL" | "VERIFY_EMAIL_ERROR" | "REMOVE_TOTP" | "REMOVE_TOTP_ERROR" | "REVOKE_GRANT" | "REVOKE_GRANT_ERROR" | "SEND_VERIFY_EMAIL" | "SEND_VERIFY_EMAIL_ERROR" | "SEND_RESET_PASSWORD" | "SEND_RESET_PASSWORD_ERROR" | "SEND_IDENTITY_PROVIDER_LINK" | "SEND_IDENTITY_PROVIDER_LINK_ERROR" | "RESET_PASSWORD" | "RESET_PASSWORD_ERROR" | "RESTART_AUTHENTICATION" | "RESTART_AUTHENTICATION_ERROR" | "INVALID_SIGNATURE" | "INVALID_SIGNATURE_ERROR" | "REGISTER_NODE" | "REGISTER_NODE_ERROR" | "UNREGISTER_NODE" | "UNREGISTER_NODE_ERROR" | "USER_INFO_REQUEST" | "USER_INFO_REQUEST_ERROR" | "IDENTITY_PROVIDER_LINK_ACCOUNT" | "IDENTITY_PROVIDER_LINK_ACCOUNT_ERROR" | "IDENTITY_PROVIDER_LOGIN" | "IDENTITY_PROVIDER_LOGIN_ERROR" | "IDENTITY_PROVIDER_FIRST_LOGIN" | "IDENTITY_PROVIDER_FIRST_LOGIN_ERROR" | "IDENTITY_PROVIDER_POST_LOGIN" | "IDENTITY_PROVIDER_POST_LOGIN_ERROR" | "IDENTITY_PROVIDER_RESPONSE" | "IDENTITY_PROVIDER_RESPONSE_ERROR" | "IDENTITY_PROVIDER_RETRIEVE_TOKEN" | "IDENTITY_PROVIDER_RETRIEVE_TOKEN_ERROR" | "IMPERSONATE" | "IMPERSONATE_ERROR" | "CUSTOM_REQUIRED_ACTION" | "CUSTOM_REQUIRED_ACTION_ERROR" | "EXECUTE_ACTIONS" | "EXECUTE_ACTIONS_ERROR" | "EXECUTE_ACTION_TOKEN" | "EXECUTE_ACTION_TOKEN_ERROR" | "CLIENT_INFO" | "CLIENT_INFO_ERROR" | "CLIENT_REGISTER" | "CLIENT_REGISTER_ERROR" | "CLIENT_UPDATE" | "CLIENT_UPDATE_ERROR" | "CLIENT_DELETE" | "CLIENT_DELETE_ERROR" | "CLIENT_INITIATED_ACCOUNT_LINKING" | "CLIENT_INITIATED_ACCOUNT_LINKING_ERROR" | "TOKEN_EXCHANGE" | "TOKEN_EXCHANGE_ERROR" | "PERMISSION_TOKEN" | "PERMISSION_TOKEN_ERROR" | "UPDATE_CREDENTIAL" | "UPDATE_CREDENTIAL_ERROR" | "REMOVE_CREDENTIAL" | "REMOVE_CREDENTIAL_ERROR"; +export default EventType; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventTypes.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventTypes.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/eventTypes.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/featureRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/featureRepresentation.d.ts new file mode 100644 index 00000000..3efc6f63 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/featureRepresentation.d.ts @@ -0,0 +1,15 @@ +export default interface FeatureRepresentation { + name: string; + label: string; + type: FeatureType; + enabled: boolean; + dependencies: string[]; +} +export declare enum FeatureType { + Default = "DEFAULT", + DisabledByDefault = "DISABLED_BY_DEFAULT", + Preview = "PREVIEW", + PreviewDisabledByDefault = "PREVIEW_DISABLED_BY_DEFAULT", + Experimental = "EXPERIMENTAL", + Deprecated = "DEPRECATED" +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/featureRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/featureRepresentation.js new file mode 100644 index 00000000..b0e9df28 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/featureRepresentation.js @@ -0,0 +1,9 @@ +export var FeatureType; +(function (FeatureType) { + FeatureType["Default"] = "DEFAULT"; + FeatureType["DisabledByDefault"] = "DISABLED_BY_DEFAULT"; + FeatureType["Preview"] = "PREVIEW"; + FeatureType["PreviewDisabledByDefault"] = "PREVIEW_DISABLED_BY_DEFAULT"; + FeatureType["Experimental"] = "EXPERIMENTAL"; + FeatureType["Deprecated"] = "DEPRECATED"; +})(FeatureType || (FeatureType = {})); diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/federatedIdentityRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/federatedIdentityRepresentation.d.ts new file mode 100644 index 00000000..f568f9ef --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/federatedIdentityRepresentation.d.ts @@ -0,0 +1,8 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_federatedidentityrepresentation + */ +export default interface FederatedIdentityRepresentation { + identityProvider?: string; + userId?: string; + userName?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/federatedIdentityRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/federatedIdentityRepresentation.js new file mode 100644 index 00000000..058a0745 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/federatedIdentityRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_federatedidentityrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/globalRequestResult.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/globalRequestResult.d.ts new file mode 100644 index 00000000..d7c28186 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/globalRequestResult.d.ts @@ -0,0 +1,7 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_globalrequestresult + */ +export default interface GlobalRequestResult { + successRequests?: string[]; + failedRequests?: string[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/globalRequestResult.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/globalRequestResult.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/globalRequestResult.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/groupRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/groupRepresentation.d.ts new file mode 100644 index 00000000..c6d81500 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/groupRepresentation.d.ts @@ -0,0 +1,14 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_grouprepresentation + */ +export default interface GroupRepresentation { + id?: string; + name?: string; + path?: string; + subGroupCount?: number; + subGroups?: GroupRepresentation[]; + access?: Record; + attributes?: Record; + clientRoles?: Record; + realmRoles?: string[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/groupRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/groupRepresentation.js new file mode 100644 index 00000000..ba234101 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/groupRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_grouprepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation.d.ts new file mode 100644 index 00000000..58b42027 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation.d.ts @@ -0,0 +1,10 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_identityprovidermapperrepresentation + */ +export default interface IdentityProviderMapperRepresentation { + config?: any; + id?: string; + identityProviderAlias?: string; + identityProviderMapper?: string; + name?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation.js new file mode 100644 index 00000000..c55dd03a --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_identityprovidermapperrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperTypeRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperTypeRepresentation.d.ts new file mode 100644 index 00000000..12965643 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperTypeRepresentation.d.ts @@ -0,0 +1,8 @@ +import type { ConfigPropertyRepresentation } from "./configPropertyRepresentation.js"; +export interface IdentityProviderMapperTypeRepresentation { + id?: string; + name?: string; + category?: string; + helpText?: string; + properties?: ConfigPropertyRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperTypeRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperTypeRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderMapperTypeRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation.d.ts new file mode 100644 index 00000000..1a568933 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation.d.ts @@ -0,0 +1,19 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_identityproviderrepresentation + */ +export default interface IdentityProviderRepresentation { + addReadTokenRoleOnCreate?: boolean; + alias?: string; + config?: Record; + displayName?: string; + enabled?: boolean; + firstBrokerLoginFlowAlias?: string; + internalId?: string; + linkOnly?: boolean; + hideOnLogin?: boolean; + postBrokerLoginFlowAlias?: string; + providerId?: string; + storeToken?: boolean; + trustEmail?: boolean; + organizationId?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation.js new file mode 100644 index 00000000..f578c20d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_identityproviderrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/keyMetadataRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/keyMetadataRepresentation.d.ts new file mode 100644 index 00000000..093e2cae --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/keyMetadataRepresentation.d.ts @@ -0,0 +1,20 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_keysmetadatarepresentation-keymetadatarepresentation + */ +export default interface KeysMetadataRepresentation { + active?: { + [index: string]: string; + }; + keys?: KeyMetadataRepresentation[]; +} +export interface KeyMetadataRepresentation { + providerId?: string; + providerPriority?: number; + kid?: string; + status?: string; + type?: string; + algorithm?: string; + publicKey?: string; + certificate?: string; + validTo?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/keyMetadataRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/keyMetadataRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/keyMetadataRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/keystoreConfig.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/keystoreConfig.d.ts new file mode 100644 index 00000000..ef834803 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/keystoreConfig.d.ts @@ -0,0 +1,11 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/#_keystoreconfig + */ +export default interface KeyStoreConfig { + realmCertificate?: boolean; + storePassword?: string; + keyPassword?: string; + keyAlias?: string; + realmAlias?: string; + format?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/keystoreConfig.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/keystoreConfig.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/keystoreConfig.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/managementPermissionReference.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/managementPermissionReference.d.ts new file mode 100644 index 00000000..9a6c1d56 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/managementPermissionReference.d.ts @@ -0,0 +1,5 @@ +export interface ManagementPermissionReference { + enabled?: boolean; + resource?: string; + scopePermissions?: Record; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/managementPermissionReference.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/managementPermissionReference.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/managementPermissionReference.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/mappingsRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/mappingsRepresentation.d.ts new file mode 100644 index 00000000..4948d4f4 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/mappingsRepresentation.d.ts @@ -0,0 +1,8 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_mappingsrepresentation + */ +import type RoleRepresentation from "./roleRepresentation.js"; +export default interface MappingsRepresentation { + clientMappings?: Record; + realmMappings?: RoleRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/mappingsRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/mappingsRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/mappingsRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/memberRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/memberRepresentation.d.ts new file mode 100644 index 00000000..f469703d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/memberRepresentation.d.ts @@ -0,0 +1,4 @@ +import type UserRepresentation from "./userRepresentation.js"; +export default interface MemberRepresentation extends UserRepresentation { + membershipType?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/memberRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/memberRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/memberRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationDomainRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationDomainRepresentation.d.ts new file mode 100644 index 00000000..5089fc90 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationDomainRepresentation.d.ts @@ -0,0 +1,4 @@ +export default interface OrganizationDomainRepresentation { + name?: string; + verified?: boolean; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationDomainRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationDomainRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationDomainRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationRepresentation.d.ts new file mode 100644 index 00000000..f2a607e0 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationRepresentation.d.ts @@ -0,0 +1,15 @@ +import type OrganizationDomainRepresentation from "./organizationDomainRepresentation.js"; +import type IdentityProviderRepresentation from "./identityProviderRepresentation.js"; +import type MemberRepresentation from "./memberRepresentation.js"; +export default interface OrganizationRepresentation { + id?: string; + name?: string; + alias?: string; + description?: string; + redirectUrl?: string; + enabled?: boolean; + attributes?: Record; + domains?: OrganizationDomainRepresentation[]; + members?: MemberRepresentation[]; + identityProviders?: IdentityProviderRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/organizationRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/passwordPolicyTypeRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/passwordPolicyTypeRepresentation.d.ts new file mode 100644 index 00000000..6803e17e --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/passwordPolicyTypeRepresentation.d.ts @@ -0,0 +1,10 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_passwordpolicytyperepresentation + */ +export default interface PasswordPolicyTypeRepresentation { + id?: string; + displayName?: string; + configType?: string; + defaultValue?: string; + multipleSupported?: boolean; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/passwordPolicyTypeRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/passwordPolicyTypeRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/passwordPolicyTypeRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyEvaluationResponse.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyEvaluationResponse.d.ts new file mode 100644 index 00000000..16acd16d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyEvaluationResponse.d.ts @@ -0,0 +1,9 @@ +import type AccessTokenRepresentation from "./accessTokenRepresentation.js"; +import type EvaluationResultRepresentation from "./evaluationResultRepresentation.js"; +import type { DecisionEffect } from "./policyRepresentation.js"; +export default interface PolicyEvaluationResponse { + results?: EvaluationResultRepresentation[]; + entitlements?: boolean; + status?: DecisionEffect; + rpt?: AccessTokenRepresentation; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyEvaluationResponse.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyEvaluationResponse.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyEvaluationResponse.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyProviderRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyProviderRepresentation.d.ts new file mode 100644 index 00000000..24ffe1da --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyProviderRepresentation.d.ts @@ -0,0 +1,5 @@ +export default interface PolicyProviderRepresentation { + type?: string; + name?: string; + group?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyProviderRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyProviderRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyProviderRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyRepresentation.d.ts new file mode 100644 index 00000000..2a1f7008 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyRepresentation.d.ts @@ -0,0 +1,36 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_policyrepresentation + */ +export declare enum DecisionStrategy { + AFFIRMATIVE = "AFFIRMATIVE", + UNANIMOUS = "UNANIMOUS", + CONSENSUS = "CONSENSUS" +} +export declare enum DecisionEffect { + Permit = "PERMIT", + Deny = "DENY" +} +export declare enum Logic { + POSITIVE = "POSITIVE", + NEGATIVE = "NEGATIVE" +} +export interface PolicyRoleRepresentation { + id: string; + required?: boolean; +} +export default interface PolicyRepresentation { + config?: Record; + decisionStrategy?: DecisionStrategy; + description?: string; + id?: string; + logic?: Logic; + name?: string; + owner?: string; + policies?: string[]; + resources?: string[]; + scopes?: string[]; + type?: string; + users?: string[]; + roles?: PolicyRoleRepresentation[]; + resourceType?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyRepresentation.js new file mode 100644 index 00000000..b4a7bd3d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyRepresentation.js @@ -0,0 +1,19 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_policyrepresentation + */ +export var DecisionStrategy; +(function (DecisionStrategy) { + DecisionStrategy["AFFIRMATIVE"] = "AFFIRMATIVE"; + DecisionStrategy["UNANIMOUS"] = "UNANIMOUS"; + DecisionStrategy["CONSENSUS"] = "CONSENSUS"; +})(DecisionStrategy || (DecisionStrategy = {})); +export var DecisionEffect; +(function (DecisionEffect) { + DecisionEffect["Permit"] = "PERMIT"; + DecisionEffect["Deny"] = "DENY"; +})(DecisionEffect || (DecisionEffect = {})); +export var Logic; +(function (Logic) { + Logic["POSITIVE"] = "POSITIVE"; + Logic["NEGATIVE"] = "NEGATIVE"; +})(Logic || (Logic = {})); diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyResultRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyResultRepresentation.d.ts new file mode 100644 index 00000000..bcea4cd0 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyResultRepresentation.d.ts @@ -0,0 +1,8 @@ +import type PolicyRepresentation from "./policyRepresentation.js"; +import type { DecisionEffect } from "./policyRepresentation.js"; +export default interface PolicyResultRepresentation { + policy?: PolicyRepresentation; + status?: DecisionEffect; + associatedPolicies?: PolicyResultRepresentation[]; + scopes?: string[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyResultRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyResultRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/policyResultRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/profileInfoRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/profileInfoRepresentation.d.ts new file mode 100644 index 00000000..74151b2d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/profileInfoRepresentation.d.ts @@ -0,0 +1,9 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_profileinforepresentation + */ +export default interface ProfileInfoRepresentation { + name?: string; + disabledFeatures?: string[]; + previewFeatures?: string[]; + experimentalFeatures?: string[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/profileInfoRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/profileInfoRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/profileInfoRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/protocolMapperRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/protocolMapperRepresentation.d.ts new file mode 100644 index 00000000..d227c6dd --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/protocolMapperRepresentation.d.ts @@ -0,0 +1,10 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_protocolmapperrepresentation + */ +export default interface ProtocolMapperRepresentation { + config?: Record; + id?: string; + name?: string; + protocol?: string; + protocolMapper?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/protocolMapperRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/protocolMapperRepresentation.js new file mode 100644 index 00000000..7cd16004 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/protocolMapperRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_protocolmapperrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmEventsConfigRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmEventsConfigRepresentation.d.ts new file mode 100644 index 00000000..35cc05e0 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmEventsConfigRepresentation.d.ts @@ -0,0 +1,11 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/#_realmeventsconfigrepresentation + */ +export interface RealmEventsConfigRepresentation { + eventsEnabled?: boolean; + eventsExpiration?: number; + eventsListeners?: string[]; + enabledEventTypes?: string[]; + adminEventsEnabled?: boolean; + adminEventsDetailsEnabled?: boolean; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmEventsConfigRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmEventsConfigRepresentation.js new file mode 100644 index 00000000..d693686d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmEventsConfigRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/#_realmeventsconfigrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmRepresentation.d.ts new file mode 100644 index 00000000..6fdba1c6 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmRepresentation.d.ts @@ -0,0 +1,139 @@ +import type ClientRepresentation from "./clientRepresentation.js"; +import type ComponentExportRepresentation from "./componentExportRepresentation.js"; +import type UserRepresentation from "./userRepresentation.js"; +import type GroupRepresentation from "./groupRepresentation.js"; +import type IdentityProviderRepresentation from "./identityProviderRepresentation.js"; +import type RequiredActionProviderRepresentation from "./requiredActionProviderRepresentation.js"; +import type RolesRepresentation from "./rolesRepresentation.js"; +import type ClientProfilesRepresentation from "./clientProfilesRepresentation.js"; +import type ClientPoliciesRepresentation from "./clientPoliciesRepresentation.js"; +import type RoleRepresentation from "./roleRepresentation.js"; +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_realmrepresentation + */ +export default interface RealmRepresentation { + accessCodeLifespan?: number; + accessCodeLifespanLogin?: number; + accessCodeLifespanUserAction?: number; + accessTokenLifespan?: number; + accessTokenLifespanForImplicitFlow?: number; + accountTheme?: string; + actionTokenGeneratedByAdminLifespan?: number; + actionTokenGeneratedByUserLifespan?: number; + adminEventsDetailsEnabled?: boolean; + adminEventsEnabled?: boolean; + adminPermissionsClient?: ClientRepresentation; + adminPermissionsEnabled?: boolean; + adminTheme?: string; + attributes?: Record; + authenticationFlows?: any[]; + authenticatorConfig?: any[]; + browserFlow?: string; + browserSecurityHeaders?: Record; + bruteForceProtected?: boolean; + clientAuthenticationFlow?: string; + clientScopeMappings?: Record; + clientScopes?: any[]; + clients?: ClientRepresentation[]; + clientPolicies?: ClientPoliciesRepresentation; + clientProfiles?: ClientProfilesRepresentation; + components?: { + [index: string]: ComponentExportRepresentation; + }; + defaultDefaultClientScopes?: string[]; + defaultGroups?: string[]; + defaultLocale?: string; + defaultOptionalClientScopes?: string[]; + defaultRoles?: string[]; + defaultRole?: RoleRepresentation; + defaultSignatureAlgorithm?: string; + directGrantFlow?: string; + displayName?: string; + displayNameHtml?: string; + dockerAuthenticationFlow?: string; + duplicateEmailsAllowed?: boolean; + editUsernameAllowed?: boolean; + emailTheme?: string; + enabled?: boolean; + enabledEventTypes?: string[]; + eventsEnabled?: boolean; + eventsExpiration?: number; + eventsListeners?: string[]; + failureFactor?: number; + federatedUsers?: UserRepresentation[]; + groups?: GroupRepresentation[]; + id?: string; + identityProviderMappers?: any[]; + identityProviders?: IdentityProviderRepresentation[]; + internationalizationEnabled?: boolean; + keycloakVersion?: string; + loginTheme?: string; + loginWithEmailAllowed?: boolean; + maxDeltaTimeSeconds?: number; + maxFailureWaitSeconds?: number; + maxTemporaryLockouts?: number; + bruteForceStrategy?: "MULTIPLE" | "LINEAR"; + minimumQuickLoginWaitSeconds?: number; + notBefore?: number; + oauth2DeviceCodeLifespan?: number; + oauth2DevicePollingInterval?: number; + offlineSessionIdleTimeout?: number; + offlineSessionMaxLifespan?: number; + offlineSessionMaxLifespanEnabled?: boolean; + organizationsEnabled?: boolean; + verifiableCredentialsEnabled?: boolean; + otpPolicyAlgorithm?: string; + otpPolicyDigits?: number; + otpPolicyInitialCounter?: number; + otpPolicyLookAheadWindow?: number; + otpPolicyPeriod?: number; + otpPolicyType?: string; + otpSupportedApplications?: string[]; + otpPolicyCodeReusable?: boolean; + passwordPolicy?: string; + permanentLockout?: boolean; + protocolMappers?: any[]; + quickLoginCheckMilliSeconds?: number; + realm?: string; + refreshTokenMaxReuse?: number; + registrationAllowed?: boolean; + registrationEmailAsUsername?: boolean; + registrationFlow?: string; + rememberMe?: boolean; + requiredActions?: RequiredActionProviderRepresentation[]; + resetCredentialsFlow?: string; + resetPasswordAllowed?: boolean; + revokeRefreshToken?: boolean; + roles?: RolesRepresentation; + scopeMappings?: any[]; + smtpServer?: Record; + sslRequired?: string; + ssoSessionIdleTimeout?: number; + ssoSessionIdleTimeoutRememberMe?: number; + ssoSessionMaxLifespan?: number; + ssoSessionMaxLifespanRememberMe?: number; + clientSessionIdleTimeout?: number; + clientSessionMaxLifespan?: number; + supportedLocales?: string[]; + userFederationMappers?: any[]; + userFederationProviders?: any[]; + userManagedAccessAllowed?: boolean; + users?: UserRepresentation[]; + verifyEmail?: boolean; + waitIncrementSeconds?: number; +} +export type PartialImportRealmRepresentation = RealmRepresentation & { + ifResourceExists: "FAIL" | "SKIP" | "OVERWRITE"; +}; +export type PartialImportResponse = { + overwritten: number; + added: number; + skipped: number; + results: PartialImportResult[]; +}; +export type PartialImportResult = { + action: string; + resourceType: string; + resourceName: string; + id: string; +}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/realmRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigInfoRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigInfoRepresentation.d.ts new file mode 100644 index 00000000..a8361e5e --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigInfoRepresentation.d.ts @@ -0,0 +1,4 @@ +import { ConfigPropertyRepresentation } from "./configPropertyRepresentation.js"; +export default interface RequiredActionConfigInfoRepresentation { + properties?: ConfigPropertyRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigInfoRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigInfoRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigInfoRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigRepresentation.d.ts new file mode 100644 index 00000000..7d34814c --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigRepresentation.d.ts @@ -0,0 +1,5 @@ +export default interface RequiredActionConfigRepresentation { + config?: { + [index: string]: string; + }; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation.d.ts new file mode 100644 index 00000000..7d4e63c0 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation.d.ts @@ -0,0 +1,19 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_requiredactionproviderrepresentation + */ +export declare enum RequiredActionAlias { + VERIFY_EMAIL = "VERIFY_EMAIL", + UPDATE_PROFILE = "UPDATE_PROFILE", + CONFIGURE_TOTP = "CONFIGURE_TOTP", + UPDATE_PASSWORD = "UPDATE_PASSWORD", + TERMS_AND_CONDITIONS = "TERMS_AND_CONDITIONS" +} +export default interface RequiredActionProviderRepresentation { + alias?: string; + config?: Record; + defaultAction?: boolean; + enabled?: boolean; + name?: string; + providerId?: string; + priority?: number; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation.js new file mode 100644 index 00000000..eb85d049 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation.js @@ -0,0 +1,11 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_requiredactionproviderrepresentation + */ +export var RequiredActionAlias; +(function (RequiredActionAlias) { + RequiredActionAlias["VERIFY_EMAIL"] = "VERIFY_EMAIL"; + RequiredActionAlias["UPDATE_PROFILE"] = "UPDATE_PROFILE"; + RequiredActionAlias["CONFIGURE_TOTP"] = "CONFIGURE_TOTP"; + RequiredActionAlias["UPDATE_PASSWORD"] = "UPDATE_PASSWORD"; + RequiredActionAlias["TERMS_AND_CONDITIONS"] = "TERMS_AND_CONDITIONS"; +})(RequiredActionAlias || (RequiredActionAlias = {})); diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderSimpleRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderSimpleRepresentation.d.ts new file mode 100644 index 00000000..d668788a --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderSimpleRepresentation.d.ts @@ -0,0 +1,5 @@ +export default interface RequiredActionProviderSimpleRepresentation { + id?: string; + name?: string; + providerId?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderSimpleRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderSimpleRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderSimpleRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceEvaluation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceEvaluation.d.ts new file mode 100644 index 00000000..98dc50d2 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceEvaluation.d.ts @@ -0,0 +1,14 @@ +import type ResourceRepresentation from "./resourceRepresentation.js"; +export default interface ResourceEvaluation { + roleIds?: string[]; + clientId?: string; + userId: string; + resources?: ResourceRepresentation[]; + resourceType?: string; + entitlements: boolean; + context: { + attributes: { + [key: string]: string; + }; + }; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceEvaluation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceEvaluation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceEvaluation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation.d.ts new file mode 100644 index 00000000..8b8652d5 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation.d.ts @@ -0,0 +1,19 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_resourcerepresentation + */ +import type { ResourceOwnerRepresentation } from "./resourceServerRepresentation.js"; +import type ScopeRepresentation from "./scopeRepresentation.js"; +export default interface ResourceRepresentation { + name?: string; + type?: string; + owner?: ResourceOwnerRepresentation; + ownerManagedAccess?: boolean; + displayName?: string; + attributes?: { + [index: string]: string[]; + }; + _id?: string; + uris?: string[]; + scopes?: ScopeRepresentation[]; + icon_uri?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceServerRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceServerRepresentation.d.ts new file mode 100644 index 00000000..25532347 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceServerRepresentation.d.ts @@ -0,0 +1,47 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_policyrepresentation + */ +import type PolicyRepresentation from "./policyRepresentation.js"; +import type ResourceRepresentation from "./resourceRepresentation.js"; +import type ScopeRepresentation from "./scopeRepresentation.js"; +export default interface ResourceServerRepresentation { + id?: string; + clientId?: string; + name?: string; + allowRemoteResourceManagement?: boolean; + authorizationSchema?: AuthorizationSchemaRepresentation; + policyEnforcementMode?: PolicyEnforcementMode; + resources?: ResourceRepresentation[]; + policies?: PolicyRepresentation[]; + scopes?: ScopeRepresentation[]; + decisionStrategy?: DecisionStrategy; +} +export interface AuthorizationSchemaRepresentation { + resourceTypes?: ResourceTypesRepresentation[]; +} +export interface ResourceOwnerRepresentation { + id?: string; + name?: string; +} +export interface ResourceTypesRepresentation { + type?: string; + scopes?: string[]; +} +export interface AbstractPolicyRepresentation { + id?: string; + name?: string; + description?: string; + type?: string; + policies?: string[]; + resources?: string[]; + scopes?: string[]; + logic?: Logic; + decisionStrategy?: DecisionStrategy; + owner?: string; + resourcesData?: ResourceRepresentation[]; + scopesData?: ScopeRepresentation[]; +} +export type PolicyEnforcementMode = "ENFORCING" | "PERMISSIVE" | "DISABLED"; +export type DecisionStrategy = "AFFIRMATIVE" | "UNANIMOUS" | "CONSENSUS"; +export type Logic = "POSITIVE" | "NEGATIVE"; +export type Category = "INTERNAL" | "ACCESS" | "ID" | "ADMIN" | "USERINFO"; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceServerRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceServerRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/resourceServerRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/roleRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/roleRepresentation.d.ts new file mode 100644 index 00000000..887b1205 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/roleRepresentation.d.ts @@ -0,0 +1,29 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_rolerepresentation + */ +export default interface RoleRepresentation { + id?: string; + name?: string; + description?: string; + scopeParamRequired?: boolean; + composite?: boolean; + composites?: Composites; + clientRole?: boolean; + containerId?: string; + attributes?: { + [index: string]: string[]; + }; +} +export interface Composites { + realm?: string[]; + client?: { + [index: string]: string[]; + }; + application?: { + [index: string]: string[]; + }; +} +export interface RoleMappingPayload extends RoleRepresentation { + id: string; + name: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/roleRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/roleRepresentation.js new file mode 100644 index 00000000..ed0b15cf --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/roleRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_rolerepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/rolesRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/rolesRepresentation.d.ts new file mode 100644 index 00000000..155909ea --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/rolesRepresentation.d.ts @@ -0,0 +1,13 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_rolesrepresentation + */ +import type RoleRepresentation from "./roleRepresentation.js"; +export default interface RolesRepresentation { + realm?: RoleRepresentation[]; + client?: { + [index: string]: RoleRepresentation[]; + }; + application?: { + [index: string]: RoleRepresentation[]; + }; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/rolesRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/rolesRepresentation.js new file mode 100644 index 00000000..59215db5 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/rolesRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_rolesrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/scopeRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/scopeRepresentation.d.ts new file mode 100644 index 00000000..84b4144a --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/scopeRepresentation.d.ts @@ -0,0 +1,13 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_scoperepresentation + */ +import type PolicyRepresentation from "./policyRepresentation.js"; +import type ResourceRepresentation from "./resourceRepresentation.js"; +export default interface ScopeRepresentation { + displayName?: string; + iconUri?: string; + id?: string; + name?: string; + policies?: PolicyRepresentation[]; + resources?: ResourceRepresentation[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/scopeRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/scopeRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/scopeRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/serverInfoRepesentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/serverInfoRepesentation.d.ts new file mode 100644 index 00000000..7ed2687d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/serverInfoRepesentation.d.ts @@ -0,0 +1,94 @@ +import type ComponentTypeRepresentation from "./componentTypeRepresentation.js"; +import type { ConfigPropertyRepresentation } from "./configPropertyRepresentation.js"; +import FeatureRepresentation from "./featureRepresentation.js"; +import type PasswordPolicyTypeRepresentation from "./passwordPolicyTypeRepresentation.js"; +import type ProfileInfoRepresentation from "./profileInfoRepresentation.js"; +import type ProtocolMapperRepresentation from "./protocolMapperRepresentation.js"; +import type SystemInfoRepresentation from "./systemInfoRepersantation.js"; +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_serverinforepresentation + */ +export interface ServerInfoRepresentation { + systemInfo?: SystemInfoRepresentation; + memoryInfo?: MemoryInfoRepresentation; + profileInfo?: ProfileInfoRepresentation; + features?: FeatureRepresentation[]; + cryptoInfo?: CryptoInfoRepresentation; + themes?: { + [index: string]: ThemeInfoRepresentation[]; + }; + socialProviders?: { + [index: string]: string; + }[]; + identityProviders?: { + [index: string]: string; + }[]; + clientImporters?: { + [index: string]: string; + }[]; + providers?: { + [index: string]: SpiInfoRepresentation; + }; + protocolMapperTypes?: { + [index: string]: ProtocolMapperTypeRepresentation[]; + }; + builtinProtocolMappers?: { + [index: string]: ProtocolMapperRepresentation[]; + }; + clientInstallations?: { + [index: string]: ClientInstallationRepresentation[]; + }; + componentTypes?: { + [index: string]: ComponentTypeRepresentation[]; + }; + passwordPolicies?: PasswordPolicyTypeRepresentation[]; + enums?: { + [index: string]: string[]; + }; +} +export interface ThemeInfoRepresentation { + name: string; + locales?: string[]; +} +export interface SpiInfoRepresentation { + internal: boolean; + providers: { + [index: string]: ProviderRepresentation; + }; +} +export interface ProviderRepresentation { + order: number; + operationalInfo?: Record; +} +export interface ClientInstallationRepresentation { + id: string; + protocol: string; + downloadOnly: boolean; + displayType: string; + helpText: string; + filename: string; + mediaType: string; +} +export interface MemoryInfoRepresentation { + total: number; + totalFormated: string; + used: number; + usedFormated: string; + free: number; + freePercentage: number; + freeFormated: string; +} +export interface ProtocolMapperTypeRepresentation { + id: string; + name: string; + category: string; + helpText: string; + priority: number; + properties: ConfigPropertyRepresentation[]; +} +export interface CryptoInfoRepresentation { + cryptoProvider: string; + supportedKeystoreTypes: string[]; + clientSignatureSymmetricAlgorithms: string[]; + clientSignatureAsymmetricAlgorithms: string[]; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/serverInfoRepesentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/serverInfoRepesentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/serverInfoRepesentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/synchronizationResultRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/synchronizationResultRepresentation.d.ts new file mode 100644 index 00000000..cd49f6ba --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/synchronizationResultRepresentation.d.ts @@ -0,0 +1,11 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_synchronizationresult + */ +export default interface SynchronizationResultRepresentation { + ignored?: boolean; + added?: number; + updated?: number; + removed?: number; + failed?: number; + status?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/synchronizationResultRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/synchronizationResultRepresentation.js new file mode 100644 index 00000000..bb4beeb0 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/synchronizationResultRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_synchronizationresult + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/systemInfoRepersantation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/systemInfoRepersantation.d.ts new file mode 100644 index 00000000..c80b67a9 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/systemInfoRepersantation.d.ts @@ -0,0 +1,23 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_systeminforepresentation + */ +export default interface SystemInfoRepresentation { + version?: string; + serverTime?: string; + uptime?: string; + uptimeMillis?: number; + javaVersion?: string; + javaVendor?: string; + javaVm?: string; + javaVmVersion?: string; + javaRuntime?: string; + javaHome?: string; + osName?: string; + osArchitecture?: string; + osVersion?: string; + fileEncoding?: string; + userName?: string; + userDir?: string; + userTimezone?: string; + userLocale?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/systemInfoRepersantation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/systemInfoRepersantation.js new file mode 100644 index 00000000..19f9a01f --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/systemInfoRepersantation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_systeminforepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/testLdapConnection.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/testLdapConnection.d.ts new file mode 100644 index 00000000..4a69e95d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/testLdapConnection.d.ts @@ -0,0 +1,14 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/#_testldapconnectionrepresentation + */ +export default interface TestLdapConnectionRepresentation { + action?: string; + connectionUrl?: string; + bindDn?: string; + bindCredential?: string; + useTruststoreSpi?: string; + connectionTimeout?: string; + componentId?: string; + startTls?: string; + authType?: string; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/testLdapConnection.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/testLdapConnection.js new file mode 100644 index 00000000..3b9b58f2 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/testLdapConnection.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/#_testldapconnectionrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/userConsentRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userConsentRepresentation.d.ts new file mode 100644 index 00000000..0960af99 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userConsentRepresentation.d.ts @@ -0,0 +1,9 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/#_userconsentrepresentation + */ +export default interface UserConsentRepresentation { + clientId?: string; + createdDate?: number; + grantedClientScopes?: string[]; + lastUpdatedDate?: number; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/userConsentRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userConsentRepresentation.js new file mode 100644 index 00000000..4c150773 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userConsentRepresentation.js @@ -0,0 +1,4 @@ +/** + * https://www.keycloak.org/docs-api/11.0/rest-api/#_userconsentrepresentation + */ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata.d.ts new file mode 100644 index 00000000..5f62d6ad --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata.d.ts @@ -0,0 +1,61 @@ +export interface UserProfileConfig { + attributes?: UserProfileAttribute[]; + groups?: UserProfileGroup[]; + unmanagedAttributePolicy?: UnmanagedAttributePolicy; +} +export interface UserProfileAttribute { + name?: string; + validations?: Record; + validators?: Record; + annotations?: Record; + required?: UserProfileAttributeRequired; + readOnly?: boolean; + permissions?: UserProfileAttributePermissions; + selector?: UserProfileAttributeSelector; + displayName?: string; + group?: string; + multivalued?: boolean; +} +export interface UserProfileAttributeRequired { + roles?: string[]; + scopes?: string[]; +} +export interface UserProfileAttributePermissions { + view?: string[]; + edit?: string[]; +} +export interface UserProfileAttributeSelector { + scopes?: string[]; +} +export interface UserProfileGroup { + name?: string; + displayHeader?: string; + displayDescription?: string; + annotations?: Record; +} +export interface UserProfileAttributeMetadata { + name?: string; + displayName?: string; + required?: boolean; + readOnly?: boolean; + group?: string; + annotations?: Record; + validators?: Record>; + multivalued?: boolean; +} +export interface UserProfileAttributeGroupMetadata { + name?: string; + displayHeader?: string; + displayDescription?: string; + annotations?: Record; +} +export interface UserProfileMetadata { + attributes?: UserProfileAttributeMetadata[]; + groups?: UserProfileAttributeGroupMetadata[]; +} +export declare enum UnmanagedAttributePolicy { + Disabled = "DISABLED", + Enabled = "ENABLED", + AdminView = "ADMIN_VIEW", + AdminEdit = "ADMIN_EDIT" +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata.js new file mode 100644 index 00000000..2f5e7900 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata.js @@ -0,0 +1,7 @@ +export var UnmanagedAttributePolicy; +(function (UnmanagedAttributePolicy) { + UnmanagedAttributePolicy["Disabled"] = "DISABLED"; + UnmanagedAttributePolicy["Enabled"] = "ENABLED"; + UnmanagedAttributePolicy["AdminView"] = "ADMIN_VIEW"; + UnmanagedAttributePolicy["AdminEdit"] = "ADMIN_EDIT"; +})(UnmanagedAttributePolicy || (UnmanagedAttributePolicy = {})); diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/userRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userRepresentation.d.ts new file mode 100644 index 00000000..55e05ff0 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userRepresentation.d.ts @@ -0,0 +1,31 @@ +import type CredentialRepresentation from "./credentialRepresentation.js"; +import type FederatedIdentityRepresentation from "./federatedIdentityRepresentation.js"; +import type { RequiredActionAlias } from "./requiredActionProviderRepresentation.js"; +import type UserConsentRepresentation from "./userConsentRepresentation.js"; +import type { UserProfileMetadata } from "./userProfileMetadata.js"; +export default interface UserRepresentation { + id?: string; + createdTimestamp?: number; + username?: string; + enabled?: boolean; + totp?: boolean; + emailVerified?: boolean; + disableableCredentialTypes?: string[]; + requiredActions?: (RequiredActionAlias | string)[]; + notBefore?: number; + access?: Record; + attributes?: Record; + clientConsents?: UserConsentRepresentation[]; + clientRoles?: Record; + credentials?: CredentialRepresentation[]; + email?: string; + federatedIdentities?: FederatedIdentityRepresentation[]; + federationLink?: string; + firstName?: string; + groups?: string[]; + lastName?: string; + realmRoles?: string[]; + self?: string; + serviceAccountClientId?: string; + userProfileMetadata?: UserProfileMetadata; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/userRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/userSessionRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userSessionRepresentation.d.ts new file mode 100644 index 00000000..270d7a26 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userSessionRepresentation.d.ts @@ -0,0 +1,10 @@ +export default interface UserSessionRepresentation { + id?: string; + clients?: Record; + ipAddress?: string; + lastAccess?: number; + start?: number; + userId?: string; + username?: string; + transientUser?: boolean; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/userSessionRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userSessionRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/userSessionRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation.d.ts new file mode 100644 index 00000000..af9deb73 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation.d.ts @@ -0,0 +1,17 @@ +export type AccessChecker = { + hasAll: (...types: AccessType[]) => boolean; + hasAny: (...types: AccessType[]) => boolean; +}; +export type AccessTypeFunc = (accessChecker: AccessChecker) => boolean; +export type AccessType = "view-realm" | "view-identity-providers" | "manage-identity-providers" | "impersonation" | "create-client" | "manage-users" | "query-realms" | "view-authorization" | "query-clients" | "query-users" | "manage-events" | "manage-realm" | "view-events" | "view-users" | "view-clients" | "manage-authorization" | "manage-clients" | "query-groups" | "anyone" | AccessTypeFunc; +export default interface WhoAmIRepresentation { + userId: string; + realm: string; + displayName: string; + locale: string; + createRealm: boolean; + realm_access: { + [key: string]: AccessType[]; + }; + temporary: boolean; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation.js b/node_modules/@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation.js @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/index.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/index.d.ts new file mode 100644 index 00000000..3f4b49e3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/index.d.ts @@ -0,0 +1,6 @@ +import { KeycloakAdminClient } from "./client.js"; +import { RequiredActionAlias } from "./defs/requiredActionProviderRepresentation.js"; +export declare const requiredAction: typeof RequiredActionAlias; +export default KeycloakAdminClient; +export { NetworkError, fetchWithError } from "./utils/fetchWithError.js"; +export type { NetworkErrorOptions } from "./utils/fetchWithError.js"; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/index.js b/node_modules/@keycloak/keycloak-admin-client/lib/index.js new file mode 100644 index 00000000..3fd77fd3 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/index.js @@ -0,0 +1,5 @@ +import { KeycloakAdminClient } from "./client.js"; +import { RequiredActionAlias } from "./defs/requiredActionProviderRepresentation.js"; +export const requiredAction = RequiredActionAlias; +export default KeycloakAdminClient; +export { NetworkError, fetchWithError } from "./utils/fetchWithError.js"; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/agent.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/agent.d.ts new file mode 100644 index 00000000..471af002 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/agent.d.ts @@ -0,0 +1,31 @@ +import type { KeycloakAdminClient } from "../client.js"; +type Method = "GET" | "POST" | "PUT" | "DELETE"; +export interface RequestArgs { + method: Method; + path?: string; + urlParamKeys?: string[]; + queryParamKeys?: string[]; + keyTransform?: Record; + catchNotFound?: boolean; + payloadKey?: string; + returnResourceIdInLocationHeader?: { + field: string; + }; + /** + * Keys to be ignored, meaning that they will not be filtered out of the request payload even if they are a part of `urlParamKeys` or `queryParamKeys`, + */ + ignoredKeys?: string[]; + headers?: [string, string][] | Record | Headers; +} +export declare class Agent { + #private; + constructor({ client, path, getUrlParams, getBaseUrl, }: { + client: KeycloakAdminClient; + path?: string; + getUrlParams?: () => Record; + getBaseUrl?: () => string; + }); + request({ method, path, urlParamKeys, queryParamKeys, catchNotFound, keyTransform, payloadKey, returnResourceIdInLocationHeader, ignoredKeys, headers, }: RequestArgs): (payload?: any, options?: Pick) => Promise; + updateRequest({ method, path, urlParamKeys, queryParamKeys, catchNotFound, keyTransform, payloadKey, returnResourceIdInLocationHeader, headers, }: RequestArgs): (query?: any, payload?: any) => Promise; +} +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/agent.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/agent.js new file mode 100644 index 00000000..52253d0c --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/agent.js @@ -0,0 +1,180 @@ +import urlJoin from "url-join"; +import { parseTemplate } from "url-template"; +import { fetchWithError, NetworkError, parseResponse, } from "../utils/fetchWithError.js"; +import { stringifyQueryParams } from "../utils/stringifyQueryParams.js"; +// constants +const SLASH = "/"; +const pick = (value, keys) => Object.fromEntries(Object.entries(value).filter(([key]) => keys.includes(key))); +const omit = (value, keys) => Object.fromEntries(Object.entries(value).filter(([key]) => !keys.includes(key))); +export class Agent { + #client; + #basePath; + #getBaseParams; + #getBaseUrl; + constructor({ client, path = "/", getUrlParams = () => ({}), getBaseUrl = () => client.baseUrl, }) { + this.#client = client; + this.#getBaseParams = getUrlParams; + this.#getBaseUrl = getBaseUrl; + this.#basePath = path; + } + request({ method, path = "", urlParamKeys = [], queryParamKeys = [], catchNotFound = false, keyTransform, payloadKey, returnResourceIdInLocationHeader, ignoredKeys, headers, }) { + return async (payload = {}, options) => { + const baseParams = this.#getBaseParams?.() ?? {}; + // Filter query parameters by queryParamKeys + const queryParams = queryParamKeys.length > 0 + ? pick(payload, queryParamKeys) + : undefined; + // Add filtered payload parameters to base parameters + const allUrlParamKeys = [...Object.keys(baseParams), ...urlParamKeys]; + const urlParams = { ...baseParams, ...pick(payload, allUrlParamKeys) }; + if (!(payload instanceof FormData)) { + // Omit url parameters and query parameters from payload + const omittedKeys = ignoredKeys + ? [...allUrlParamKeys, ...queryParamKeys].filter((key) => !ignoredKeys.includes(key)) + : [...allUrlParamKeys, ...queryParamKeys]; + payload = omit(payload, omittedKeys); + } + // Transform keys of both payload and queryParams + if (keyTransform) { + this.#transformKey(payload, keyTransform); + this.#transformKey(queryParams, keyTransform); + } + return this.#requestWithParams({ + method, + path, + payload, + urlParams, + queryParams, + // catchNotFound precedence: global > local > default + catchNotFound, + ...(this.#client.getGlobalRequestArgOptions() ?? options ?? {}), + payloadKey, + returnResourceIdInLocationHeader, + headers, + }); + }; + } + updateRequest({ method, path = "", urlParamKeys = [], queryParamKeys = [], catchNotFound = false, keyTransform, payloadKey, returnResourceIdInLocationHeader, headers, }) { + return async (query = {}, payload = {}) => { + const baseParams = this.#getBaseParams?.() ?? {}; + // Filter query parameters by queryParamKeys + const queryParams = queryParamKeys + ? pick(query, queryParamKeys) + : undefined; + // Add filtered query parameters to base parameters + const allUrlParamKeys = [...Object.keys(baseParams), ...urlParamKeys]; + const urlParams = { + ...baseParams, + ...pick(query, allUrlParamKeys), + }; + // Transform keys of queryParams + if (keyTransform) { + this.#transformKey(queryParams, keyTransform); + } + return this.#requestWithParams({ + method, + path, + payload, + urlParams, + queryParams, + catchNotFound, + payloadKey, + returnResourceIdInLocationHeader, + headers, + }); + }; + } + async #requestWithParams({ method, path, payload, urlParams, queryParams, catchNotFound, payloadKey, returnResourceIdInLocationHeader, headers, }) { + const newPath = urlJoin(this.#basePath, path); + // Parse template and replace with values from urlParams + const pathTemplate = parseTemplate(newPath); + const parsedPath = pathTemplate.expand(urlParams); + const url = new URL(`${this.#getBaseUrl?.() ?? ""}${parsedPath}`); + const requestOptions = { ...this.#client.getRequestOptions() }; + const requestHeaders = new Headers([ + ...new Headers(requestOptions.headers).entries(), + ["authorization", `Bearer ${await this.#client.getAccessToken()}`], + ["accept", "application/json, text/plain, */*"], + ...new Headers(headers).entries(), + ]); + const searchParams = {}; + // Add payload parameters to search params if method is 'GET'. + if (method === "GET") { + Object.assign(searchParams, payload); + } + else if (requestHeaders.get("content-type") === "text/plain") { + // Pass the payload as a plain string if the content type is 'text/plain'. + requestOptions.body = payload; + } + else if (payload instanceof FormData) { + requestOptions.body = payload; + } + else { + // Otherwise assume it's JSON and stringify it. + requestOptions.body = + payloadKey && typeof payload[payloadKey] === "string" + ? payload[payloadKey] + : JSON.stringify(payloadKey ? payload[payloadKey] : payload); + } + if (requestOptions.body && + !requestHeaders.has("content-type") && + !(payload instanceof FormData)) { + requestHeaders.set("content-type", "application/json"); + } + if (queryParams) { + Object.assign(searchParams, queryParams); + } + url.search = stringifyQueryParams(searchParams); + try { + const res = await fetchWithError(url, { + ...requestOptions, + headers: requestHeaders, + method, + }); + // now we get the response of the http request + // if `resourceIdInLocationHeader` is true, we'll get the resourceId from the location header field + // todo: find a better way to find the id in path, maybe some kind of pattern matching + // for now, we simply split the last sub-path of the path returned in location header field + if (returnResourceIdInLocationHeader) { + const locationHeader = res.headers.get("location"); + if (typeof locationHeader !== "string") { + throw new Error(`location header is not found in request: ${res.url}`); + } + const resourceId = locationHeader.split(SLASH).pop(); + if (!resourceId) { + // throw an error to let users know the response is not expected + throw new Error(`resourceId is not found in Location header from request: ${res.url}`); + } + // return with format {[field]: string} + const { field } = returnResourceIdInLocationHeader; + return { [field]: resourceId }; + } + if (Object.entries(headers || []).find(([key, value]) => key.toLowerCase() === "accept" && + value === "application/octet-stream")) { + return await res.arrayBuffer(); + } + return await parseResponse(res); + } + catch (err) { + if (err instanceof NetworkError && + err.response.status === 404 && + catchNotFound) { + return null; + } + throw err; + } + } + #transformKey(payload, keyMapping) { + if (!payload) { + return; + } + Object.keys(keyMapping).some((key) => { + if (typeof payload[key] === "undefined") { + return false; + } + const newKey = keyMapping[key]; + payload[newKey] = payload[key]; + delete payload[key]; + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/attackDetection.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/attackDetection.d.ts new file mode 100644 index 00000000..a9e4bc36 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/attackDetection.d.ts @@ -0,0 +1,20 @@ +import Resource from "./resource.js"; +import type KeycloakAdminClient from "../index.js"; +export declare class AttackDetection extends Resource<{ + realm?: string; +}> { + findOne: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise | undefined>; + del: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delAll: (payload?: { + realm?: string; + } | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/attackDetection.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/attackDetection.js new file mode 100644 index 00000000..737e7cb2 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/attackDetection.js @@ -0,0 +1,27 @@ +import Resource from "./resource.js"; +export class AttackDetection extends Resource { + findOne = this.makeRequest({ + method: "GET", + path: "/users/{id}", + urlParamKeys: ["id"], + catchNotFound: true, + }); + del = this.makeRequest({ + method: "DELETE", + path: "/users/{id}", + urlParamKeys: ["id"], + }); + delAll = this.makeRequest({ + method: "DELETE", + path: "/users", + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/attack-detection/brute-force", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/authenticationManagement.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/authenticationManagement.d.ts new file mode 100644 index 00000000..9d3258de --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/authenticationManagement.d.ts @@ -0,0 +1,179 @@ +import Resource from "./resource.js"; +import type RequiredActionProviderRepresentation from "../defs/requiredActionProviderRepresentation.js"; +import type { KeycloakAdminClient } from "../client.js"; +import type AuthenticationExecutionInfoRepresentation from "../defs/authenticationExecutionInfoRepresentation.js"; +import type AuthenticationFlowRepresentation from "../defs/authenticationFlowRepresentation.js"; +import type AuthenticatorConfigRepresentation from "../defs/authenticatorConfigRepresentation.js"; +import type { AuthenticationProviderRepresentation } from "../defs/authenticatorConfigRepresentation.js"; +import type AuthenticatorConfigInfoRepresentation from "../defs/authenticatorConfigInfoRepresentation.js"; +import type RequiredActionProviderSimpleRepresentation from "../defs/requiredActionProviderSimpleRepresentation.js"; +import type RequiredActionConfigInfoRepresentation from "../defs/requiredActionConfigInfoRepresentation.js"; +import type RequiredActionConfigRepresentation from "../defs/requiredActionConfigRepresentation.js"; +export declare class AuthenticationManagement extends Resource<{ + realm?: string; +}> { + /** + * Authentication Management + * https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authentication_management_resource + */ + registerRequiredAction: (payload?: (Record & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getRequiredActions: (payload?: (void & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getRequiredActionForAlias: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getClientAuthenticatorProviders: (payload?: (void & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getAuthenticatorProviders: (payload?: (void & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getFormActionProviders: (payload?: (void & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateRequiredAction: (query: { + alias: string; + } & { + realm?: string; + }, payload: RequiredActionProviderRepresentation) => Promise; + deleteRequiredAction: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + lowerRequiredActionPriority: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + raiseRequiredActionPriority: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getUnregisteredRequiredActions: (payload?: (void & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getFlows: (payload?: { + realm?: string; + } | undefined, options?: Pick) => Promise; + getFlow: (payload?: ({ + flowId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getFormProviders: (payload?: (void & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + createFlow: (payload?: (AuthenticationFlowRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + copyFlow: (payload?: ({ + flow: string; + newName: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + deleteFlow: (payload?: ({ + flowId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateFlow: (query: { + flowId: string; + } & { + realm?: string; + }, payload: AuthenticationFlowRepresentation) => Promise; + getExecutions: (payload?: ({ + flow: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addExecution: (query: { + flow: string; + } & { + realm?: string; + }, payload: AuthenticationExecutionInfoRepresentation) => Promise; + addExecutionToFlow: (payload?: ({ + flow: string; + provider: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addFlowToFlow: (payload?: ({ + flow: string; + alias: string; + type: string; + provider: string; + description: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateExecution: (query: { + flow: string; + } & { + realm?: string; + }, payload: AuthenticationExecutionInfoRepresentation) => Promise; + delExecution: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + lowerPriorityExecution: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + raisePriorityExecution: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getRequiredActionConfigDescription: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getRequiredActionConfig: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + removeRequiredActionConfig: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateRequiredActionConfig: (query: { + alias: string; + } & { + realm?: string; + }, payload: RequiredActionConfigRepresentation) => Promise; + getConfigDescription: (payload?: ({ + providerId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + createConfig: (payload?: (AuthenticatorConfigRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateConfig: (payload?: (AuthenticatorConfigRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getConfig: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delConfig: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/authenticationManagement.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/authenticationManagement.js new file mode 100644 index 00000000..01df408c --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/authenticationManagement.js @@ -0,0 +1,199 @@ +import Resource from "./resource.js"; +export class AuthenticationManagement extends Resource { + /** + * Authentication Management + * https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authentication_management_resource + */ + // Register a new required action + registerRequiredAction = this.makeRequest({ + method: "POST", + path: "/register-required-action", + }); + // Get required actions. Returns a list of required actions. + getRequiredActions = this.makeRequest({ + method: "GET", + path: "/required-actions", + }); + // Get required action for alias + getRequiredActionForAlias = this.makeRequest({ + method: "GET", + path: "/required-actions/{alias}", + urlParamKeys: ["alias"], + catchNotFound: true, + }); + getClientAuthenticatorProviders = this.makeRequest({ + method: "GET", + path: "/client-authenticator-providers", + }); + getAuthenticatorProviders = this.makeRequest({ + method: "GET", + path: "/authenticator-providers", + }); + getFormActionProviders = this.makeRequest({ + method: "GET", + path: "/form-action-providers", + }); + // Update required action + updateRequiredAction = this.makeUpdateRequest({ + method: "PUT", + path: "/required-actions/{alias}", + urlParamKeys: ["alias"], + }); + // Delete required action + deleteRequiredAction = this.makeRequest({ + method: "DELETE", + path: "/required-actions/{alias}", + urlParamKeys: ["alias"], + }); + // Lower required action’s priority + lowerRequiredActionPriority = this.makeRequest({ + method: "POST", + path: "/required-actions/{alias}/lower-priority", + urlParamKeys: ["alias"], + }); + // Raise required action’s priority + raiseRequiredActionPriority = this.makeRequest({ + method: "POST", + path: "/required-actions/{alias}/raise-priority", + urlParamKeys: ["alias"], + }); + // Get unregistered required actions Returns a list of unregistered required actions. + getUnregisteredRequiredActions = this.makeRequest({ + method: "GET", + path: "/unregistered-required-actions", + }); + getFlows = this.makeRequest({ + method: "GET", + path: "/flows", + }); + getFlow = this.makeRequest({ + method: "GET", + path: "/flows/{flowId}", + urlParamKeys: ["flowId"], + }); + getFormProviders = this.makeRequest({ + method: "GET", + path: "/form-providers", + }); + createFlow = this.makeRequest({ + method: "POST", + path: "/flows", + returnResourceIdInLocationHeader: { field: "id" }, + }); + copyFlow = this.makeRequest({ + method: "POST", + path: "/flows/{flow}/copy", + urlParamKeys: ["flow"], + }); + deleteFlow = this.makeRequest({ + method: "DELETE", + path: "/flows/{flowId}", + urlParamKeys: ["flowId"], + }); + updateFlow = this.makeUpdateRequest({ + method: "PUT", + path: "/flows/{flowId}", + urlParamKeys: ["flowId"], + }); + getExecutions = this.makeRequest({ + method: "GET", + path: "/flows/{flow}/executions", + urlParamKeys: ["flow"], + }); + addExecution = this.makeUpdateRequest({ + method: "POST", + path: "/flows/{flow}/executions", + urlParamKeys: ["flow"], + }); + addExecutionToFlow = this.makeRequest({ + method: "POST", + path: "/flows/{flow}/executions/execution", + urlParamKeys: ["flow"], + returnResourceIdInLocationHeader: { field: "id" }, + }); + addFlowToFlow = this.makeRequest({ + method: "POST", + path: "/flows/{flow}/executions/flow", + urlParamKeys: ["flow"], + returnResourceIdInLocationHeader: { field: "id" }, + }); + updateExecution = this.makeUpdateRequest({ + method: "PUT", + path: "/flows/{flow}/executions", + urlParamKeys: ["flow"], + }); + delExecution = this.makeRequest({ + method: "DELETE", + path: "/executions/{id}", + urlParamKeys: ["id"], + }); + lowerPriorityExecution = this.makeRequest({ + method: "POST", + path: "/executions/{id}/lower-priority", + urlParamKeys: ["id"], + }); + raisePriorityExecution = this.makeRequest({ + method: "POST", + path: "/executions/{id}/raise-priority", + urlParamKeys: ["id"], + }); + // Get required actions provider's configuration description + getRequiredActionConfigDescription = this.makeRequest({ + method: "GET", + path: "/required-actions/{alias}/config-description", + urlParamKeys: ["alias"], + }); + // Get the configuration of the RequiredAction provider in the current Realm. + getRequiredActionConfig = this.makeRequest({ + method: "GET", + path: "/required-actions/{alias}/config", + urlParamKeys: ["alias"], + }); + // Remove the configuration from the RequiredAction provider in the current Realm. + removeRequiredActionConfig = this.makeRequest({ + method: "DELETE", + path: "/required-actions/{alias}/config", + urlParamKeys: ["alias"], + }); + // Update the configuration from the RequiredAction provider in the current Realm. + updateRequiredActionConfig = this.makeUpdateRequest({ + method: "PUT", + path: "/required-actions/{alias}/config", + urlParamKeys: ["alias"], + }); + getConfigDescription = this.makeRequest({ + method: "GET", + path: "config-description/{providerId}", + urlParamKeys: ["providerId"], + }); + createConfig = this.makeRequest({ + method: "POST", + path: "/executions/{id}/config", + urlParamKeys: ["id"], + returnResourceIdInLocationHeader: { field: "id" }, + }); + updateConfig = this.makeRequest({ + method: "PUT", + path: "/config/{id}", + urlParamKeys: ["id"], + }); + getConfig = this.makeRequest({ + method: "GET", + path: "/config/{id}", + urlParamKeys: ["id"], + }); + delConfig = this.makeRequest({ + method: "DELETE", + path: "/config/{id}", + urlParamKeys: ["id"], + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/authentication", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/cache.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/cache.d.ts new file mode 100644 index 00000000..fa5e821b --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/cache.d.ts @@ -0,0 +1,19 @@ +import Resource from "./resource.js"; +import type { KeycloakAdminClient } from "../client.js"; +export declare class Cache extends Resource<{ + realm?: string; +}> { + clearUserCache: (payload?: { + realm?: string; + } | undefined, options?: Pick) => Promise; + clearKeysCache: (payload?: { + realm?: string; + } | undefined, options?: Pick) => Promise; + clearCrlCache: (payload?: { + realm?: string; + } | undefined, options?: Pick) => Promise; + clearRealmCache: (payload?: { + realm?: string; + } | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/cache.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/cache.js new file mode 100644 index 00000000..73c08a2d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/cache.js @@ -0,0 +1,28 @@ +import Resource from "./resource.js"; +export class Cache extends Resource { + clearUserCache = this.makeRequest({ + method: "POST", + path: "/clear-user-cache", + }); + clearKeysCache = this.makeRequest({ + method: "POST", + path: "/clear-keys-cache", + }); + clearCrlCache = this.makeRequest({ + method: "POST", + path: "/clear-crl-cache", + }); + clearRealmCache = this.makeRequest({ + method: "POST", + path: "/clear-realm-cache", + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientPolicies.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientPolicies.d.ts new file mode 100644 index 00000000..71acaad2 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientPolicies.d.ts @@ -0,0 +1,28 @@ +import Resource from "./resource.js"; +import type { KeycloakAdminClient } from "../client.js"; +import type ClientProfilesRepresentation from "../defs/clientProfilesRepresentation.js"; +import type ClientPoliciesRepresentation from "../defs/clientPoliciesRepresentation.js"; +/** + * https://www.keycloak.org/docs-api/15.0/rest-api/#_client_registration_policy_resource + */ +export declare class ClientPolicies extends Resource<{ + realm?: string; +}> { + constructor(client: KeycloakAdminClient); + listProfiles: (payload?: ({ + includeGlobalProfiles?: boolean; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + createProfiles: (payload?: (ClientProfilesRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listPolicies: (payload?: ({ + includeGlobalPolicies?: boolean; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updatePolicy: (payload?: (ClientPoliciesRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientPolicies.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientPolicies.js new file mode 100644 index 00000000..41e2015d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientPolicies.js @@ -0,0 +1,41 @@ +import Resource from "./resource.js"; +/** + * https://www.keycloak.org/docs-api/15.0/rest-api/#_client_registration_policy_resource + */ +export class ClientPolicies extends Resource { + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/client-policies", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } + /* Client Profiles */ + listProfiles = this.makeRequest({ + method: "GET", + path: "/profiles", + queryParamKeys: ["include-global-profiles"], + keyTransform: { + includeGlobalProfiles: "include-global-profiles", + }, + }); + createProfiles = this.makeRequest({ + method: "PUT", + path: "/profiles", + }); + /* Client Policies */ + listPolicies = this.makeRequest({ + method: "GET", + path: "/policies", + queryParamKeys: ["include-global-policies"], + keyTransform: { + includeGlobalPolicies: "include-global-policies", + }, + }); + updatePolicy = this.makeRequest({ + method: "PUT", + path: "/policies", + }); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientScopes.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientScopes.d.ts new file mode 100644 index 00000000..2cbbbbd0 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientScopes.d.ts @@ -0,0 +1,196 @@ +import type ClientScopeRepresentation from "../defs/clientScopeRepresentation.js"; +import Resource from "./resource.js"; +import type { KeycloakAdminClient } from "../client.js"; +import type ProtocolMapperRepresentation from "../defs/protocolMapperRepresentation.js"; +import type MappingsRepresentation from "../defs/mappingsRepresentation.js"; +import type RoleRepresentation from "../defs/roleRepresentation.js"; +export declare class ClientScopes extends Resource<{ + realm?: string; +}> { + find: (payload?: { + realm?: string; + } | undefined, options?: Pick) => Promise; + create: (payload?: (ClientScopeRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + }>; + /** + * Client-Scopes by id + */ + findOne: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + update: (query: { + id: string; + } & { + realm?: string; + }, payload: ClientScopeRepresentation) => Promise; + del: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Default Client-Scopes + */ + listDefaultClientScopes: (payload?: (void & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addDefaultClientScope: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delDefaultClientScope: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Default Optional Client-Scopes + */ + listDefaultOptionalClientScopes: (payload?: (void & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addDefaultOptionalClientScope: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delDefaultOptionalClientScope: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Protocol Mappers + */ + addMultipleProtocolMappers: (query: { + id: string; + } & { + realm?: string; + }, payload: ProtocolMapperRepresentation[]) => Promise; + addProtocolMapper: (query: { + id: string; + } & { + realm?: string; + }, payload: ProtocolMapperRepresentation) => Promise; + listProtocolMappers: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findProtocolMapper: (payload?: ({ + id: string; + mapperId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findProtocolMappersByProtocol: (payload?: ({ + id: string; + protocol: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateProtocolMapper: (query: { + id: string; + mapperId: string; + } & { + realm?: string; + }, payload: ProtocolMapperRepresentation) => Promise; + delProtocolMapper: (payload?: ({ + id: string; + mapperId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Scope Mappings + */ + listScopeMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addClientScopeMappings: (query: { + id: string; + client: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + listClientScopeMappings: (payload?: ({ + id: string; + client: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAvailableClientScopeMappings: (payload?: ({ + id: string; + client: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listCompositeClientScopeMappings: (payload?: ({ + id: string; + client: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delClientScopeMappings: (query: { + id: string; + client: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + addRealmScopeMappings: (query: { + id: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + listRealmScopeMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAvailableRealmScopeMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listCompositeRealmScopeMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delRealmScopeMappings: (query: { + id: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + constructor(client: KeycloakAdminClient); + /** + * Find client scope by name. + */ + findOneByName(payload: { + realm?: string; + name: string; + }): Promise; + /** + * Delete client scope by name. + */ + delByName(payload: { + realm?: string; + name: string; + }): Promise; + /** + * Find single protocol mapper by name. + */ + findProtocolMapperByName(payload: { + realm?: string; + id: string; + name: string; + }): Promise; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientScopes.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientScopes.js new file mode 100644 index 00000000..b1e79f38 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clientScopes.js @@ -0,0 +1,204 @@ +import Resource from "./resource.js"; +export class ClientScopes extends Resource { + find = this.makeRequest({ + method: "GET", + path: "/client-scopes", + }); + create = this.makeRequest({ + method: "POST", + path: "/client-scopes", + returnResourceIdInLocationHeader: { field: "id" }, + }); + /** + * Client-Scopes by id + */ + findOne = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}", + urlParamKeys: ["id"], + catchNotFound: true, + }); + update = this.makeUpdateRequest({ + method: "PUT", + path: "/client-scopes/{id}", + urlParamKeys: ["id"], + }); + del = this.makeRequest({ + method: "DELETE", + path: "/client-scopes/{id}", + urlParamKeys: ["id"], + }); + /** + * Default Client-Scopes + */ + listDefaultClientScopes = this.makeRequest({ + method: "GET", + path: "/default-default-client-scopes", + }); + addDefaultClientScope = this.makeRequest({ + method: "PUT", + path: "/default-default-client-scopes/{id}", + urlParamKeys: ["id"], + }); + delDefaultClientScope = this.makeRequest({ + method: "DELETE", + path: "/default-default-client-scopes/{id}", + urlParamKeys: ["id"], + }); + /** + * Default Optional Client-Scopes + */ + listDefaultOptionalClientScopes = this.makeRequest({ + method: "GET", + path: "/default-optional-client-scopes", + }); + addDefaultOptionalClientScope = this.makeRequest({ + method: "PUT", + path: "/default-optional-client-scopes/{id}", + urlParamKeys: ["id"], + }); + delDefaultOptionalClientScope = this.makeRequest({ + method: "DELETE", + path: "/default-optional-client-scopes/{id}", + urlParamKeys: ["id"], + }); + /** + * Protocol Mappers + */ + addMultipleProtocolMappers = this.makeUpdateRequest({ + method: "POST", + path: "/client-scopes/{id}/protocol-mappers/add-models", + urlParamKeys: ["id"], + }); + addProtocolMapper = this.makeUpdateRequest({ + method: "POST", + path: "/client-scopes/{id}/protocol-mappers/models", + urlParamKeys: ["id"], + }); + listProtocolMappers = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/protocol-mappers/models", + urlParamKeys: ["id"], + }); + findProtocolMapper = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/protocol-mappers/models/{mapperId}", + urlParamKeys: ["id", "mapperId"], + catchNotFound: true, + }); + findProtocolMappersByProtocol = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/protocol-mappers/protocol/{protocol}", + urlParamKeys: ["id", "protocol"], + catchNotFound: true, + }); + updateProtocolMapper = this.makeUpdateRequest({ + method: "PUT", + path: "/client-scopes/{id}/protocol-mappers/models/{mapperId}", + urlParamKeys: ["id", "mapperId"], + }); + delProtocolMapper = this.makeRequest({ + method: "DELETE", + path: "/client-scopes/{id}/protocol-mappers/models/{mapperId}", + urlParamKeys: ["id", "mapperId"], + }); + /** + * Scope Mappings + */ + listScopeMappings = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/scope-mappings", + urlParamKeys: ["id"], + }); + addClientScopeMappings = this.makeUpdateRequest({ + method: "POST", + path: "/client-scopes/{id}/scope-mappings/clients/{client}", + urlParamKeys: ["id", "client"], + }); + listClientScopeMappings = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/scope-mappings/clients/{client}", + urlParamKeys: ["id", "client"], + }); + listAvailableClientScopeMappings = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/scope-mappings/clients/{client}/available", + urlParamKeys: ["id", "client"], + }); + listCompositeClientScopeMappings = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/scope-mappings/clients/{client}/composite", + urlParamKeys: ["id", "client"], + }); + delClientScopeMappings = this.makeUpdateRequest({ + method: "DELETE", + path: "/client-scopes/{id}/scope-mappings/clients/{client}", + urlParamKeys: ["id", "client"], + }); + addRealmScopeMappings = this.makeUpdateRequest({ + method: "POST", + path: "/client-scopes/{id}/scope-mappings/realm", + urlParamKeys: ["id"], + }); + listRealmScopeMappings = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/scope-mappings/realm", + urlParamKeys: ["id"], + }); + listAvailableRealmScopeMappings = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/scope-mappings/realm/available", + urlParamKeys: ["id"], + }); + listCompositeRealmScopeMappings = this.makeRequest({ + method: "GET", + path: "/client-scopes/{id}/scope-mappings/realm/composite", + urlParamKeys: ["id"], + }); + delRealmScopeMappings = this.makeUpdateRequest({ + method: "DELETE", + path: "/client-scopes/{id}/scope-mappings/realm", + urlParamKeys: ["id"], + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } + /** + * Find client scope by name. + */ + async findOneByName(payload) { + const allScopes = await this.find({ + ...(payload.realm ? { realm: payload.realm } : {}), + }); + return allScopes.find((item) => item.name === payload.name); + } + /** + * Delete client scope by name. + */ + async delByName(payload) { + const scope = await this.findOneByName(payload); + if (!scope) { + throw new Error("Scope not found."); + } + await this.del({ + ...(payload.realm ? { realm: payload.realm } : {}), + id: scope.id, + }); + } + /** + * Find single protocol mapper by name. + */ + async findProtocolMapperByName(payload) { + const allProtocolMappers = await this.listProtocolMappers({ + id: payload.id, + ...(payload.realm ? { realm: payload.realm } : {}), + }); + return allProtocolMappers.find((mapper) => mapper.name === payload.name); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/clients.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clients.d.ts new file mode 100644 index 00000000..d4af7cb4 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clients.d.ts @@ -0,0 +1,682 @@ +import type { KeycloakAdminClient } from "../client.js"; +import type CertificateRepresentation from "../defs/certificateRepresentation.js"; +import type ClientRepresentation from "../defs/clientRepresentation.js"; +import type ClientScopeRepresentation from "../defs/clientScopeRepresentation.js"; +import type CredentialRepresentation from "../defs/credentialRepresentation.js"; +import type GlobalRequestResult from "../defs/globalRequestResult.js"; +import type KeyStoreConfig from "../defs/keystoreConfig.js"; +import type { ManagementPermissionReference } from "../defs/managementPermissionReference.js"; +import type MappingsRepresentation from "../defs/mappingsRepresentation.js"; +import type PolicyEvaluationResponse from "../defs/policyEvaluationResponse.js"; +import type PolicyProviderRepresentation from "../defs/policyProviderRepresentation.js"; +import type PolicyRepresentation from "../defs/policyRepresentation.js"; +import type ProtocolMapperRepresentation from "../defs/protocolMapperRepresentation.js"; +import type ResourceEvaluation from "../defs/resourceEvaluation.js"; +import type ResourceRepresentation from "../defs/resourceRepresentation.js"; +import type ResourceServerRepresentation from "../defs/resourceServerRepresentation.js"; +import type RoleRepresentation from "../defs/roleRepresentation.js"; +import type ScopeRepresentation from "../defs/scopeRepresentation.js"; +import type UserRepresentation from "../defs/userRepresentation.js"; +import type UserSessionRepresentation from "../defs/userSessionRepresentation.js"; +import Resource from "./resource.js"; +export interface PaginatedQuery { + first?: number; + max?: number; +} +export interface ClientQuery extends PaginatedQuery { + clientId?: string; + viewableOnly?: boolean; + search?: boolean; + q?: string; +} +export interface ResourceQuery extends PaginatedQuery { + id?: string; + name?: string; + type?: string; + owner?: string; + uri?: string; + deep?: boolean; +} +export interface PolicyQuery extends PaginatedQuery { + id?: string; + name?: string; + type?: string; + resource?: string; + scope?: string; + permission?: string; + owner?: string; + fields?: string; +} +export declare class Clients extends Resource<{ + realm?: string; +}> { + find: (payload?: (ClientQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + create: (payload?: (ClientRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + }>; + /** + * Single client + */ + findOne: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + update: (query: { + id: string; + } & { + realm?: string; + }, payload: ClientRepresentation) => Promise; + del: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Client roles + */ + createRole: (payload?: (RoleRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + roleName: string; + }>; + listRoles: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findRole: (payload?: ({ + id: string; + roleName: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateRole: (query: { + id: string; + roleName: string; + } & { + realm?: string; + }, payload: RoleRepresentation) => Promise; + delRole: (payload?: ({ + id: string; + roleName: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findUsersWithRole: (payload?: ({ + id: string; + roleName: string; + briefRepresentation?: boolean; + first?: number; + max?: number; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Service account user + */ + getServiceAccountUser: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Client secret + */ + generateNewClientSecret: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + invalidateSecret: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + generateRegistrationAccessToken: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + registrationAccessToken: string; + }>; + getClientSecret: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Client Scopes + */ + listDefaultClientScopes: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addDefaultClientScope: (payload?: ({ + id: string; + clientScopeId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delDefaultClientScope: (payload?: ({ + id: string; + clientScopeId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listOptionalClientScopes: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addOptionalClientScope: (payload?: ({ + id: string; + clientScopeId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delOptionalClientScope: (payload?: ({ + id: string; + clientScopeId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Protocol Mappers + */ + addMultipleProtocolMappers: (query: { + id: string; + } & { + realm?: string; + }, payload: ProtocolMapperRepresentation[]) => Promise; + addProtocolMapper: (query: { + id: string; + } & { + realm?: string; + }, payload: ProtocolMapperRepresentation) => Promise; + listProtocolMappers: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findProtocolMapperById: (payload?: ({ + id: string; + mapperId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findProtocolMappersByProtocol: (payload?: ({ + id: string; + protocol: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateProtocolMapper: (query: { + id: string; + mapperId: string; + } & { + realm?: string; + }, payload: ProtocolMapperRepresentation) => Promise; + delProtocolMapper: (payload?: ({ + id: string; + mapperId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Scope Mappings + */ + listScopeMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addClientScopeMappings: (query: { + id: string; + client: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + listClientScopeMappings: (payload?: ({ + id: string; + client: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAvailableClientScopeMappings: (payload?: ({ + id: string; + client: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listCompositeClientScopeMappings: (payload?: ({ + id: string; + client: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delClientScopeMappings: (query: { + id: string; + client: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + evaluatePermission: (payload?: ({ + id: string; + roleContainer: string; + type: "granted" | "not-granted"; + scope: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + evaluateListProtocolMapper: (payload?: ({ + id: string; + scope: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + evaluateGenerateAccessToken: (payload?: ({ + id: string; + scope: string; + userId: string; + audience: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise>; + evaluateGenerateUserInfo: (payload?: ({ + id: string; + scope: string; + userId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise>; + evaluateGenerateIdToken: (payload?: ({ + id: string; + scope: string; + userId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise>; + addRealmScopeMappings: (query: { + id: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + listRealmScopeMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAvailableRealmScopeMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listCompositeRealmScopeMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delRealmScopeMappings: (query: { + id: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + /** + * Sessions + */ + listSessions: (payload?: ({ + id: string; + first?: number; + max?: number; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listOfflineSessions: (payload?: ({ + id: string; + first?: number; + max?: number; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getSessionCount: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + count: number; + }>; + /** + * Resource + */ + getResourceServer: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateResourceServer: (query: { + id: string; + } & { + realm?: string; + }, payload: ResourceServerRepresentation) => Promise; + listResources: (payload?: (ResourceQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + createResource: (query: { + id: string; + } & { + realm?: string; + }, payload: ResourceRepresentation) => Promise; + getResource: (payload?: ({ + id: string; + resourceId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateResource: (query: { + id: string; + resourceId: string; + } & { + realm?: string; + }, payload: ResourceRepresentation) => Promise; + delResource: (payload?: ({ + id: string; + resourceId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + importResource: (query: { + id: string; + } & { + realm?: string; + }, payload: ResourceServerRepresentation) => Promise; + exportResource: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + evaluateResource: (query: { + id: string; + } & { + realm?: string; + }, payload: ResourceEvaluation) => Promise; + /** + * Policy + */ + listPolicies: (payload?: (PolicyQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise<"" | PolicyRepresentation[]>; + findPolicyByName: (payload?: ({ + id: string; + name: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updatePolicy: (query: { + id: string; + type: string; + policyId: string; + } & { + realm?: string; + }, payload: PolicyRepresentation) => Promise; + createPolicy: (query: { + id: string; + type: string; + } & { + realm?: string; + }, payload: PolicyRepresentation) => Promise; + findOnePolicy: (payload?: ({ + id: string; + type: string; + policyId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listDependentPolicies: (payload?: ({ + id: string; + policyId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delPolicy: (payload?: ({ + id: string; + policyId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listPolicyProviders: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + createOrUpdatePolicy(payload: { + id: string; + policyName: string; + policy: PolicyRepresentation; + }): Promise; + /** + * Scopes + */ + listAllScopes: (payload?: ({ + id: string; + name?: string; + deep?: boolean; + } & PaginatedQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAllResourcesByScope: (payload?: ({ + id: string; + scopeId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAllPermissionsByScope: (payload?: ({ + id: string; + scopeId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listPermissionsByResource: (payload?: ({ + id: string; + resourceId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listScopesByResource: (payload?: ({ + id: string; + resourceName: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + name: string; + }[]>; + listPermissionScope: (payload?: ({ + id: string; + policyId?: string; + name?: string; + resource?: string; + } & PaginatedQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + createAuthorizationScope: (query: { + id: string; + } & { + realm?: string; + }, payload: ScopeRepresentation) => Promise; + updateAuthorizationScope: (query: { + id: string; + scopeId: string; + } & { + realm?: string; + }, payload: ScopeRepresentation) => Promise; + getAuthorizationScope: (payload?: ({ + id: string; + scopeId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delAuthorizationScope: (payload?: ({ + id: string; + scopeId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Permissions + */ + findPermissions: (payload?: ({ + id: string; + name?: string; + resource?: string; + scope?: string; + } & PaginatedQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + createPermission: (query: { + id: string; + type: string; + } & { + realm?: string; + }, payload: PolicyRepresentation) => Promise; + updatePermission: (query: { + id: string; + type: string; + permissionId: string; + } & { + realm?: string; + }, payload: PolicyRepresentation) => Promise; + delPermission: (payload?: ({ + id: string; + type: string; + permissionId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findOnePermission: (payload?: ({ + id: string; + type: string; + permissionId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getAssociatedScopes: (payload?: ({ + id: string; + permissionId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + name: string; + }[]>; + getAssociatedResources: (payload?: ({ + id: string; + permissionId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + _id: string; + name: string; + }[]>; + getAssociatedPolicies: (payload?: ({ + id: string; + permissionId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getOfflineSessionCount: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + count: number; + }>; + getInstallationProviders: (payload?: ({ + id: string; + providerId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + pushRevocation: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addClusterNode: (payload?: ({ + id: string; + node: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + deleteClusterNode: (payload?: ({ + id: string; + node: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + testNodesAvailable: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getKeyInfo: (payload?: ({ + id: string; + attr: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + generateKey: (payload?: ({ + id: string; + attr: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + downloadKey: (query: { + id: string; + attr: string; + } & { + realm?: string; + }, payload: KeyStoreConfig) => Promise; + generateAndDownloadKey: (query: { + id: string; + attr: string; + } & { + realm?: string; + }, payload: KeyStoreConfig) => Promise; + uploadKey: (query: { + id: string; + attr: string; + } & { + realm?: string; + }, payload: FormData) => Promise; + uploadCertificate: (query: { + id: string; + attr: string; + } & { + realm?: string; + }, payload: FormData) => Promise; + updateFineGrainPermission: (query: { + id: string; + } & { + realm?: string; + }, payload: ManagementPermissionReference) => Promise; + listFineGrainPermissions: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); + /** + * Find single protocol mapper by name. + */ + findProtocolMapperByName(payload: { + realm?: string; + id: string; + name: string; + }): Promise; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/clients.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clients.js new file mode 100644 index 00000000..2d9cca11 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/clients.js @@ -0,0 +1,582 @@ +import Resource from "./resource.js"; +export class Clients extends Resource { + find = this.makeRequest({ + method: "GET", + }); + create = this.makeRequest({ + method: "POST", + returnResourceIdInLocationHeader: { field: "id" }, + }); + /** + * Single client + */ + findOne = this.makeRequest({ + method: "GET", + path: "/{id}", + urlParamKeys: ["id"], + catchNotFound: true, + }); + update = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}", + urlParamKeys: ["id"], + }); + del = this.makeRequest({ + method: "DELETE", + path: "/{id}", + urlParamKeys: ["id"], + }); + /** + * Client roles + */ + createRole = this.makeRequest({ + method: "POST", + path: "/{id}/roles", + urlParamKeys: ["id"], + returnResourceIdInLocationHeader: { field: "roleName" }, + }); + listRoles = this.makeRequest({ + method: "GET", + path: "/{id}/roles", + urlParamKeys: ["id"], + }); + findRole = this.makeRequest({ + method: "GET", + path: "/{id}/roles/{roleName}", + urlParamKeys: ["id", "roleName"], + catchNotFound: true, + }); + updateRole = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}/roles/{roleName}", + urlParamKeys: ["id", "roleName"], + }); + delRole = this.makeRequest({ + method: "DELETE", + path: "/{id}/roles/{roleName}", + urlParamKeys: ["id", "roleName"], + }); + findUsersWithRole = this.makeRequest({ + method: "GET", + path: "/{id}/roles/{roleName}/users", + urlParamKeys: ["id", "roleName"], + }); + /** + * Service account user + */ + getServiceAccountUser = this.makeRequest({ + method: "GET", + path: "/{id}/service-account-user", + urlParamKeys: ["id"], + }); + /** + * Client secret + */ + generateNewClientSecret = this.makeRequest({ + method: "POST", + path: "/{id}/client-secret", + urlParamKeys: ["id"], + }); + invalidateSecret = this.makeRequest({ + method: "DELETE", + path: "/{id}/client-secret/rotated", + urlParamKeys: ["id"], + }); + generateRegistrationAccessToken = this.makeRequest({ + method: "POST", + path: "/{id}/registration-access-token", + urlParamKeys: ["id"], + }); + getClientSecret = this.makeRequest({ + method: "GET", + path: "/{id}/client-secret", + urlParamKeys: ["id"], + }); + /** + * Client Scopes + */ + listDefaultClientScopes = this.makeRequest({ + method: "GET", + path: "/{id}/default-client-scopes", + urlParamKeys: ["id"], + }); + addDefaultClientScope = this.makeRequest({ + method: "PUT", + path: "/{id}/default-client-scopes/{clientScopeId}", + urlParamKeys: ["id", "clientScopeId"], + }); + delDefaultClientScope = this.makeRequest({ + method: "DELETE", + path: "/{id}/default-client-scopes/{clientScopeId}", + urlParamKeys: ["id", "clientScopeId"], + }); + listOptionalClientScopes = this.makeRequest({ + method: "GET", + path: "/{id}/optional-client-scopes", + urlParamKeys: ["id"], + }); + addOptionalClientScope = this.makeRequest({ + method: "PUT", + path: "/{id}/optional-client-scopes/{clientScopeId}", + urlParamKeys: ["id", "clientScopeId"], + }); + delOptionalClientScope = this.makeRequest({ + method: "DELETE", + path: "/{id}/optional-client-scopes/{clientScopeId}", + urlParamKeys: ["id", "clientScopeId"], + }); + /** + * Protocol Mappers + */ + addMultipleProtocolMappers = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/protocol-mappers/add-models", + urlParamKeys: ["id"], + }); + addProtocolMapper = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/protocol-mappers/models", + urlParamKeys: ["id"], + }); + listProtocolMappers = this.makeRequest({ + method: "GET", + path: "/{id}/protocol-mappers/models", + urlParamKeys: ["id"], + }); + findProtocolMapperById = this.makeRequest({ + method: "GET", + path: "/{id}/protocol-mappers/models/{mapperId}", + urlParamKeys: ["id", "mapperId"], + catchNotFound: true, + }); + findProtocolMappersByProtocol = this.makeRequest({ + method: "GET", + path: "/{id}/protocol-mappers/protocol/{protocol}", + urlParamKeys: ["id", "protocol"], + catchNotFound: true, + }); + updateProtocolMapper = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}/protocol-mappers/models/{mapperId}", + urlParamKeys: ["id", "mapperId"], + }); + delProtocolMapper = this.makeRequest({ + method: "DELETE", + path: "/{id}/protocol-mappers/models/{mapperId}", + urlParamKeys: ["id", "mapperId"], + }); + /** + * Scope Mappings + */ + listScopeMappings = this.makeRequest({ + method: "GET", + path: "/{id}/scope-mappings", + urlParamKeys: ["id"], + }); + addClientScopeMappings = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/scope-mappings/clients/{client}", + urlParamKeys: ["id", "client"], + }); + listClientScopeMappings = this.makeRequest({ + method: "GET", + path: "/{id}/scope-mappings/clients/{client}", + urlParamKeys: ["id", "client"], + }); + listAvailableClientScopeMappings = this.makeRequest({ + method: "GET", + path: "/{id}/scope-mappings/clients/{client}/available", + urlParamKeys: ["id", "client"], + }); + listCompositeClientScopeMappings = this.makeRequest({ + method: "GET", + path: "/{id}/scope-mappings/clients/{client}/composite", + urlParamKeys: ["id", "client"], + }); + delClientScopeMappings = this.makeUpdateRequest({ + method: "DELETE", + path: "/{id}/scope-mappings/clients/{client}", + urlParamKeys: ["id", "client"], + }); + evaluatePermission = this.makeRequest({ + method: "GET", + path: "/{id}/evaluate-scopes/scope-mappings/{roleContainer}/{type}", + urlParamKeys: ["id", "roleContainer", "type"], + queryParamKeys: ["scope"], + }); + evaluateListProtocolMapper = this.makeRequest({ + method: "GET", + path: "/{id}/evaluate-scopes/protocol-mappers", + urlParamKeys: ["id"], + queryParamKeys: ["scope"], + }); + evaluateGenerateAccessToken = this.makeRequest({ + method: "GET", + path: "/{id}/evaluate-scopes/generate-example-access-token", + urlParamKeys: ["id"], + queryParamKeys: ["scope", "userId", "audience"], + }); + evaluateGenerateUserInfo = this.makeRequest({ + method: "GET", + path: "/{id}/evaluate-scopes/generate-example-userinfo", + urlParamKeys: ["id"], + queryParamKeys: ["scope", "userId"], + }); + evaluateGenerateIdToken = this.makeRequest({ + method: "GET", + path: "/{id}/evaluate-scopes/generate-example-id-token", + urlParamKeys: ["id"], + queryParamKeys: ["scope", "userId"], + }); + addRealmScopeMappings = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/scope-mappings/realm", + urlParamKeys: ["id", "client"], + }); + listRealmScopeMappings = this.makeRequest({ + method: "GET", + path: "/{id}/scope-mappings/realm", + urlParamKeys: ["id"], + }); + listAvailableRealmScopeMappings = this.makeRequest({ + method: "GET", + path: "/{id}/scope-mappings/realm/available", + urlParamKeys: ["id"], + }); + listCompositeRealmScopeMappings = this.makeRequest({ + method: "GET", + path: "/{id}/scope-mappings/realm/composite", + urlParamKeys: ["id"], + }); + delRealmScopeMappings = this.makeUpdateRequest({ + method: "DELETE", + path: "/{id}/scope-mappings/realm", + urlParamKeys: ["id"], + }); + /** + * Sessions + */ + listSessions = this.makeRequest({ + method: "GET", + path: "/{id}/user-sessions", + urlParamKeys: ["id"], + }); + listOfflineSessions = this.makeRequest({ + method: "GET", + path: "/{id}/offline-sessions", + urlParamKeys: ["id"], + }); + getSessionCount = this.makeRequest({ + method: "GET", + path: "/{id}/session-count", + urlParamKeys: ["id"], + }); + /** + * Resource + */ + getResourceServer = this.makeRequest({ + method: "GET", + path: "{id}/authz/resource-server", + urlParamKeys: ["id"], + }); + updateResourceServer = this.makeUpdateRequest({ + method: "PUT", + path: "{id}/authz/resource-server", + urlParamKeys: ["id"], + }); + listResources = this.makeRequest({ + method: "GET", + path: "{id}/authz/resource-server/resource", + urlParamKeys: ["id"], + }); + createResource = this.makeUpdateRequest({ + method: "POST", + path: "{id}/authz/resource-server/resource", + urlParamKeys: ["id"], + }); + getResource = this.makeRequest({ + method: "GET", + path: "{id}/authz/resource-server/resource/{resourceId}", + urlParamKeys: ["id", "resourceId"], + }); + updateResource = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}/authz/resource-server/resource/{resourceId}", + urlParamKeys: ["id", "resourceId"], + }); + delResource = this.makeRequest({ + method: "DELETE", + path: "/{id}/authz/resource-server/resource/{resourceId}", + urlParamKeys: ["id", "resourceId"], + }); + importResource = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/authz/resource-server/import", + urlParamKeys: ["id"], + }); + exportResource = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/settings", + urlParamKeys: ["id"], + }); + evaluateResource = this.makeUpdateRequest({ + method: "POST", + path: "{id}/authz/resource-server/policy/evaluate", + urlParamKeys: ["id"], + }); + /** + * Policy + */ + listPolicies = this.makeRequest({ + method: "GET", + path: "{id}/authz/resource-server/policy", + urlParamKeys: ["id"], + }); + findPolicyByName = this.makeRequest({ + method: "GET", + path: "{id}/authz/resource-server/policy/search", + urlParamKeys: ["id"], + }); + updatePolicy = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}/authz/resource-server/policy/{type}/{policyId}", + urlParamKeys: ["id", "type", "policyId"], + }); + createPolicy = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/authz/resource-server/policy/{type}", + urlParamKeys: ["id", "type"], + }); + findOnePolicy = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/policy/{type}/{policyId}", + urlParamKeys: ["id", "type", "policyId"], + catchNotFound: true, + }); + listDependentPolicies = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/policy/{policyId}/dependentPolicies", + urlParamKeys: ["id", "policyId"], + }); + delPolicy = this.makeRequest({ + method: "DELETE", + path: "{id}/authz/resource-server/policy/{policyId}", + urlParamKeys: ["id", "policyId"], + }); + listPolicyProviders = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/policy/providers", + urlParamKeys: ["id"], + }); + async createOrUpdatePolicy(payload) { + const policyFound = await this.findPolicyByName({ + id: payload.id, + name: payload.policyName, + }); + if (policyFound) { + await this.updatePolicy({ + id: payload.id, + policyId: policyFound.id, + type: payload.policy.type, + }, payload.policy); + return this.findPolicyByName({ + id: payload.id, + name: payload.policyName, + }); + } + else { + return this.createPolicy({ id: payload.id, type: payload.policy.type }, payload.policy); + } + } + /** + * Scopes + */ + listAllScopes = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/scope", + urlParamKeys: ["id"], + }); + listAllResourcesByScope = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/scope/{scopeId}/resources", + urlParamKeys: ["id", "scopeId"], + }); + listAllPermissionsByScope = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/scope/{scopeId}/permissions", + urlParamKeys: ["id", "scopeId"], + }); + listPermissionsByResource = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/resource/{resourceId}/permissions", + urlParamKeys: ["id", "resourceId"], + }); + listScopesByResource = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/resource/{resourceName}/scopes", + urlParamKeys: ["id", "resourceName"], + }); + listPermissionScope = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/permission/scope", + urlParamKeys: ["id"], + }); + createAuthorizationScope = this.makeUpdateRequest({ + method: "POST", + path: "{id}/authz/resource-server/scope", + urlParamKeys: ["id"], + }); + updateAuthorizationScope = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}/authz/resource-server/scope/{scopeId}", + urlParamKeys: ["id", "scopeId"], + }); + getAuthorizationScope = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/scope/{scopeId}", + urlParamKeys: ["id", "scopeId"], + }); + delAuthorizationScope = this.makeRequest({ + method: "DELETE", + path: "/{id}/authz/resource-server/scope/{scopeId}", + urlParamKeys: ["id", "scopeId"], + }); + /** + * Permissions + */ + findPermissions = this.makeRequest({ + method: "GET", + path: "{id}/authz/resource-server/permission", + urlParamKeys: ["id"], + }); + createPermission = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/authz/resource-server/permission/{type}", + urlParamKeys: ["id", "type"], + }); + updatePermission = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}/authz/resource-server/permission/{type}/{permissionId}", + urlParamKeys: ["id", "type", "permissionId"], + }); + delPermission = this.makeRequest({ + method: "DELETE", + path: "/{id}/authz/resource-server/permission/{type}/{permissionId}", + urlParamKeys: ["id", "type", "permissionId"], + }); + findOnePermission = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/permission/{type}/{permissionId}", + urlParamKeys: ["id", "type", "permissionId"], + }); + getAssociatedScopes = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/policy/{permissionId}/scopes", + urlParamKeys: ["id", "permissionId"], + }); + getAssociatedResources = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/policy/{permissionId}/resources", + urlParamKeys: ["id", "permissionId"], + }); + getAssociatedPolicies = this.makeRequest({ + method: "GET", + path: "/{id}/authz/resource-server/policy/{permissionId}/associatedPolicies", + urlParamKeys: ["id", "permissionId"], + }); + getOfflineSessionCount = this.makeRequest({ + method: "GET", + path: "/{id}/offline-session-count", + urlParamKeys: ["id"], + }); + getInstallationProviders = this.makeRequest({ + method: "GET", + path: "/{id}/installation/providers/{providerId}", + urlParamKeys: ["id", "providerId"], + }); + pushRevocation = this.makeRequest({ + method: "POST", + path: "/{id}/push-revocation", + urlParamKeys: ["id"], + }); + addClusterNode = this.makeRequest({ + method: "POST", + path: "/{id}/nodes", + urlParamKeys: ["id"], + }); + deleteClusterNode = this.makeRequest({ + method: "DELETE", + path: "/{id}/nodes/{node}", + urlParamKeys: ["id", "node"], + }); + testNodesAvailable = this.makeRequest({ + method: "GET", + path: "/{id}/test-nodes-available", + urlParamKeys: ["id"], + }); + getKeyInfo = this.makeRequest({ + method: "GET", + path: "/{id}/certificates/{attr}", + urlParamKeys: ["id", "attr"], + }); + generateKey = this.makeRequest({ + method: "POST", + path: "/{id}/certificates/{attr}/generate", + urlParamKeys: ["id", "attr"], + }); + downloadKey = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/certificates/{attr}/download", + urlParamKeys: ["id", "attr"], + headers: { + accept: "application/octet-stream", + }, + }); + generateAndDownloadKey = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/certificates/{attr}/generate-and-download", + urlParamKeys: ["id", "attr"], + headers: { + accept: "application/octet-stream", + }, + }); + uploadKey = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/certificates/{attr}/upload", + urlParamKeys: ["id", "attr"], + }); + uploadCertificate = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/certificates/{attr}/upload-certificate", + urlParamKeys: ["id", "attr"], + }); + updateFineGrainPermission = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}/management/permissions", + urlParamKeys: ["id"], + }); + listFineGrainPermissions = this.makeRequest({ + method: "GET", + path: "/{id}/management/permissions", + urlParamKeys: ["id"], + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/clients", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } + /** + * Find single protocol mapper by name. + */ + async findProtocolMapperByName(payload) { + const allProtocolMappers = await this.listProtocolMappers({ + id: payload.id, + ...(payload.realm ? { realm: payload.realm } : {}), + }); + return allProtocolMappers.find((mapper) => mapper.name === payload.name); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/components.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/components.d.ts new file mode 100644 index 00000000..034db334 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/components.d.ts @@ -0,0 +1,47 @@ +import Resource from "./resource.js"; +import type ComponentRepresentation from "../defs/componentRepresentation.js"; +import type ComponentTypeRepresentation from "../defs/componentTypeRepresentation.js"; +import type { KeycloakAdminClient } from "../client.js"; +export interface ComponentQuery { + name?: string; + parent?: string; + type?: string; +} +export declare class Components extends Resource<{ + realm?: string; +}> { + /** + * components + * https://www.keycloak.org/docs-api/11.0/rest-api/#_component_resource + */ + find: (payload?: (ComponentQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + create: (payload?: (ComponentRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + }>; + findOne: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + update: (query: { + id: string; + } & { + realm?: string; + }, payload: ComponentRepresentation) => Promise; + del: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listSubComponents: (payload?: ({ + id: string; + type: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/components.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/components.js new file mode 100644 index 00000000..a7e12931 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/components.js @@ -0,0 +1,45 @@ +import Resource from "./resource.js"; +export class Components extends Resource { + /** + * components + * https://www.keycloak.org/docs-api/11.0/rest-api/#_component_resource + */ + find = this.makeRequest({ + method: "GET", + }); + create = this.makeRequest({ + method: "POST", + returnResourceIdInLocationHeader: { field: "id" }, + }); + findOne = this.makeRequest({ + method: "GET", + path: "/{id}", + urlParamKeys: ["id"], + catchNotFound: true, + }); + update = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}", + urlParamKeys: ["id"], + }); + del = this.makeRequest({ + method: "DELETE", + path: "/{id}", + urlParamKeys: ["id"], + }); + listSubComponents = this.makeRequest({ + method: "GET", + path: "/{id}/sub-component-types", + urlParamKeys: ["id"], + queryParamKeys: ["type"], + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/components", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/groups.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/groups.d.ts new file mode 100644 index 00000000..221068ac --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/groups.d.ts @@ -0,0 +1,192 @@ +import type { KeycloakAdminClient } from "../client.js"; +import type GroupRepresentation from "../defs/groupRepresentation.js"; +import type { ManagementPermissionReference } from "../defs/managementPermissionReference.js"; +import type MappingsRepresentation from "../defs/mappingsRepresentation.js"; +import type RoleRepresentation from "../defs/roleRepresentation.js"; +import type { RoleMappingPayload } from "../defs/roleRepresentation.js"; +import type UserRepresentation from "../defs/userRepresentation.js"; +import Resource from "./resource.js"; +interface Query { + q?: string; + search?: string; + exact?: boolean; +} +interface PaginatedQuery { + first?: number; + max?: number; +} +interface SummarizedQuery { + briefRepresentation?: boolean; + populateHierarchy?: boolean; +} +export type GroupQuery = Query & PaginatedQuery & SummarizedQuery; +export type SubGroupQuery = Query & PaginatedQuery & SummarizedQuery & { + parentId: string; +}; +export interface GroupCountQuery { + search?: string; + top?: boolean; +} +export declare class Groups extends Resource<{ + realm?: string; +}> { + find: (payload?: (Query & PaginatedQuery & SummarizedQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + create: (payload?: (GroupRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + }>; + updateRoot: (payload?: (GroupRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Single user + */ + findOne: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + update: (query: { + id: string; + } & { + realm?: string; + }, payload: GroupRepresentation) => Promise; + del: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + count: (payload?: (GroupCountQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + count: number; + }>; + /** + * Creates a child group on the specified parent group. If the group already exists, then an error is returned. + */ + createChildGroup: (query: { + id: string; + } & { + realm?: string; + }, payload: Omit) => Promise<{ + id: string; + }>; + /** + * Updates a child group on the specified parent group. If the group doesn’t exist, then an error is returned. + * Can be used to move a group from one parent to another. + */ + updateChildGroup: (query: { + id: string; + } & { + realm?: string; + }, payload: GroupRepresentation) => Promise; + /** + * Finds all subgroups on the specified parent group matching the provided parameters. + */ + listSubGroups: (payload?: (Query & PaginatedQuery & SummarizedQuery & { + parentId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Members + */ + listMembers: (payload?: ({ + id: string; + first?: number; + max?: number; + briefRepresentation?: boolean; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Role mappings + * https://www.keycloak.org/docs-api/11.0/rest-api/#_role_mapper_resource + */ + listRoleMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addRealmRoleMappings: (payload?: ({ + id: string; + roles: RoleMappingPayload[]; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listRealmRoleMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delRealmRoleMappings: (payload?: ({ + id: string; + roles: RoleMappingPayload[]; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAvailableRealmRoleMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listCompositeRealmRoleMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Client role mappings + * https://www.keycloak.org/docs-api/11.0/rest-api/#_client_role_mappings_resource + */ + listClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + roles: RoleMappingPayload[]; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + roles: RoleMappingPayload[]; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAvailableClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listCompositeClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Authorization permissions + */ + updatePermission: (query: { + id: string; + } & { + realm?: string; + }, payload: ManagementPermissionReference) => Promise; + listPermissions: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); +} +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/groups.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/groups.js new file mode 100644 index 00000000..25972b21 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/groups.js @@ -0,0 +1,172 @@ +import Resource from "./resource.js"; +export class Groups extends Resource { + find = this.makeRequest({ + method: "GET", + queryParamKeys: [ + "search", + "q", + "exact", + "briefRepresentation", + "populateHierarchy", + "first", + "max", + ], + }); + create = this.makeRequest({ + method: "POST", + returnResourceIdInLocationHeader: { field: "id" }, + }); + updateRoot = this.makeRequest({ + method: "POST", + }); + /** + * Single user + */ + findOne = this.makeRequest({ + method: "GET", + path: "/{id}", + urlParamKeys: ["id"], + catchNotFound: true, + }); + update = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}", + urlParamKeys: ["id"], + }); + del = this.makeRequest({ + method: "DELETE", + path: "/{id}", + urlParamKeys: ["id"], + }); + count = this.makeRequest({ + method: "GET", + path: "/count", + }); + /** + * Creates a child group on the specified parent group. If the group already exists, then an error is returned. + */ + createChildGroup = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/children", + urlParamKeys: ["id"], + returnResourceIdInLocationHeader: { field: "id" }, + }); + /** + * Updates a child group on the specified parent group. If the group doesn’t exist, then an error is returned. + * Can be used to move a group from one parent to another. + */ + updateChildGroup = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/children", + urlParamKeys: ["id"], + }); + /** + * Finds all subgroups on the specified parent group matching the provided parameters. + */ + listSubGroups = this.makeRequest({ + method: "GET", + path: "/{parentId}/children", + urlParamKeys: ["parentId"], + queryParamKeys: ["search", "first", "max", "briefRepresentation"], + catchNotFound: true, + }); + /** + * Members + */ + listMembers = this.makeRequest({ + method: "GET", + path: "/{id}/members", + urlParamKeys: ["id"], + catchNotFound: true, + }); + /** + * Role mappings + * https://www.keycloak.org/docs-api/11.0/rest-api/#_role_mapper_resource + */ + listRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings", + urlParamKeys: ["id"], + }); + addRealmRoleMappings = this.makeRequest({ + method: "POST", + path: "/{id}/role-mappings/realm", + urlParamKeys: ["id"], + payloadKey: "roles", + }); + listRealmRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/realm", + urlParamKeys: ["id"], + }); + delRealmRoleMappings = this.makeRequest({ + method: "DELETE", + path: "/{id}/role-mappings/realm", + urlParamKeys: ["id"], + payloadKey: "roles", + }); + listAvailableRealmRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/realm/available", + urlParamKeys: ["id"], + }); + // Get effective realm-level role mappings This will recurse all composite roles to get the result. + listCompositeRealmRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/realm/composite", + urlParamKeys: ["id"], + }); + /** + * Client role mappings + * https://www.keycloak.org/docs-api/11.0/rest-api/#_client_role_mappings_resource + */ + listClientRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/clients/{clientUniqueId}", + urlParamKeys: ["id", "clientUniqueId"], + }); + addClientRoleMappings = this.makeRequest({ + method: "POST", + path: "/{id}/role-mappings/clients/{clientUniqueId}", + urlParamKeys: ["id", "clientUniqueId"], + payloadKey: "roles", + }); + delClientRoleMappings = this.makeRequest({ + method: "DELETE", + path: "/{id}/role-mappings/clients/{clientUniqueId}", + urlParamKeys: ["id", "clientUniqueId"], + payloadKey: "roles", + }); + listAvailableClientRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/clients/{clientUniqueId}/available", + urlParamKeys: ["id", "clientUniqueId"], + }); + listCompositeClientRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/clients/{clientUniqueId}/composite", + urlParamKeys: ["id", "clientUniqueId"], + }); + /** + * Authorization permissions + */ + updatePermission = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}/management/permissions", + urlParamKeys: ["id"], + }); + listPermissions = this.makeRequest({ + method: "GET", + path: "/{id}/management/permissions", + urlParamKeys: ["id"], + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/groups", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/identityProviders.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/identityProviders.d.ts new file mode 100644 index 00000000..d7cba4a7 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/identityProviders.d.ts @@ -0,0 +1,108 @@ +import type { KeycloakAdminClient } from "../client.js"; +import type IdentityProviderMapperRepresentation from "../defs/identityProviderMapperRepresentation.js"; +import type { IdentityProviderMapperTypeRepresentation } from "../defs/identityProviderMapperTypeRepresentation.js"; +import type IdentityProviderRepresentation from "../defs/identityProviderRepresentation.js"; +import type { ManagementPermissionReference } from "../defs/managementPermissionReference.js"; +import Resource from "./resource.js"; +export interface PaginatedQuery { + first?: number; + max?: number; +} +export interface IdentityProvidersQuery extends PaginatedQuery { + search?: string; + realmOnly?: boolean; +} +export declare class IdentityProviders extends Resource<{ + realm?: string; +}> { + /** + * Identity provider + * https://www.keycloak.org/docs-api/11.0/rest-api/#_identity_providers_resource + */ + find: (payload?: (IdentityProvidersQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + create: (payload?: (IdentityProviderRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + }>; + findOne: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + update: (query: { + alias: string; + } & { + realm?: string; + }, payload: IdentityProviderRepresentation) => Promise; + del: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findFactory: (payload?: ({ + providerId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findMappers: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findOneMapper: (payload?: ({ + alias: string; + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + createMapper: (payload?: ({ + alias: string; + identityProviderMapper: IdentityProviderMapperRepresentation; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + }>; + updateMapper: (query: { + alias: string; + id: string; + } & { + realm?: string; + }, payload: IdentityProviderMapperRepresentation) => Promise; + delMapper: (payload?: ({ + alias: string; + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findMapperTypes: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise>; + importFromUrl: (payload?: ((FormData | { + fromUrl: string; + providerId: string; + }) & { + realm?: string; + }) | undefined, options?: Pick) => Promise>; + updatePermission: (query: { + alias: string; + } & { + realm?: string; + }, payload: ManagementPermissionReference) => Promise; + listPermissions: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + reloadKeys: (payload?: ({ + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/identityProviders.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/identityProviders.js new file mode 100644 index 00000000..683e2c80 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/identityProviders.js @@ -0,0 +1,98 @@ +import Resource from "./resource.js"; +export class IdentityProviders extends Resource { + /** + * Identity provider + * https://www.keycloak.org/docs-api/11.0/rest-api/#_identity_providers_resource + */ + find = this.makeRequest({ + method: "GET", + path: "/instances", + }); + create = this.makeRequest({ + method: "POST", + path: "/instances", + returnResourceIdInLocationHeader: { field: "id" }, + }); + findOne = this.makeRequest({ + method: "GET", + path: "/instances/{alias}", + urlParamKeys: ["alias"], + catchNotFound: true, + }); + update = this.makeUpdateRequest({ + method: "PUT", + path: "/instances/{alias}", + urlParamKeys: ["alias"], + }); + del = this.makeRequest({ + method: "DELETE", + path: "/instances/{alias}", + urlParamKeys: ["alias"], + }); + findFactory = this.makeRequest({ + method: "GET", + path: "/providers/{providerId}", + urlParamKeys: ["providerId"], + }); + findMappers = this.makeRequest({ + method: "GET", + path: "/instances/{alias}/mappers", + urlParamKeys: ["alias"], + }); + findOneMapper = this.makeRequest({ + method: "GET", + path: "/instances/{alias}/mappers/{id}", + urlParamKeys: ["alias", "id"], + catchNotFound: true, + }); + createMapper = this.makeRequest({ + method: "POST", + path: "/instances/{alias}/mappers", + urlParamKeys: ["alias"], + payloadKey: "identityProviderMapper", + returnResourceIdInLocationHeader: { field: "id" }, + }); + updateMapper = this.makeUpdateRequest({ + method: "PUT", + path: "/instances/{alias}/mappers/{id}", + urlParamKeys: ["alias", "id"], + }); + delMapper = this.makeRequest({ + method: "DELETE", + path: "/instances/{alias}/mappers/{id}", + urlParamKeys: ["alias", "id"], + }); + findMapperTypes = this.makeRequest({ + method: "GET", + path: "/instances/{alias}/mapper-types", + urlParamKeys: ["alias"], + }); + importFromUrl = this.makeRequest({ + method: "POST", + path: "/import-config", + }); + updatePermission = this.makeUpdateRequest({ + method: "PUT", + path: "/instances/{alias}/management/permissions", + urlParamKeys: ["alias"], + }); + listPermissions = this.makeRequest({ + method: "GET", + path: "/instances/{alias}/management/permissions", + urlParamKeys: ["alias"], + }); + reloadKeys = this.makeRequest({ + method: "GET", + path: "/instances/{alias}/reload-keys", + urlParamKeys: ["alias"], + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/identity-provider", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/organizations.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/organizations.d.ts new file mode 100644 index 00000000..6e3cdba8 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/organizations.d.ts @@ -0,0 +1,97 @@ +import type { KeycloakAdminClient } from "../client.js"; +import IdentityProviderRepresentation from "../defs/identityProviderRepresentation.js"; +import type OrganizationRepresentation from "../defs/organizationRepresentation.js"; +import UserRepresentation from "../defs/userRepresentation.js"; +import Resource from "./resource.js"; +interface PaginatedQuery { + first?: number; + max?: number; + search?: string; +} +export interface OrganizationQuery extends PaginatedQuery { + q?: string; + exact?: boolean; +} +interface MemberQuery extends PaginatedQuery { + orgId: string; + membershipType?: string; +} +export declare class Organizations extends Resource<{ + realm?: string; +}> { + /** + * Organizations + */ + constructor(client: KeycloakAdminClient); + find: (payload?: (OrganizationQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findOne: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + create: (payload?: (OrganizationRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + }>; + delById: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateById: (query: { + id: string; + } & { + realm?: string; + }, payload: OrganizationRepresentation) => Promise; + listMembers: (payload?: (MemberQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addMember: (payload?: ({ + orgId: string; + userId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delMember: (payload?: ({ + orgId: string; + userId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + memberOrganizations: (payload?: ({ + userId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + invite: (query: { + orgId: string; + } & { + realm?: string; + }, payload: FormData) => Promise; + inviteExistingUser: (query: { + orgId: string; + } & { + realm?: string; + }, payload: FormData) => Promise; + listIdentityProviders: (payload?: ({ + orgId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + linkIdp: (payload?: ({ + orgId: string; + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + unLinkIdp: (payload?: ({ + orgId: string; + alias: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; +} +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/organizations.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/organizations.js new file mode 100644 index 00000000..a47ee116 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/organizations.js @@ -0,0 +1,85 @@ +import Resource from "./resource.js"; +export class Organizations extends Resource { + /** + * Organizations + */ + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/organizations", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } + find = this.makeRequest({ + method: "GET", + path: "/", + }); + findOne = this.makeRequest({ + method: "GET", + path: "/{id}", + urlParamKeys: ["id"], + }); + create = this.makeRequest({ + method: "POST", + returnResourceIdInLocationHeader: { field: "id" }, + }); + delById = this.makeRequest({ + method: "DELETE", + path: "/{id}", + urlParamKeys: ["id"], + }); + updateById = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}", + urlParamKeys: ["id"], + }); + listMembers = this.makeRequest({ + method: "GET", + path: "/{orgId}/members", + urlParamKeys: ["orgId"], + }); + addMember = this.makeRequest({ + method: "POST", + path: "/{orgId}/members", + urlParamKeys: ["orgId"], + payloadKey: "userId", + }); + delMember = this.makeRequest({ + method: "DELETE", + path: "/{orgId}/members/{userId}", + urlParamKeys: ["orgId", "userId"], + }); + memberOrganizations = this.makeRequest({ + method: "GET", + path: "/members/{userId}/organizations", + urlParamKeys: ["userId"], + }); + invite = this.makeUpdateRequest({ + method: "POST", + path: "/{orgId}/members/invite-user", + urlParamKeys: ["orgId"], + }); + inviteExistingUser = this.makeUpdateRequest({ + method: "POST", + path: "/{orgId}/members/invite-existing-user", + urlParamKeys: ["orgId"], + }); + listIdentityProviders = this.makeRequest({ + method: "GET", + path: "/{orgId}/identity-providers", + urlParamKeys: ["orgId"], + }); + linkIdp = this.makeRequest({ + method: "POST", + path: "/{orgId}/identity-providers", + urlParamKeys: ["orgId"], + payloadKey: "alias", + }); + unLinkIdp = this.makeRequest({ + method: "DELETE", + path: "/{orgId}/identity-providers/{alias}", + urlParamKeys: ["orgId", "alias"], + }); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/realms.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/realms.d.ts new file mode 100644 index 00000000..b63d43e0 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/realms.d.ts @@ -0,0 +1,186 @@ +import Resource from "./resource.js"; +import type AdminEventRepresentation from "../defs/adminEventRepresentation.js"; +import type RealmRepresentation from "../defs/realmRepresentation.js"; +import type { PartialImportRealmRepresentation, PartialImportResponse } from "../defs/realmRepresentation.js"; +import type EventRepresentation from "../defs/eventRepresentation.js"; +import type EventType from "../defs/eventTypes.js"; +import type KeysMetadataRepresentation from "../defs/keyMetadataRepresentation.js"; +import type ClientInitialAccessPresentation from "../defs/clientInitialAccessPresentation.js"; +import type TestLdapConnectionRepresentation from "../defs/testLdapConnection.js"; +import type { KeycloakAdminClient } from "../client.js"; +import type { RealmEventsConfigRepresentation } from "../defs/realmEventsConfigRepresentation.js"; +import type GlobalRequestResult from "../defs/globalRequestResult.js"; +import type GroupRepresentation from "../defs/groupRepresentation.js"; +import type { ManagementPermissionReference } from "../defs/managementPermissionReference.js"; +import type ComponentTypeRepresentation from "../defs/componentTypeRepresentation.js"; +import type { ClientSessionStat } from "../defs/clientSessionStat.js"; +export declare class Realms extends Resource { + /** + * Realm + * https://www.keycloak.org/docs-api/11.0/rest-api/#_realms_admin_resource + */ + find: (payload?: { + briefRepresentation?: boolean; + } | undefined, options?: Pick) => Promise; + create: (payload?: RealmRepresentation | undefined, options?: Pick) => Promise<{ + realmName: string; + }>; + findOne: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + update: (query: { + realm: string; + }, payload: RealmRepresentation) => Promise; + del: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + partialImport: (payload?: { + realm: string; + rep: PartialImportRealmRepresentation; + } | undefined, options?: Pick) => Promise; + export: (payload?: { + realm: string; + exportClients?: boolean; + exportGroupsAndRoles?: boolean; + } | undefined, options?: Pick) => Promise; + getDefaultGroups: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + addDefaultGroup: (payload?: { + realm: string; + id: string; + } | undefined, options?: Pick) => Promise; + removeDefaultGroup: (payload?: { + realm: string; + id: string; + } | undefined, options?: Pick) => Promise; + getGroupByPath: (payload?: { + path: string; + realm: string; + } | undefined, options?: Pick) => Promise; + /** + * Get events Returns all events, or filters them based on URL query parameters listed here + */ + findEvents: (payload?: { + realm: string; + client?: string; + dateFrom?: string; + dateTo?: string; + first?: number; + ipAddress?: string; + max?: number; + type?: EventType | EventType[]; + user?: string; + } | undefined, options?: Pick) => Promise; + getConfigEvents: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + updateConfigEvents: (query: { + realm: string; + }, payload: RealmEventsConfigRepresentation) => Promise; + clearEvents: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + clearAdminEvents: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + getClientRegistrationPolicyProviders: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + getClientsInitialAccess: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + createClientsInitialAccess: (query: { + realm: string; + }, payload: { + count?: number; + expiration?: number; + }) => Promise; + delClientsInitialAccess: (payload?: { + realm: string; + id: string; + } | undefined, options?: Pick) => Promise; + /** + * Remove a specific user session. + */ + removeSession: (payload?: { + realm: string; + sessionId: string; + } | undefined, options?: Pick) => Promise; + /** + * Get admin events Returns all admin events, or filters events based on URL query parameters listed here + */ + findAdminEvents: (payload?: { + realm: string; + authClient?: string; + authIpAddress?: string; + authRealm?: string; + authUser?: string; + dateFrom?: Date; + dateTo?: Date; + first?: number; + max?: number; + operationTypes?: string; + resourcePath?: string; + resourceTypes?: string; + } | undefined, options?: Pick) => Promise; + /** + * Users management permissions + */ + getUsersManagementPermissions: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + updateUsersManagementPermissions: (payload?: { + realm: string; + enabled: boolean; + } | undefined, options?: Pick) => Promise; + /** + * Sessions + */ + getClientSessionStats: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + logoutAll: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + deleteSession: (payload?: { + realm: string; + session: string; + isOffline: boolean; + } | undefined, options?: Pick) => Promise; + pushRevocation: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + getKeys: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + testLDAPConnection: (query: { + realm: string; + }, payload: TestLdapConnectionRepresentation) => Promise; + testSMTPConnection: (query: { + realm: string; + }, payload: Record) => Promise; + ldapServerCapabilities: (query: { + realm: string; + }, payload: TestLdapConnectionRepresentation) => Promise; + getRealmSpecificLocales: (payload?: { + realm: string; + } | undefined, options?: Pick) => Promise; + getRealmLocalizationTexts: (payload?: { + realm: string; + selectedLocale: string; + first?: number; + max?: number; + } | undefined, options?: Pick) => Promise>; + addLocalization: (query: { + realm: string; + selectedLocale: string; + key: string; + }, payload: string) => Promise; + deleteRealmLocalizationTexts: (payload?: { + realm: string; + selectedLocale: string; + key?: string; + } | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/realms.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/realms.js new file mode 100644 index 00000000..7fc43bcd --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/realms.js @@ -0,0 +1,235 @@ +import Resource from "./resource.js"; +export class Realms extends Resource { + /** + * Realm + * https://www.keycloak.org/docs-api/11.0/rest-api/#_realms_admin_resource + */ + find = this.makeRequest({ + method: "GET", + }); + create = this.makeRequest({ + method: "POST", + returnResourceIdInLocationHeader: { field: "realmName" }, + }); + findOne = this.makeRequest({ + method: "GET", + path: "/{realm}", + urlParamKeys: ["realm"], + catchNotFound: true, + }); + update = this.makeUpdateRequest({ + method: "PUT", + path: "/{realm}", + urlParamKeys: ["realm"], + }); + del = this.makeRequest({ + method: "DELETE", + path: "/{realm}", + urlParamKeys: ["realm"], + }); + partialImport = this.makeRequest({ + method: "POST", + path: "/{realm}/partialImport", + urlParamKeys: ["realm"], + payloadKey: "rep", + }); + export = this.makeRequest({ + method: "POST", + path: "/{realm}/partial-export", + urlParamKeys: ["realm"], + queryParamKeys: ["exportClients", "exportGroupsAndRoles"], + }); + getDefaultGroups = this.makeRequest({ + method: "GET", + path: "/{realm}/default-groups", + urlParamKeys: ["realm"], + }); + addDefaultGroup = this.makeRequest({ + method: "PUT", + path: "/{realm}/default-groups/{id}", + urlParamKeys: ["realm", "id"], + }); + removeDefaultGroup = this.makeRequest({ + method: "DELETE", + path: "/{realm}/default-groups/{id}", + urlParamKeys: ["realm", "id"], + }); + getGroupByPath = this.makeRequest({ + method: "GET", + path: "/{realm}/group-by-path/{path}", + urlParamKeys: ["realm", "path"], + }); + /** + * Get events Returns all events, or filters them based on URL query parameters listed here + */ + findEvents = this.makeRequest({ + method: "GET", + path: "/{realm}/events", + urlParamKeys: ["realm"], + queryParamKeys: [ + "client", + "dateFrom", + "dateTo", + "first", + "ipAddress", + "max", + "type", + "user", + ], + }); + getConfigEvents = this.makeRequest({ + method: "GET", + path: "/{realm}/events/config", + urlParamKeys: ["realm"], + }); + updateConfigEvents = this.makeUpdateRequest({ + method: "PUT", + path: "/{realm}/events/config", + urlParamKeys: ["realm"], + }); + clearEvents = this.makeRequest({ + method: "DELETE", + path: "/{realm}/events", + urlParamKeys: ["realm"], + }); + clearAdminEvents = this.makeRequest({ + method: "DELETE", + path: "/{realm}/admin-events", + urlParamKeys: ["realm"], + }); + getClientRegistrationPolicyProviders = this.makeRequest({ + method: "GET", + path: "/{realm}/client-registration-policy/providers", + urlParamKeys: ["realm"], + }); + getClientsInitialAccess = this.makeRequest({ + method: "GET", + path: "/{realm}/clients-initial-access", + urlParamKeys: ["realm"], + }); + createClientsInitialAccess = this.makeUpdateRequest({ + method: "POST", + path: "/{realm}/clients-initial-access", + urlParamKeys: ["realm"], + }); + delClientsInitialAccess = this.makeRequest({ + method: "DELETE", + path: "/{realm}/clients-initial-access/{id}", + urlParamKeys: ["realm", "id"], + }); + /** + * Remove a specific user session. + */ + removeSession = this.makeRequest({ + method: "DELETE", + path: "/{realm}/sessions/{sessionId}", + urlParamKeys: ["realm", "sessionId"], + catchNotFound: true, + }); + /** + * Get admin events Returns all admin events, or filters events based on URL query parameters listed here + */ + findAdminEvents = this.makeRequest({ + method: "GET", + path: "/{realm}/admin-events", + urlParamKeys: ["realm"], + queryParamKeys: [ + "authClient", + "authIpAddress", + "authRealm", + "authUser", + "dateFrom", + "dateTo", + "max", + "first", + "operationTypes", + "resourcePath", + "resourceTypes", + ], + }); + /** + * Users management permissions + */ + getUsersManagementPermissions = this.makeRequest({ + method: "GET", + path: "/{realm}/users-management-permissions", + urlParamKeys: ["realm"], + }); + updateUsersManagementPermissions = this.makeRequest({ + method: "PUT", + path: "/{realm}/users-management-permissions", + urlParamKeys: ["realm"], + }); + /** + * Sessions + */ + getClientSessionStats = this.makeRequest({ + method: "GET", + path: "/{realm}/client-session-stats", + urlParamKeys: ["realm"], + }); + logoutAll = this.makeRequest({ + method: "POST", + path: "/{realm}/logout-all", + urlParamKeys: ["realm"], + }); + deleteSession = this.makeRequest({ + method: "DELETE", + path: "/{realm}/sessions/{session}", + urlParamKeys: ["realm", "session"], + queryParamKeys: ["isOffline"], + }); + pushRevocation = this.makeRequest({ + method: "POST", + path: "/{realm}/push-revocation", + urlParamKeys: ["realm"], + ignoredKeys: ["realm"], + }); + getKeys = this.makeRequest({ + method: "GET", + path: "/{realm}/keys", + urlParamKeys: ["realm"], + }); + testLDAPConnection = this.makeUpdateRequest({ + method: "POST", + path: "/{realm}/testLDAPConnection", + urlParamKeys: ["realm"], + }); + testSMTPConnection = this.makeUpdateRequest({ + method: "POST", + path: "/{realm}/testSMTPConnection", + urlParamKeys: ["realm"], + }); + ldapServerCapabilities = this.makeUpdateRequest({ + method: "POST", + path: "/{realm}/ldap-server-capabilities", + urlParamKeys: ["realm"], + }); + getRealmSpecificLocales = this.makeRequest({ + method: "GET", + path: "/{realm}/localization", + urlParamKeys: ["realm"], + }); + getRealmLocalizationTexts = this.makeRequest({ + method: "GET", + path: "/{realm}/localization/{selectedLocale}", + urlParamKeys: ["realm", "selectedLocale"], + }); + addLocalization = this.makeUpdateRequest({ + method: "PUT", + path: "/{realm}/localization/{selectedLocale}/{key}", + urlParamKeys: ["realm", "selectedLocale", "key"], + headers: { "content-type": "text/plain" }, + }); + deleteRealmLocalizationTexts = this.makeRequest({ + method: "DELETE", + path: "/{realm}/localization/{selectedLocale}/{key}", + urlParamKeys: ["realm", "selectedLocale", "key"], + }); + constructor(client) { + super(client, { + path: "/admin/realms", + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/resource.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/resource.d.ts new file mode 100644 index 00000000..469380fc --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/resource.d.ts @@ -0,0 +1,12 @@ +import type { KeycloakAdminClient } from "../client.js"; +import { RequestArgs } from "./agent.js"; +export default class Resource { + #private; + constructor(client: KeycloakAdminClient, settings?: { + path?: string; + getUrlParams?: () => Record; + getBaseUrl?: () => string; + }); + makeRequest: (args: RequestArgs) => ((payload?: PayloadType & ParamType, options?: Pick) => Promise); + makeUpdateRequest: (args: RequestArgs) => ((query: QueryType & ParamType, payload: PayloadType) => Promise); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/resource.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/resource.js new file mode 100644 index 00000000..9e1ef9a5 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/resource.js @@ -0,0 +1,17 @@ +import { Agent } from "./agent.js"; +export default class Resource { + #agent; + constructor(client, settings = {}) { + this.#agent = new Agent({ + client, + ...settings, + }); + } + makeRequest = (args) => { + return this.#agent.request(args); + }; + // update request will take three types: query, payload and response + makeUpdateRequest = (args) => { + return this.#agent.updateRequest(args); + }; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/roles.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/roles.d.ts new file mode 100644 index 00000000..0f498397 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/roles.d.ts @@ -0,0 +1,113 @@ +import Resource from "./resource.js"; +import type RoleRepresentation from "../defs/roleRepresentation.js"; +import type UserRepresentation from "../defs/userRepresentation.js"; +import type { KeycloakAdminClient } from "../client.js"; +import type { ManagementPermissionReference } from "../defs/managementPermissionReference.js"; +export interface RoleQuery { + first?: number; + max?: number; + search?: string; + briefRepresentation?: boolean; +} +export declare class Roles extends Resource<{ + realm?: string; +}> { + /** + * Realm roles + */ + find: (payload?: (RoleQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + create: (payload?: (RoleRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + roleName: string; + }>; + /** + * Roles by name + */ + findOneByName: (payload?: ({ + name: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + updateByName: (query: { + name: string; + } & { + realm?: string; + }, payload: RoleRepresentation) => Promise; + delByName: (payload?: ({ + name: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + findUsersWithRole: (payload?: ({ + name: string; + briefRepresentation?: boolean; + first?: number; + max?: number; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Roles by id + */ + findOneById: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + createComposite: (query: { + roleId: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + getCompositeRoles: (payload?: ({ + id: string; + search?: string; + first?: number; + max?: number; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getCompositeRolesForRealm: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getCompositeRolesForClient: (payload?: ({ + id: string; + clientId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delCompositeRoles: (query: { + id: string; + } & { + realm?: string; + }, payload: RoleRepresentation[]) => Promise; + updateById: (query: { + id: string; + } & { + realm?: string; + }, payload: RoleRepresentation) => Promise; + delById: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Authorization permissions + */ + updatePermission: (query: { + id: string; + } & { + realm?: string; + }, payload: ManagementPermissionReference) => Promise; + listPermissions: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/roles.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/roles.js new file mode 100644 index 00000000..af892506 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/roles.js @@ -0,0 +1,106 @@ +import Resource from "./resource.js"; +export class Roles extends Resource { + /** + * Realm roles + */ + find = this.makeRequest({ + method: "GET", + path: "/roles", + }); + create = this.makeRequest({ + method: "POST", + path: "/roles", + returnResourceIdInLocationHeader: { field: "roleName" }, + }); + /** + * Roles by name + */ + findOneByName = this.makeRequest({ + method: "GET", + path: "/roles/{name}", + urlParamKeys: ["name"], + catchNotFound: true, + }); + updateByName = this.makeUpdateRequest({ + method: "PUT", + path: "/roles/{name}", + urlParamKeys: ["name"], + }); + delByName = this.makeRequest({ + method: "DELETE", + path: "/roles/{name}", + urlParamKeys: ["name"], + }); + findUsersWithRole = this.makeRequest({ + method: "GET", + path: "/roles/{name}/users", + urlParamKeys: ["name"], + catchNotFound: true, + }); + /** + * Roles by id + */ + findOneById = this.makeRequest({ + method: "GET", + path: "/roles-by-id/{id}", + urlParamKeys: ["id"], + catchNotFound: true, + }); + createComposite = this.makeUpdateRequest({ + method: "POST", + path: "/roles-by-id/{roleId}/composites", + urlParamKeys: ["roleId"], + }); + getCompositeRoles = this.makeRequest({ + method: "GET", + path: "/roles-by-id/{id}/composites", + urlParamKeys: ["id"], + }); + getCompositeRolesForRealm = this.makeRequest({ + method: "GET", + path: "/roles-by-id/{id}/composites/realm", + urlParamKeys: ["id"], + }); + getCompositeRolesForClient = this.makeRequest({ + method: "GET", + path: "/roles-by-id/{id}/composites/clients/{clientId}", + urlParamKeys: ["id", "clientId"], + }); + delCompositeRoles = this.makeUpdateRequest({ + method: "DELETE", + path: "/roles-by-id/{id}/composites", + urlParamKeys: ["id"], + }); + updateById = this.makeUpdateRequest({ + method: "PUT", + path: "/roles-by-id/{id}", + urlParamKeys: ["id"], + }); + delById = this.makeRequest({ + method: "DELETE", + path: "/roles-by-id/{id}", + urlParamKeys: ["id"], + }); + /** + * Authorization permissions + */ + updatePermission = this.makeUpdateRequest({ + method: "PUT", + path: "/roles-by-id/{id}/management/permissions", + urlParamKeys: ["id"], + }); + listPermissions = this.makeRequest({ + method: "GET", + path: "/roles-by-id/{id}/management/permissions", + urlParamKeys: ["id"], + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/serverInfo.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/serverInfo.d.ts new file mode 100644 index 00000000..98f0eb82 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/serverInfo.d.ts @@ -0,0 +1,16 @@ +import Resource from "./resource.js"; +import type { ServerInfoRepresentation } from "../defs/serverInfoRepesentation.js"; +import type KeycloakAdminClient from "../index.js"; +import type EffectiveMessageBundleRepresentation from "../defs/effectiveMessageBundleRepresentation.js"; +export interface MessageBundleQuery { + realm: string; + theme?: string; + themeType?: string; + locale?: string; + source?: boolean; +} +export declare class ServerInfo extends Resource { + constructor(client: KeycloakAdminClient); + find: (payload?: {} | undefined, options?: Pick) => Promise; + findEffectiveMessageBundles: (payload?: MessageBundleQuery | undefined, options?: Pick) => Promise; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/serverInfo.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/serverInfo.js new file mode 100644 index 00000000..a516fac5 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/serverInfo.js @@ -0,0 +1,19 @@ +import Resource from "./resource.js"; +export class ServerInfo extends Resource { + constructor(client) { + super(client, { + path: "/", + getBaseUrl: () => client.baseUrl, + }); + } + find = this.makeRequest({ + method: "GET", + path: "/admin/serverinfo", + }); + findEffectiveMessageBundles = this.makeRequest({ + method: "GET", + path: "/resources/{realm}/{themeType}/{locale}", + urlParamKeys: ["realm", "themeType", "locale"], + queryParamKeys: ["theme", "source"], + }); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/userStorageProvider.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/userStorageProvider.d.ts new file mode 100644 index 00000000..36f652a8 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/userStorageProvider.d.ts @@ -0,0 +1,43 @@ +import type { KeycloakAdminClient } from "../client.js"; +import type SynchronizationResultRepresentation from "../defs/synchronizationResultRepresentation.js"; +import Resource from "./resource.js"; +type ActionType = "triggerFullSync" | "triggerChangedUsersSync"; +export type DirectionType = "fedToKeycloak" | "keycloakToFed"; +type NameResponse = { + id: string; + name: string; +}; +export declare class UserStorageProvider extends Resource<{ + realm?: string; +}> { + name: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + removeImportedUsers: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + sync: (payload?: ({ + id: string; + action?: ActionType; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + unlinkUsers: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + mappersSync: (payload?: ({ + id: string; + parentId: string; + direction?: DirectionType; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + constructor(client: KeycloakAdminClient); +} +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/userStorageProvider.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/userStorageProvider.js new file mode 100644 index 00000000..6992a7ed --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/userStorageProvider.js @@ -0,0 +1,39 @@ +import Resource from "./resource.js"; +export class UserStorageProvider extends Resource { + name = this.makeRequest({ + method: "GET", + path: "/{id}/name", + urlParamKeys: ["id"], + }); + removeImportedUsers = this.makeRequest({ + method: "POST", + path: "/{id}/remove-imported-users", + urlParamKeys: ["id"], + }); + sync = this.makeRequest({ + method: "POST", + path: "/{id}/sync", + urlParamKeys: ["id"], + queryParamKeys: ["action"], + }); + unlinkUsers = this.makeRequest({ + method: "POST", + path: "/{id}/unlink-users", + urlParamKeys: ["id"], + }); + mappersSync = this.makeRequest({ + method: "POST", + path: "/{parentId}/mappers/{id}/sync", + urlParamKeys: ["id", "parentId"], + queryParamKeys: ["direction"], + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/user-storage", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/users.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/users.d.ts new file mode 100644 index 00000000..1e1fa051 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/users.d.ts @@ -0,0 +1,336 @@ +import type { KeycloakAdminClient } from "../client.js"; +import type CredentialRepresentation from "../defs/credentialRepresentation.js"; +import type FederatedIdentityRepresentation from "../defs/federatedIdentityRepresentation.js"; +import type GroupRepresentation from "../defs/groupRepresentation.js"; +import type MappingsRepresentation from "../defs/mappingsRepresentation.js"; +import type { RequiredActionAlias } from "../defs/requiredActionProviderRepresentation.js"; +import type RoleRepresentation from "../defs/roleRepresentation.js"; +import type { RoleMappingPayload } from "../defs/roleRepresentation.js"; +import type UserConsentRepresentation from "../defs/userConsentRepresentation.js"; +import type { UserProfileConfig, UserProfileMetadata } from "../defs/userProfileMetadata.js"; +import type UserRepresentation from "../defs/userRepresentation.js"; +import type UserSessionRepresentation from "../defs/userSessionRepresentation.js"; +import Resource from "./resource.js"; +interface SearchQuery { + search?: string; +} +interface PaginationQuery { + first?: number; + max?: number; +} +interface UserBaseQuery { + email?: string; + firstName?: string; + lastName?: string; + username?: string; + q?: string; +} +export interface UserQuery extends PaginationQuery, SearchQuery, UserBaseQuery { + exact?: boolean; + [key: string]: string | number | undefined | boolean; +} +export declare class Users extends Resource<{ + realm?: string; +}> { + find: (payload?: (UserQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + create: (payload?: (UserRepresentation & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + id: string; + }>; + /** + * Single user + */ + findOne: (payload?: ({ + id: string; + userProfileMetadata?: boolean; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + update: (query: { + id: string; + } & { + realm?: string; + }, payload: UserRepresentation) => Promise; + del: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + count: (payload?: (UserBaseQuery & SearchQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getProfile: (payload?: { + realm?: string; + } | undefined, options?: Pick) => Promise; + updateProfile: (payload?: (UserProfileConfig & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getProfileMetadata: (payload?: { + realm?: string; + } | undefined, options?: Pick) => Promise; + /** + * role mappings + */ + listRoleMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addRealmRoleMappings: (payload?: ({ + id: string; + roles: RoleMappingPayload[]; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listRealmRoleMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delRealmRoleMappings: (payload?: ({ + id: string; + roles: RoleMappingPayload[]; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAvailableRealmRoleMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listCompositeRealmRoleMappings: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Client role mappings + * https://www.keycloak.org/docs-api/11.0/rest-api/#_client_role_mappings_resource + */ + listClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + roles: RoleMappingPayload[]; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + roles: RoleMappingPayload[]; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listAvailableClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + listCompositeClientRoleMappings: (payload?: ({ + id: string; + clientUniqueId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Send a update account email to the user + * an email contains a link the user can click to perform a set of required actions. + */ + executeActionsEmail: (payload?: ({ + id: string; + clientId?: string; + lifespan?: number; + redirectUri?: string; + actions?: (RequiredActionAlias | string)[]; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * Group + */ + listGroups: (payload?: ({ + id: string; + briefRepresentation?: boolean; + } & PaginationQuery & SearchQuery & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addToGroup: (payload?: ({ + id: string; + groupId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delFromGroup: (payload?: ({ + id: string; + groupId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + countGroups: (payload?: ({ + id: string; + search?: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise<{ + count: number; + }>; + /** + * Federated Identity + */ + listFederatedIdentities: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + addToFederatedIdentity: (payload?: ({ + id: string; + federatedIdentityId: string; + federatedIdentity: FederatedIdentityRepresentation; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + delFromFederatedIdentity: (payload?: ({ + id: string; + federatedIdentityId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * remove totp + */ + removeTotp: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * reset password + */ + resetPassword: (payload?: ({ + id: string; + credential: CredentialRepresentation; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getUserStorageCredentialTypes: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * get user credentials + */ + getCredentials: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * delete user credentials + */ + deleteCredential: (payload?: ({ + id: string; + credentialId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * update a credential label for a user + */ + updateCredentialLabel: (query: { + id: string; + credentialId: string; + } & { + realm?: string; + }, payload: string) => Promise; + moveCredentialPositionDown: (payload?: ({ + id: string; + credentialId: string; + newPreviousCredentialId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + moveCredentialPositionUp: (payload?: ({ + id: string; + credentialId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * send verify email + */ + sendVerifyEmail: (payload?: ({ + id: string; + clientId?: string; + redirectUri?: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * list user sessions + */ + listSessions: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * list offline sessions associated with the user and client + */ + listOfflineSessions: (payload?: ({ + id: string; + clientId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * logout user from all sessions + */ + logout: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + /** + * list consents granted by the user + */ + listConsents: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + impersonation: (query: { + id: string; + } & { + realm?: string; + }, payload: { + user: string; + realm: string; + }) => Promise>; + /** + * revoke consent and offline tokens for particular client from user + */ + revokeConsent: (payload?: ({ + id: string; + clientId: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; + getUnmanagedAttributes: (payload?: ({ + id: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise>; + constructor(client: KeycloakAdminClient); +} +export {}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/users.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/users.js new file mode 100644 index 00000000..2c87a62d --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/users.js @@ -0,0 +1,300 @@ +import Resource from "./resource.js"; +export class Users extends Resource { + find = this.makeRequest({ + method: "GET", + }); + create = this.makeRequest({ + method: "POST", + returnResourceIdInLocationHeader: { field: "id" }, + }); + /** + * Single user + */ + findOne = this.makeRequest({ + method: "GET", + path: "/{id}", + urlParamKeys: ["id"], + catchNotFound: true, + }); + update = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}", + urlParamKeys: ["id"], + }); + del = this.makeRequest({ + method: "DELETE", + path: "/{id}", + urlParamKeys: ["id"], + }); + count = this.makeRequest({ + method: "GET", + path: "/count", + }); + getProfile = this.makeRequest({ + method: "GET", + path: "/profile", + }); + updateProfile = this.makeRequest({ + method: "PUT", + path: "/profile", + }); + getProfileMetadata = this.makeRequest({ + method: "GET", + path: "/profile/metadata", + }); + /** + * role mappings + */ + listRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings", + urlParamKeys: ["id"], + }); + addRealmRoleMappings = this.makeRequest({ + method: "POST", + path: "/{id}/role-mappings/realm", + urlParamKeys: ["id"], + payloadKey: "roles", + }); + listRealmRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/realm", + urlParamKeys: ["id"], + }); + delRealmRoleMappings = this.makeRequest({ + method: "DELETE", + path: "/{id}/role-mappings/realm", + urlParamKeys: ["id"], + payloadKey: "roles", + }); + listAvailableRealmRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/realm/available", + urlParamKeys: ["id"], + }); + // Get effective realm-level role mappings This will recurse all composite roles to get the result. + listCompositeRealmRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/realm/composite", + urlParamKeys: ["id"], + }); + /** + * Client role mappings + * https://www.keycloak.org/docs-api/11.0/rest-api/#_client_role_mappings_resource + */ + listClientRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/clients/{clientUniqueId}", + urlParamKeys: ["id", "clientUniqueId"], + }); + addClientRoleMappings = this.makeRequest({ + method: "POST", + path: "/{id}/role-mappings/clients/{clientUniqueId}", + urlParamKeys: ["id", "clientUniqueId"], + payloadKey: "roles", + }); + delClientRoleMappings = this.makeRequest({ + method: "DELETE", + path: "/{id}/role-mappings/clients/{clientUniqueId}", + urlParamKeys: ["id", "clientUniqueId"], + payloadKey: "roles", + }); + listAvailableClientRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/clients/{clientUniqueId}/available", + urlParamKeys: ["id", "clientUniqueId"], + }); + listCompositeClientRoleMappings = this.makeRequest({ + method: "GET", + path: "/{id}/role-mappings/clients/{clientUniqueId}/composite", + urlParamKeys: ["id", "clientUniqueId"], + }); + /** + * Send a update account email to the user + * an email contains a link the user can click to perform a set of required actions. + */ + executeActionsEmail = this.makeRequest({ + method: "PUT", + path: "/{id}/execute-actions-email", + urlParamKeys: ["id"], + payloadKey: "actions", + queryParamKeys: ["lifespan", "redirectUri", "clientId"], + keyTransform: { + clientId: "client_id", + redirectUri: "redirect_uri", + }, + }); + /** + * Group + */ + listGroups = this.makeRequest({ + method: "GET", + path: "/{id}/groups", + urlParamKeys: ["id"], + }); + addToGroup = this.makeRequest({ + method: "PUT", + path: "/{id}/groups/{groupId}", + urlParamKeys: ["id", "groupId"], + }); + delFromGroup = this.makeRequest({ + method: "DELETE", + path: "/{id}/groups/{groupId}", + urlParamKeys: ["id", "groupId"], + }); + countGroups = this.makeRequest({ + method: "GET", + path: "/{id}/groups/count", + urlParamKeys: ["id"], + }); + /** + * Federated Identity + */ + listFederatedIdentities = this.makeRequest({ + method: "GET", + path: "/{id}/federated-identity", + urlParamKeys: ["id"], + }); + addToFederatedIdentity = this.makeRequest({ + method: "POST", + path: "/{id}/federated-identity/{federatedIdentityId}", + urlParamKeys: ["id", "federatedIdentityId"], + payloadKey: "federatedIdentity", + }); + delFromFederatedIdentity = this.makeRequest({ + method: "DELETE", + path: "/{id}/federated-identity/{federatedIdentityId}", + urlParamKeys: ["id", "federatedIdentityId"], + }); + /** + * remove totp + */ + removeTotp = this.makeRequest({ + method: "PUT", + path: "/{id}/remove-totp", + urlParamKeys: ["id"], + }); + /** + * reset password + */ + resetPassword = this.makeRequest({ + method: "PUT", + path: "/{id}/reset-password", + urlParamKeys: ["id"], + payloadKey: "credential", + }); + getUserStorageCredentialTypes = this.makeRequest({ + method: "GET", + path: "/{id}/configured-user-storage-credential-types", + urlParamKeys: ["id"], + }); + /** + * get user credentials + */ + getCredentials = this.makeRequest({ + method: "GET", + path: "/{id}/credentials", + urlParamKeys: ["id"], + }); + /** + * delete user credentials + */ + deleteCredential = this.makeRequest({ + method: "DELETE", + path: "/{id}/credentials/{credentialId}", + urlParamKeys: ["id", "credentialId"], + }); + /** + * update a credential label for a user + */ + updateCredentialLabel = this.makeUpdateRequest({ + method: "PUT", + path: "/{id}/credentials/{credentialId}/userLabel", + urlParamKeys: ["id", "credentialId"], + headers: { "content-type": "text/plain" }, + }); + // Move a credential to a position behind another credential + moveCredentialPositionDown = this.makeRequest({ + method: "POST", + path: "/{id}/credentials/{credentialId}/moveAfter/{newPreviousCredentialId}", + urlParamKeys: ["id", "credentialId", "newPreviousCredentialId"], + }); + // Move a credential to a first position in the credentials list of the user + moveCredentialPositionUp = this.makeRequest({ + method: "POST", + path: "/{id}/credentials/{credentialId}/moveToFirst", + urlParamKeys: ["id", "credentialId"], + }); + /** + * send verify email + */ + sendVerifyEmail = this.makeRequest({ + method: "PUT", + path: "/{id}/send-verify-email", + urlParamKeys: ["id"], + queryParamKeys: ["clientId", "redirectUri"], + keyTransform: { + clientId: "client_id", + redirectUri: "redirect_uri", + }, + }); + /** + * list user sessions + */ + listSessions = this.makeRequest({ + method: "GET", + path: "/{id}/sessions", + urlParamKeys: ["id"], + }); + /** + * list offline sessions associated with the user and client + */ + listOfflineSessions = this.makeRequest({ + method: "GET", + path: "/{id}/offline-sessions/{clientId}", + urlParamKeys: ["id", "clientId"], + }); + /** + * logout user from all sessions + */ + logout = this.makeRequest({ + method: "POST", + path: "/{id}/logout", + urlParamKeys: ["id"], + }); + /** + * list consents granted by the user + */ + listConsents = this.makeRequest({ + method: "GET", + path: "/{id}/consents", + urlParamKeys: ["id"], + }); + impersonation = this.makeUpdateRequest({ + method: "POST", + path: "/{id}/impersonation", + urlParamKeys: ["id"], + }); + /** + * revoke consent and offline tokens for particular client from user + */ + revokeConsent = this.makeRequest({ + method: "DELETE", + path: "/{id}/consents/{clientId}", + urlParamKeys: ["id", "clientId"], + }); + getUnmanagedAttributes = this.makeRequest({ + method: "GET", + path: "/{id}/unmanagedAttributes", + urlParamKeys: ["id"], + }); + constructor(client) { + super(client, { + path: "/admin/realms/{realm}/users", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/whoAmI.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/resources/whoAmI.d.ts new file mode 100644 index 00000000..ba0da457 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/whoAmI.d.ts @@ -0,0 +1,13 @@ +import type WhoAmIRepresentation from "../defs/whoAmIRepresentation.js"; +import type KeycloakAdminClient from "../index.js"; +import Resource from "./resource.js"; +export declare class WhoAmI extends Resource<{ + realm?: string; +}> { + constructor(client: KeycloakAdminClient); + find: (payload?: ({ + currentRealm: string; + } & { + realm?: string; + }) | undefined, options?: Pick) => Promise; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/resources/whoAmI.js b/node_modules/@keycloak/keycloak-admin-client/lib/resources/whoAmI.js new file mode 100644 index 00000000..959046ad --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/resources/whoAmI.js @@ -0,0 +1,17 @@ +import Resource from "./resource.js"; +export class WhoAmI extends Resource { + constructor(client) { + super(client, { + path: "/admin/{realm}/console", + getUrlParams: () => ({ + realm: client.realmName, + }), + getBaseUrl: () => client.baseUrl, + }); + } + find = this.makeRequest({ + method: "GET", + path: "/whoami", + queryParamKeys: ["currentRealm"], + }); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/utils/auth.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/utils/auth.d.ts new file mode 100644 index 00000000..ff65f9ed --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/utils/auth.d.ts @@ -0,0 +1,42 @@ +export type GrantTypes = "client_credentials" | "password" | "refresh_token"; +export interface Credentials { + username?: string; + password?: string; + grantType: GrantTypes; + clientId: string; + clientSecret?: string; + totp?: string; + offlineToken?: boolean; + refreshToken?: string; + scopes?: string[]; +} +export interface Settings { + realmName?: string; + baseUrl?: string; + scope?: string; + credentials: Credentials; + requestOptions?: RequestInit; +} +export interface TokenResponseRaw { + access_token: string; + expires_in: string; + refresh_expires_in: number; + refresh_token: string; + token_type: string; + not_before_policy: number; + session_state: string; + scope: string; + id_token?: string; +} +export interface TokenResponse { + accessToken: string; + expiresIn: string; + refreshExpiresIn: number; + refreshToken: string; + tokenType: string; + notBeforePolicy: number; + sessionState: string; + scope: string; + idToken?: string; +} +export declare const getToken: (settings: Settings) => Promise; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/utils/auth.js b/node_modules/@keycloak/keycloak-admin-client/lib/utils/auth.js new file mode 100644 index 00000000..823aca4c --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/utils/auth.js @@ -0,0 +1,54 @@ +import camelize from "camelize-ts"; +import { defaultBaseUrl, defaultRealm } from "./constants.js"; +import { fetchWithError } from "./fetchWithError.js"; +import { stringifyQueryParams } from "./stringifyQueryParams.js"; +// See: https://developer.mozilla.org/en-US/docs/Glossary/Base64 +const bytesToBase64 = (bytes) => btoa(Array.from(bytes, (byte) => String.fromCodePoint(byte)).join("")); +const toBase64 = (input) => bytesToBase64(new TextEncoder().encode(input)); +// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#encoding_for_rfc3986 +const encodeRFC3986URIComponent = (input) => encodeURIComponent(input).replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`); +// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent +// Specifically, the section on encoding `application/x-www-form-urlencoded`. +const encodeFormURIComponent = (data) => encodeRFC3986URIComponent(data).replaceAll("%20", "+"); +export const getToken = async (settings) => { + // Construct URL + const baseUrl = settings.baseUrl || defaultBaseUrl; + const realmName = settings.realmName || defaultRealm; + const url = `${baseUrl}/realms/${realmName}/protocol/openid-connect/token`; + // Prepare credentials for openid-connect token request + // ref: http://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint + const credentials = settings.credentials || {}; + const payload = stringifyQueryParams({ + username: credentials.username, + password: credentials.password, + grant_type: credentials.grantType, + client_id: credentials.clientId, + totp: credentials.totp, + ...(credentials.offlineToken ? { scope: "offline_access" } : {}), + ...(credentials.scopes ? { scope: credentials.scopes.join(" ") } : {}), + ...(credentials.refreshToken + ? { + refresh_token: credentials.refreshToken, + client_secret: credentials.clientSecret, + } + : {}), + }); + const options = settings.requestOptions ?? {}; + const headers = new Headers(options.headers); + if (credentials.clientSecret) { + // See: https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1 + const username = encodeFormURIComponent(credentials.clientId); + const password = encodeFormURIComponent(credentials.clientSecret); + // See: https://datatracker.ietf.org/doc/html/rfc2617#section-2 + headers.set("authorization", `Basic ${toBase64(`${username}:${password}`)}`); + } + headers.set("content-type", "application/x-www-form-urlencoded"); + const response = await fetchWithError(url, { + ...options, + method: "POST", + headers, + body: payload, + }); + const data = (await response.json()); + return camelize(data); +}; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/utils/constants.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/utils/constants.d.ts new file mode 100644 index 00000000..51d3f9a6 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/utils/constants.d.ts @@ -0,0 +1,2 @@ +export declare const defaultBaseUrl = "http://127.0.0.1:8180"; +export declare const defaultRealm = "master"; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/utils/constants.js b/node_modules/@keycloak/keycloak-admin-client/lib/utils/constants.js new file mode 100644 index 00000000..eaee4ffa --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/utils/constants.js @@ -0,0 +1,2 @@ +export const defaultBaseUrl = "http://127.0.0.1:8180"; +export const defaultRealm = "master"; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/utils/fetchWithError.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/utils/fetchWithError.d.ts new file mode 100644 index 00000000..04554d69 --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/utils/fetchWithError.d.ts @@ -0,0 +1,11 @@ +export type NetworkErrorOptions = { + response: Response; + responseData: unknown; +}; +export declare class NetworkError extends Error { + response: Response; + responseData: unknown; + constructor(message: string, options: NetworkErrorOptions); +} +export declare function fetchWithError(input: Request | string | URL, init?: RequestInit): Promise; +export declare function parseResponse(response: Response): Promise; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/utils/fetchWithError.js b/node_modules/@keycloak/keycloak-admin-client/lib/utils/fetchWithError.js new file mode 100644 index 00000000..138b81bb --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/utils/fetchWithError.js @@ -0,0 +1,46 @@ +const ERROR_FIELDS = ["error", "errorMessage"]; +export class NetworkError extends Error { + response; + responseData; + constructor(message, options) { + super(message); + this.response = options.response; + this.responseData = options.responseData; + } +} +export async function fetchWithError(input, init) { + const response = await fetch(input, init); + if (!response.ok) { + const responseData = await parseResponse(response); + const message = getErrorMessage(responseData); + throw new NetworkError(message, { + response, + responseData, + }); + } + return response; +} +export async function parseResponse(response) { + if (!response.body) { + return ""; + } + const data = await response.text(); + try { + return JSON.parse(data); + } + catch { + return data; + } +} +function getErrorMessage(data) { + if (typeof data !== "object" || data === null) { + return "Unable to determine error message."; + } + for (const key of ERROR_FIELDS) { + const value = data[key]; + if (typeof value === "string") { + return value; + } + } + return "Network response was not OK."; +} diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/utils/stringifyQueryParams.d.ts b/node_modules/@keycloak/keycloak-admin-client/lib/utils/stringifyQueryParams.d.ts new file mode 100644 index 00000000..3690fd1f --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/utils/stringifyQueryParams.d.ts @@ -0,0 +1 @@ +export declare function stringifyQueryParams(params: Record): string; diff --git a/node_modules/@keycloak/keycloak-admin-client/lib/utils/stringifyQueryParams.js b/node_modules/@keycloak/keycloak-admin-client/lib/utils/stringifyQueryParams.js new file mode 100644 index 00000000..25c0f15e --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/lib/utils/stringifyQueryParams.js @@ -0,0 +1,25 @@ +export function stringifyQueryParams(params) { + const searchParams = new URLSearchParams(); + for (const [key, value] of Object.entries(params)) { + // Ignore undefined and null values. + if (value === undefined || value === null) { + continue; + } + // Ignore empty strings. + if (typeof value === "string" && value.length === 0) { + continue; + } + // Ignore empty arrays. + if (Array.isArray(value) && value.length === 0) { + continue; + } + // Append each entry of an array as a separate parameter, or the value itself otherwise. + if (Array.isArray(value)) { + value.forEach((item) => searchParams.append(key, item.toString())); + } + else { + searchParams.append(key, value.toString()); + } + } + return searchParams.toString(); +} diff --git a/node_modules/@keycloak/keycloak-admin-client/package.json b/node_modules/@keycloak/keycloak-admin-client/package.json new file mode 100644 index 00000000..886daadc --- /dev/null +++ b/node_modules/@keycloak/keycloak-admin-client/package.json @@ -0,0 +1,67 @@ +{ + "name": "@keycloak/keycloak-admin-client", + "version": "26.2.2", + "description": "A client to interact with Keycloak's Administration API", + "type": "module", + "main": "lib/index.js", + "files": [ + "lib" + ], + "types": "lib/index.d.ts", + "engines": { + "node": ">=18" + }, + "publishConfig": { + "access": "public" + }, + "wireit": { + "build": { + "command": "tsc --pretty", + "files": [ + "src", + "tsconfig.json" + ], + "output": [ + "lib" + ] + }, + "lint": { + "command": "eslint ." + }, + "test": { + "command": "TS_NODE_PROJECT=tsconfig.test.json mocha --recursive \"test/**/*.spec.ts\" --timeout 10000" + } + }, + "dependencies": { + "camelize-ts": "^3.0.0", + "url-join": "^5.0.0", + "url-template": "^3.1.1" + }, + "devDependencies": { + "@faker-js/faker": "^9.6.0", + "@types/chai": "^5.2.1", + "@types/lodash-es": "^4.17.12", + "@types/mocha": "^10.0.10", + "@types/node": "^22.14.0", + "chai": "^5.2.0", + "lodash-es": "^4.17.21", + "mocha": "^11.1.0", + "ts-node": "^10.9.2" + }, + "author": { + "name": "Red Hat, Inc.", + "url": "https://www.keycloak.org/" + }, + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/keycloak/keycloak.git", + "directory": "js/libs/keycloak-admin-client" + }, + "homepage": "https://www.keycloak.org/", + "scripts": { + "build": "wireit", + "lint": "wireit", + "test": "wireit" + } +} \ No newline at end of file diff --git a/node_modules/camelize-ts/README.md b/node_modules/camelize-ts/README.md new file mode 100644 index 00000000..c434c79a --- /dev/null +++ b/node_modules/camelize-ts/README.md @@ -0,0 +1,136 @@ +camelize-ts +=== +[![CI](https://github.com/kbrabrand/camelize-ts/actions/workflows/main.yml/badge.svg)](https://github.com/kbrabrand/camelize-ts/actions/workflows/main.yml) + +A typescript typed camelCase function that recursively camel cases a snake cased or pascal cased object structure. It camel cases a simple string too, if you need that. + +`camelize-ts` is [`snakify-ts`](https://www.npmjs.com/package/snakify-ts)’ twin 👯. + +## Why do this again? +This has obviously been done before, and the "new" thing with this pacakge is not camel casing itself but the fact that it is a generic that, given the form of the input data structure, will provide you with typing for the returned object structure so that it fits with other types. + +As an example I've been using it to camelize PostgreSQL rows (returned with snake case) before passing them to other functions in our GraphQL server (using camel cased property names). + +## Example +```ts +import camelize from 'camelize-ts' + +// Expects camel case +function nameIt({ + firstName, + lastName +}: { + id: number, + firstName: string, + lastName: string, + roles: string[] +}) { return `${firstName} ${lastName}` } + +// camel case snake_cased stuff from postgres +const camelizedUser = camelize({ + id: 1, + first_name: 'Grim', + last_name: 'Reaper', + roles: ['user', 'admin'] +}) + +console.log(JSON.stringify(camelizedUser, null, 2)) +console.log(nameIt(camelizedUser) +``` + +output: + +```sh +{ + "id": 1, + "firstName": "Grim", + "lastName": "Reaper", + "roles": [ + "user", + "admin" + ] +} + +Grim Reaper +``` + +It also converts pascal cased object fields to camel case. + +```ts +import camelize from 'camelize-ts' + +const camelizedUser = camelize({ + Id: 1, + first_name: 'Grim', + last_name: 'Reaper', + greetings: { + Morning: 'Good morning!', + Night: 'Good night!' + }, + roles: ['user', 'admin'], + UpdatedAt: '2000-01-01T00:00:00.000Z' +}) + +console.log(JSON.stringify(camelizedUser, null, 2)) +``` + +output: + +```sh +{ + "id": 1, + "firstName": "Grim", + "lastName": "Reaper", + "greetings": { + "morning": "Good morning!", + "night": "Good night!" + }, + "roles": [ + "user", + "admin" + ], + "updatedAt": "2000-01-01T00:00:00.000Z" +} +``` + + +### Shallow option +By default camelize will traverse to the bottom of the object/array structure you pass. If you want to perform a shallow camelize, touching only the top level of the value you can pass true for the `shallow` option (second argument). + +### Type inference +You don't need to pass a type to `camelize` since it uses argument inference to find the type to convert. But if you need to, you can pass a type like this: + +```ts +camelize< + // type of value to camelize + { first_name: string }, + + // whether or not to perform shallow camelization + true +>( + // value to camelize, type must match the specified type + value, + + // shallow, must match what's set as the second type argument above (after the type) + true +) +``` + +#### Type conversion +If you need to convert just a type, you can use the `Camelize` generic type to do this: + +```ts +import { Camelize } from 'camelize-ts' + +type MySnakePerson = { first_name: string } +type MyCamelPerson = Camelize +``` + +## Running tests +```sh +npm run test // one time/CI +npm run test:watch // on each file change +``` + +## Licence +MIT diff --git a/node_modules/camelize-ts/dist/index.d.ts b/node_modules/camelize-ts/dist/index.d.ts new file mode 100644 index 00000000..7d15ebf8 --- /dev/null +++ b/node_modules/camelize-ts/dist/index.d.ts @@ -0,0 +1,15 @@ +declare type CamelCase = S extends `${infer P1}_${infer P2}${infer P3}` ? `${P1}${Uppercase}${CamelCase}` : S; +declare type CamelizeObject = { + [K in keyof T as Uncapitalize>]: T[K] extends Date ? T[K] : T[K] extends RegExp ? T[K] : T[K] extends Array ? U extends ({} | undefined) ? Array> : T[K] : T[K] extends ({} | undefined) ? S extends true ? T[K] : CamelizeObject : T[K]; +}; +export declare type Camelize = T extends Array<(infer U)> ? Array> : CamelizeObject; +export default function camelize( +/** + * Value to be camelized + */ +obj: T, +/** + * If true, only the top level keys of the obj will be camel cased + */ +shallow?: S): T extends String ? string : Camelize; +export {}; diff --git a/node_modules/camelize-ts/dist/index.js b/node_modules/camelize-ts/dist/index.js new file mode 100644 index 00000000..b8ec9e33 --- /dev/null +++ b/node_modules/camelize-ts/dist/index.js @@ -0,0 +1,38 @@ +function camelCase(str) { + return str.replace(/[_.-](\w|$)/g, function (_, x) { + return x.toUpperCase(); + }); +} +function walk(obj, shallow = false) { + if (!obj || typeof obj !== "object") + return obj; + if (obj instanceof Date || obj instanceof RegExp) + return obj; + if (Array.isArray(obj)) + return obj.map(v => { + if (!shallow) { + return walk(v); + } + if (typeof v === 'object') + return walk(v, shallow); + return v; + }); + return Object.keys(obj).reduce((res, key) => { + const camel = camelCase(key); + const uncapitalized = camel.charAt(0).toLowerCase() + camel.slice(1); + res[uncapitalized] = shallow ? obj[key] : walk(obj[key]); + return res; + }, {}); +} +export default function camelize( +/** + * Value to be camelized + */ +obj, +/** + * If true, only the top level keys of the obj will be camel cased + */ +shallow) { + return typeof obj === "string" ? camelCase(obj) : walk(obj, shallow); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/camelize-ts/dist/index.js.map b/node_modules/camelize-ts/dist/index.js.map new file mode 100644 index 00000000..5714adc3 --- /dev/null +++ b/node_modules/camelize-ts/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAyBA,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC,EAAE,CAAC;QAC7C,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK;IAChC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IAChD,IAAI,GAAG,YAAY,IAAI,IAAI,GAAG,YAAY,MAAM;QAAE,OAAO,GAAG,CAAC;IAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACzC,IAAI,CAAC,OAAO,EAAE;gBAAE,OAAO,IAAI,CAAC,CAAC,CAAC,CAAA;aAAE;YAChC,IAAI,OAAO,CAAC,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;YAClD,OAAO,CAAC,CAAA;QACV,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC1C,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACrE,GAAG,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACzD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ;AAC9B;;GAEG;AACH,GAAM;AAEN;;GAEG;AACH,OAAW;IAEX,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACvE,CAAC","sourcesContent":["type CamelCase =\n S extends `${infer P1}_${infer P2}${infer P3}`\n ? `${P1}${Uppercase}${CamelCase}`\n : S;\n\ntype CamelizeObject = {\n [K in keyof T as Uncapitalize>]:\n T[K] extends Date ? T[K] :\n T[K] extends RegExp ? T[K] :\n T[K] extends Array\n ? U extends ({} | undefined)\n ? Array>\n : T[K]\n : T[K] extends ({} | undefined)\n ? S extends true\n ? T[K]\n : CamelizeObject\n : T[K]\n};\n\nexport type Camelize =\n T extends Array<(infer U)>\n ? Array>\n : CamelizeObject;\n\nfunction camelCase(str: string) {\n return str.replace(/[_.-](\\w|$)/g, function (_, x) {\n return x.toUpperCase();\n });\n}\n\nfunction walk(obj, shallow = false): any {\n if (!obj || typeof obj !== \"object\") return obj;\n if (obj instanceof Date || obj instanceof RegExp) return obj;\n if (Array.isArray(obj)) return obj.map(v => {\n if (!shallow) { return walk(v) }\n if (typeof v === 'object') return walk(v, shallow)\n return v\n })\n\n return Object.keys(obj).reduce((res, key) => {\n const camel = camelCase(key);\n const uncapitalized = camel.charAt(0).toLowerCase() + camel.slice(1);\n res[uncapitalized] = shallow ? obj[key] : walk(obj[key]);\n return res;\n }, {});\n}\n\nexport default function camelize(\n /**\n * Value to be camelized\n */\n obj: T,\n\n /**\n * If true, only the top level keys of the obj will be camel cased\n */\n shallow?: S\n): T extends String ? string : Camelize {\n return typeof obj === \"string\" ? camelCase(obj) : walk(obj, shallow);\n}\n"]} \ No newline at end of file diff --git a/node_modules/camelize-ts/package.json b/node_modules/camelize-ts/package.json new file mode 100644 index 00000000..092b0617 --- /dev/null +++ b/node_modules/camelize-ts/package.json @@ -0,0 +1,60 @@ +{ + "name": "camelize-ts", + "version": "3.0.0", + "description": "Recursive camel casing of object property names with proper typing", + "type": "module", + "main": "./dist/index.js", + "exports": "./dist/index.js", + "types": "./dist/index.d.ts", + "sideEffects": false, + "files": [ + "dist" + ], + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "scripts": { + "test": "jest", + "test:coverage": "jest --coverage", + "test:watch": "jest --watch --verbose", + "build": "tsc", + "prepublishOnly": "npm run build" + }, + "repository": "kbrabrand/camelize-ts", + "author": { + "name": "Kristoffer Brabrand", + "email": "kristoffer@brabrand.no", + "url": "https://github.com/kbrabrand" + }, + "license": "MIT", + "keywords": [ + "camel-case", + "json", + "transform", + "typescript" + ], + "devDependencies": { + "@types/jest": "^27.4.0", + "jest": "^27.4.7", + "ts-jest": "^27.1.3", + "typescript": "^4.5.5" + }, + "jest": { + "collectCoverageFrom": [ + "./*" + ], + "transform": { + "^.+\\.tsx?$": "ts-jest" + }, + "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", + "moduleFileExtensions": [ + "ts", + "tsx", + "js", + "jsx", + "json", + "node" + ], + "clearMocks": true + } +} diff --git a/node_modules/url-template/LICENSE b/node_modules/url-template/LICENSE new file mode 100644 index 00000000..cc868f43 --- /dev/null +++ b/node_modules/url-template/LICENSE @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2012-2014, Bram Stein + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/url-template/README.md b/node_modules/url-template/README.md new file mode 100644 index 00000000..84aa67a2 --- /dev/null +++ b/node_modules/url-template/README.md @@ -0,0 +1,33 @@ +## A JavaScript URI template implementation + +This is a simple URI template implementation following the [RFC 6570 URI Template specification](http://tools.ietf.org/html/rfc6570). The implementation supports all levels defined in the specification and is extensively tested. + +## Installation + +For use with Node.js or build tools you can install it through npm: + +```sh +$ npm install url-template +``` + +If you want to use it directly in a browser use a CDN like [Skypack](https://www.skypack.dev/view/url-template). + +## Example + +```js +import { parseTemplate } from 'url-template'; + +const emailUrlTemplate = parseTemplate('/{email}/{folder}/{id}'); +const emailUrl = emailUrlTemplate.expand({ + email: 'user@domain', + folder: 'test', + id: 42 +}); + +console.log(emailUrl); +// Returns '/user@domain/test/42' +``` + +## A note on error handling and reporting + +The RFC states that errors in the templates could optionally be handled and reported to the user. This implementation takes a slightly different approach in that it tries to do a best effort template expansion and leaves erroneous expressions in the returned URI instead of throwing errors. So for example, the incorrect expression `{unclosed` will return `{unclosed` as output. The leaves incorrect URLs to be handled by your URL library of choice. diff --git a/node_modules/url-template/lib/url-template.d.ts b/node_modules/url-template/lib/url-template.d.ts new file mode 100644 index 00000000..8a9b227f --- /dev/null +++ b/node_modules/url-template/lib/url-template.d.ts @@ -0,0 +1,7 @@ +export type PrimitiveValue = string | number | boolean | null; + +export interface Template { + expand(context: Record>): string; +} + +export function parseTemplate(template: string): Template; diff --git a/node_modules/url-template/lib/url-template.js b/node_modules/url-template/lib/url-template.js new file mode 100644 index 00000000..92c234b3 --- /dev/null +++ b/node_modules/url-template/lib/url-template.js @@ -0,0 +1,135 @@ +function encodeReserved(str) { + return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) { + if (!/%[0-9A-Fa-f]/.test(part)) { + part = encodeURI(part).replace(/%5B/g, '[').replace(/%5D/g, ']'); + } + return part; + }).join(''); +} + +function encodeUnreserved(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase(); + }); +} + +function encodeValue(operator, value, key) { + value = (operator === '+' || operator === '#') ? encodeReserved(value) : encodeUnreserved(value); + + if (key) { + return encodeUnreserved(key) + '=' + value; + } else { + return value; + } +} + +function isDefined(value) { + return value !== undefined && value !== null; +} + +function isKeyOperator(operator) { + return operator === ';' || operator === '&' || operator === '?'; +} + +function getValues(context, operator, key, modifier) { + var value = context[key], + result = []; + + if (isDefined(value) && value !== '') { + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + value = value.toString(); + + if (modifier && modifier !== '*') { + value = value.substring(0, parseInt(modifier, 10)); + } + + result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null)); + } else { + if (modifier === '*') { + if (Array.isArray(value)) { + value.filter(isDefined).forEach(function (value) { + result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null)); + }); + } else { + Object.keys(value).forEach(function (k) { + if (isDefined(value[k])) { + result.push(encodeValue(operator, value[k], k)); + } + }); + } + } else { + var tmp = []; + + if (Array.isArray(value)) { + value.filter(isDefined).forEach(function (value) { + tmp.push(encodeValue(operator, value)); + }); + } else { + Object.keys(value).forEach(function (k) { + if (isDefined(value[k])) { + tmp.push(encodeUnreserved(k)); + tmp.push(encodeValue(operator, value[k].toString())); + } + }); + } + + if (isKeyOperator(operator)) { + result.push(encodeUnreserved(key) + '=' + tmp.join(',')); + } else if (tmp.length !== 0) { + result.push(tmp.join(',')); + } + } + } + } else { + if (operator === ';') { + if (isDefined(value)) { + result.push(encodeUnreserved(key)); + } + } else if (value === '' && (operator === '&' || operator === '?')) { + result.push(encodeUnreserved(key) + '='); + } else if (value === '') { + result.push(''); + } + } + return result; +} + +export function parseTemplate(template) { + var operators = ['+', '#', '.', '/', ';', '?', '&']; + + return { + expand: function (context) { + return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) { + if (expression) { + var operator = null, + values = []; + + if (operators.indexOf(expression.charAt(0)) !== -1) { + operator = expression.charAt(0); + expression = expression.substr(1); + } + + expression.split(/,/g).forEach(function (variable) { + var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); + values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3])); + }); + + if (operator && operator !== '+') { + var separator = ','; + + if (operator === '?') { + separator = '&'; + } else if (operator !== '#') { + separator = operator; + } + return (values.length !== 0 ? operator : '') + values.join(separator); + } else { + return values.join(','); + } + } else { + return encodeReserved(literal); + } + }); + } + }; +} diff --git a/node_modules/url-template/package.json b/node_modules/url-template/package.json new file mode 100644 index 00000000..df600184 --- /dev/null +++ b/node_modules/url-template/package.json @@ -0,0 +1,38 @@ +{ + "name": "url-template", + "version": "3.1.1", + "description": "A URI template implementation (RFC 6570 compliant)", + "author": "Bram Stein (https://www.bramstein.com)", + "keywords": [ + "uri-template", + "uri template", + "uri", + "url", + "rfc 6570", + "url template", + "url-template" + ], + "devDependencies": { + "chai": "^4.3.6", + "mocha": "^10.0.0" + }, + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "git://github.com/bramstein/url-template.git" + }, + "type": "module", + "main": "./lib/url-template.js", + "exports": "./lib/url-template.js", + "types": "./lib/url-template.d.ts", + "sideEffects": false, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "scripts": { + "test": "node --experimental-json-modules node_modules/mocha/bin/mocha --reporter spec" + }, + "files": [ + "lib" + ] +} diff --git a/package-lock.json b/package-lock.json index d9c9a12c..503a8d07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@fullcalendar/react": "^6.1.15", "@hookform/resolvers": "^3.9.1", + "@keycloak/keycloak-admin-client": "^26.2.2", "@nextcloud/files": "^2.1.0", "@prisma/client": "^6.4.1", "@radix-ui/react-accordion": "^1.2.2", @@ -1280,6 +1281,20 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@keycloak/keycloak-admin-client": { + "version": "26.2.2", + "resolved": "https://registry.npmjs.org/@keycloak/keycloak-admin-client/-/keycloak-admin-client-26.2.2.tgz", + "integrity": "sha512-H0U3jjkXRHR0zU9xVcv5+GzWpDCAEab4NHKCbilVZSjrSLzqbGLMTEiGAo81NpHilseTiFpzEkz2qFm6/Hm0BA==", + "license": "Apache-2.0", + "dependencies": { + "camelize-ts": "^3.0.0", + "url-join": "^5.0.0", + "url-template": "^3.1.1" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@next/env": { "version": "15.3.1", "resolved": "https://registry.npmjs.org/@next/env/-/env-15.3.1.tgz", @@ -3868,6 +3883,15 @@ "node": ">= 6" } }, + "node_modules/camelize-ts": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelize-ts/-/camelize-ts-3.0.0.tgz", + "integrity": "sha512-cgRwKKavoDKLTjO4FQTs3dRBePZp/2Y9Xpud0FhuCOTE86M2cniKN4CCXgRnsyXNMmQMifVHcv6SPaMtTx6ofQ==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001692", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001692.tgz", @@ -7917,6 +7941,15 @@ "requires-port": "^1.0.0" } }, + "node_modules/url-template": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-3.1.1.tgz", + "integrity": "sha512-4oszoaEKE/mQOtAmdMWqIRHmkxWkUZMnXFnjQ5i01CuRSK3uluxcH1MRVVVWmhlnzT1SCDfKxxficm2G37qzCA==", + "license": "BSD-3-Clause", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/use-callback-ref": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz", diff --git a/package.json b/package.json index de7b3f4f..137adee2 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "@fullcalendar/react": "^6.1.15", "@hookform/resolvers": "^3.9.1", + "@keycloak/keycloak-admin-client": "^26.2.2", "@nextcloud/files": "^2.1.0", "@prisma/client": "^6.4.1", "@radix-ui/react-accordion": "^1.2.2", diff --git a/yarn.lock b/yarn.lock index 7e432d2a..5c9b248f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -65,6 +65,11 @@ resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.0.tgz" integrity sha512-mVwdUb5SRkPayVadIOI78K7aAnPamoeFR2bT5nszFUZ9P8UpK4ratOdYbZZXYSqPKMHfS1wdHCJk1P1EZpRdvw== +"@esbuild/linux-arm64@0.25.0": + version "0.25.0" + resolved "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.0.tgz" + integrity sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg== + "@floating-ui/core@^1.6.0": version "1.6.9" resolved "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.9.tgz" @@ -168,6 +173,30 @@ resolved "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.1.0.tgz" integrity sha512-HZ/JUmPwrJSoM4DIQPv/BfNh9yrOA8tlBbqbLz4JZ5uew2+o22Ik+tHQJcih7QJuSa0zo5coHTfD5J8inqj9DA== +"@img/sharp-libvips-linux-arm64@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.1.0.tgz" + integrity sha512-IVfGJa7gjChDET1dK9SekxFFdflarnUB8PwW8aGwEoF3oAsSDuNUTYS+SKDOyOJxQyDC1aPFMuRYLoDInyV9Ew== + +"@img/sharp-libvips-linuxmusl-arm64@1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.1.0.tgz" + integrity sha512-jYZdG+whg0MDK+q2COKbYidaqW/WTz0cc1E+tMAusiDygrM4ypmSCjOJPmFTvHHJ8j/6cAGyeDWZOsK06tP33w== + +"@img/sharp-linux-arm64@0.34.1": + version "0.34.1" + resolved "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.1.tgz" + integrity sha512-kX2c+vbvaXC6vly1RDf/IWNXxrlxLNpBVWkdpRq5Ka7OOKj6nr66etKy2IENf6FtOgklkg9ZdGpEu9kwdlcwOQ== + optionalDependencies: + "@img/sharp-libvips-linux-arm64" "1.1.0" + +"@img/sharp-linuxmusl-arm64@0.34.1": + version "0.34.1" + resolved "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.1.tgz" + integrity sha512-DfvyxzHxw4WGdPiTF0SOHnm11Xv4aQexvqhRDAoD00MzHekAj9a/jADXeXYCDFH/DzYruwHbXU7uz+H+nWmSOQ== + optionalDependencies: + "@img/sharp-libvips-linuxmusl-arm64" "1.1.0" + "@ioredis/commands@^1.1.1": version "1.2.0" resolved "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz" @@ -217,6 +246,15 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@keycloak/keycloak-admin-client@^26.2.2": + version "26.2.2" + resolved "https://registry.npmjs.org/@keycloak/keycloak-admin-client/-/keycloak-admin-client-26.2.2.tgz" + integrity sha512-H0U3jjkXRHR0zU9xVcv5+GzWpDCAEab4NHKCbilVZSjrSLzqbGLMTEiGAo81NpHilseTiFpzEkz2qFm6/Hm0BA== + dependencies: + camelize-ts "^3.0.0" + url-join "^5.0.0" + url-template "^3.1.1" + "@next/env@15.3.1": version "15.3.1" resolved "https://registry.npmjs.org/@next/env/-/env-15.3.1.tgz" @@ -227,6 +265,16 @@ resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.3.1.tgz" integrity sha512-hjDw4f4/nla+6wysBL07z52Gs55Gttp5Bsk5/8AncQLJoisvTBP0pRIBK/B16/KqQyH+uN4Ww8KkcAqJODYH3w== +"@next/swc-linux-arm64-gnu@15.3.1": + version "15.3.1" + resolved "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.3.1.tgz" + integrity sha512-wBQ+jGUI3N0QZyWmmvRHjXjTWFy8o+zPFLSOyAyGFI94oJi+kK/LIZFJXeykvgXUk1NLDAEFDZw/NVINhdk9FQ== + +"@next/swc-linux-arm64-musl@15.3.1": + version "15.3.1" + resolved "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.3.1.tgz" + integrity sha512-IIxXEXRti/AulO9lWRHiCpUUR8AR/ZYLPALgiIg/9ENzMzLn3l0NSxVdva7R/VDcuSEBo0eGVCe3evSIHNz0Hg== + "@nextcloud/files@^2.1.0": version "2.1.0" resolved "https://registry.npmjs.org/@nextcloud/files/-/files-2.1.0.tgz" @@ -1398,6 +1446,11 @@ camelcase-css@^2.0.1: resolved "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz" integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA== +camelize-ts@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/camelize-ts/-/camelize-ts-3.0.0.tgz" + integrity sha512-cgRwKKavoDKLTjO4FQTs3dRBePZp/2Y9Xpud0FhuCOTE86M2cniKN4CCXgRnsyXNMmQMifVHcv6SPaMtTx6ofQ== + caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001646, caniuse-lite@^1.0.30001688: version "1.0.30001692" resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001692.tgz" @@ -3819,6 +3872,11 @@ url-parse@^1.5.10: querystringify "^2.1.1" requires-port "^1.0.0" +url-template@^3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/url-template/-/url-template-3.1.1.tgz" + integrity sha512-4oszoaEKE/mQOtAmdMWqIRHmkxWkUZMnXFnjQ5i01CuRSK3uluxcH1MRVVVWmhlnzT1SCDfKxxficm2G37qzCA== + use-callback-ref@^1.3.3: version "1.3.3" resolved "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz"