Spaces:
Runtime error
Runtime error
Download src/SCM.Infrastructure/Security/PasswordHasherService.cs from rafaeldavila/scm-api: direct link, hf CLI and curl.
- Browser
- Download file 698 Bytes
-
https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Infrastructure/Security/PasswordHasherService.cs
- Command line
-
hf download hf://spaces/rafaeldavila/scm-api/src/SCM.Infrastructure/Security/PasswordHasherService.cs
-
curl -L -o PasswordHasherService.cs https://huggingface.co/spaces/rafaeldavila/scm-api/resolve/main/src/SCM.Infrastructure/Security/PasswordHasherService.cs
698 Bytes
| using Microsoft.AspNetCore.Identity; | |
| using SCM.Application.Authentication; | |
| namespace SCM.Infrastructure.Security; | |
| /// <summary>Usa o <see cref="PasswordHasher{TUser}"/> do ASP.NET Core (PBKDF2 com salt).</summary> | |
| public sealed class PasswordHasherService : IPasswordHasherService | |
| { | |
| private static readonly object Placeholder = new(); | |
| private readonly PasswordHasher<object> _hasher = new(); | |
| public string Hash(string password) => _hasher.HashPassword(Placeholder, password); | |
| public bool Verify(string passwordHash, string providedPassword) | |
| => _hasher.VerifyHashedPassword(Placeholder, passwordHash, providedPassword) | |
| != PasswordVerificationResult.Failed; | |
| } | |