private bool VerifyPassword(string password, UserData userDetailsToVerify) { string hash; string salt; _passwordHashAlgorithm.Hash(password, out hash, out salt); return(_passwordHashAlgorithm.Verify(password, userDetailsToVerify.Hash, userDetailsToVerify.Salt)); }
private void AuthenticateWithPasswordHash(AuthenticationRequest authenticationRequest, UserData userData) { if (!_passwordHashAlgorithm.Verify(authenticationRequest.SuppliedPassword, userData.Hash, userData.Salt)) { if (_logFailedAuthenticationAttempts) { Log.Warning("Authentication Failed for {id}: {reason}", authenticationRequest.Id, "Invalid credentials supplied."); } authenticationRequest.Unauthorized(); return; } var principal = CreatePrincipal(userData); CachePassword(authenticationRequest.Name, authenticationRequest.SuppliedPassword, principal); authenticationRequest.Authenticated(principal); }