Handles replies to OAuth authentication requests. 更多...
头: | #include <QAbstractOAuthReplyHandler> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS NetworkAuth)
target_link_libraries(mytarget PRIVATE Qt6::NetworkAuth) |
qmake: | QT += networkauth |
继承: | QObject |
QAbstractOAuthReplyHandler (QObject * parent = nullptr) | |
virtual | ~QAbstractOAuthReplyHandler () |
virtual QString | callback () const = 0 |
virtual void | networkReplyFinished (QNetworkReply * reply ) = 0 |
void | callbackDataReceived (const QByteArray & data ) |
void | callbackReceived (const QVariantMap & 值 ) |
void | replyDataReceived (const QByteArray & data ) |
(从 6.6 起)
void
|
tokenRequestErrorOccurred (QAbstractOAuth::Error error , const QString & errorString ) |
void | tokensReceived (const QVariantMap & tokens ) |
The QAbstractOAuthReplyHandler class handles the answers to all OAuth authentication requests. This class is designed as a base whose subclasses implement custom behavior in the callback () 和 networkReplyFinished () 方法。
[explicit]
QAbstractOAuthReplyHandler::
QAbstractOAuthReplyHandler
(
QObject
*
parent
= nullptr)
Constructs a reply handler as a child of parent .
[virtual noexcept]
QAbstractOAuthReplyHandler::
~QAbstractOAuthReplyHandler
()
Destroys the reply handler.
[pure virtual]
QString
QAbstractOAuthReplyHandler::
callback
() const
Returns an absolute URI that the server will redirect the resource owner back to when the Resource Owner Authorization step is completed. If the client is unable to receive callbacks or a callback URI has been established via other means, the parameter value must be set to "oob" (all lower-case), to indicate an out-of-band configuration.
Derived classes should implement this function to provide the expected callback type.
[signal]
void
QAbstractOAuthReplyHandler::
callbackDataReceived
(const
QByteArray
&
data
)
This signal is emitted when a callback request is received: data contains the information before parsing.
[signal]
void
QAbstractOAuthReplyHandler::
callbackReceived
(const
QVariantMap
&
值
)
This signal is emitted when the reply from the server is received, with 值 containing the token credentials and any additional information the server may have returned. When this signal is emitted, the authorization process is complete.
[pure virtual slot]
void
QAbstractOAuthReplyHandler::
networkReplyFinished
(
QNetworkReply
*
reply
)
After the server determines whether the request is valid this function will be called. Reimplement it to get the data received from the server wrapped in reply . reply will be automatically deleted using deleteLater (), it thus must not be stored beyond the scope of this function.
[signal]
void
QAbstractOAuthReplyHandler::
replyDataReceived
(const
QByteArray
&
data
)
This signal is emitted when an HTTP request finishes and the data is available. data contains the response before parsing.
[signal, since 6.6]
void
QAbstractOAuthReplyHandler::
tokenRequestErrorOccurred
(
QAbstractOAuth::Error
error
, const
QString
&
errorString
)
This signal is emitted when a token request or refresh error has occurred. The errorString may provide further details on the error.
该函数在 Qt 6.6 引入。
另请参阅 QAbstractOAuth::requestFailed ().
[signal]
void
QAbstractOAuthReplyHandler::
tokensReceived
(const
QVariantMap
&
tokens
)
This signal is emitted when new tokens are received from the server.