title: Asp.Net Core 2.1 SPA React Template with Windows Authentication
body: <p>When I use Windows Authentication in my debug environment(IIS Express), I get the proper domain name. But when I push it to the production environment(IIS), I get no domain name at all. Am I missing something?</p>
  
  <p>Reproduce my Issue:</p>
  
  <p>I've created a new Web Project in VS2017 (15.7.6) with the React template and enabled Windows authentication by changing the launchSettings.json to:</p>
  
  <pre><code>"windowsAuthentication": true,
  "anonymousAuthentication": false,
  </code></pre>
  
  <p>Now I changed the <code>ConfigureServices</code> Method in <code>Startup.cs</code> to this:</p>
  
  
  
  <pre class="lang-cs prettyprint-override"><code>public void ConfigureServices(IServiceCollection services) 
  {
      services.Configure&lt;IISOptions&gt;(options =&gt;
      {
          options.AutomaticAuthentication = true;
      });
      services.AddAuthentication(IISDefaults.AuthenticationScheme);
  
      var names = new[] { "peter", "joey" };
  
  
      services.AddAuthorization(options =&gt;
      {
          options.AddPolicy("OnlyEmployees", policy =&gt;
          {
              policy.AddAuthenticationSchemes(IISDefaults.AuthenticationScheme);
              policy.Requirements.Add(new CheckForEmployee(names));
          });
      });
      services.AddSingleton&lt;IAuthorizationHandler, CheckForEmployeeHandler&gt;();
  
      services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
      // In production, the React files will be served from this directory
      services.AddSpaStaticFiles(configuration =&gt;
      {
          configuration.RootPath = "ClientApp/build";
      }); 
  }
  </code></pre>
  
  <p>I added 2 Files to the Project: </p>
  
  <p>CheckForEmployee.cs</p>
  
  <pre class="lang-cs prettyprint-override"><code>using Microsoft.AspNetCore.Authorization;
  
  namespace WebServer_WindowsAuthentication
  {
      public class CheckForEmployee : IAuthorizationRequirement
      {
          public string[] Names { get; set; }
          public CheckForEmployee(string[] names)
          {
              Names = names;
          }
      }
  }
  </code></pre>
  
  <p>CheckForEmployeeHandler.cs</p>
  
  <pre class="lang-cs prettyprint-override"><code>using System.Linq;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Authorization;
  
  namespace WebServer_WindowsAuthentication
  {
      public class CheckForEmployeeHandler : AuthorizationHandler&lt;CheckForEmployee&gt;
      {
          protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, CheckForEmployee requirement)
          {
              if (requirement.Names.Contains(context.User.Identity.Name))
              {
                  context.Succeed(requirement);
              }
  
              return Task.CompletedTask;
          }
      }
  }
  </code></pre>