Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
add delete for initial access (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
edewit authored Mar 5, 2021
1 parent c563754 commit 0661af3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/resources/realms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
12 changes: 12 additions & 0 deletions test/realms.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 0661af3

Please sign in to comment.