GData.ClientLoginAuthorizer¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
A client ID for your application. |
||
r |
The user’s account password for authentication. |
||
r/w |
A |
||
r/w |
The proxy URI used internally for all network requests. |
||
r/w |
A timeout, in seconds, for network operations. |
||
r |
The user’s Google username for authentication. |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class GData.ClientLoginAuthorizer(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
All the fields in the
GData.ClientLoginAuthorizer
structure are private and should never be accessed directly.New in version 0.9.0.
- classmethod new(client_id, service_type)¶
- Parameters:
client_id (
str
) – your application’s client IDservice_type (
GObject.GType
) – theGObject.GType
of aGData.Service
subclass which theGData.ClientLoginAuthorizer
will be used with
- Returns:
a new
GData.ClientLoginAuthorizer
, orNone
; unref withGObject.Object.unref
()- Return type:
Creates a new
GData.ClientLoginAuthorizer
. The client_id must be unique for your application, and as registered with Google.The
GData.AuthorizationDomains
for the given service_type (i.e. as returned byGData.Service.get_authorization_domains
()) are the ones the user will be logged in to using the provided username and password whenGData.ClientLoginAuthorizer.authenticate
() is called. Note that the same username and password will be used for all domains.New in version 0.9.0.
- classmethod new_for_authorization_domains(client_id, authorization_domains)¶
- Parameters:
client_id (
str
) – your application’s client IDauthorization_domains ([
GData.AuthorizationDomain
]) – a non-empty list ofGData.AuthorizationDomains
to be authorized against by theGData.ClientLoginAuthorizer
- Returns:
a new
GData.ClientLoginAuthorizer
, orNone
; unref withGObject.Object.unref
()- Return type:
Creates a new
GData.ClientLoginAuthorizer
. The client_id must be unique for your application, and as registered with Google. This function is intended to be used only when the default authorization domain list for a singleGData.Service
, as used byGData.ClientLoginAuthorizer.new
(), isn’t suitable. For example, this could be because theGData.ClientLoginAuthorizer
will be used with multipleGData.Service
subclasses, or because the client requires a specific set of authorization domains.The specified
GData.AuthorizationDomains
are the ones the user will be logged in to using the provided username and password whenGData.ClientLoginAuthorizer.authenticate
() is called. Note that the same username and password will be used for all domains.New in version 0.9.0.
- authenticate(username, password, cancellable)¶
- Parameters:
username (
str
) – the user’s usernamepassword (
str
) – the user’s passwordcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
True
if authentication and authorization was successful against all the services,False
otherwise- Return type:
Authenticates the
GData.ClientLoginAuthorizer
with the Google Accounts service using username and password and authorizes it against all the service types passed toGData.ClientLoginAuthorizer.new
(); i.e. logs into the service with the given user account. username should be a full e-mail address (e.g.john.smith\@gmail.com
). If a full e-mail address is not given, username will have\@gmail.com
appended to create an e-mail addressIf cancellable is not
None
, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the errorGio.IOErrorEnum.CANCELLED
will be returned.If the operation errors or is cancelled part-way through,
GData.Authorizer.is_authorized_for_domain
() is guaranteed to returnFalse
for allGData.AuthorizationDomains
, even if authentication has succeeded for some of them already.A
GData.ClientLoginAuthorizerError.BAD_AUTHENTICATION
will be returned if authentication failed due to an incorrect username or password. OtherGData.ClientLoginAuthorizerError
errors can be returned for other conditions.If the service requires a CAPTCHA to be completed, the
GData.ClientLoginAuthorizer
::captcha-challenge
signal will be emitted. The return value from a signal handler for the signal should be a newly allocated string containing the text from the image. If the text isNone
or empty, authentication will fail with aGData.ClientLoginAuthorizerError.CAPTCHA_REQUIRED
error. Otherwise, authentication will be automatically and transparently restarted with the new CAPTCHA details.A
GData.ServiceError.PROTOCOL_ERROR
will be returned if the server’s responses were invalid.New in version 0.9.0.
- authenticate_async(username, password, cancellable, callback, *user_data)¶
- Parameters:
username (
str
) – the user’s usernamepassword (
str
) – the user’s passwordcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when authentication is finisheduser_data (
object
orNone
) – data to pass to the callback function
Authenticates the
GData.ClientLoginAuthorizer
with the Google accounts service using the given username and password. self, username and password are all reffed/copied when this function is called, so can safely be freed after this function returns.For more details, see
GData.ClientLoginAuthorizer.authenticate
(), which is the synchronous version of this function.When the operation is finished, callback will be called. You can then call
GData.ClientLoginAuthorizer.authenticate_finish
() to get the results of the operation.New in version 0.9.0.
- authenticate_finish(async_result)¶
- Parameters:
async_result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
- Return type:
Finishes an asynchronous authentication operation started with
GData.ClientLoginAuthorizer.authenticate_async
().New in version 0.9.0.
- get_client_id()¶
- Returns:
the authorizer’s client ID
- Return type:
Returns the authorizer’s client ID, as specified on constructing the
GData.ClientLoginAuthorizer
.New in version 0.9.0.
- get_password()¶
-
Returns the password of the currently authenticated user, or
None
if nobody is authenticated.It is not safe to call this while an authentication operation is ongoing.
If libgdata is compiled with libgcr support, the password will be stored in non-pageable memory. Since this function doesn’t return a copy of the password, the returned value is guaranteed to not hit disk. It’s advised that any copies of the password made in client programs also use non-pageable memory.
New in version 0.9.0.
- get_proxy_resolver()¶
- Returns:
a
Gio.ProxyResolver
, orNone
- Return type:
Gets the
Gio.ProxyResolver
on theGData.ClientLoginAuthorizer
'sSoup.Session
.New in version 0.15.0.
- get_proxy_uri()¶
- Returns:
the proxy URI, or
None
; free withSoup.URI.free
()- Return type:
Gets the proxy URI on the
GData.ClientLoginAuthorizer
'sSoup.Session
.New in version 0.9.0.
Deprecated since version 0.15.0: Use
GData.ClientLoginAuthorizer.get_proxy_resolver
() instead, which gives more flexibility over the proxy used.
- get_timeout()¶
- Returns:
the timeout, or 0
- Return type:
Gets the
GData.ClientLoginAuthorizer
:timeout
property; the network timeout, in seconds.New in version 0.9.0.
- get_username()¶
-
Returns the username of the currently authenticated user, or
None
if nobody is authenticated.It is not safe to call this while an authentication operation is ongoing.
New in version 0.9.0.
- set_proxy_resolver(proxy_resolver)¶
- Parameters:
proxy_resolver (
Gio.ProxyResolver
orNone
) – aGio.ProxyResolver
, orNone
Sets the
Gio.ProxyResolver
on theSoup.Session
used internally by the givenGData.ClientLoginAuthorizer
.Setting this will clear the
GData.ClientLoginAuthorizer
:proxy-uri
property.New in version 0.15.0.
- set_proxy_uri(proxy_uri)¶
-
Sets the proxy URI on the
Soup.Session
used internally by theGData.ClientLoginAuthorizer
. This forces all requests through the given proxy.If proxy_uri is
None
, no proxy will be used.New in version 0.9.0.
Deprecated since version 0.15.0: Use
GData.ClientLoginAuthorizer.set_proxy_resolver
() instead, which gives more flexibility over the proxy used.
- set_timeout(timeout)¶
- Parameters:
timeout (
int
) – the timeout, or 0
Sets the
GData.ClientLoginAuthorizer
:timeout
property; the network timeout, in seconds.If timeout is 0, network operations will never time out.
New in version 0.9.0.
Signal Details¶
- GData.ClientLoginAuthorizer.signals.captcha_challenge(client_login_authorizer, uri)¶
- Signal Name:
captcha-challenge
- Flags:
- Parameters:
client_login_authorizer (
GData.ClientLoginAuthorizer
) – The object which received the signaluri (
str
) – the URI of the CAPTCHA image to be used
- Returns:
a newly allocated string containing the text in the CAPTCHA image
- Return type:
The
GData.ClientLoginAuthorizer
::captcha-challenge
signal is emitted during the authentication process if the authorizer requires a CAPTCHA to be completed. The URI of a CAPTCHA image is given, and the program should display this to the user, and return their response (the text displayed in the image). There is no timeout imposed by the library for the response.New in version 0.9.0.
Property Details¶
- GData.ClientLoginAuthorizer.props.client_id¶
- Name:
client-id
- Type:
- Default Value:
- Flags:
A client ID for your application (see the
reference documentation). It is recommended that the ID is of the form
company name-application name- version ID
.New in version 0.9.0.
- GData.ClientLoginAuthorizer.props.password¶
-
The user’s account password for authentication.
This will only be set after authentication using
GData.ClientLoginAuthorizer.authenticate
() is completed successfully. It will then be set to the password passed toGData.ClientLoginAuthorizer.authenticate
(), and aGObject.Object
::notify
signal will be emitted. If authentication fails, it will be set toNone
.If libgdata is compiled with libgcr support, the password will be stored in non-pageable memory. However, if it is retrieved using g_object_get() (or related functions) it will be copied to non-pageable memory and could end up being written to disk. Accessing the password using
GData.ClientLoginAuthorizer.get_password
() will not perform any copies, and so maintains privacy.New in version 0.9.0.
- GData.ClientLoginAuthorizer.props.proxy_resolver¶
- Name:
proxy-resolver
- Type:
- Default Value:
- Flags:
The
Gio.ProxyResolver
used to determine a proxy URI. Setting this will clear theGData.ClientLoginAuthorizer
:proxy-uri
property.New in version 0.15.0.
- GData.ClientLoginAuthorizer.props.proxy_uri¶
-
The proxy URI used internally for all network requests.
New in version 0.9.0.
Deprecated since version 0.15.0: Use
GData.ClientLoginAuthorizer
:proxy-resolver
instead, which gives more flexibility over the proxy used.
- GData.ClientLoginAuthorizer.props.timeout¶
-
A timeout, in seconds, for network operations. If the timeout is exceeded, the operation will be cancelled and
GData.ServiceError.NETWORK_ERROR
will be returned.If the timeout is 0, operations will never time out.
New in version 0.9.0.
- GData.ClientLoginAuthorizer.props.username¶
-
The user’s Google username for authentication. This will always be a full e-mail address.
This will only be set after authentication using
GData.ClientLoginAuthorizer.authenticate
() is completed successfully. It will then be set to the username passed toGData.ClientLoginAuthorizer.authenticate
(), and aGObject.Object
::notify
signal will be emitted. If authentication fails, it will be set toNone
.New in version 0.9.0.