Node.js NTLM HTTP Authentication how to handle 3 types

Ok, sorry if this is a stupid question, but I'm trying to get NTLM Authentication to work with w / Node.js. I read this ( http://davenport.sourceforge.net/ntlm.html#theNtlmMessageHeaderLayout ). I send the header and get the Base64 authentication header.

I tried converting it from Base64 to UTF8, creating a new base64 encoded buffer, and then calling toString('utf8') , which returns a string like

NTLMSSP\u0000\u0001\u0000\u0000\u0000\u0007�\b�\u0000

I need help here. I understand that NTLMSSP \ u0000 is a null-terminated signature, but also something that should indicate the rest, but for me it's just rubbish. These are unicode characters, but how can I get data from this? Perhaps I am converting it incorrectly, which may add to my problems, but I hope someone can help.

+5
source share
4 answers

See http://www.innovation.ch/personal/ronald/ntlm.html What you get is a Type 2 message. The pages explain this very practically. You need to extract the server request (nonce) and server flags.

I just implemented a module for node.js to do just that: https://github.com/SamDecrock/node-http-ntlm

+4
source

Have you watched NTLMAPS ?

You may be able to solve your problem using it as a proxy server, but if you really want to implement NTLM authentication in Javascript, NTLMAPS provides a lot of working code to learn.

+2
source

Sam posted the best resource I've seen to understand what is happening.

jclulow on GitHub seems to have implemented it in the Samba library that he built.

Take a look here: https://github.com/jclulow/node-smbhash under lib \ ntlm.js you can see how it handled the responses.

+2
source

I created a client a couple of months ago using javascript, ntlm.js. Maybe this will help you get along. It was based on @ innov.ch documentation and official Microsoft documentation (see links on github page).

+1
source

All Articles