Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2005|回复: 2
打印 上一主题 下一主题

NTLM认证登录问题---关于域用户

[复制链接]

388

主题

602

帖子

2218

积分

金牌会员

Rank: 6Rank: 6

积分
2218
跳转到指定楼层
楼主
发表于 2016-7-4 14:54:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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 ?
回复

使用道具 举报

388

主题

602

帖子

2218

积分

金牌会员

Rank: 6Rank: 6

积分
2218
沙发
 楼主| 发表于 2016-7-4 14:55:58 | 只看该作者
本帖最后由 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-301159
  1. diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
  2. index a744688..a3ffad6 100644
  3. --- a/src/network/socket/qhttpsocketengine.cpp
  4. +++ b/src/network/socket/qhttpsocketengine.cpp
  5. @@ -497,7 +497,6 @@ void QHttpSocketEngine::slotSocketConnected()
  6.      QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
  7.      //qDebug() << "slotSocketConnected: priv=" << priv << (priv ? (int)priv->method : -1);
  8.      if (priv && priv->method != QAuthenticatorPrivate::None) {
  9. -        d->credentialsSent = true;
  10.          data += "Proxy-Authorization: " + priv->calculateResponse(method, path);
  11.          data += "\r\n";
  12.      }
  13. @@ -627,8 +626,10 @@ void QHttpSocketEngine::slotSocketReadNotification()
  14.              d->reply = new QHttpNetworkReply;
  15.          }

  16. -        if (priv->phase == QAuthenticatorPrivate::Done)
  17. +        if (priv->phase == QAuthenticatorPrivate::Done) {
  18.              emit proxyAuthenticationRequired(d->proxy, &d->authenticator);
  19. +            d->credentialsSent = true;
  20. +        }
  21.          // priv->phase will get reset to QAuthenticatorPrivate::Start if the authenticator got modified in the signal above.
  22.          if (priv->phase == QAuthenticatorPrivate::Done) {
  23.              setError(QAbstractSocket::ProxyAuthenticationRequiredError, tr("Authentication required"));
复制代码
http://blog.okbase.net/bruceteen/archive/245.html


回复 支持 反对

使用道具 举报

388

主题

602

帖子

2218

积分

金牌会员

Rank: 6Rank: 6

积分
2218
板凳
 楼主| 发表于 2016-7-4 15:26:55 | 只看该作者
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-13 15:19 , Processed in 0.062144 second(s), 18 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表