12

I need to use node.js to communicate with a server using NTLM proxy authentication.

I have used 2 modules:

  1. node-curl https://github.com/jiangmiao/node-curl
  2. request, coming highly recommended htps://github.com/mikeal/request

I found no documentation for the request module for ntlm , and though node-curl supports the curl easy options , I found no documentation about how to specify the CURLAUTH_NTLM for the CURLOPT_HTTPAUTH.

I want to know how to take care of the NTLM proxy authentication. I would love to continue using the request module.

ozba
  • 6,522
  • 4
  • 33
  • 40
user1514989
  • 175
  • 1
  • 1
  • 7
  • 1
    Also see [this question](http://stackoverflow.com/questions/5541099/node-js-ntlm-http-authentication-how-to-handle-the-the-3-types). I don't think there is any support for NTLM in request or any node modules, so your best bet seems to be to [`spawn`](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) a `curl --proxy-ntlm` process. – Linus Thiel Aug 27 '12 at 14:39

5 Answers5

9

Wrote a Node.js library to do the HTTP NTLM Handshaking: https://github.com/SamDecrock/node-http-ntlm

It's ported from the python-ntlm library.

Sam
  • 5,375
  • 2
  • 45
  • 54
3

If you are using Express you can use express-ntlm it makes NTLM a lot less frustrating overall

https://www.npmjs.com/package/express-ntlm

Kinetic
  • 1,714
  • 1
  • 13
  • 38
2

Is it important for you to use NTLM directly in node.js code?

Instead you can try to install some intermediate NTLM proxies that will give you a chance to use simple HTTP proxy in node.js. There are at least two solutions for it:

  1. Cntlm - written in C
  2. Ntlmaps - written in Python
molefrog
  • 29
  • 3
-1

Here is a partial implementation of the server side of NTLM in Node.js. It may help with developing a client side request: https://gist.github.com/3049352

And here is some code which appears to generate the type 1 message and recieve the type 2 response. The type 3 message is not yet implemented and is the final step: github.com/kevinswiber/node-ntlm-client

Here is some documentation on the NTLM protocol that should help complete it: http://www.innovation.ch/personal/ronald/ntlm.html

It's a start.

haxorjim
  • 9
  • 2
-1

Unfortunately I've only made more or less simplistic versions of NTLM.

This is a bit more complete: https://gist.github.com/Piot/3063016

Peter B
  • 25,670
  • 4
  • 22
  • 18