QAbstractOAuth2#
The QAbstractOAuth2
class is the base of all implementations of OAuth 2 authentication methods. More…
Inherited by: QOAuth2AuthorizationCodeFlow
Synopsis#
Properties#
scope
- This property holds the desired scope which defines the permissions requested by the client
Functions#
def
clientIdentifierSharedKey
()def
expirationAt
()def
refreshToken
()def
responseType
()def
scope
()def
setClientIdentifierSharedKey
(clientIdentifierSharedKey)def
setRefreshToken
(refreshToken)def
setResponseType
(responseType)def
setScope
(scope)def
setSslConfiguration
(configuration)def
setState
(state)def
setUserAgent
(userAgent)def
sslConfiguration
()def
state
()def
userAgent
()
Virtual functions#
def
createAuthenticatedUrl
(url[, parameters=QVariantMap()])def
post
(url, multiPart)def
post
(url, data)def
put
(url, multiPart)def
put
(url, data)
Signals#
def
authorizationCallbackReceived
(data)def
clientIdentifierSharedKeyChanged
(clientIdentifierSharedKey)def
error
(error, errorDescription, uri)def
expirationAtChanged
(expiration)def
refreshTokenChanged
(refreshToken)def
responseTypeChanged
(responseType)def
scopeChanged
(scope)def
sslConfigurationChanged
(configuration)def
stateChanged
(state)def
userAgentChanged
(userAgent)
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
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
- class PySide6.QtNetworkAuth.QAbstractOAuth2(manager[, parent=None])#
PySide6.QtNetworkAuth.QAbstractOAuth2([parent=None])
- Parameters:
manager –
PySide6.QtNetwork.QNetworkAccessManager
parent –
PySide6.QtCore.QObject
Constructs a QAbstractOAuth2
object using parent
as parent and sets manager
as the network access manager.
Constructs a QAbstractOAuth2
object using parent
as parent.
Note
Properties can be used directly when from __feature__ import true_property
is used or via accessor functions otherwise.
This property holds the client shared key used as a password if the server requires authentication to request the token.
- Access functions:
setClientIdentifierSharedKey
(clientIdentifierSharedKey)Signal
clientIdentifierSharedKeyChanged
(clientIdentifierSharedKey)
- property PᅟySide6.QtNetworkAuth.QAbstractOAuth2.expiration: PySide6.QtCore.QDateTime#
This property holds the expiration time of the current access token.
- Access functions:
expirationAt
()Signal
expirationAtChanged
(expiration)
- property PᅟySide6.QtNetworkAuth.QAbstractOAuth2.refreshToken: str#
- Access functions:
refreshToken
()setRefreshToken
(refreshToken)Signal
refreshTokenChanged
(refreshToken)
- property PᅟySide6.QtNetworkAuth.QAbstractOAuth2.scope: str#
This property holds This property holds the desired scope which defines the permissions requested by the client..
- Access functions:
scope
()setScope
(scope)Signal
scopeChanged
(scope)
- property PᅟySide6.QtNetworkAuth.QAbstractOAuth2.state: str#
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:
state
()setState
(state)Signal
stateChanged
(state)
- property PᅟySide6.QtNetworkAuth.QAbstractOAuth2.userAgent: str#
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:
userAgent
()setUserAgent
(userAgent)Signal
userAgentChanged
(userAgent)
- PySide6.QtNetworkAuth.QAbstractOAuth2.authorizationCallbackReceived(data)#
- Parameters:
data – Dictionary with keys of type .QString and values of type QVariant.
Signal emitted when the reply server receives the authorization callback from the server: data
contains the values received from the server.
- PySide6.QtNetworkAuth.QAbstractOAuth2.clientIdentifierSharedKey()#
- Return type:
str
See also
Getter of property clientIdentifierSharedKey
.
- Parameters:
clientIdentifierSharedKey – str
Notification signal of property clientIdentifierSharedKey
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.createAuthenticatedUrl(url[, parameters=QVariantMap()])#
- Parameters:
url –
PySide6.QtCore.QUrl
parameters – Dictionary with keys of type .QString and values of type QVariant.
- Return type:
The returned URL is based on url
, combining it with the given parameters
and the access token.
- PySide6.QtNetworkAuth.QAbstractOAuth2.error(error, errorDescription, uri)#
- Parameters:
error – str
errorDescription – str
uri –
PySide6.QtCore.QUrl
Signal emitted when the server responds to the authorization request with an error as defined in RFC 6749 error response .
error
is the name of the error; errorDescription
describes the error and uri
is an optional URI containing more information about the error.
See also
- PySide6.QtNetworkAuth.QAbstractOAuth2.expirationAt()#
- Return type:
Getter of property expiration
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.expirationAtChanged(expiration)#
- Parameters:
expiration –
PySide6.QtCore.QDateTime
Notification signal of property expiration
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.post(url, multiPart)#
- Parameters:
url –
PySide6.QtCore.QUrl
multiPart –
PySide6.QtNetwork.QHttpMultiPart
- Return type:
This is an overloaded function.
Sends an authenticated POST request and returns a new QNetworkReply. The url
and multiPart
are used to create the request.
{Hypertext Transfer Protocol – HTTP/1.1: POST}
- PySide6.QtNetworkAuth.QAbstractOAuth2.post(url, data)
- Parameters:
url –
PySide6.QtCore.QUrl
data –
PySide6.QtCore.QByteArray
- Return type:
This is an overloaded function.
Sends an authenticated POST request and returns a new QNetworkReply. The url
and data
are used to create the request.
{Hypertext Transfer Protocol – HTTP/1.1: POST}
- PySide6.QtNetworkAuth.QAbstractOAuth2.put(url, multiPart)#
- Parameters:
url –
PySide6.QtCore.QUrl
multiPart –
PySide6.QtNetwork.QHttpMultiPart
- Return type:
This is an overloaded function.
Sends an authenticated PUT request and returns a new QNetworkReply. The url
and multiPart
are used to create the request.
{Hypertext Transfer Protocol – HTTP/1.1: PUT}
- PySide6.QtNetworkAuth.QAbstractOAuth2.put(url, data)
- Parameters:
url –
PySide6.QtCore.QUrl
data –
PySide6.QtCore.QByteArray
- Return type:
This is an overloaded function.
Sends an authenticated PUT request and returns a new QNetworkReply. The url
and data
are used to create the request.
{Hypertext Transfer Protocol – HTTP/1.1: PUT}
- PySide6.QtNetworkAuth.QAbstractOAuth2.refreshToken()#
- Return type:
str
Gets the current refresh token.
Refresh tokens usually have longer lifespans than access tokens, so it makes sense to save them for later use.
Returns the current refresh token or an empty string, if there is no refresh token available.
See also
Getter of property refreshToken
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.refreshTokenChanged(refreshToken)#
- Parameters:
refreshToken – str
Notification signal of property refreshToken
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.responseType()#
- Return type:
str
Returns the response_type used.
- PySide6.QtNetworkAuth.QAbstractOAuth2.responseTypeChanged(responseType)#
- Parameters:
responseType – str
- PySide6.QtNetworkAuth.QAbstractOAuth2.scope()#
- Return type:
str
See also
Getter of property scope
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.scopeChanged(scope)#
- Parameters:
scope – str
Notification signal of property scope
.
- Parameters:
clientIdentifierSharedKey – str
See also
Setter of property clientIdentifierSharedKey
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.setRefreshToken(refreshToken)#
- Parameters:
refreshToken – str
Sets the new refresh token refreshToken
to be used.
A custom refresh token can be used to refresh the access token via this method and then the access token can be refreshed via refreshAccessToken()
.
See also
Setter of property refreshToken
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.setResponseType(responseType)#
- Parameters:
responseType – str
Setter of property scope
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.setSslConfiguration(configuration)#
- Parameters:
configuration –
PySide6.QtNetwork.QSslConfiguration
Sets the TLS configuration
to be used when establishing a mutual TLS connection between the client and the Authorization Server.
Setter of property state
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.setUserAgent(userAgent)#
- Parameters:
userAgent – str
See also
Setter of property userAgent
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.sslConfiguration()#
- Return type:
Returns the TLS configuration to be used when establishing a mutual TLS connection between the client and the Authorization Server.
- PySide6.QtNetworkAuth.QAbstractOAuth2.sslConfigurationChanged(configuration)#
- Parameters:
configuration –
PySide6.QtNetwork.QSslConfiguration
The signal is emitted when the TLS configuration has changed. The configuration
parameter contains the new TLS configuration.
See also
- PySide6.QtNetworkAuth.QAbstractOAuth2.state()#
- Return type:
str
See also
Getter of property state
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.stateChanged(state)#
- Parameters:
state – str
Notification signal of property state
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.userAgent()#
- Return type:
str
See also
Getter of property userAgent
.
- PySide6.QtNetworkAuth.QAbstractOAuth2.userAgentChanged(userAgent)#
- Parameters:
userAgent – str
Notification signal of property userAgent
.