问题
I'm using Node.js to connect to Server with NTLM Authentication. As the NTLM protocol steps below(refer: http://www.innovation.ch/personal/ronald/ntlm.html).
1: C --> S GET ...
2: C <-- S 401 Unauthorized
WWW-Authenticate: NTLM
3: C --> S GET ...
Authorization: NTLM <base64-encoded type-1-message>
4: C <-- S 401 Unauthorized
WWW-Authenticate: NTLM <base64-encoded type-2-message>
5: C --> S GET ...
Authorization: NTLM <base64-encoded type-3-message>
6: C <-- S 200 Ok
the 1-5 step works fine, but in the 6th step, the server didn't return me with 200 OK, but returned me with status code 401, and with headers:
HEADS: {
'content-type': 'text/html',
server: 'Microsoft-IIS/8.0',
'www-authenticate': 'Negotiate, NTLM',
'x-powered-by': 'ASP.NET',
date: 'Sat, 12 Jul 2014 06:44:25 GMT',
'content-length': '1293'
}
Is there anything wrong? Could you help me? Why doesn't it return 200 OK and correct response body? Thanks very much
回答1:
all.
I found the answer finally. I use this ntlm module(https://www.npmjs.org/package/ntlm) to do the ntlm Authentication. And it doesn't work because I use wrong username. I found it from debug log and you can also found this info in the adfs machine's event view(it will have error info). I'm sorry for the stupid mistake, but not bad now I know ntlm well. Thanks Alireza. Thanks all:-)
来源:https://stackoverflow.com/questions/24710843/ntlm-authentication-failed-the-server-finally-response-401-but-not-200-ok