CodeLiturgy.Dashboard/CodeLiturgy.Data.Auth/Session/ISessionCache.cs

57 lines
1.5 KiB
C#
Raw Normal View History

2022-09-26 04:40:18 +03:00
using System.Threading.Tasks;
using BlueWest.Data.Application;
2022-09-27 20:12:13 +03:00
using BlueWest.Data.Auth.Context.Users;
2022-09-26 04:40:18 +03:00
using Microsoft.Extensions.Hosting;
2022-09-27 20:12:13 +03:00
namespace BlueWest.Data.Auth
2022-09-26 04:40:18 +03:00
{
/// <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);
/// <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);
/// <summary>
/// Save Cache
/// </summary>
/// <returns></returns>
Task SaveAsync();
/// <summary>
/// Save Cache
/// </summary>
/// <returns></returns>
void Save();
}
}