Table of Contents

Interface IKeycloakGroupClient

Namespace
Keycloak.AuthServices.Sdk.Admin
Assembly
Keycloak.AuthServices.Sdk.dll

Group management

public interface IKeycloakGroupClient

Methods

CreateChildGroupAsync(string, string, GroupRepresentation, CancellationToken)

Set or create child.

Task CreateChildGroupAsync(string realm, string groupId, GroupRepresentation group, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

groupId string

Group ID.

group GroupRepresentation

Group representation.

cancellationToken CancellationToken

Returns

Task

Remarks

This will just set the parent if it exists. Create it and set the parent if the group doesn’t exist.

CreateChildGroupWithResponseAsync(string, string, GroupRepresentation, CancellationToken)

Set or create child.

Task<HttpResponseMessage> CreateChildGroupWithResponseAsync(string realm, string groupId, GroupRepresentation group, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

groupId string

Group ID.

group GroupRepresentation

Group representation.

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

Remarks

This will just set the parent if it exists. Create it and set the parent if the group doesn’t exist.

CreateGroupAsync(string, GroupRepresentation, CancellationToken)

Create or add a top level realm groupSet or create child.

Task CreateGroupAsync(string realm, GroupRepresentation group, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

group GroupRepresentation

Group representation.

cancellationToken CancellationToken

Returns

Task

Remarks

This will update the group and set the parent if it exists. Create it and set the parent if the group doesn’t exist.

CreateGroupWithResponseAsync(string, GroupRepresentation, CancellationToken)

Create or add a top level realm groupSet or create child.

Task<HttpResponseMessage> CreateGroupWithResponseAsync(string realm, GroupRepresentation group, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

group GroupRepresentation

Group representation.

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

Remarks

This will update the group and set the parent if it exists. Create it and set the parent if the group doesn’t exist.

DeleteGroupAsync(string, string, CancellationToken)

Delete a group. Note: the Keycloak documentation does not specify if this deletes subgroups.

Task DeleteGroupAsync(string realm, string groupId, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

groupId string

Group ID.

cancellationToken CancellationToken

Returns

Task

DeleteGroupWithResponseAsync(string, string, CancellationToken)

Delete a group. Note: the Keycloak documentation does not specify if this deletes subgroups.

Task<HttpResponseMessage> DeleteGroupWithResponseAsync(string realm, string groupId, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

groupId string

Group ID.

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

GetGroupAsync(string, string, CancellationToken)

Get representation of a Group.

Task<GroupRepresentation> GetGroupAsync(string realm, string groupId, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

groupId string

Group ID.

cancellationToken CancellationToken

Returns

Task<GroupRepresentation>

The group representation.

GetGroupWithResponseAsync(string, string, CancellationToken)

Get representation of a Group.

Task<HttpResponseMessage> GetGroupWithResponseAsync(string realm, string groupId, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

groupId string

Group ID.

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

The group representation.

GetGroupsAsync(string, GetGroupsRequestParameters?, CancellationToken)

Get group hierarchy. Only name and ids are returned.

Task<IEnumerable<GroupRepresentation>> GetGroupsAsync(string realm, GetGroupsRequestParameters? parameters = null, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

parameters GetGroupsRequestParameters

Optional query parameters.

cancellationToken CancellationToken

Returns

Task<IEnumerable<GroupRepresentation>>

A stream of groups, filtered according to query parameters.

GetGroupsWithResponseAsync(string, GetGroupsRequestParameters?, CancellationToken)

Get a collection of groups on the realm.

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

Parameters

realm string

Realm name (not ID).

parameters GetGroupsRequestParameters

Optional query parameters.

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

A stream of groups, filtered according to query parameters.

UpdateGroupAsync(string, string, GroupRepresentation, CancellationToken)

Update group, ignores subgroups.

Task UpdateGroupAsync(string realm, string groupId, GroupRepresentation group, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

groupId string

Group ID.

group GroupRepresentation

Group representation.

cancellationToken CancellationToken

Returns

Task

UpdateGroupWithResponseAsync(string, string, GroupRepresentation, CancellationToken)

Update group, ignores subgroups.

Task<HttpResponseMessage> UpdateGroupWithResponseAsync(string realm, string groupId, GroupRepresentation group, CancellationToken cancellationToken = default)

Parameters

realm string

Realm name (not ID).

groupId string

Group ID.

group GroupRepresentation

Group representation.

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>