From 0661af3fd41c51b69c2efcc5eb2e09caf9359627 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Fri, 5 Mar 2021 11:55:20 +0100 Subject: [PATCH] add delete for initial access (#143) --- src/resources/realms.ts | 8 ++++++++ test/realms.spec.ts | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/resources/realms.ts b/src/resources/realms.ts index c082ffa9..f4d6a1e3 100644 --- a/src/resources/realms.ts +++ b/src/resources/realms.ts @@ -114,6 +114,14 @@ export class Realms extends Resource { urlParamKeys: ['realm'], }); + public delClientsInitialAccess = this.makeRequest< + {realm: string, id: string}, void + >({ + method: 'DELETE', + path: '/{realm}/clients-initial-access/{id}', + urlParamKeys: ['realm', 'id'], + }); + /** * Remove a specific user session. */ diff --git a/test/realms.spec.ts b/test/realms.spec.ts index b773d52f..9f0f00e4 100644 --- a/test/realms.spec.ts +++ b/test/realms.spec.ts @@ -120,6 +120,18 @@ describe('Realms', () => { expect(initialAccess).to.be.ok; expect(initialAccess[0].count).to.be.eq(1); }); + + it('del client initial access', async () => { + const access = await kcAdminClient.realms.createClientsInitialAccess({realm: currentRealmName}, {count: 1, expiration: 0}); + expect((await kcAdminClient.realms.getClientsInitialAccess({realm: currentRealmName})).length).to.be.eq(2); + + await kcAdminClient.realms.delClientsInitialAccess({realm: currentRealmName, id: access.id!}); + + const initialAccess = await kcAdminClient.realms.getClientsInitialAccess({realm: currentRealmName}); + expect(initialAccess).to.be.ok; + expect(initialAccess[0].count).to.be.eq(1); + }); + }); describe('Realm Events', () => {