0

I see my AD name when I use IIS Express is

@User.Identity.Name

I switch to Kestrel and the name is blank ?

What happened to AD with Kestrel?

I've tried some fixes below but not quite sure I knew what I was doing

services.AddAuthentication(HttpSysDefaults.AuthenticationScheme);

 //.UseHttpSys(options =>
                //{
                //    options.Authentication.Schemes =
                //        AuthenticationSchemes.NTLM |
                //        AuthenticationSchemes.Negotiate;
                //    options.Authentication.AllowAnonymous = false;
                //})
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
punkouter
  • 5,170
  • 15
  • 71
  • 116

2 Answers2

1

As documentation states in Configure Windows Authentication in ASP.NET Core:

Windows Authentication (also known as Negotiate, Kerberos, or NTLM authentication) can be configured for ASP.NET Core apps hosted with IIS or HTTP.sys.

So Kestrel just simply doesn't support Windows Authentication. You have two options: to host with IIS or HTTP.sys. Tu use 'HTTP.sys' you need this:

.UseHttpSys(options =>
{
    options.Authentication.Schemes = AuthenticationSchemes.NTLM | AuthenticationSchemes.Negotiate;
    options.Authentication.AllowAnonymous = false;
})
Dmitry Pavlov
  • 30,789
  • 8
  • 97
  • 121
0

This may not help you now, but Windows Authentication with Kestrel (including on Linux and Mac) will be supported in ASP.NET Core 3, which you can read about here.

Gabriel Luci
  • 38,328
  • 4
  • 55
  • 84
  • We will upgrade to v3 before its released so hopefully this makes my problem go away .. In the end we will use docker and I guess want to host in Kestral anyways – punkouter Aug 19 '19 at 19:20