title: .NET Core 2.0 authorization filter - not working as expected
body: <p>I am trying to validate an Active Directory role group (using Windows authentication) before executing an API action method in .NET Core 2.0. Something straight-forward <a href="https://stackoverflow.com/questions/48113243/asp-net-core-authorize-ad-groups-through-web-config">like this</a> should suit my needs.</p>
  
  <p>My <code>Program.cs</code>:</p>
  
  <pre><code>public static IWebHost BuildWebHost(string[] args) =&gt;
              WebHost.CreateDefaultBuilder(args)
                  .UseIISIntegration()
                  .UseStartup&lt;Startup&gt;()
                  .Build();
  </code></pre>
  
  <p>My <code>ConfigureServices</code> method in <code>Startup.cs</code> (I am referencing a role group in my <code>appsettings.json</code> file):</p>
  
  <pre><code>services.AddAuthentication();
  services.AddAuthorization(options =&gt;
  {
      options.AddPolicy("ValidRoleGroup", policy =&gt; 
           policy.RequireRole(Configuration["AuthenticatedGroup"]));
  });
  
  services.AddMvc(config =&gt;
  {
      var policy = new AuthorizationPolicyBuilder()
                      .RequireAuthenticatedUser()
                      .Build();
  
      config.Filters.Add(new AuthorizeFilter(policy));
   });
  </code></pre>
  
  <p>My <code>Configure</code> method:</p>
  
  <pre><code>public void Configure(IApplicationBuilder app, IHostingEnvironment env, 
                        ILoggerFactory loggerFactory)
  {
       app.UseAuthentication();
       app.UseMvc();
  }
  </code></pre>
  
  <p>And then, I decorate my method with <code>[Authorize(Policy = "ValidRoleGroup")]</code>. </p>
  
  <p>When I review the error in Application Insights, I get a message stating <code>Authorization failed for user: (null)</code>. Am I missing anything important?</p>