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 QABSTRACTOAUTH2_P_H
16#define QABSTRACTOAUTH2_P_H
17
18#ifndef QT_NO_HTTP
19
20#include <optional>
21
22#include <private/qabstractoauth_p.h>
23
24#include <QtNetworkAuth/qoauthglobal.h>
25#include <QtNetworkAuth/qabstractoauth2.h>
26
27#include <QtCore/qurl.h>
28#include <QtCore/qstring.h>
29#include <QtCore/qpointer.h>
30
31#include <QtNetwork/qnetworkreply.h>
32
33QT_BEGIN_NAMESPACE
34
35class QNetworkAccessManager;
36
37class QAbstractOAuth2Private : public QAbstractOAuthPrivate
38{
39 Q_DECLARE_PUBLIC(QAbstractOAuth2)
40
41public:
42 QAbstractOAuth2Private(const QPair<QString, QString> &clientCredentials,
43 const QUrl &authorizationUrl, QNetworkAccessManager *manager = nullptr);
44 ~QAbstractOAuth2Private();
45
46 static QString generateRandomState();
47 QNetworkRequest createRequest(QUrl url, const QVariantMap *parameters = nullptr);
48
49 QString clientIdentifierSharedKey;
50 QString scope;
51 QString state = generateRandomState();
52 QString userAgent = QStringLiteral("QtOAuth/1.0 (+https://www.qt.io)");
53 QString responseType;
54 const QString bearerFormat = QStringLiteral("Bearer %1"); // Case sensitive
55 QDateTime expiresAt;
56 QString refreshToken;
57#ifndef QT_NO_SSL
58 std::optional<QSslConfiguration> sslConfiguration;
59#endif
60
61 struct OAuth2KeyString
62 {
63 static const QString accessToken;
64 static const QString apiKey;
65 static const QString clientIdentifier;
66 static const QString clientSharedSecret;
67 static const QString code;
68 static const QString error;
69 static const QString errorDescription;
70 static const QString errorUri;
71 static const QString expiresIn;
72 static const QString grantType;
73 static const QString redirectUri;
74 static const QString refreshToken;
75 static const QString responseType;
76 static const QString scope;
77 static const QString state;
78 static const QString tokenType;
79 };
80};
81
82QT_END_NAMESPACE
83
84#endif // QT_NO_HTTP
85
86#endif // QABSTRACTOAUTH2_P_H
87

source code of qtnetworkauth/src/oauth/qabstractoauth2_p.h