jlguenego / node-expose-sspi

Expose Microsoft Windows SSPI to Node for SSO authentication.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NTLM Authentication doesn't seem to work in node.js

tomika opened this issue · comments

The NTLM authentication doesn't seems to work at all in nodejs (12.19.0)

In Windows 10 Pro x64 built in IIS configured to accept NTLM (works with any browser).

To reproduce:
const sso = require("node-expose-sspi");
const x = new sso.Client();
x.setSSP("NTLM");
x.setCredentials("", "username", "password");
x.fetch("https://localhost/").then(r =>console.log(r.status)).catch(e => console.error(e));

I've tried to access other Microsoft webservers also, the result is the same.
I've set env variable DEBUG=node-expose-sspi:*. but got no more log.
I've debugged the program, everything seems to be alright, but after sending NTLM 3 type message IIS refuses it with another 401 HTTP status code instead of responding 200.

I've compared the parsed NTLM messages (browser and nodejs) the only significant difference I see is that node-expose-sspi's NTLM 3 message doesn't containts Session Key member while the browser's version has a 16 bytes long session key. (Negotiate Key Exchange also missing of course)

OS: Windows 10 Pro version 19041.572 x64]
Browser version: Chrome 86.0.4240.111
Node version and architecture: 12.19.0 64 bits

  • Are you on a Windows domain: no
  • Can you reach the domain controller: no
  • Do your session have admin privileges: no
  • Which authentication protocol: NTLM

There is a example project inside node-expose-sspi: https://github.com/jlguenego/node-expose-sspi/tree/master/examples/client-runas

Can you check with it if it is working or not with your IIS.

Other question ? How did you managed to get the SSL on you IIS : https://localhost ? Please give me the detail.
And have you done something special to have NTLM working on your IIS ? Can you describe or give doc url ? Thanks.

I added a new version (0.1.51) which has been tested with IIS. Please try it. (it now uses a keep alive connection).

It is now working, thx

Sorry, I did not answer the question: https was a mistype, I tried it with plain http.
Sorry for misleading.