// constructors /// <summary> /// Creates a new instance of MongoUser. /// </summary> /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <param name="isReadOnly">Whether the user has read-only access.</param> public MongoUser(string username, PasswordEvidence password, bool isReadOnly) { if (username == null) { throw new ArgumentNullException("username"); } if (password == null) { throw new ArgumentNullException("password"); } _username = username; _passwordHash = HashPassword(username, password); _isReadOnly = isReadOnly; }
/// <summary> /// Calculates the password hash. /// </summary> /// <param name="username">The username.</param> /// <param name="password">The password.</param> /// <returns>The password hash.</returns> public static string HashPassword(string username, PasswordEvidence password) { return(password.ComputeMongoCRPasswordDigest(username)); }