我知道您可以使用以下方法在ASP.Net应用程序中启用NTLM身份验证:
<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和type-3消息,并生成type-2消息。
这些消息的结构是有很好的记录,但相当复杂 --编写自己的消息生成器和解析器似乎很麻烦。我认为读和写这些消息的方法应该已经在.Net中了,但是我还没有找到它们。
如何使用.Net构建和解析这些NTLM消息?
发布于 2011-03-30 11:58:25
Cassini支持NTLM身份验证,因此您可以使用源创建一个解析NTLM授权消息的类。
http://cassinidev.codeplex.com/
https://stackoverflow.com/questions/4723062
复制相似问题