OWIN MixedAuth User.Identity.GetUserId返回null

时间:2016-08-31 12:39:58

标签: owin mixed-authentication

我正在使用OWIN-MixedAuth对网站用户进行身份验证。在Win10 mahine上使用VS2015在本地运行一切都很好。将其部署到AD域中的高效Windows 2008 R2服务器,User.Identity不是ClaimsIdentity,它是一个缺少NameIdentifier声明的WindowsIdentity,而GetuserId返回null。

在Startup.Auth.cs中,我设置了以下cookie选项。登录路径按建议here指向“account / windowslogin”。

    var cookieOptions = new CookieAuthenticationOptions {
        AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
        LoginPath = new PathString(ConfigurationManager.AppSettings["LoginPath"]),
        Provider = new CookieAuthenticationProvider {
            OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, IdentityUser, Guid>(
            TimeSpan.FromMinutes(30),
            async (manager, user) => await user.GenerateUserIdentityAsync(manager),
            (id) => new Guid(id.GetUserId())),
        }
    };

为什么IIS 7.5在这里有不同的行为?

干杯 贝恩德

0 个答案:

没有答案
相关问题