Hy@everybody,

in the last few days I play around with QWebKit (and network). I only wanna do a simple thing: I want do dowload only a simple webpage. My problem is the proxy in our comapny, it requires and authentication. All works well. But I want to setup my program in the way the the user should not setup the proxy himself. I have searched the web for it and find out that (in Windows) the key-technique is SPPI (NTLM) => and here is my problem:How can I tell Qt to use SSPI instead of "handmade" proxy username and password. I only can get the hostname and the port, but the username and password has to be sent from windows (secutiry) itself (using SSPI).

Here is my Testcode (only.cpp):
Qt Code:
  1. #include "httpui.h"
  2.  
  3. HttpUi::HttpUi(QWidget *parent, Qt::WFlags flags)
  4. : QMainWindow(parent, flags)
  5. {
  6. ui.setupUi(this);
  7.  
  8. nam = new QNetworkAccessManager(this);
  9. HideWidgets();
  10. connect(ui.getButton,SIGNAL(clicked()),this,SLOT(activateGetWidgets()));
  11. connect(ui.submitButton,SIGNAL(clicked()),this,SLOT(DoHttpGet()));
  12. connect(ui.resetButton,SIGNAL(clicked()),this,SLOT(clearWidgets()));
  13. connect(nam,SIGNAL(finished(QNetworkReply*)),this,SLOT(finished(QNetworkReply*)));
  14. connect(ui.postButton,SIGNAL(clicked()),this,SLOT(activatePostWidgets()));
  15.  
  16. connect(nam, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), this, SLOT(onProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));
  17. }
  18.  
  19. HttpUi::~HttpUi()
  20. {
  21.  
  22. }
  23.  
  24. void HttpUi::onProxyAuthenticationRequired(const QNetworkProxy &prox, QAuthenticator *auth)
  25. {
  26. auth->setUser("myuser");
  27. auth->setPassword("mypassword");
  28. }
  29.  
  30. void HttpUi::changeEvent(QEvent *e)
  31. {
  32. QMainWindow::changeEvent(e);
  33. switch (e->type()) {
  34. case QEvent::LanguageChange:
  35. ui.retranslateUi(this);
  36. break;
  37. default:
  38. break;
  39. }
  40. }
  41.  
  42. void HttpUi::activateGetWidgets()
  43. {
  44. ui.urlLabel->setHidden(false);
  45. ui.urlLine->setHidden(false);
  46. ui.submitButton->setHidden(false);
  47. ui.textBrowser->setHidden(false);
  48. ui.responseTitleLabel->setHidden(false);
  49. ui.getButton->setHidden(true);
  50. ui.postButton->setHidden(true);
  51.  
  52. }
  53.  
  54. void HttpUi::activatePostWidgets()
  55. {
  56. ui.dataLabel->setHidden(false);
  57. ui.dataLine->setHidden(false);
  58. activateGetWidgets();
  59.  
  60. }
  61.  
  62.  
  63.  
  64. void HttpUi::finished(QNetworkReply *reply)
  65. {
  66. if(reply->error() == QNetworkReply::NoError)
  67. {
  68. ui.textBrowser->setText(reply->readAll());
  69.  
  70. }
  71. else
  72. {
  73. ui.textBrowser->setText(reply->errorString());
  74. }
  75. }
  76.  
  77. void HttpUi::DoHttpGet()
  78. {
  79. ui.resetButton->setHidden(false);
  80. QString url = ui.urlLine->text();
  81. QString data = ui.dataLine->text();
  82. QByteArray postData;
  83. postData.append(data.toAscii());
  84. if(postData.isEmpty() == true)
  85. {
  86. nam->get(QNetworkRequest(QUrl(url)));
  87. }
  88. else
  89. {
  90. nam->post(QNetworkRequest(QUrl(url)),postData);
  91. }
  92.  
  93. }
  94.  
  95. void HttpUi::HideWidgets()
  96. {
  97. ui.urlLabel->setHidden(true);
  98. ui.urlLine->setHidden(true);
  99. ui.dataLabel->setHidden(true);
  100. ui.dataLine->setHidden(true);
  101. ui.submitButton->setHidden(true);
  102. ui.responseTitleLabel->setHidden(true);
  103. ui.textBrowser->setHidden(true);
  104. ui.resetButton->setHidden(true);
  105.  
  106. }
  107.  
  108. void HttpUi::clearWidgets()
  109. {
  110. ui.urlLabel->setHidden(true);
  111. ui.urlLine->setHidden(true);
  112. ui.dataLabel->setHidden(true);
  113. ui.dataLine->setHidden(true);
  114. ui.submitButton->setHidden(true);
  115. ui.responseTitleLabel->setHidden(true);
  116. ui.textBrowser->setHidden(true);
  117. ui.resetButton->setHidden(true);
  118. ui.urlLine->clear();
  119. ui.textBrowser->clear();
  120. ui.dataLine->clear();
  121. ui.getButton->setHidden(false);
  122. ui.postButton->setHidden(false);
  123.  
  124. }
To copy to clipboard, switch view to plain text mode 
The code is from here. I only add the connect for proxyAuthenticationRequired-SIGNAL => so if a password is required i can set it.
I can't get it work over SPPI because I don't know how to use SSPI in Qt!

So my question is: How can I use SSPI-Authentication instead of setting it myself?

Qt: 4.7.3
OS: Windows 7 x64

Greetings
Tonka