| 1 | // Copyright (C) 2017 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include "qabstractoauthreplyhandler.h" |
| 5 | #include "qabstractoauthreplyhandler_p.h" |
| 6 | |
| 7 | Q_LOGGING_CATEGORY(lcReplyHandler, "qt.networkauth.replyhandler" ) |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | /*! |
| 12 | \class QAbstractOAuthReplyHandler |
| 13 | \inmodule QtNetworkAuth |
| 14 | \ingroup oauth |
| 15 | \brief Handles replies to OAuth authentication requests. |
| 16 | \since 5.8 |
| 17 | |
| 18 | The QAbstractOAuthReplyHandler class handles the answers |
| 19 | to all OAuth authentication requests. |
| 20 | This class is designed as a base whose subclasses implement |
| 21 | custom behavior in the callback() and networkReplyFinished() |
| 22 | methods. |
| 23 | */ |
| 24 | |
| 25 | /*! |
| 26 | \fn QString QAbstractOAuthReplyHandler::callback() const |
| 27 | |
| 28 | Returns an absolute URI that the server will redirect the |
| 29 | resource owner back to when the Resource Owner Authorization step |
| 30 | is completed. If the client is unable to receive callbacks or a |
| 31 | callback URI has been established via other means, the parameter |
| 32 | value \b must be set to "oob" (all lower-case), to indicate an |
| 33 | out-of-band configuration. |
| 34 | |
| 35 | Derived classes should implement this function to provide the |
| 36 | expected callback type. |
| 37 | */ |
| 38 | |
| 39 | /*! |
| 40 | \fn void QAbstractOAuthReplyHandler::networkReplyFinished(QNetworkReply *reply) |
| 41 | |
| 42 | After the server determines whether the request is valid this |
| 43 | function will be called. Reimplement it to get the data received |
| 44 | from the server wrapped in \a reply. \a reply will be automatically |
| 45 | deleted using deleteLater(), it thus must not be stored beyond the |
| 46 | scope of this function. |
| 47 | |
| 48 | */ |
| 49 | |
| 50 | /*! |
| 51 | \fn void QAbstractOAuthReplyHandler::callbackReceived(const QVariantMap &values) |
| 52 | |
| 53 | This signal is emitted when the reply from the server is |
| 54 | received, with \a values containing the token credentials |
| 55 | and any additional information the server may have returned. |
| 56 | When this signal is emitted, the authorization process |
| 57 | is complete. |
| 58 | */ |
| 59 | |
| 60 | /*! |
| 61 | \fn void QAbstractOAuthReplyHandler::tokensReceived(const QVariantMap &tokens) |
| 62 | |
| 63 | This signal is emitted when new \a tokens are received from the |
| 64 | server. |
| 65 | */ |
| 66 | |
| 67 | /*! |
| 68 | |
| 69 | \fn void QAbstractOAuthReplyHandler::tokenRequestErrorOccurred(QAbstractOAuth::Error error, |
| 70 | const QString& errorString) |
| 71 | |
| 72 | This signal is emitted when a token request or refresh \a error has |
| 73 | occurred. The \a errorString may provide further details on the error. |
| 74 | |
| 75 | \sa QAbstractOAuth::requestFailed() |
| 76 | \since 6.6 |
| 77 | */ |
| 78 | |
| 79 | /*! |
| 80 | \fn void QAbstractOAuthReplyHandler::replyDataReceived(const QByteArray &data) |
| 81 | |
| 82 | This signal is emitted when an HTTP request finishes and the |
| 83 | data is available. \a data contains the response before parsing. |
| 84 | */ |
| 85 | |
| 86 | /*! |
| 87 | \fn void QAbstractOAuthReplyHandler::callbackDataReceived(const QByteArray &data) |
| 88 | |
| 89 | This signal is emitted when a callback request is received: |
| 90 | \a data contains the information before parsing. |
| 91 | */ |
| 92 | |
| 93 | /*! |
| 94 | Constructs a reply handler as a child of \a parent. |
| 95 | */ |
| 96 | QAbstractOAuthReplyHandler::QAbstractOAuthReplyHandler(QObject *parent) |
| 97 | : QObject(parent) |
| 98 | {} |
| 99 | |
| 100 | /*! |
| 101 | Destroys the reply handler. |
| 102 | */ |
| 103 | QAbstractOAuthReplyHandler::~QAbstractOAuthReplyHandler() |
| 104 | {} |
| 105 | |
| 106 | /*! \internal */ |
| 107 | QAbstractOAuthReplyHandler::QAbstractOAuthReplyHandler(QObjectPrivate &d, QObject *parent) |
| 108 | : QObject(d, parent) |
| 109 | {} |
| 110 | |
| 111 | QT_END_NAMESPACE |
| 112 | |