/// <summary> /// Initializes a new instance of the <see cref="LoginCommandHandler"/> class. /// </summary> /// <param name="userRepository">The user repository.</param> /// <param name="passwordHashChecker">The password hash checker.</param> /// <param name="jwtProvider">The JWT provider.</param> public LoginCommandHandler(IUserRepository userRepository, IPasswordHashChecker passwordHashChecker, IJwtProvider jwtProvider) { _userRepository = userRepository; _passwordHashChecker = passwordHashChecker; _jwtProvider = jwtProvider; }
/// <summary> /// Verifies that the provided password hash matches the password hash. /// </summary> /// <param name="password">The password to be checked against the user password hash.</param> /// <param name="passwordHashChecker">The password hash checker.</param> /// <returns>True if the password hashes match, otherwise false.</returns> public bool VerifyPasswordHash(string password, IPasswordHashChecker passwordHashChecker) => !string.IsNullOrWhiteSpace(password) && passwordHashChecker.HashesMatch(_passwordHash, password);