How does Windows Authentication (Negotiate/Kerberos) work in ASP.NET Core for intranet applications, and when is it appropriate?
Short answer
Windows/Negotiate authentication (via the Microsoft.AspNetCore.Authentication.Negotiate package) leverages the client machine's existing domain-joined Windows credentials, transparently authenticating the user without any login prompt when both client and server are on the same…
Advertisement
AModel answer
Windows/Negotiate authentication (via the Microsoft.AspNetCore.Authentication.Negotiate package) leverages the client machine's existing domain-joined Windows credentials, transparently authenticating the user without any login prompt when both client and server are on the same Active Directory domain -- appropriate specifically for internal intranet line-of-business applications where all users are on managed, domain-joined corporate machines, but entirely unsuitable for public-facing or external applications.
builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
.AddNegotiate();
builder.Services.AddAuthorization(options => {
options.FallbackPolicy = options.DefaultPolicy; // require auth by default
});Real-world example
An internal HR portal accessible only from within the corporate network uses Windows Authentication so employees are automatically signed in using their existing domain credentials, with zero separate login screen or password to manage.
Likely follow-ups
- Why is Windows Authentication inappropriate for internet-facing applications?
- How does this interact with load balancers or reverse proxies in front of the application?
Related topics