PySide6.QtNetworkAuth.QOAuth1

class QOAuth1

The QOAuth1 class provides an implementation of the OAuth 1 Protocol . More

Inheritance diagram of PySide6.QtNetworkAuth.QOAuth1

Synopsis

Methods

Slots

Signals

Static functions

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

QOAuth1 provides a method for clients to access server resources on behalf of a resource owner (such as a different client or an end-user). It also provides a process for end-users to authorize third-party access to their server resources without sharing their credentials (typically, a username and password pair), using user-agent redirections.

QOAuth1 uses tokens to represent the authorization granted to the client by the resource owner. Typically, token credentials are issued by the server at the resource owner’s request, after authenticating the resource owner’s identity (usually using a username and password).

When making the temporary credentials request, the client authenticates using only the client credentials. When making the token request, the client authenticates using the client credentials as well as the temporary credentials. Once the client receives and stores the token credentials, it can proceed to access protected resources on behalf of the resource owner by making authenticated requests using the client credentials together with the token credentials received.

class SignatureMethod

Indicates the signature method to be used to sign requests.

Constant

Description

QOAuth1.SignatureMethod.Hmac_Sha1

HMAC-SHA1 signature method.

QOAuth1.SignatureMethod.Rsa_Sha1

RSA-SHA1 signature method (not supported).

QOAuth1.SignatureMethod.PlainText

PLAINTEXT signature method.

__init__([parent=None])
Parameters:

parentQObject

Constructs a QOAuth1 object with parent object parent.

__init__(manager[, parent=None])
Parameters:

Constructs a QOAuth1 object with parent object parent, using manager to access the network.

__init__(clientIdentifier, clientSharedSecret, manager[, parent=None])
Parameters:

Constructs a QOAuth1 object with parent object parent, using manager to access the network. Also sets clientIdentifier and clientSharedSecret to sign the calls to the web server and identify the application.

clientCredentials()
Return type:

.std.pairQString,QString

Returns the pair of QString used to identify the application and sign requests to the web server.

clientSharedSecret()
Return type:

str

Returns the current shared secret used to sign requests to the web server.

clientSharedSecretChanged(credential)
Parameters:

credential – str

continueGrantWithVerifier(verifier)
Parameters:

verifier – str

Continues the Redirection-Based Authorization flow using verifier. Call this function when using an Out-of-band reply handler to supply the verifier provided by the web server.

static generateAuthorizationHeader(oauthParams)
Parameters:

oauthParams – Dictionary with keys of type .QString and values of type QVariant.

Return type:

QByteArray

Generates an authorization header using oauthParams.

See also: The OAuth 1.0 Protocol: Authorization Header

static nonce()
Return type:

QByteArray

Generates a nonce.

See also: The OAuth 1.0 Protocol: Nonce and Timestamp

requestTemporaryCredentials(operation, url[, parameters=QVariantMap()])
Parameters:
  • operationOperation

  • urlQUrl

  • parameters – Dictionary with keys of type .QString and values of type QVariant.

Return type:

QNetworkReply

Starts the a request for temporary credentials using the request method operation. The request URL is url and the parameters shall encoded and sent during the request.

See also: The OAuth 1.0 Protocol: Temporary Credentials

requestTokenCredentials(operation, url, temporaryToken[, parameters=QVariantMap()])
Parameters:
  • operationOperation

  • urlQUrl

  • temporaryToken – .std.pairQString,QString

  • parameters – Dictionary with keys of type .QString and values of type QVariant.

Return type:

QNetworkReply

Starts a request for token credentials using the request method operation. The request URL is url and the parameters shall be encoded and sent during the request. The temporaryToken pair of string is used to identify and sign the request.

See also: The OAuth 1.0 Protocol: Token Credentials

setClientCredentials(clientCredentials)
Parameters:

clientCredentials – .std.pairQString,QString

Sets clientCredentials as the pair of QString used to identify the application and sign requests to the web server.

setClientCredentials(clientIdentifier, clientSharedSecret)
Parameters:
  • clientIdentifier – str

  • clientSharedSecret – str

Sets clientIdentifier and clientSharedSecret as the pair of QString used to identify the application and sign requests to the web server. clientIdentifier identifies the application and clientSharedSecret is used to sign requests.

setClientSharedSecret(clientSharedSecret)
Parameters:

clientSharedSecret – str

Sets clientSharedSecret as the string used to sign the requests to the web server.

setSignatureMethod(value)
Parameters:

valueSignatureMethod

Sets value as the method used to sign requests to the web server.

setTemporaryCredentialsUrl(url)
Parameters:

urlQUrl

Sets url as the URL to request temporary credentials to start the authentication process.

setTokenCredentials(tokenCredentials)
Parameters:

tokenCredentials – .std.pairQString,QString

Sets tokenCredentials as the pair of QString used to identify and sign authenticated requests to the web server.

setTokenCredentials(token, tokenSecret)
Parameters:
  • token – str

  • tokenSecret – str

Sets token and tokenSecret as the pair of QString used to identify and sign authenticated requests to the web server. Once the client receives and stores the token credentials, it can proceed to access protected resources on behalf of the resource owner by making authenticated requests using the client credentials together with the token credentials received.

setTokenCredentialsUrl(url)
Parameters:

urlQUrl

Sets url as the URL to request the token credentials to continue the authentication process.

setTokenSecret(tokenSecret)
Parameters:

tokenSecret – str

Sets tokenSecret as the current token secret used to sign authenticated calls to the web server.

setup(request, signingParameters, operation)
Parameters:
  • requestQNetworkRequest

  • signingParameters – Dictionary with keys of type .QString and values of type QVariant.

  • operationOperation

setup(request, signingParameters, operationVerb)
Parameters:
  • requestQNetworkRequest

  • signingParameters – Dictionary with keys of type .QString and values of type QVariant.

  • operationVerbQByteArray

signatureMethod()
Return type:

SignatureMethod

Returns the method used to sign the request to the web server.

signatureMethodChanged(method)
Parameters:

methodSignatureMethod

temporaryCredentialsUrl()
Return type:

QUrl

Returns the url used to request temporary credentials to start the authentication process.

temporaryCredentialsUrlChanged(url)
Parameters:

urlQUrl

tokenCredentials()
Return type:

.std.pairQString,QString

Returns the pair of QString used to identify and sign authenticated requests to the web server.

tokenCredentialsUrl()
Return type:

QUrl

Returns the url used to request token credentials to continue the authentication process.

tokenCredentialsUrlChanged(url)
Parameters:

urlQUrl

tokenSecret()
Return type:

str

Returns the current token secret used to sign authenticated requests to the web server.

tokenSecretChanged(token)
Parameters:

token – str