/// <summary> /// Expects the persisted credential payload is a salted password hash and that the token is already lower cased /// </summary> /// <param name="other"></param> /// <returns></returns> internal bool Matches(PersistedCredential other) { if (this.userName.Length > 0 && this.password.Length > 0 && other != null) { if (other.TextToken.Equals(this.userName, StringComparison.OrdinalIgnoreCase)) { SaltPair salted = UserPasswordProviderFactory.Instance.Shaker.Salt(this.password); return(salted.SaltedPayload.Equals(other.Text)); } } return(false); }
/// <summary> /// Creates a username/password pair that is: lower case username, and salted password hash ready for comparing /// </summary> /// <returns></returns> internal UsernamePassword ToHistoryPair() { SaltPair salted = UserPasswordProviderFactory.Instance.Shaker.Salt(this.password); return(new UsernamePassword(this.userName.ToLowerInvariant(), salted.SaltedPayload)); }