title: ASP.NET Core - Authorization Using Windows Authentication
body: <p>I have configured my web api to work with windows authentication. My goal is essentially to restrict certain actions in my controllers based on a users windows account. Some will be able to preform read actions while others will be able to preform actions that will write to the underlying database. I have found plenty of documentation on how to set up claims based authorization which is the route I think I need to go. What I have not found is how to set this up with windows auth. I think I am missing a middle step such as registering the windows auth as the identity provider? </p>
  
  <p><strong>startup.cs</strong></p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddMvc();
  
      services.AddAuthentication(IISDefaults.AuthenticationScheme);
  
      services.AddAuthorization(options =&gt;
      {
          options.AddPolicy("readOnly", policy =&gt;
                            policy.RequireClaim(`???????????????????????`));
          options.AddPolicy("write", policy =&gt;
                            policy.RequireClaim(`???????????????????????`));
      });
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>[Authorize(Policy = "ReadOnly")]
  public class MyController : Controller
  {
      public ActionResult SomeReadOnlyAction()
      {
          //Return data from database
      }
  
      [Authorize(Policy = "Write")]
      public ActionResult AWriteAction()
      {
          //Create/Update/Delete data from database
      }
  }
  </code></pre>
  
  <p>I guess another way to ask this question is how do you configure or access claims/roles etc... with windows authentication. </p>