first commit
This commit is contained in:
commit
1530450313
165 changed files with 8443 additions and 0 deletions
25
src/AuthApp/AuthService.cs
Normal file
25
src/AuthApp/AuthService.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using AuthApp.Data;
|
||||
using AuthApp.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// Сервис аутентификации
|
||||
/// </summary>
|
||||
namespace AuthApp.Services
|
||||
{
|
||||
public class AuthService
|
||||
{
|
||||
private readonly UserRepository _repository = new();
|
||||
|
||||
/// <summary>
|
||||
/// Проверка логина и пароля
|
||||
/// </summary>
|
||||
public bool Authenticate(string login, string password)
|
||||
{
|
||||
var user = _repository.GetUser(login);
|
||||
if (user == null) return false;
|
||||
|
||||
string hash = PasswordHasher.Hash(password);
|
||||
return (user.PasswordHash == hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue