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

added list policy providers endpoint #355

Merged
merged 1 commit into from Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/defs/policyProviderRepresentation.ts
@@ -0,0 +1,5 @@
export interface PolicyProviderRepresentation {
type?: string;
name?: string;
group?: string;
}
10 changes: 10 additions & 0 deletions src/resources/clients.ts
Expand Up @@ -16,6 +16,7 @@ import CertificateRepresentation from '../defs/certificateRepresentation';
import KeyStoreConfig from '../defs/keystoreConfig';
import ResourceServerRepresentation from '../defs/resourceServerRepresentation';
import ScopeRepresentation from '../defs/scopeRepresentation';
import {PolicyProviderRepresentation} from '../defs/policyProviderRepresentation';

export interface PaginatedQuery {
first?: number;
Expand Down Expand Up @@ -622,6 +623,15 @@ export class Clients extends Resource<{realm?: string}> {
urlParamKeys: ['id', 'policyId'],
});

public listPolicyProviders = this.makeRequest<
{id: string},
PolicyProviderRepresentation
>({
method: 'GET',
path: '/{id}/authz/resource-server/policy/providers',
urlParamKeys: ['id'],
});

public async createOrUpdatePolicy(payload: {
id: string;
policyName: string;
Expand Down
7 changes: 7 additions & 0 deletions test/clients.spec.ts
Expand Up @@ -1260,5 +1260,12 @@ describe('Clients', () => {
},
]);
});

it('list policy providers', async () => {
const result = await kcAdminClient.clients.listPolicyProviders({
id: currentClient.id!,
});
expect(result).to.be.ok;
});
});
});