2021-04-02 17:28:07 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using System.Security.Claims;
|
2021-08-11 16:54:42 +05:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
|
|
|
|
|
namespace AsbCloudApp.Services
|
|
|
|
|
{
|
2022-11-17 17:54:25 +05:00
|
|
|
|
#nullable enable
|
2022-08-05 17:16:11 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Сервис авторизации
|
|
|
|
|
/// </summary>
|
2021-04-02 17:28:07 +05:00
|
|
|
|
public interface IAuthService
|
|
|
|
|
{
|
2022-08-05 17:16:11 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Смена пароля пользователю
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idUser"></param>
|
|
|
|
|
/// <param name="newPassword"></param>
|
|
|
|
|
/// <returns></returns>
|
2021-04-02 17:28:07 +05:00
|
|
|
|
int ChangePassword(int idUser, string newPassword);
|
2022-08-05 17:16:11 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Смена пароля пользователю
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="userLogin"></param>
|
|
|
|
|
/// <param name="newPassword"></param>
|
|
|
|
|
/// <returns></returns>
|
2021-04-02 17:28:07 +05:00
|
|
|
|
int ChangePassword(string userLogin, string newPassword);
|
2022-08-05 17:16:11 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Авторизация
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="login"></param>
|
|
|
|
|
/// <param name="password"></param>
|
|
|
|
|
/// <param name="token">токен отмены задачи</param>
|
|
|
|
|
/// <returns></returns>
|
2022-11-17 17:54:25 +05:00
|
|
|
|
Task<UserTokenDto?> LoginAsync(string login,
|
2021-08-11 16:54:42 +05:00
|
|
|
|
string password, CancellationToken token = default);
|
2021-04-02 17:28:07 +05:00
|
|
|
|
|
2022-08-05 17:16:11 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Обновление токена авторизации
|
|
|
|
|
/// </summary>
|
2022-11-17 17:54:25 +05:00
|
|
|
|
/// <param name="identity"></param>
|
|
|
|
|
/// <param name="token"></param>
|
2022-08-05 17:16:11 +05:00
|
|
|
|
/// <returns></returns>
|
2022-10-24 10:36:53 +05:00
|
|
|
|
Task<UserTokenDto?> RefreshAsync(ClaimsPrincipal identity,
|
|
|
|
|
CancellationToken token);
|
2022-08-05 17:16:11 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Регистрация нового пользователя
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="userDto"></param>
|
|
|
|
|
/// <returns></returns>
|
2021-12-11 16:46:04 +05:00
|
|
|
|
int Register(UserRegistrationDto userDto);
|
2021-04-02 17:28:07 +05:00
|
|
|
|
}
|
2022-11-17 17:54:25 +05:00
|
|
|
|
#nullable disable
|
2021-04-02 17:28:07 +05:00
|
|
|
|
}
|