using Connected.Security.Identity; using Microsoft.AspNetCore.Http; namespace Common.Security.Identity; internal class IdentityService : IIdentityService { public IdentityService(IHttpContextAccessor contextAccessor) { HttpContext = contextAccessor.HttpContext; } private HttpContext? HttpContext { get; } public IUser? CurrentUser => Identity?.User; public bool IsAuthenticated => Identity is not null && Identity.IsAuthenticated; private UserIdentity? Identity => HttpContext?.User?.Identity as UserIdentity; }