2022-09-18 04:00:24 +03:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
using BlueWest.Data.Application;
|
|
|
|
using BlueWest.WebApi.Context.Users;
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
|
|
|
namespace BlueWest.WebApi
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Methods for handling session cache data.
|
|
|
|
/// </summary>
|
|
|
|
public interface ISessionCache : IHostedService
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a Session Token by Id.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="tokenId"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
Task<SessionToken> GetSessionTokenByIdAsync(string tokenId);
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new session token
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="token"></param>
|
|
|
|
Task AddSessionToken(SessionToken token);
|
|
|
|
|
2022-09-19 05:50:15 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Check for validity of the session
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sessionTokenId"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
Task<bool> IsSessionValidAsync(string sessionTokenId);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Checks if the session is valid
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sessionTokenId"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
bool IsSessionValid(string sessionTokenId);
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-18 04:00:24 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Save Cache
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
Task SaveAsync();
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Save Cache
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
void Save();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|