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-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>
|
2021-09-10 11:28:57 +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>
|
|
|
|
|
/// <param name="user"></param>
|
|
|
|
|
/// <returns></returns>
|
2021-04-02 17:28:07 +05:00
|
|
|
|
string Refresh(ClaimsPrincipal user);
|
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
|
|
|
|
}
|
|
|
|
|
}
|