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
realmstringRealm name (not ID).
userUserRepresentationUser representation.
cancellationTokenCancellationToken
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
realmstringRealm name (not ID).
userUserRepresentationUser representation.
cancellationTokenCancellationToken
Returns
Remarks
Username must be unique.
DeleteCredentialAsync(string, string, string, CancellationToken)
Remove a credential for a user
Task DeleteCredentialAsync(string realm, string userId, string credentialId, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name(not ID).
userIdstringUser ID
credentialIdstringCredential ID
cancellationTokenCancellationToken
Returns
DeleteCredentialWithResponseAsync(string, string, string, CancellationToken)
Remove a credential for a user
Task<HttpResponseMessage> DeleteCredentialWithResponseAsync(string realm, string userId, string credentialId, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name(not ID).
userIdstringUser ID
credentialIdstringCredential ID
cancellationTokenCancellationToken
Returns
DeleteUserAsync(string, string, CancellationToken)
Delete the given user.
Task DeleteUserAsync(string realm, string userId, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name (not ID).
userIdstringUser ID.
cancellationTokenCancellationToken
Returns
DeleteUserWithResponseAsync(string, string, CancellationToken)
Delete the given user.
Task<HttpResponseMessage> DeleteUserWithResponseAsync(string realm, string userId, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name (not ID).
userIdstringUser ID.
cancellationTokenCancellationToken
Returns
ExecuteActionsEmailAsync(string, string, ExecuteActionsEmailRequest, CancellationToken)
Execute actions email for the user.
Task ExecuteActionsEmailAsync(string realm, string userId, ExecuteActionsEmailRequest request, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name (not ID).
userIdstringUser ID.
requestExecuteActionsEmailRequestcancellationTokenCancellationToken
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
realmstringRealm name (not ID).
userIdstringUser ID.
requestExecuteActionsEmailRequestcancellationTokenCancellationToken
Returns
GetCredentialsAsync(string, string, CancellationToken)
Get a user's credentials.
Task<IEnumerable<CredentialRepresentation>> GetCredentialsAsync(string realm, string userId, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name(not ID).
userIdstringUser ID
cancellationTokenCancellationToken
Returns
GetCredentialsWithResponseAsync(string, string, CancellationToken)
Get a user's credentials.
Task<HttpResponseMessage> GetCredentialsWithResponseAsync(string realm, string userId, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name(not ID).
userIdstringUser ID
cancellationTokenCancellationToken
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
realmstringRealm name (not ID).
userIdstringUser ID.
includeUserProfileMetadataboolIndicates if the user profile metadata should be added to the response.
cancellationTokenCancellationToken
Returns
- Task<UserRepresentation>
The user representation.
GetUserCountAsync(string, GetUserCountRequestParameters?, CancellationToken)
Get the integer amount of users on the realm that match the provided GetUserCountRequestParameters.
Task<int> GetUserCountAsync(string realm, GetUserCountRequestParameters? parameters = null, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name (not ID).
parametersGetUserCountRequestParametersOptional query parameters.
cancellationTokenCancellationToken
Returns
GetUserCountWithResponseAsync(string, GetUserCountRequestParameters?, CancellationToken)
Get the integer amount of users on the realm that match the provided GetUserCountRequestParameters.
Note that the response is not JSON, but simply the integer value as a string.
Task<HttpResponseMessage> GetUserCountWithResponseAsync(string realm, GetUserCountRequestParameters? parameters = null, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name (not ID).
parametersGetUserCountRequestParametersOptional query parameters.
cancellationTokenCancellationToken
Returns
- Task<HttpResponseMessage>
An integer amount of users
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
realmstringRealm name (not ID).
userIdstringUser ID.
parametersGetUserGroupsRequestParametersOptional query parameters.
cancellationTokenCancellationToken
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
realmstringRealm name (not ID).
userIdstringUser ID.
parametersGetUserGroupsRequestParametersOptional query parameters.
cancellationTokenCancellationToken
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
realmstringRealm name (not ID).
userIdstringUser ID.
includeUserProfileMetadataboolIndicates if the user profile metadata should be added to the response.
cancellationTokenCancellationToken
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
realmstringRealm name (not ID).
parametersGetUsersRequestParametersOptional query parameters.
cancellationTokenCancellationToken
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
realmstringRealm name (not ID).
parametersGetUsersRequestParametersOptional query parameters.
cancellationTokenCancellationToken
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
realmstringRealm name(not ID).
userIdstringUser ID.
groupIdstringGroup ID.
cancellationTokenCancellationToken
Returns
JoinGroupWithResponseAsync(string, string, string, CancellationToken)
Join a group
Task<HttpResponseMessage> JoinGroupWithResponseAsync(string realm, string userId, string groupId, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name(not ID).
userIdstringUser ID.
groupIdstringGroup ID.
cancellationTokenCancellationToken
Returns
LeaveGroupAsync(string, string, string, CancellationToken)
Leave a group
Task LeaveGroupAsync(string realm, string userId, string groupId, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name(not ID).
userIdstringUser ID.
groupIdstringGroup ID.
cancellationTokenCancellationToken
Returns
LeaveGroupWithResponseAsync(string, string, string, CancellationToken)
Leave a group
Task<HttpResponseMessage> LeaveGroupWithResponseAsync(string realm, string userId, string groupId, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name(not ID).
userIdstringUser ID.
groupIdstringGroup ID.
cancellationTokenCancellationToken
Returns
ResetPasswordAsync(string, string, CredentialRepresentation, CancellationToken)
Set up a new password for the user
Task ResetPasswordAsync(string realm, string userId, CredentialRepresentation credential, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name(not ID).
userIdstringUser ID.
credentialCredentialRepresentationCredential representation.
cancellationTokenCancellationToken
Returns
ResetPasswordWithResponseAsync(string, string, CredentialRepresentation, CancellationToken)
Set up a new password for the user
Task<HttpResponseMessage> ResetPasswordWithResponseAsync(string realm, string userId, CredentialRepresentation credential, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name(not ID).
userIdstringUser ID.
credentialCredentialRepresentationCredential representation.
cancellationTokenCancellationToken
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
realmstringRealm name (not ID).
userIdstringUser ID.
clientIdstringClient ID.
redirectUristringRedirect URI. The default for the redirect is the account client.
cancellationTokenCancellationToken
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
realmstringRealm name (not ID).
userIdstringUser ID.
clientIdstringClient ID.
redirectUristringRedirect URI. The default for the redirect is the account client.
cancellationTokenCancellationToken
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
realmstringRealm name (not ID).
userIdstringUser ID.
userUserRepresentationUser representation.
cancellationTokenCancellationToken
Returns
UpdateUserWithResponseAsync(string, string, UserRepresentation, CancellationToken)
Update the user.
Task<HttpResponseMessage> UpdateUserWithResponseAsync(string realm, string userId, UserRepresentation user, CancellationToken cancellationToken = default)
Parameters
realmstringRealm name (not ID).
userIdstringUser ID.
userUserRepresentationUser representation.
cancellationTokenCancellationToken