NTLM Authentication Failed, the server finally response “401”, but not “200 OK”

亡梦爱人 提交于 2019-12-11 02:59:05

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!