【发布时间】:2017-07-23 16:43:01
【问题描述】:
尝试在测试环境中实现主题。
.UseWebListener(options=>
{
options.ListenerSettings.Authentication.Schemes = AuthenticationSchemes.NTLM |
AuthenticationSchemes.Negotiate;
options.ListenerSettings.Authentication.AllowAnonymous = true;
})
和
app.UseWhen(context => context.Request.Path.StartsWithSegments("/ntlm"),
builder => builder.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AutomaticAuthenticate = true,
AutomaticChallenge = true,
LoginPath = "/Main/Login",
LogoutPath = "/Main/Logout",
AuthenticationScheme = "NTLM", AccessDeniedPath = "/Main/Deny"
}
));
app.UseWhen(context => !context.Request.Path.StartsWithSegments("/ntlm"),
builder => builder.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AutomaticAuthenticate = false,
AutomaticChallenge = false,
LoginPath = "/Main/Login",
LogoutPath = "/Main/Logout",
AuthenticationScheme = "Cookies"
}
));
但是请求路径是否以“/ntlm”开头似乎没有区别。
我尝试运行两个 WebListener,但我认为开销更大。
我想要实现的目标: 用户使用登录表单进入起始页面,上面有一个“Windows auth”按钮。 他可以输入凭据或按下按钮并使用他的操作系统身份进入。
【问题讨论】:
标签: authentication asp.net-core forms-authentication windows-authentication