Hi @Sandeep Murusupalli
Thanks a lot for your response and solution. I’ll try this…
In my understanding, it is not only about Headers, for Microsoft NTLM, any logic should implement the below “Process Flow”. So I’ve used Apache HTTPClient Libs in my Java code.
“Windows integrated authentication” is what’s known as NTLM authentication. When you receive a HTTP 401 from IIS with aWWW-Authenticate
header containingNTLM
.
1.The client requests a protected resource from the server:
GET /index.html HTTP/1.1
2.The server responds with a401
status, indicating that the client must authenticate.NTLM
is presented as a supported authentication mechanism via theWWW-Authenticate
header. Typically, the server closes the connection at this time:
3.HTTP/1.1401Unauthorized
4.WWW-Authenticate: NTLM
Connection: close
Note that Internet Explorer will only select NTLM if it is the first mechanism offered; this is at odds with RFC 2616, which states that the client must select the strongest supported authentication scheme.
5.The client resubmits the request with anAuthorization
header containing aType 1 messageparameter. The Type 1 message is Base-64 encoded for transmission. From this point forward, the connection is kept open; closing the connection requires reauthentication of subsequent requests. This implies that the server and client must support persistent connections, via either the HTTP 1.0-style “Keep-Alive” header or HTTP 1.1 (in which persistent connections are employed by default). The relevant request headers appear as follows:
6.GET /index.html HTTP/1.1
Authorization: NTLM TlRMTVNTUAABAAAABzIAAAYABgArAAAACwALACAAAABXT1JLU1RBVElPTkRPTUFJTg==
7.The server replies with a401
status containing aType 2 messagein theWWW-Authenticate
header (again, Base-64 encoded). This is shown below.
8.HTTP/1.1401Unauthorized
WWW-Authenticate: NTLM TlRMTVNTUAACAAAADAAMADAAAAABAoEAASNFZ4mrze8AAAAAAAAAAGIAYgA8AAAARABPAE0AQQBJAE4AAgAMAEQATwBNAEEASQBOAAEADABTAEUAUgBWAEUAUgAEABQAZABvAG0AYQBpAG4ALgBjAG8AbQADACIAcwBlAHIAdgBlAHIALgBkAG8AbQBhAGkAbgAuAGMAbwBtAAAAAAA=
9.The client responds to the Type 2 message by resubmitting the request with anAuthorization
header containing a Base-64 encodedType 3 message:
10.GET /index.html HTTP/1.1
Authorization: NTLM TlRMTVNTUAADAAAAGAAYAGoAAAAYABgAggAAAAwADABAAAAACAAIAEwAAAAWABYAVAAAAAAAAACaAAAAAQIAAEQATwBNAEEASQBOAHUAcwBlAHIAVwBPAFIASwBTAFQAQQBUAEkATwBOAMM3zVy9RPyXgqZnr21CfG3mfCDC0+d8ViWpjBwx6BhHRmspst9GgPOZWPuMITqcxg==
11.Finally, the server validates the responses in the client’s Type 3 message and allows access to the resource.
HTTP/1.1200 OK
Pls. share me, if u have some other solution. Thanks again.