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.Authorizer
structure are private and should never be accessed directly.New in version 0.9.0.
- is_authorized_for_domain(domain)¶
- Parameters:
domain (
GData.AuthorizationDomain
) – theGData.AuthorizationDomain
to check against- Returns:
True
if theGData.Authorizer
has been authorized to access domain,False
otherwise- Return type:
Returns whether the
GData.Authorizer
instance 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.Authorizer
class 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.Authorizer
included domain in the list of requested authorization domains.Note that
None
may be passed as theGData.Authorizer
, in which caseFalse
will always be returned, regardless of the domain. This is for convenience of checking whether a domain is authorized by theGData.Authorizer
returned 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.AuthorizationDomain
orNone
) – theGData.AuthorizationDomain
the query falls under, orNone
message (
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.Authorizer
isn’t authenticated or authorized (for domain), no changes will be made to the message.domain may be
None
if 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.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
True
if an authorization refresh was attempted and was successful,False
if a refresh wasn’t attempted or was unsuccessful- Return type:
Forces the
GData.Authorizer
to refresh any authorization tokens it holds with the online service. This should typically be called when aGData.Service
query 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.Authorizer
instance will have been updated.If
False
is 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,False
will be returned but error will not be set.If the
GData.Authorizer
has not been previously authenticated or authorized (using the class’ specific methods), no authorization will be attempted,False
will be returned immediately and error will not be set.Some
GData.Authorizer
implementations may not support refreshing authorization tokens at all; for example if doing so requires user interaction.False
will 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.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the authorization refresh operation is finished, orNone
user_data (
object
orNone
) – data to pass to the callback function
Forces the
GData.Authorizer
to 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.Authorizer
class 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:
True
if an authorization refresh was attempted and was successful,False
if 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.AuthorizationDomain
to check against- Returns:
True
if theGData.Authorizer
has been authorized to access domain,False
otherwise- Return type:
Returns whether the
GData.Authorizer
instance 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.Authorizer
class 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.Authorizer
included domain in the list of requested authorization domains.Note that
None
may be passed as theGData.Authorizer
, in which caseFalse
will always be returned, regardless of the domain. This is for convenience of checking whether a domain is authorized by theGData.Authorizer
returned 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.AuthorizationDomain
orNone
) – theGData.AuthorizationDomain
the query falls under, orNone
message (
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.Authorizer
isn’t authenticated or authorized (for domain), no changes will be made to the message.domain may be
None
if 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.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Returns:
True
if an authorization refresh was attempted and was successful,False
if a refresh wasn’t attempted or was unsuccessful- Return type:
Forces the
GData.Authorizer
to refresh any authorization tokens it holds with the online service. This should typically be called when aGData.Service
query 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.Authorizer
instance will have been updated.If
False
is 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,False
will be returned but error will not be set.If the
GData.Authorizer
has not been previously authenticated or authorized (using the class’ specific methods), no authorization will be attempted,False
will be returned immediately and error will not be set.Some
GData.Authorizer
implementations may not support refreshing authorization tokens at all; for example if doing so requires user interaction.False
will 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.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the authorization refresh operation is finished, orNone
user_data (
object
orNone
) – data to pass to the callback function
Forces the
GData.Authorizer
to 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.Authorizer
class 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:
True
if an authorization refresh was attempted and was successful,False
if 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.