windowshttpactive-directoryntlmproxy-authentication

Issuing HTTP requests using IE proxy with AD authentication


In a corporate desktop scenario, where the user is logged in to an Active Directory domain, I'd like my application to issue HTTP requests using the same proxy as Internet Explorer uses. The problem is that the proxy requires NTLM authentication using the credentials of the currently logged in user, which is something I don't know how my application could acquire.

Besides asking the user for his/her password (for which I found a lot of solutions), is there a way to do it the right, like using some native API? I'm not picky about programming languages in this case, if it works in this scenario, I accept it, although I'd prefer C/C++.


Solution

  • Since you are on Windows, and you are using domain logins, you should rather rely on Kerberos. Anyway, you now several options:

    1. If you use WinHTTP , you simple have to enable it.
    2. Use libcurl on Windows and it will compile with SSPI support by default.
    3. If you use sockets by yourself, you have to call SSPI with the Negotiate package and exchange tokens per HTTP all by yourself.