Описан интерфейс сервиса сессии пользователя.
This commit is contained in:
parent
fe86ee934c
commit
05642717c8
4 changed files with 49 additions and 13 deletions
|
|
@ -1,12 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Intersvyaz.Core
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -120,8 +120,9 @@
|
||||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Class1.cs" />
|
<Compile Include="Models\SessionData.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Services\ISessionService.cs" />
|
||||||
<EmbeddedResource Include="Properties\Intersvyaz.Core.rd.xml" />
|
<EmbeddedResource Include="Properties\Intersvyaz.Core.rd.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -129,6 +130,7 @@
|
||||||
<Version>6.2.8</Version>
|
<Version>6.2.8</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
13
src/Intersvyaz.Core/Models/SessionData.cs
Normal file
13
src/Intersvyaz.Core/Models/SessionData.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Intersvyaz.Core.Models
|
||||||
|
{
|
||||||
|
public class SessionData
|
||||||
|
{
|
||||||
|
public string Username { get; set; }
|
||||||
|
|
||||||
|
public string Token { get; set; }
|
||||||
|
|
||||||
|
public DateTime ExpiresAt { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
33
src/Intersvyaz.Core/Services/ISessionService.cs
Normal file
33
src/Intersvyaz.Core/Services/ISessionService.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Intersvyaz.Core.Models;
|
||||||
|
|
||||||
|
namespace Intersvyaz.Core.Services
|
||||||
|
{
|
||||||
|
public interface ISessionService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Получить сессию пользователя. При отсутствие сессии,
|
||||||
|
/// входит в систему автоматически.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="username">Имя пользователя.</param>
|
||||||
|
/// <param name="password">Пароль пользователя.</param>
|
||||||
|
/// <returns>Данные об сессии.</returns>
|
||||||
|
Task<SessionData> GetSessionAsync(string username, string password);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получить сессию пользователя.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Данные об сессии.</returns>
|
||||||
|
SessionData GetSession();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Проверить, есть ли сессия пользователя.
|
||||||
|
/// </summary>
|
||||||
|
bool HasSession();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Удалить сессию пользователя.
|
||||||
|
/// </summary>
|
||||||
|
void DeleteSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue