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 | #ifndef QT_NO_HTTP |
19 | |
20 | #include <private/qobject_p.h> |
21 | |
22 | #include <QtNetworkAuth/qoauthglobal.h> |
23 | #include <QtNetworkAuth/qabstractoauth.h> |
24 | #include <QtNetworkAuth/qoauthoobreplyhandler.h> |
25 | |
26 | #include <QtCore/qurl.h> |
27 | #include <QtCore/qglobal.h> |
28 | #include <QtCore/qvariant.h> |
29 | #include <QtCore/qscopedpointer.h> |
30 | #include <QtCore/qloggingcategory.h> |
31 | |
32 | #include <QtNetwork/qtcpserver.h> |
33 | #include <QtNetwork/qnetworkaccessmanager.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 generateRandomString(quint8 length); |
53 | |
54 | const QLoggingCategory loggingCategory; |
55 | QString clientIdentifier; |
56 | QString token; |
57 | |
58 | // Resource Owner Authorization: https://tools.ietf.org/html/rfc5849#section-2.2 |
59 | QUrl authorizationUrl; |
60 | QVariantMap extraTokens; |
61 | QAbstractOAuth::Status status = QAbstractOAuth::Status::NotAuthenticated; |
62 | QNetworkAccessManager::Operation operation; |
63 | QPointer<QAbstractOAuthReplyHandler> replyHandler; |
64 | QScopedPointer<QOAuthOobReplyHandler> defaultReplyHandler; |
65 | QPointer<QNetworkAccessManager> networkAccessManagerPointer; |
66 | QAbstractOAuth::ModifyParametersFunction modifyParametersFunction; |
67 | QAbstractOAuth::ContentType contentType = QAbstractOAuth::ContentType::WwwFormUrlEncoded; |
68 | |
69 | QByteArray convertParameters(const QVariantMap ¶meters); |
70 | void addContentTypeHeaders(QNetworkRequest *request); |
71 | |
72 | static QUrlQuery createQuery(const QMultiMap<QString, QVariant> ¶meters); |
73 | }; |
74 | |
75 | QT_END_NAMESPACE |
76 | |
77 | #endif // QT_NO_HTTP |
78 | |
79 | #endif // QABSTRACTQOAUTH_H |
80 |