コード例 #1
0
 // 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;
 }
コード例 #2
0
 /// <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));
 }