使用ASPNet Core在Linux上托管时的Windows身份验证

Jon*_*Jon 4 .net asp.net .net-core dnx asp.net-core

我目前有一个自托管的Owin应用程序,它在Windows上运行,如下所示:

public class Program
{
    private static void Main(string[] args)
    {
        using (WebApp.Start<Startup>("http://localhost:9000"))
        {
            Console.WriteLine("Press Enter to quit.");
            Console.ReadKey();
        }
    }
}

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        var listener = (HttpListener) app.Properties["System.Net.HttpListener"];
        listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;

        app.UseNancy();
    }
Run Code Online (Sandbox Code Playgroud)

当请求进入时,将使用其Windows域凭据验证用户.

对于ASPNetCore,我想知道是否有类似的设置可以使用但是应用程序在Linux上使用Kestrel Web服务器运行.

我听说Windows 2016和OpenIdConnect中间件可能有多种选择,或者我可以使用在Windows上运行的IdentityServer但在Linux上使用应用程序,但我认为需要中间件,我也不清楚是否会有"认证舞蹈"暗示它可能不像我现在那样无缝.

任何建议和/或代码示例将不胜感激.

谢谢

Tra*_*her 5

在任何平台上都没有直接支持Kestrel中的Windows auth,也没有任何可用的中间件支持Linux上的Windows身份验证.

通过Windows服务器路由登录请求是您唯一的选择.IdentityServer将是一个很好的起点.OpenIdConnect可能是您以最少的用户交互在两台服务器之间传递身份的最佳选择.