NTLM认证登录问题---关于域用户
QNetworkAccessManager* m_pNetworkManager = new QNetworkAccessManager(this);connect(m_pNetworkManager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
SLOT(slot_authenticationRequired(QNetworkReply*, QAuthenticator*)));
m_pNetworkReply = m_pNetworkManager->post(netRequest,contentByteArray);//发起post请求
void Httpxxx::slot_authenticationRequired(QNetworkReply *reply, QAuthenticator *auth)
{
auth->setUser(m_strUserName);
auth->setPassword(m_strPassWord);
}
非域用户的情况下在发送post请求后,会调用slot_authenticationRequired,为什么域用户的情况下就不再调用了,而是直接用当前登录的域用户进行了验证,想用自己设置的其它用户登录应该如何设置?
官方文档有这么一句话,但不知道如何处理?
在QAuthenticator的说明中:
NTLM version 2
The NTLM authentication mechanism currently supports no incoming or outgoing options.On Windows, if no user has been set,domain\user credentials will be searched for on the local system to enable Single-Sign-On functionality.
这个no user has been set ,如何 进行set ?
本帖最后由 hechengjin 于 2016-7-5 16:26 编辑
http://stackoverflow.com/questio ... uthentication-in-qt
https://bugreports.qt.io/browse/QTBUG-44096***
For https://bugreports.qt.io/browse/QTBUG-44096?focusedCommentId=301159&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-301159diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index a744688..a3ffad6 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -497,7 +497,6 @@ void QHttpSocketEngine::slotSocketConnected()
QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
//qDebug() << "slotSocketConnected: priv=" << priv << (priv ? (int)priv->method : -1);
if (priv && priv->method != QAuthenticatorPrivate::None) {
- d->credentialsSent = true;
data += "Proxy-Authorization: " + priv->calculateResponse(method, path);
data += "\r\n";
}
@@ -627,8 +626,10 @@ void QHttpSocketEngine::slotSocketReadNotification()
d->reply = new QHttpNetworkReply;
}
- if (priv->phase == QAuthenticatorPrivate::Done)
+ if (priv->phase == QAuthenticatorPrivate::Done) {
emit proxyAuthenticationRequired(d->proxy, &d->authenticator);
+ d->credentialsSent = true;
+ }
// priv->phase will get reset to QAuthenticatorPrivate::Start if the authenticator got modified in the signal above.
if (priv->phase == QAuthenticatorPrivate::Done) {
setError(QAbstractSocket::ProxyAuthenticationRequiredError, tr("Authentication required"));http://blog.okbase.net/bruceteen/archive/245.html
http://stackoverflow.com/questions/35074075/qt-authenticationrequired-over-https-and-downloading-file
页:
[1]