5#ifndef QAUTHENTICATOR_P_H
6#define QAUTHENTICATOR_P_H
19#include <QtNetwork/private/qtnetworkglobal_p.h>
21#include <qbytearray.h>
23#include <qauthenticator.h>
30class QHttpResponseHeader;
33class QSSPIWindowsHandles;
34#elif QT_CONFIG(gssapi)
41 enum Method { None, Basic, Negotiate, Ntlm, DigestMd5, };
42 QAuthenticatorPrivate();
44 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QAuthenticatorPrivate)
45 void swap(QAuthenticatorPrivate &other)
noexcept
47 user.swap(other.user);
48 extractedUser.swap(other.extractedUser);
49 password.swap(other.password);
50 options.swap(other.options);
51 std::swap(method, other.method);
52 realm.swap(other.realm);
53 challenge.swap(other.challenge);
55 sspiWindowsHandles.swap(other.sspiWindowsHandles);
56#elif QT_CONFIG(gssapi)
57 gssApiHandles.swap(other.gssApiHandles);
59 std::swap(hasFailed, other.hasFailed);
60 std::swap(phase, other.phase);
61 cnonce.swap(other.cnonce);
62 std::swap(nonceCount, other.nonceCount);
63 workstation.swap(other.workstation);
64 userDomain.swap(other.userDomain);
67 ~QAuthenticatorPrivate();
70 QString extractedUser;
77 std::unique_ptr<QSSPIWindowsHandles> sspiWindowsHandles;
78#elif QT_CONFIG(gssapi)
79 std::unique_ptr<QGssApiHandles> gssApiHandles;
100 QByteArray calculateResponse(QByteArrayView method, QByteArrayView path, QStringView host);
102 inline static QAuthenticatorPrivate *getPrivate(QAuthenticator &auth) {
return auth.d; }
103 inline static const QAuthenticatorPrivate *getPrivate(
const QAuthenticator &auth) {
return auth.d; }
105 QByteArray digestMd5Response(QByteArrayView challenge, QByteArrayView method,
106 QByteArrayView path);
107 static QHash<QByteArray, QByteArray>
108 parseDigestAuthenticationChallenge(QByteArrayView challenge);
110 void parseHttpResponse(
const QHttpHeaders &headers,
bool isProxy, QStringView host);
111 void updateCredentials();
113 static bool isMethodSupported(QByteArrayView method);
QByteArray targetInfoBuff
unsigned char challenge[8]
QByteArray ntlmResponseBuf
static QByteArray clientChallenge(const QAuthenticatorPrivate *ctx)
static QByteArray qNtlmPhase1()
#define NTLMSSP_NEGOTIATE_NTLM2
#define NTLMSSP_NEGOTIATE_TARGET_INFO
static QByteArray qStringAsUcs2Le(const QString &src)
static QByteArray qEncodeLmv2Response(const QAuthenticatorPrivate *ctx, const QNtlmPhase2Block &ch, QNtlmPhase3Block *phase3)
static bool verifyDigestMD5(QByteArrayView value)
static bool containsAuth(QByteArrayView data)
static int qEncodeNtlmString(QNtlmBuffer &buf, int offset, const QString &s, bool unicode)
static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray &phase2data)
QByteArray qEncodeHmacMd5(QByteArray &key, QByteArrayView message)
#define NTLMSSP_NEGOTIATE_OEM
static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, const QNtlmPhase2Block &ch, QNtlmPhase3Block *phase3)
static QByteArray digestMd5ResponseHelper(QByteArrayView alg, QByteArrayView userName, QByteArrayView realm, QByteArrayView password, QByteArrayView nonce, QByteArrayView nonceCount, QByteArrayView cNonce, QByteArrayView qop, QByteArrayView method, QByteArrayView digestUri, QByteArrayView hEntity)
static QDataStream & operator>>(QDataStream &s, QNtlmBuffer &b)
static QByteArray qCreatev2Hash(const QAuthenticatorPrivate *ctx, QNtlmPhase3Block *phase3)
static void qStreamNtlmBuffer(QDataStream &ds, const QByteArray &s)
#define NTLMSSP_REQUEST_TARGET
static QString qStringFromUcs2Le(QByteArray src)
static void qStreamNtlmString(QDataStream &ds, const QString &s, bool unicode)
#define NTLMSSP_NEGOTIATE_NTLM
static QByteArray qExtractServerTime(const QByteArray &targetInfoBuff)
#define NTLMSSP_NEGOTIATE_UNICODE
static int qEncodeNtlmBuffer(QNtlmBuffer &buf, int offset, const QByteArray &s)
const quint8 hirespversion
#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN
static bool qNtlmDecodePhase2(const QByteArray &data, QNtlmPhase2Block &ch)
#define Q_LOGGING_CATEGORY(name,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)