QAbstractOAuth2 Class
The QAbstractOAuth2 class is the base of all implementations of OAuth 2 authentication methods. More...
| Header: | #include <QAbstractOAuth2> |
| qmake: | QT += networkauth |
| Since: | Qt 5.8 |
| Inherits: | QAbstractOAuth |
Properties
|
- 3 properties inherited from QAbstractOAuth
Public Functions
| QAbstractOAuth2(QObject *parent = nullptr) | |
| QAbstractOAuth2(QNetworkAccessManager *manager, QObject *parent = nullptr) | |
| ~QAbstractOAuth2() | |
| QString | clientIdentifierSharedKey() const |
| virtual QUrl | createAuthenticatedUrl(const QUrl &url, const QVariantMap ¶meters = QVariantMap()) |
| QDateTime | expirationAt() const |
| virtual QString | responseType() const = 0 |
| QString | scope() const |
| void | setClientIdentifierSharedKey(const QString &clientIdentifierSharedKey) |
| void | setScope(const QString &scope) |
| void | setState(const QString &state) |
| void | setUserAgent(const QString &userAgent) |
| QString | state() const |
| QString | userAgent() const |
- 18 public functions inherited from QAbstractOAuth
Signals
| void | authorizationCallbackReceived(const QVariantMap &data) |
| void | clientIdentifierChanged(const QString &clientIdentifier) |
| void | clientIdentifierSharedKeyChanged(const QString &clientIdentifierSharedKey) |
| void | error(const QString &error, const QString &errorDescription, const QUrl &uri) |
| void | expirationAtChanged(const QDateTime &expiration) |
| void | scopeChanged(const QString &scope) |
| void | stateChanged(const QString &state) |
| void | userAgentChanged(const QString &userAgent) |
- 10 signals inherited from QAbstractOAuth
Protected Functions
| QAbstractOAuth2(QAbstractOAuth2Private &, QObject *parent = nullptr) |
- 3 protected functions inherited from QAbstractOAuth
Additional Inherited Members
- 1 public slot inherited from QAbstractOAuth
- 1 static protected member inherited from QAbstractOAuth
Detailed Description
The QAbstractOAuth2 class is the base of all implementations of OAuth 2 authentication methods.
The class defines the basic interface of the OAuth 2 authentication classes. By inheriting this class, you can create custom authentication methods using the OAuth 2 standard for different web services.
A description of how OAuth 2 works can be found in: The OAuth 2.0 Authorization Framework
Property Documentation
clientIdentifier : const QString
This property holds the client identifier used to identify the application in the authentication process.
Notifier signal:
| void | clientIdentifierChanged(const QString &clientIdentifier) |
clientIdentifierSharedKey : QString
This property holds the client shared key used as a password if the server requires authentication to request the token.
Access functions:
| QString | clientIdentifierSharedKey() const |
| void | setClientIdentifierSharedKey(const QString &clientIdentifierSharedKey) |
Notifier signal:
| void | clientIdentifierSharedKeyChanged(const QString &clientIdentifierSharedKey) |
expiration : const QDateTime
This property holds the expiration time of the current access token.
Access functions:
| QDateTime | expirationAt() const |
Notifier signal:
| void | expirationAtChanged(const QDateTime &expiration) |
scope : QString
This property holds this property holds the desired scope which defines the permissions requested by the client.
Access functions:
| QString | scope() const |
| void | setScope(const QString &scope) |
Notifier signal:
| void | scopeChanged(const QString &scope) |
state : QString
This property holds the string sent to the server during authentication. The state is used to identify and validate the request when the callback is received.
Access functions:
| QString | state() const |
| void | setState(const QString &state) |
Notifier signal:
| void | stateChanged(const QString &state) |
userAgent : QString
This property holds the User-Agent header used to create the network requests.
The default value is "QtOAuth/1.0 (+https://www.qt.io)".
Access functions:
| QString | userAgent() const |
| void | setUserAgent(const QString &userAgent) |
Notifier signal:
| void | userAgentChanged(const QString &userAgent) |
Member Function Documentation
QAbstractOAuth2::QAbstractOAuth2(QObject *parent = nullptr)
Constructs a QAbstractOAuth2 object using parent as parent.
QAbstractOAuth2::QAbstractOAuth2(QNetworkAccessManager *manager, QObject *parent = nullptr)
Constructs a QAbstractOAuth2 object using parent as parent and sets manager as the network access manager.
[protected] QAbstractOAuth2::QAbstractOAuth2(QAbstractOAuth2Private &, QObject *parent = nullptr)
Copy constructor.
QAbstractOAuth2::~QAbstractOAuth2()
Destroys the QAbstractOAuth2 instance.
[signal] void QAbstractOAuth2::authorizationCallbackReceived(const QVariantMap &data)
Signal emitted when the reply server receives the authorization callback from the server: data contains the values received from the server.
[virtual] QUrl QAbstractOAuth2::createAuthenticatedUrl(const QUrl &url, const QVariantMap ¶meters = QVariantMap())
The returned URL is based on url, combining it with the given parameters and the access token.
[signal] void QAbstractOAuth2::error(const QString &error, const QString &errorDescription, const QUrl &uri)
Signal emitted when the server responds to the request with an error: error is the name of the error; description describes the error and uri is an optional URI containing more information about the error.