如何支持与后备,形成ASP.NET MVC NTLM身份验证? [英] How to support NTLM authentication with fall-back to form in ASP.NET MVC?

查看:117
本文介绍了如何支持与后备,形成ASP.NET MVC NTLM身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何能实现在ASP.NET MVC应用程序如下:

How can I implement following in ASP.NET MVC application:


  1. 用户打开内部网站

  2. 的用户被悄悄如果可能的话
  3. 认证
  4. 如果NTLM身份验证,也没有制定出来,显示登录表单用户

  5. 从predefined域列表中的用户登录表示密码,然后选择域

  6. 用户在code。使用AD认证

我知道如何实现4和5,但无法找到如何NTLM和形式相结合的信息。
这样NTLM本地登录/密码对话框永远不会显示 - 透明认证或好看的登录页面

I know how to implement 4 and 5 but cannot find info on how to combine NTLM and forms. So that NTLM native login/password dialog is never shown - transparent authentication or nice looking login page.

应该如何工作的?
如果用户被要求登录名和密码?
可她目前的凭据(域用户名)不要求输入登录名和密码被使用?

How should work? Should user be asked login and password? Can her current credentials (domain username) be used without asking to enter login and password?

更新这些,调查同样的问题:

当我问这个,我不能完全理解NTLM身份验证的内部工作原理。
这里重要的一点是,如果用户的浏览器不支持NTLM正常,或NTLM支持由用户禁用 - 服务器永远不会得到机会去解决这个

When I was asking this I was not fully understand how NTLM authentication works internally. Important thing here to understand is that if user's browser doesn't support NTLM properly or if NTLM support is disabled by user - server will never get chance to work around this.

如何Windows身份验证工作:

How Windows authentication is working:


  1. 客户端发送一个普通的HTTP请求到服务器

  2. 服务器,HTTP状态为401和迹象表明,NTLM身份验证必须用于访问资源的响应

  3. 客户端发送NTLM类型1的消息

  4. 服务器与挑战NTLM 2型消息响应

  5. 客户端发送的Type3消息,应对挑战

  6. 服务器请求的实际内容进行响应

正如你所见,浏览器不支持NTLM不会去步骤(3),而不是生成的用户将显示IIS错误401页。

As you see, browser not supporting NTLM will not go to step (3), instead user will be shown IIS generated Error 401 page.

如果用户没有凭证,取消NTLM身份验证弹出的对话框窗口浏览器之后将不会继续(3)为好。

If user doesn’t have credentials, after cancelling NTLM authentication popup dialog window browser will not continue to (3) as well.

所以我们没有机会自动将用户重定向到自定义登录页面。

So we have no chance to automatically redirect users to custom login page.

这里唯一的选择是我们决定是否用户应支持NTLM,如果是这样,重定向到NTLM保护的主页上有一个门户页面。

The only option here is to have a "gateway" page where we decide if user should support NTLM and if so, redirect to NTLM protected home page.

如果没有的话,显示登录表单,并允许验证通过手动输入登录名和密码。

And if not, show login form and allow authentication by manually entering login and password.

决策通常是由根据用户的IP地址和/或主机名或者通过匹配的IP范围或通过检查predefined IP地址表。

Decision is usually made based on users’ IP address and/or host name either by matching IP ranges or by checking table of predefined IPs.

推荐答案

本文章可能让你在正确的方向。基本上,你有两个虚拟目录两个应用程序在相同的主机名。一个应用程序使用窗体身份验证,一是使用Windows。使用Windows身份验证一个创建有效形式的身份验证cookie,并重定向到第二个虚拟目录。

This article might get you pointed in the right direction. Basically you have two apps in two virtual directories under the same host name. One app uses Forms authentication, one uses Windows. The one using Windows authentication creates a valid form authentication cookie and redirects to the second virtual directory.

ASP.NET混合模式身份验证

这篇关于如何支持与后备,形成ASP.NET MVC NTLM身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆