57 lines
1.5 KiB
C#
57 lines
1.5 KiB
C#
using System.Threading.Tasks;
|
|
using BlueWest.Data.Application;
|
|
using BlueWest.Data.Auth.Context.Users;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace BlueWest.Data.Auth
|
|
{
|
|
/// <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();
|
|
|
|
|
|
}
|
|
}
|
|
|