我知道您可以启用 NTLM验证在 ASP.Net 应用程序中使用:
<authentication mode="Windows" />
但是 - 我需要在同一个应用程序中处理表单、HTTP 和其他自定义身份验证,因此 ASP.Net 有限的内置支持没有用。
NTLM 握手应该相当简单:
Request - [unauthenticated - no user info passed]
Response - 401 Unauthorized
WWW-Authenticate: NTLM
Request - Authorization: NTLM <base64-encoded type-1-message>
Response - 401 Unauthorized
WWW-Authenticate: NTLM <base64-encoded type-2-message>
Request - Authorization: NTLM <base64-encoded type-3-message>
Server can now check username/password against LDAP from type-3 message
Response - 200 Ok [now authenticated & authorised]
所以要推出我自己的,我需要解析type-1 and type-3消息并生成type-2信息。
这些消息的结构是有据可查但相当复杂 http://www.innovation.ch/personal/ronald/ntlm.html- 编写自己的消息生成器和解析器似乎很混乱。我认为读写这些消息的方法应该已经在.Net中了,但我一直没能找到它们。
如何使用 .Net 构建和解析这些 NTLM 消息?
Cassini 支持 NTLM 身份验证,因此您可以使用源代码更轻松地创建解析 NTLM 授权消息的类。
http://cassinidev.codeplex.com/ http://cassinidev.codeplex.com/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)