How to get User at Service Layer
问题 I use ASP.NET Core 2.1 and would like to fetch User at a service level . I've seen examples when HttpContextAccessor gets injected into some service and then we fetch the current User via UserManager var user = await _userManager.GetUserAsync(accessor.HttpContext.User); or in controller var user = await _userManager.GetUserAsync(User); Problems: Injecting HttpContextAccessor into service seems to be wrong - simply because we violate SRP and the Service Layer isn't isolated (it is dependant on