Table of Contents

Interface IKeycloakPolicyClient

Namespace
Keycloak.AuthServices.Sdk.Protection
Assembly
Keycloak.AuthServices.Sdk.dll

Must be used by the owner of the resource for whom the policy is being created.

public interface IKeycloakPolicyClient

Remarks

Methods

CreatePolicyAsync(string, string, Policy, CancellationToken)

Creates a policy

Task CreatePolicyAsync(string realm, string resourceId, Policy policy, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

resourceId string

The resource ID to create the policy for.

policy Policy

Policy representation

cancellationToken CancellationToken

Returns

Task

The created policy representation Policy

CreatePolicyWithResponseAsync(string, string, Policy, CancellationToken)

Creates a policy

Task<HttpResponseMessage> CreatePolicyWithResponseAsync(string realm, string resourceId, Policy policy, CancellationToken cancellationToken)

Parameters

realm string

Realm name (not ID).

resourceId string

The resource ID to create the policy for.

policy Policy

Policy representation

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

The HttpResponseMessage of the request

DeletePolicyAsync(string, string, CancellationToken)

Deletes a policy

Task DeletePolicyAsync(string realm, string policyId, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

policyId string

Policy ID.

cancellationToken CancellationToken

Returns

Task

Remarks

DeletePolicyWithResponseAsync(string, string, CancellationToken)

Deletes a policy

Task<HttpResponseMessage> DeletePolicyWithResponseAsync(string realm, string policyId, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

policyId string

Policy ID.

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

Remarks

GetPoliciesAsync(string, GetPoliciesRequestParameters?, CancellationToken)

Gets all Policies

Task<IEnumerable<Policy>> GetPoliciesAsync(string realm, GetPoliciesRequestParameters? parameters = null, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

parameters GetPoliciesRequestParameters
cancellationToken CancellationToken

Returns

Task<IEnumerable<Policy>>

A list of policy representations Policy

Remarks

GetPoliciesWithResponseAsync(string, GetPoliciesRequestParameters?, CancellationToken)

Gets all Policies

Task<HttpResponseMessage> GetPoliciesWithResponseAsync(string realm, GetPoliciesRequestParameters? parameters = null, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

parameters GetPoliciesRequestParameters
cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

The HttpResponseMessage of the request

Remarks

GetPolicyAsync(string, string, CancellationToken)

Get representation of a Policy

Task<Policy> GetPolicyAsync(string realm, string policyId, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

policyId string

Policy ID

cancellationToken CancellationToken

Returns

Task<Policy>

The policy representation Policy

GetPolicyWithResponseAsync(string, string, CancellationToken)

Gets a Policy

Task<HttpResponseMessage> GetPolicyWithResponseAsync(string realm, string policyId, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

policyId string

Policy ID

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

The HttpResponseMessage of the request

UpdatePolicyAsync(string, string, Policy, CancellationToken)

Updates a policy

Task UpdatePolicyAsync(string realm, string policyId, Policy policy, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

policyId string

Policy ID.

policy Policy

Policy object.

cancellationToken CancellationToken

Returns

Task

Remarks

UpdatePolicyWithResponseAsync(string, string, Policy, CancellationToken)

Updates a policy

Task<HttpResponseMessage> UpdatePolicyWithResponseAsync(string realm, string policyId, Policy policy, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

policyId string

Policy ID.

policy Policy

Policy object.

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

Remarks