using Backend.Domain; namespace Backend.Security; public static class HttpContextSessionExtensions { private const string SessionItemKey = "__current_session"; public static void SetCurrentSession(this HttpContext context, UserSession session) => context.Items[SessionItemKey] = session; public static UserSession? GetCurrentSession(this HttpContext context) => context.Items.TryGetValue(SessionItemKey, out var value) ? value as UserSession : null; }