首页 > 解决方案 > Linux 上的 ASP.NET Core Windows 身份验证

问题描述

我在 Linux 容器中运行 ASP.NET Core Web 应用程序。我需要为我的应用程序提供 Windows 身份验证。如何实施?

我假设可以使用可以通过 Kerberos 进行身份验证的反向代理服务器来解决问题。

标签: linuxasp.net-coreactive-directorykerberos

解决方案


从 ASP.NET Core 3.0 开始,现在可以通过添加Microsoft.AspNetCore.Authentication.Negotiate NuGet 包在 Linux 和 MacOS 上使用 Windows 身份验证,并在您的Startup.ConfigureServices方法中使用它:

services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
   .AddNegotiate();

这在Startup.Configure

app.UseAuthentication();

以及文档中描述的一些附加配置。


推荐阅读