Node.js NTLM HTTP身份验证,如何处理这三种类型 [英] Node.js NTLM HTTP Authentication, how to handle the 3 types
问题描述
我正在尝试使用Node.js进行NTLM身份验证.我正在阅读此内容( http://davenport.sourceforge.net/ntlm.html#theNtlmMessageHeaderLayout ).我发送了标头并获得了Base64身份验证标头.
I'm trying to get NTLM Authentication working w/ Node.js. I've been reading this ( http://davenport.sourceforge.net/ntlm.html#theNtlmMessageHeaderLayout ). I send the header and get a Base64 authentication header.
我尝试通过使用base64编码创建一个新的Buffer,然后调用toString('utf8')
返回一个类似
I tried converting it from Base64 to UTF8 by making a new Buffer with base64 encoding and then calling toString('utf8')
which returns a string something like
NTLMSSP\u0000\u0001\u0000\u0000\u0000\u0007�\b�\u0000
这是我需要帮助的地方.我知道NTLMSSP \ u0000是终止为null的签名,但是其余的应该表示,但是对我来说这只是垃圾.它是unicode字符,但是我应该如何从中获取实际数据呢?我可能没有正确地转换它,这可能会增加我的麻烦,但我希望有人可以提供帮助.
This is where I need help. I understand the NTLMSSP\u0000 is the null terminated signature, but and what the rest is supposed to indicate, but to me it's just garbage. It's unicode characters, but how am I supposed to get actual data out of that? I may be converting it incorrectly, which may be adding to my troubles, but I'm hoping someone can help.
推荐答案
看看 http://www.innovation.ch/personal/ronald/ntlm.html 您收到的是第二类消息.这些页面以非常实用的方式对其进行了说明.您必须提取服务器质询(立即)和服务器标志.
Have a look at http://www.innovation.ch/personal/ronald/ntlm.html What you receive is a Type-2 Message. The pages explains it in a very practical way. You have to extract the server challenge (nonce) and the server flags.
我刚刚实现了一个用于node.js的模块来做到这一点: https://github.com. com/SamDecrock/node-http-ntlm
I just implemented a module for node.js to do just that: https://github.com/SamDecrock/node-http-ntlm
这篇关于Node.js NTLM HTTP身份验证,如何处理这三种类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!