private void AuthenticateWithPassword(AuthenticationRequest authenticationRequest, string correctPassword, IPrincipal principal) { if (authenticationRequest.SuppliedPassword != correctPassword) { authenticationRequest.Unauthorized(); return; } authenticationRequest.Authenticated(principal); }
private void AuthenticateWithPasswordHash(AuthenticationRequest authenticationRequest, UserData userData) { if (!_passwordHashAlgorithm.Verify(authenticationRequest.SuppliedPassword, userData.Hash, userData.Salt)) { authenticationRequest.Unauthorized(); return; } var principal = CreatePrincipal(userData); CachePassword(authenticationRequest.Name, authenticationRequest.SuppliedPassword, principal); authenticationRequest.Authenticated(principal); }
private void AuthenticateWithPassword(AuthenticationRequest authenticationRequest, string correctPassword, ClaimsPrincipal principal) { if (authenticationRequest.SuppliedPassword != correctPassword) { if (_logFailedAuthenticationAttempts) { Log.Warning("Authentication Failed for {id}: {reason}", authenticationRequest.Id, "Invalid credentials supplied."); } authenticationRequest.Unauthorized(); return; } authenticationRequest.Authenticated(principal); }
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); }