| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2017 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt Network Auth module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 or (at your option) any later version |
| 20 | ** approved by the KDE Free Qt Foundation. The licenses are as published by |
| 21 | ** the Free Software Foundation and appearing in the file LICENSE.GPL3 |
| 22 | ** included in the packaging of this file. Please review the following |
| 23 | ** information to ensure the GNU General Public License requirements will |
| 24 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 25 | ** |
| 26 | ** $QT_END_LICENSE$ |
| 27 | ** |
| 28 | ****************************************************************************/ |
| 29 | |
| 30 | #include <QtNetwork/qtnetwork-config.h> |
| 31 | |
| 32 | #ifndef QT_NO_HTTP |
| 33 | |
| 34 | #include "qabstractoauthreplyhandler.h" |
| 35 | #include "qabstractoauthreplyhandler_p.h" |
| 36 | |
| 37 | Q_LOGGING_CATEGORY(lcReplyHandler, "qt.networkauth.replyhandler" ) |
| 38 | |
| 39 | QT_BEGIN_NAMESPACE |
| 40 | |
| 41 | /*! |
| 42 | \class QAbstractOAuthReplyHandler |
| 43 | \inmodule QtNetworkAuth |
| 44 | \ingroup oauth |
| 45 | \brief Handles replies to OAuth authentication requests. |
| 46 | \since 5.8 |
| 47 | |
| 48 | The QAbstractOAuthReplyHandler class handles the answers |
| 49 | to all OAuth authentication requests. |
| 50 | This class is designed as a base whose subclasses implement |
| 51 | custom behavior in the callback() and networkReplyFinished() |
| 52 | methods. |
| 53 | */ |
| 54 | |
| 55 | /*! |
| 56 | \fn QString QAbstractOAuthReplyHandler::callback() const |
| 57 | |
| 58 | Returns an absolute URI that the server will redirect the |
| 59 | resource owner back to when the Resource Owner Authorization step |
| 60 | is completed. If the client is unable to receive callbacks or a |
| 61 | callback URI has been established via other means, the parameter |
| 62 | value \b must be set to "oob" (all lower-case), to indicate an |
| 63 | out-of-band configuration. |
| 64 | |
| 65 | Derived classes should implement this function to provide the |
| 66 | expected callback type. |
| 67 | */ |
| 68 | |
| 69 | /*! |
| 70 | \fn void QAbstractOAuthReplyHandler::networkReplyFinished(QNetworkReply *reply) |
| 71 | |
| 72 | After the server determines whether the request is valid this |
| 73 | function will be called. Reimplement it to get the data received |
| 74 | from the server wrapped in \a reply. |
| 75 | */ |
| 76 | |
| 77 | /*! |
| 78 | \fn void QAbstractOAuthReplyHandler::callbackReceived(const QVariantMap &values) |
| 79 | |
| 80 | This signal is emitted when the reply from the server is |
| 81 | received, with \a values containing the token credentials |
| 82 | and any additional information the server may have returned. |
| 83 | When this signal is emitted, the authorization process |
| 84 | is complete. |
| 85 | */ |
| 86 | |
| 87 | /*! |
| 88 | \fn void QAbstractOAuthReplyHandler::tokensReceived(const QVariantMap &tokens) |
| 89 | |
| 90 | This signal is emitted when new \a tokens are received from the |
| 91 | server. |
| 92 | */ |
| 93 | |
| 94 | /*! |
| 95 | \fn void QAbstractOAuthReplyHandler::replyDataReceived(const QByteArray &data) |
| 96 | |
| 97 | This signal is emitted when an HTTP request finishes and the |
| 98 | data is available. \a data contains the response before parsing. |
| 99 | */ |
| 100 | |
| 101 | /*! |
| 102 | \fn void QAbstractOAuthReplyHandler::callbackDataReceived(const QByteArray &data) |
| 103 | |
| 104 | This signal is emitted when a callback request is received: |
| 105 | \a data contains the information before parsing. |
| 106 | */ |
| 107 | |
| 108 | /*! |
| 109 | Constructs a reply handler as a child of \a parent. |
| 110 | */ |
| 111 | QAbstractOAuthReplyHandler::QAbstractOAuthReplyHandler(QObject *parent) |
| 112 | : QObject(parent) |
| 113 | {} |
| 114 | |
| 115 | /*! |
| 116 | Destroys the reply handler. |
| 117 | */ |
| 118 | QAbstractOAuthReplyHandler::~QAbstractOAuthReplyHandler() |
| 119 | {} |
| 120 | |
| 121 | /*! \internal */ |
| 122 | QAbstractOAuthReplyHandler::QAbstractOAuthReplyHandler(QObjectPrivate &d, QObject *parent) |
| 123 | : QObject(d, parent) |
| 124 | {} |
| 125 | |
| 126 | QT_END_NAMESPACE |
| 127 | |
| 128 | #endif // QT_NO_HTTP |
| 129 | |