- class QOAuth1#
The
QOAuth1
class provides an implementation of the OAuth 1 Protocol . More…Synopsis#
Methods#
def
__init__()
def
setTokenSecret()
def
setup()
def
tokenSecret()
Slots#
Signals#
Static functions#
def
nonce()
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.
Constructs a
QOAuth1
object with parent objectparent
.- __init__(clientIdentifier, clientSharedSecret, manager[, parent=None])
- Parameters:
clientIdentifier – str
clientSharedSecret – str
manager –
QNetworkAccessManager
parent –
QObject
Constructs a
QOAuth1
object with parent objectparent
, usingmanager
to access the network. Also setsclientIdentifier
andclientSharedSecret
to sign the calls to the web server and identify the application.- __init__(manager[, parent=None])
- Parameters:
manager –
QNetworkAccessManager
parent –
QObject
Constructs a
QOAuth1
object with parent objectparent
, usingmanager
to access the network.- clientCredentials()#
- Return type:
.std.pairQString,QString
Returns the pair of QString used to identify the application and sign requests to the web server.
See also
- Return type:
str
Returns the current shared secret used to sign requests to the web server.
- 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:
Generates an authorization header using
oauthParams
.See also: The OAuth 1.0 Protocol: Authorization Header
- static nonce()#
- Return type:
Generates a nonce.
See also: The OAuth 1.0 Protocol: Nonce and Timestamp
- requestTemporaryCredentials(operation, url[, parameters=QVariantMap()])#
- Parameters:
- Return type:
Starts the a request for temporary credentials using the request method
operation
. The request URL isurl
and theparameters
shall encoded and sent during the request.See also: The OAuth 1.0 Protocol: Temporary Credentials
- requestTokenCredentials(operation, url, temporaryToken[, parameters=QVariantMap()])#
- Parameters:
- Return type:
Starts a request for token credentials using the request method
operation
. The request URL isurl
and theparameters
shall be encoded and sent during the request. ThetemporaryToken
pair of string is used to identify and sign the request.See also: The OAuth 1.0 Protocol: Token Credentials
- setClientCredentials(clientIdentifier, clientSharedSecret)#
- Parameters:
clientIdentifier – str
clientSharedSecret – str
Sets
clientIdentifier
andclientSharedSecret
as the pair of QString used to identify the application and sign requests to the web server.clientIdentifier
identifies the application andclientSharedSecret
is used to sign requests.See also
- 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.See also
- Parameters:
clientSharedSecret – str
Sets
clientSharedSecret
as the string used to sign the requests to the web server.- setSignatureMethod(value)#
- Parameters:
value –
SignatureMethod
Sets
value
as the method used to sign requests to the web server.See also
Sets
url
as the URL to request temporary credentials to start the authentication process.See also
- setTokenCredentials(token, tokenSecret)#
- Parameters:
token – str
tokenSecret – str
Sets
token
andtokenSecret
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.See also
- 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.See also
Sets
url
as the URL to request the token credentials to continue the authentication process.See also
- setTokenSecret(tokenSecret)#
- Parameters:
tokenSecret – str
Sets
tokenSecret
as the current token secret used to sign authenticated calls to the web server.See also
- setup(request, signingParameters, operation)#
- Parameters:
request –
QNetworkRequest
signingParameters – Dictionary with keys of type .QString and values of type QVariant.
operation –
Operation
- setup(request, signingParameters, operationVerb)
- Parameters:
request –
QNetworkRequest
signingParameters – Dictionary with keys of type .QString and values of type QVariant.
operationVerb –
QByteArray
- signatureMethod()#
- Return type:
Returns the method used to sign the request to the web server.
See also
- signatureMethodChanged(method)#
- Parameters:
method –
SignatureMethod
Returns the url used to request temporary credentials to start the authentication process.
See also
- tokenCredentials()#
- Return type:
.std.pairQString,QString
Returns the pair of QString used to identify and sign authenticated requests to the web server.
See also
Returns the url used to request token credentials to continue the authentication process.
See also
- tokenSecret()#
- Return type:
str
Returns the current token secret used to sign authenticated requests to the web server.
See also
- tokenSecretChanged(token)#
- Parameters:
token – str