PDA

View Full Version : login as a domain user on http



orgads
17th August 2009, 13:12
Hello,

I'm trying to read from http server using QNetworkAccessManager. This server requires logging in as a domain user. I tried using http://domain\user:password@remote.host/path/file.html

I get a 401 reply (authentication error).

Using the same method for ftp connection does work!

I tried QHttp and even QtWebkit - same response.

Any ideas?

yogeshgokul
17th August 2009, 13:21
This seems to be a standard http authentication.
You have to do something like this:


QString credentials = m_userName + ":" + m_password;
credentials = credentials.toUtf8().toBase64();
credentials = "Basic " + credentials;
header.setValue("Authorization",credentials);

Please notice toBase64.

orgads
19th August 2009, 09:42
This seems to be a standard http authentication.
You have to do something like this:


QString credentials = m_userName + ":" + m_password;
credentials = credentials.toUtf8().toBase64();
credentials = "Basic " + credentials;
header.setValue("Authorization",credentials);

Please notice toBase64.

The server doesn't support Basic authentication. It supports NTLM and Negotiate.

I traced it with WireShark, and Qt IS using NTLM, but it doesn't work... The negotiation seems quite similar to Firefox (of course, different challenge results in different response), which does work!

Any ideas?