using Femto.Common; namespace Femto.Api; internal class CurrentUserContext : ICurrentUserContext { private CurrentUser? _currentUser; public CurrentUser? tryGetUserCurrentUser() => this._currentUser; public bool HasUser => this._currentUser is not null; public CurrentUser CurrentUser { get { if (_currentUser is null) throw new InvalidOperationException( "don't access current user if not authenticated" ); return _currentUser; } set => _currentUser = value; } }