ChangeUserPasswordAsync throws ArgumentException when called
When you try to update the password for an existing user that doesn't have any tags, an ArgumentException is thrown because it tries to add an empty tag.
Exception:
System.ArgumentException: tag is null or empty
at EasyNetQ.Management.Client.Model.UserInfo.AddTag(String tag)
at EasyNetQ.Management.Client.ManagementClient.ChangeUserPasswordAsync(String userName, String newPassword, CancellationToken cancellationToken)
The reason is that the following code doesn't remove empty entries:
https://github.com/EasyNetQ/EasyNetQ.Management.Client/blob/05d539354b6eea8c83c8dcf1133d86f5ec1619d4/Source/EasyNetQ.Management.Client/ManagementClient.cs#L603
This is a kind of critical, because you can't add tags that isn't one of the allowed ones when creating a user, and I don't want any of those system tags on the user.
I have the same issue, I can create users with empty or custom tags on RabbitMQ Management UI but I can't do it using this library. Is there a chance that this will be changed in near future?
I have met this problem too. Fortunatelly all pieces are public so i was able to reimplement method by myself as workaround.
private async Task<User> ChangeUserPasswordAsync(string userName, string newPassword, CancellationToken cancellationToken = default(CancellationToken))
{
var user = await Client.GetUserAsync(userName, cancellationToken).ConfigureAwait(false);
var tags = user.Tags.Split(',');
var userInfo = new UserInfo(userName, newPassword);
foreach (var tag in tags)
{
if (!string.IsNullOrEmpty(tag.Trim()))
{
userInfo.AddTag(tag.Trim());
}
}
return await Client.CreateUserAsync(userInfo, cancellationToken).ConfigureAwait(false);
}
`
https://www.nuget.org/packages/EasyNetQ.Management.Client/2.0.0-beta2