MyBookmark/Modules.Account.Application/PasswordHasher.cs
2024-10-21 01:52:41 +03:00

21 lines
643 B
C#

using Microsoft.AspNetCore.Identity;
using Modules.Account.Domain.Gateways;
namespace Modules.Account.Application;
public class PasswordHasher : IPasswordHasher
{
private readonly PasswordHasher<Domain.Entities.Account> _hasher;
public PasswordHasher()
{
_hasher = new();
}
public string HashPassword(Domain.Entities.Account account, string password) =>
_hasher.HashPassword(account, password);
public bool VerifyPassword(Domain.Entities.Account account, string password) =>
_hasher.VerifyHashedPassword(account, password, account.HashedPassword) != PasswordVerificationResult.Failed;
}