Interface IKeycloakUserClient
- Namespace
- Keycloak.AuthServices.Sdk.Admin
- Assembly
- Keycloak.AuthServices.Sdk.dll
User management
public interface IKeycloakUserClient
Methods
CreateUserAsync(string, UserRepresentation, CancellationToken)
Create a new user.
Task CreateUserAsync(string realm, UserRepresentation user, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
user
UserRepresentationUser representation.
cancellationToken
CancellationToken
Returns
Remarks
Username must be unique.
CreateUserWithResponseAsync(string, UserRepresentation, CancellationToken)
Create a new user.
Task<HttpResponseMessage> CreateUserWithResponseAsync(string realm, UserRepresentation user, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
user
UserRepresentationUser representation.
cancellationToken
CancellationToken
Returns
Remarks
Username must be unique.
DeleteUserAsync(string, string, CancellationToken)
Delete the given user.
Task DeleteUserAsync(string realm, string userId, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
cancellationToken
CancellationToken
Returns
DeleteUserWithResponseAsync(string, string, CancellationToken)
Delete the given user.
Task<HttpResponseMessage> DeleteUserWithResponseAsync(string realm, string userId, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
cancellationToken
CancellationToken
Returns
ExecuteActionsEmailAsync(string, string, ExecuteActionsEmailRequest, CancellationToken)
Execute actions email for the user.
Task ExecuteActionsEmailAsync(string realm, string userId, ExecuteActionsEmailRequest request, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
request
ExecuteActionsEmailRequestcancellationToken
CancellationToken
Returns
ExecuteActionsEmailWithResponseAsync(string, string, ExecuteActionsEmailRequest, CancellationToken)
Execute actions email for the user.
Task<HttpResponseMessage> ExecuteActionsEmailWithResponseAsync(string realm, string userId, ExecuteActionsEmailRequest request, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
request
ExecuteActionsEmailRequestcancellationToken
CancellationToken
Returns
GetUserAsync(string, string, bool, CancellationToken)
Get representation of a user.
Task<UserRepresentation> GetUserAsync(string realm, string userId, bool includeUserProfileMetadata = false, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
includeUserProfileMetadata
boolIndicates if the user profile metadata should be added to the response.
cancellationToken
CancellationToken
Returns
- Task<UserRepresentation>
The user representation.
GetUserGroupsAsync(string, string, GetUserGroupsRequestParameters?, CancellationToken)
Get a users's groups.
Task<IEnumerable<GroupRepresentation>> GetUserGroupsAsync(string realm, string userId, GetUserGroupsRequestParameters? parameters = null, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
parameters
GetUserGroupsRequestParametersOptional query parameters.
cancellationToken
CancellationToken
Returns
- Task<IEnumerable<GroupRepresentation>>
A stream of users, filtered according to query parameters.
GetUserGroupsWithResponseAsync(string, string, GetUserGroupsRequestParameters?, CancellationToken)
Get a users's groups.
Task<HttpResponseMessage> GetUserGroupsWithResponseAsync(string realm, string userId, GetUserGroupsRequestParameters? parameters = null, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
parameters
GetUserGroupsRequestParametersOptional query parameters.
cancellationToken
CancellationToken
Returns
- Task<HttpResponseMessage>
A stream of users, filtered according to query parameters.
GetUserWithResponseAsync(string, string, bool, CancellationToken)
Get representation of a user.
Task<HttpResponseMessage> GetUserWithResponseAsync(string realm, string userId, bool includeUserProfileMetadata = false, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
includeUserProfileMetadata
boolIndicates if the user profile metadata should be added to the response.
cancellationToken
CancellationToken
Returns
- Task<HttpResponseMessage>
The user representation.
GetUsersAsync(string, GetUsersRequestParameters?, CancellationToken)
Get a stream of users on the realm.
Task<IEnumerable<UserRepresentation>> GetUsersAsync(string realm, GetUsersRequestParameters? parameters = null, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
parameters
GetUsersRequestParametersOptional query parameters.
cancellationToken
CancellationToken
Returns
- Task<IEnumerable<UserRepresentation>>
A stream of users, filtered according to query parameters.
GetUsersWithResponseAsync(string, GetUsersRequestParameters?, CancellationToken)
Get a stream of users on the realm.
Task<HttpResponseMessage> GetUsersWithResponseAsync(string realm, GetUsersRequestParameters? parameters = null, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
parameters
GetUsersRequestParametersOptional query parameters.
cancellationToken
CancellationToken
Returns
- Task<HttpResponseMessage>
A stream of users, filtered according to query parameters.
JoinGroupAsync(string, string, string, CancellationToken)
Join a group
Task JoinGroupAsync(string realm, string userId, string groupId, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name(not ID).
userId
stringUser ID.
groupId
stringGroup ID.
cancellationToken
CancellationToken
Returns
JoinGroupWithResponseAsync(string, string, string, CancellationToken)
Join a group
Task<HttpResponseMessage> JoinGroupWithResponseAsync(string realm, string userId, string groupId, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name(not ID).
userId
stringUser ID.
groupId
stringGroup ID.
cancellationToken
CancellationToken
Returns
LeaveGroupAsync(string, string, string, CancellationToken)
Leave a group
Task LeaveGroupAsync(string realm, string userId, string groupId, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name(not ID).
userId
stringUser ID.
groupId
stringGroup ID.
cancellationToken
CancellationToken
Returns
LeaveGroupWithResponseAsync(string, string, string, CancellationToken)
Leave a group
Task<HttpResponseMessage> LeaveGroupWithResponseAsync(string realm, string userId, string groupId, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name(not ID).
userId
stringUser ID.
groupId
stringGroup ID.
cancellationToken
CancellationToken
Returns
SendVerifyEmailAsync(string, string, string?, string?, CancellationToken)
Send an email-verification email to the user.
Task SendVerifyEmailAsync(string realm, string userId, string? clientId = null, string? redirectUri = null, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
clientId
stringClient ID.
redirectUri
stringRedirect URI. The default for the redirect is the account client.
cancellationToken
CancellationToken
Returns
Remarks
An email contains a link the user can click to verify their email address.
SendVerifyEmailWithResponseAsync(string, string, string?, string?, CancellationToken)
Send an email-verification email to the user.
Task<HttpResponseMessage> SendVerifyEmailWithResponseAsync(string realm, string userId, string? clientId = null, string? redirectUri = null, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
clientId
stringClient ID.
redirectUri
stringRedirect URI. The default for the redirect is the account client.
cancellationToken
CancellationToken
Returns
Remarks
An email contains a link the user can click to verify their email address.
UpdateUserAsync(string, string, UserRepresentation, CancellationToken)
Update the user.
Task UpdateUserAsync(string realm, string userId, UserRepresentation user, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
user
UserRepresentationUser representation.
cancellationToken
CancellationToken
Returns
UpdateUserWithResponseAsync(string, string, UserRepresentation, CancellationToken)
Update the user.
Task<HttpResponseMessage> UpdateUserWithResponseAsync(string realm, string userId, UserRepresentation user, CancellationToken cancellationToken = default)
Parameters
realm
stringRealm name (not ID).
userId
stringUser ID.
user
UserRepresentationUser representation.
cancellationToken
CancellationToken