using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Mvc; using OliverBooth.Data.Web; using ISession = OliverBooth.Data.Blog.ISession; namespace OliverBooth.Services; public interface ISessionService { /// /// Creates a new session for the specified user. /// /// The HTTP request. /// The user. /// The newly-created session. /// /// is . /// -or- /// is . /// ISession CreateSession(HttpRequest request, IUser user); /// /// Deletes the specified session. /// /// The session to delete. /// is . void DeleteSession(ISession session); /// /// Attempts to find a session with the specified ID. /// /// The session ID. /// /// When this method returns, contains the session with the specified ID, if the session is found; otherwise, /// . /// /// /// if a session with the specified ID is found; otherwise, . /// bool TryGetSession(Guid sessionId, [NotNullWhen(true)] out ISession? session); /// /// Attempts to find the session associated with the HTTP request. /// /// The HTTP request. /// /// When this method returns, contains the session with the specified request, if the user is found; otherwise, /// . /// /// if the session was found; otherwise, . /// is . bool TryGetSession(HttpRequest request, [NotNullWhen(true)] out ISession? session); /// /// Validates the session with the incoming HTTP request. /// /// The HTTP request. /// The session. /// if the session is valid; otherwise, . /// /// is . /// -or- /// is . /// bool ValidateSession(HttpRequest request, ISession session); }