bfa0c6e1ea
* initial version of the advanced tab * added registered nodes * added fine grain open id connect configuration * added open id connect compatibility section * added advanced section * added backend * fixed type * renamed 'advanced' to advancedtab to prevent strange add of '/index.js' by snowpack * fixed storybook stories * change '_' to '-' because '_' is also used * fix spacing buttons * stop passing the form * cypress test for advanced tab * more tests * saml section * changed to use NumberInput * added authetnication flow override * fixed merge error * updated text and added link to settings tab * fixed test * added filter on flows and better reset * added now mandetory error handler * added sorting * Revert "changed to use NumberInput" This reverts commit 7829f2656ae8fc8ed4a4a6b1c4b1961241a09d8e. * allow users to put empty string as value * already on detail page after save * fixed merge error
33 lines
781 B
TypeScript
33 lines
781 B
TypeScript
import KeycloakAdminClient from "keycloak-admin";
|
|
|
|
export default class AdminClient {
|
|
private client: KeycloakAdminClient;
|
|
constructor() {
|
|
this.client = new KeycloakAdminClient({
|
|
baseUrl: "http://localhost:8180/auth",
|
|
realmName: "master",
|
|
});
|
|
}
|
|
|
|
private async login() {
|
|
await this.client.auth({
|
|
username: "admin",
|
|
password: "admin",
|
|
grantType: "password",
|
|
clientId: "admin-cli",
|
|
});
|
|
}
|
|
|
|
async deleteRealm(realm: string) {
|
|
await this.login();
|
|
await this.client.realms.del({ realm });
|
|
}
|
|
|
|
async deleteClient(clientName: string) {
|
|
await this.login();
|
|
const client = (
|
|
await this.client.clients.find({ clientId: clientName })
|
|
)[0];
|
|
await this.client.clients.del({ id: client.id! });
|
|
}
|
|
}
|