/// <summary> /// Change user's password. Clear-text password will be hashed using bcrypt /// before sending to server. /// </summary> /// <param name="policy">admin configuration parameters, pass in null for defaults</param> /// <param name="user">user name</param> /// <param name="password">user password in clear-text format</param> public void ChangePassword(AdminPolicy policy, string user, string password) { if (cluster.user == null) { throw new AerospikeException("Invalid user"); } string hash = AdminCommand.HashPassword(password); AdminCommand command = new AdminCommand(); byte[] userBytes = ByteUtil.StringToUtf8(user); if (Util.ByteArrayEquals(userBytes, cluster.user)) { // Change own password. command.ChangePassword(cluster, policy, userBytes, hash); } else { // Change other user's password by user admin. command.SetPassword(cluster, policy, userBytes, hash); } cluster.ChangePassword(userBytes, hash); }