21 lines
643 B
C#
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;
|
|
}
|