mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-14 17:54:42 +00:00
21 lines
696 B
C#
21 lines
696 B
C#
using Infrastructure.PasswordHashing;
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
namespace Features.Auth.Identity;
|
|
|
|
public sealed class Argon2PasswordHasher(IPasswordInfrastructure passwordInfrastructure)
|
|
: IPasswordHasher<ApplicationUser>
|
|
{
|
|
public string HashPassword(ApplicationUser user, string password) =>
|
|
passwordInfrastructure.Hash(password);
|
|
|
|
public PasswordVerificationResult VerifyHashedPassword(
|
|
ApplicationUser user,
|
|
string hashedPassword,
|
|
string providedPassword
|
|
) =>
|
|
passwordInfrastructure.Verify(providedPassword, hashedPassword)
|
|
? PasswordVerificationResult.Success
|
|
: PasswordVerificationResult.Failed;
|
|
}
|