GData.Authorizer¶
- Implementations:
GData.ClientLoginAuthorizer,GData.GoaAuthorizer,GData.OAuth1Authorizer,GData.OAuth2Authorizer
Methods¶
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class GData.Authorizer¶
- Bases:
- Structure:
All the fields in the
GData.Authorizerstructure are private and should never be accessed directly.New in version 0.9.0.
- is_authorized_for_domain(domain)¶
- Parameters:
domain (
GData.AuthorizationDomain) – theGData.AuthorizationDomainto check against- Returns:
Trueif theGData.Authorizerhas been authorized to access domain,Falseotherwise- Return type:
Returns whether the
GData.Authorizerinstance believes it’s currently authorized to access the given domain. Note that this will not perform any network requests, and will just look up the result in theGData.Authorizer's local cache of authorizations. This means that the result may be out of date, as the server may have since invalidated the authorization. If theGData.Authorizerclass supports timeouts and TTLs on authorizations, they will not be taken into account; this method effectively returns whether the last successful authorization operation performed on theGData.Authorizerincluded domain in the list of requested authorization domains.Note that
Nonemay be passed as theGData.Authorizer, in which caseFalsewill always be returned, regardless of the domain. This is for convenience of checking whether a domain is authorized by theGData.Authorizerreturned byGData.Service.get_authorizer(), which may beNone. For example:if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (my_service), my_domain) == TRUE) { /<!-- -->* Code to execute only if we're authorized for the given domain *<!-- -->/ }This method is thread safe.
New in version 0.9.0.
- process_request(domain, message)¶
- Parameters:
domain (
GData.AuthorizationDomainorNone) – theGData.AuthorizationDomainthe query falls under, orNonemessage (
Soup.Message) – the query to process
Processes message, adding all the necessary extra headers and parameters to ensure that it’s correctly authenticated and authorized under the given domain for the online service. Basically, if a query is not processed by calling this method on it, it will be sent to the online service as if it’s a query from a non-logged-in user. Similarly, if the
GData.Authorizerisn’t authenticated or authorized (for domain), no changes will be made to the message.domain may be
Noneif the request doesn’t require authorization.This modifies message in place.
This method is thread safe.
New in version 0.9.0.
- refresh_authorization(cancellable)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone- Raises:
- Returns:
Trueif an authorization refresh was attempted and was successful,Falseif a refresh wasn’t attempted or was unsuccessful- Return type:
Forces the
GData.Authorizerto refresh any authorization tokens it holds with the online service. This should typically be called when aGData.Servicequery returnsGData.ServiceError.AUTHENTICATION_REQUIRED, and is already called transparently by methods such asGData.Service.query() andGData.Service.insert_entry() (see their documentation for more details).If re-authorization is successful, it’s guaranteed that by the time this method returns, the properties containing the relevant authorization tokens on the
GData.Authorizerinstance will have been updated.If
Falseis returned, error will be set if (and only if) it’s due to a refresh being attempted and failing. If a refresh is not attempted,Falsewill be returned but error will not be set.If the
GData.Authorizerhas not been previously authenticated or authorized (using the class’ specific methods), no authorization will be attempted,Falsewill be returned immediately and error will not be set.Some
GData.Authorizerimplementations may not support refreshing authorization tokens at all; for example if doing so requires user interaction.Falsewill be returned immediately in that case and error will not be set.This method is thread safe.
New in version 0.9.0.
- refresh_authorization_async(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNonecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the authorization refresh operation is finished, orNoneuser_data (
objectorNone) – data to pass to the callback function
Forces the
GData.Authorizerto refresh any authorization tokens it holds with the online service. self and cancellable are reffed when this method is called, so can safely be freed after this method returns.For more details, see
GData.Authorizer.refresh_authorization(), which is the synchronous version of this method. If theGData.Authorizerclass doesn’t implement GData.AuthorizerInterface.refresh_authorization_async but does implement GData.AuthorizerInterface.refresh_authorization, the latter will be called from a new thread to make it asynchronous.When the authorization refresh operation is finished, callback will be called. You can then call
GData.Authorizer.refresh_authorization_finish() to get the results of the operation.This method is thread safe.
New in version 0.9.0.
- refresh_authorization_finish(async_result)¶
- Parameters:
async_result (
Gio.AsyncResult) – aGio.AsyncResult- Raises:
- Returns:
Trueif an authorization refresh was attempted and was successful,Falseif a refresh wasn’t attempted or was unsuccessful- Return type:
Finishes an asynchronous authorization refresh operation for the
GData.Authorizer, as started withGData.Authorizer.refresh_authorization_async().This method is thread safe.
New in version 0.9.0.
- do_is_authorized_for_domain(domain) virtual¶
- Parameters:
domain (
GData.AuthorizationDomain) – theGData.AuthorizationDomainto check against- Returns:
Trueif theGData.Authorizerhas been authorized to access domain,Falseotherwise- Return type:
Returns whether the
GData.Authorizerinstance believes it’s currently authorized to access the given domain. Note that this will not perform any network requests, and will just look up the result in theGData.Authorizer's local cache of authorizations. This means that the result may be out of date, as the server may have since invalidated the authorization. If theGData.Authorizerclass supports timeouts and TTLs on authorizations, they will not be taken into account; this method effectively returns whether the last successful authorization operation performed on theGData.Authorizerincluded domain in the list of requested authorization domains.Note that
Nonemay be passed as theGData.Authorizer, in which caseFalsewill always be returned, regardless of the domain. This is for convenience of checking whether a domain is authorized by theGData.Authorizerreturned byGData.Service.get_authorizer(), which may beNone. For example:if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (my_service), my_domain) == TRUE) { /<!-- -->* Code to execute only if we're authorized for the given domain *<!-- -->/ }This method is thread safe.
New in version 0.9.0.
- do_process_request(domain, message) virtual¶
- Parameters:
domain (
GData.AuthorizationDomainorNone) – theGData.AuthorizationDomainthe query falls under, orNonemessage (
Soup.Message) – the query to process
Processes message, adding all the necessary extra headers and parameters to ensure that it’s correctly authenticated and authorized under the given domain for the online service. Basically, if a query is not processed by calling this method on it, it will be sent to the online service as if it’s a query from a non-logged-in user. Similarly, if the
GData.Authorizerisn’t authenticated or authorized (for domain), no changes will be made to the message.domain may be
Noneif the request doesn’t require authorization.This modifies message in place.
This method is thread safe.
New in version 0.9.0.
- do_refresh_authorization(cancellable) virtual¶
- Parameters:
cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone- Returns:
Trueif an authorization refresh was attempted and was successful,Falseif a refresh wasn’t attempted or was unsuccessful- Return type:
Forces the
GData.Authorizerto refresh any authorization tokens it holds with the online service. This should typically be called when aGData.Servicequery returnsGData.ServiceError.AUTHENTICATION_REQUIRED, and is already called transparently by methods such asGData.Service.query() andGData.Service.insert_entry() (see their documentation for more details).If re-authorization is successful, it’s guaranteed that by the time this method returns, the properties containing the relevant authorization tokens on the
GData.Authorizerinstance will have been updated.If
Falseis returned, error will be set if (and only if) it’s due to a refresh being attempted and failing. If a refresh is not attempted,Falsewill be returned but error will not be set.If the
GData.Authorizerhas not been previously authenticated or authorized (using the class’ specific methods), no authorization will be attempted,Falsewill be returned immediately and error will not be set.Some
GData.Authorizerimplementations may not support refreshing authorization tokens at all; for example if doing so requires user interaction.Falsewill be returned immediately in that case and error will not be set.This method is thread safe.
New in version 0.9.0.
- do_refresh_authorization_async(cancellable, callback, *user_data) virtual¶
- Parameters:
cancellable (
Gio.CancellableorNone) – optionalGio.Cancellableobject, orNonecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the authorization refresh operation is finished, orNoneuser_data (
objectorNone) – data to pass to the callback function
Forces the
GData.Authorizerto refresh any authorization tokens it holds with the online service. self and cancellable are reffed when this method is called, so can safely be freed after this method returns.For more details, see
GData.Authorizer.refresh_authorization(), which is the synchronous version of this method. If theGData.Authorizerclass doesn’t implement GData.AuthorizerInterface.refresh_authorization_async but does implement GData.AuthorizerInterface.refresh_authorization, the latter will be called from a new thread to make it asynchronous.When the authorization refresh operation is finished, callback will be called. You can then call
GData.Authorizer.refresh_authorization_finish() to get the results of the operation.This method is thread safe.
New in version 0.9.0.
- do_refresh_authorization_finish(async_result) virtual¶
- Parameters:
async_result (
Gio.AsyncResult) – aGio.AsyncResult- Returns:
Trueif an authorization refresh was attempted and was successful,Falseif a refresh wasn’t attempted or was unsuccessful- Return type:
Finishes an asynchronous authorization refresh operation for the
GData.Authorizer, as started withGData.Authorizer.refresh_authorization_async().This method is thread safe.
New in version 0.9.0.