public async Task DropAsync(string username, DropUserOptions options) { var uri = GetUserManagementUri(options.AuthenticationDomain, username); Logger.LogInformation($"Attempting to drop user with username {username} - {uri}"); try { // check user exists, will throw UserNotFoundException if not await GetAsync(username, GetUserOptions.Default); // remove user var result = await _client.DeleteAsync(uri, options.CancellationToken).ConfigureAwait(false); result.EnsureSuccessStatusCode(); } catch (UserNotFoundException) { Logger.LogError($"Unable to drop user with username {username} as it does not exist"); throw; } catch (Exception exception) { Logger.LogError(exception, $"Error trying to drop user with username {username} - {uri}"); throw; } }
public static Task DropAsync(this IUserManager userManager, string username, Action <DropUserOptions> configureOptions) { var options = new DropUserOptions(); configureOptions(options); return(userManager.DropAsync(username, options)); }