我使用 autofac PropertiesAutowired 方法(ASP.NET CORE)。我需要的是获取类库项目中的当前用户。我该怎么做?我想要这样的东西
public IHttpContextAccessor ContextAccessor{ get; set; }
Run Code Online (Sandbox Code Playgroud)
然后像这样使用它
Context.HttpContext.User.Claims.First(i => i.Type == "NameIdentifier"
Run Code Online (Sandbox Code Playgroud)
是否可以这样做或者我应该使用其他东西来实现它?