写在ASP.Net自定义NTLM挑战/响应 [英] Writing a custom NTLM challenge/response in ASP.Net

查看:249
本文介绍了写在ASP.Net自定义NTLM挑战/响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,你可以启用NTLM的验证的使用在ASP.Net应用程序:

I know that you can enable NTLM authentication in an ASP.Net app using:

<authentication mode="Windows" />

不过 - 我需要处理表单,HTTP和其他定制认证在同一个应用程序,所以ASP.Net的有限的内置支持,是没有用的。

However - I need to handle Forms, HTTP and other custom authentications in the same app, so ASP.Net's limited built-in support is no use.

NTLM握手应该是相当简单:

The NTLM handshake should be fairly simple:

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]

因此​​,要推出自己我需要解析的类型1 型-3 的消息,并生成一个 2型的消息

So to roll my own I need to parse type-1 and type-3 messages and generate a type-2 message.

对于这些消息的结构是有据可查的,但相当复杂 - 它似乎很凌乱写我自己的消息生成器和分析器。我想的方法来读取和写入这些信息应该已经是在.NET中,但我一直没能找到他们。

The structure for those messages is well documented but fairly complex - it seems very messy to write my own message generators and parsers. I think the methods to read and write these messages should already be in .Net, but I haven't been able to find them.

如何建立和分析使用的.Net这些NTLM消息?

How can I build and parse these NTLM messages using .Net?

推荐答案

卡西尼支持NTLM身份验证,因此您可以使用源更容易地创建一个解析NTLM授权消息的类。

Cassini supports NTLM authentication, so you could use the source to more easily create a class which parses the NTLM authorization messages.

HTTP://cassinidev.$c$cplex.com/

这篇关于写在ASP.Net自定义NTLM挑战/响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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