title: HttpContextAccessor, IPrincipal and ServiceCollection
body: <p>Is there a way that I could implement next behaviour?</p>
  
  <pre><code>public static void Configure(IServiceCollection services) {
      services.AddScoped(typeof(Func&lt;IPrincipal&gt;), ???);
      services.AddInstance(typeof(Func&lt;IPrincipal&gt;), ???);
  }
  </code></pre>
  
  <p><em>1. Does not work:</em></p>
  
  <pre><code>Func&lt;IServiceProvider, IPrincipal&gt; getPrincipal = 
      (sp) =&gt; sp.GetService&lt;IHttpContextAccessor&gt;().HttpContext.User;
  
  services.AddScoped(
      typeof(Func&lt;IPrincipal&gt;), 
      getPrincipal);  
  </code></pre>
  
  <p><em>2. Does not work:</em></p>
  
  <pre><code>var builder = services.BuildServiceProvider();
  
  services.AddInstance(
      typeof(Func&lt;IPrincipal&gt;),
      builder.GetService&lt;IHttpContextAccessor&gt;().HttpContext.User);
  </code></pre>