| 1 | // Copyright (C) 2017 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | // |
| 5 | // W A R N I N G |
| 6 | // ------------- |
| 7 | // |
| 8 | // This file is not part of the Qt API. It exists for the convenience |
| 9 | // of the Network Access API. This header file may change from |
| 10 | // version to version without notice, or even be removed. |
| 11 | // |
| 12 | // We mean it. |
| 13 | // |
| 14 | |
| 15 | #ifndef QABSTRACTQOAUTH_P_H |
| 16 | #define QABSTRACTQOAUTH_P_H |
| 17 | |
| 18 | #include <private/qobject_p.h> |
| 19 | |
| 20 | #include <QtNetworkAuth/qoauthglobal.h> |
| 21 | #include <QtNetworkAuth/qabstractoauth.h> |
| 22 | #include <QtNetworkAuth/qoauthoobreplyhandler.h> |
| 23 | |
| 24 | #include <QtCore/qurl.h> |
| 25 | #include <QtCore/qglobal.h> |
| 26 | #include <QtCore/qvariant.h> |
| 27 | #include <QtCore/qscopedpointer.h> |
| 28 | #include <QtCore/qloggingcategory.h> |
| 29 | |
| 30 | #include <QtNetwork/qtcpserver.h> |
| 31 | #include <QtNetwork/qnetworkaccessmanager.h> |
| 32 | |
| 33 | #include <QtCore/qpointer.h> |
| 34 | |
| 35 | QT_BEGIN_NAMESPACE |
| 36 | |
| 37 | class QUrlQuery; |
| 38 | |
| 39 | class Q_AUTOTEST_EXPORT QAbstractOAuthPrivate : public QObjectPrivate |
| 40 | { |
| 41 | Q_DECLARE_PUBLIC(QAbstractOAuth) |
| 42 | |
| 43 | public: |
| 44 | QAbstractOAuthPrivate(const char *loggingCategory, |
| 45 | const QUrl &authorizationUrl, |
| 46 | const QString &clientIdentifier, |
| 47 | QNetworkAccessManager *manager); |
| 48 | ~QAbstractOAuthPrivate(); |
| 49 | |
| 50 | QNetworkAccessManager *networkAccessManager(); |
| 51 | void setStatus(QAbstractOAuth::Status status); |
| 52 | static QByteArray generateRandomBase64String(quint8 length); |
| 53 | void setExtraTokens(const QVariantMap &tokens); |
| 54 | |
| 55 | const QLoggingCategory loggingCategory; |
| 56 | QString clientIdentifier; |
| 57 | QString token; |
| 58 | |
| 59 | // Resource Owner Authorization: https://tools.ietf.org/html/rfc5849#section-2.2 |
| 60 | QUrl authorizationUrl; |
| 61 | QVariantMap extraTokens; |
| 62 | QAbstractOAuth::Status status = QAbstractOAuth::Status::NotAuthenticated; |
| 63 | QNetworkAccessManager::Operation operation; |
| 64 | QPointer<QAbstractOAuthReplyHandler> replyHandler; |
| 65 | QScopedPointer<QOAuthOobReplyHandler> defaultReplyHandler; |
| 66 | QPointer<QNetworkAccessManager> networkAccessManagerPointer; |
| 67 | QAbstractOAuth::ModifyParametersFunction modifyParametersFunction; |
| 68 | QAbstractOAuth::ContentType contentType = QAbstractOAuth::ContentType::WwwFormUrlEncoded; |
| 69 | |
| 70 | QByteArray convertParameters(const QVariantMap ¶meters); |
| 71 | void addContentTypeHeaders(QNetworkRequest *request); |
| 72 | |
| 73 | static QUrlQuery createQuery(const QMultiMap<QString, QVariant> ¶meters); |
| 74 | }; |
| 75 | |
| 76 | QT_END_NAMESPACE |
| 77 | |
| 78 | #endif // QABSTRACTQOAUTH_H |
| 79 |
