| Trees | Indices | Help |
|---|
|
|
Multi-credential file store with lock support.
This module implements a JSON credential store where multiple
credentials can be stored in one file. That file supports locking
both in a single process and across processes.
The credential themselves are keyed off of:
* client_id
* user_agent
* scope
The format of the stored data is like so:
{
'file_version': 1,
'data': [
{
'key': {
'clientId': '<client id>',
'userAgent': '<user agent>',
'scope': '<scope>'
},
'credential': {
# JSON serialized Credentials.
}
}
]
}
Author: jbeda@google.com (Joe Beda)
|
|||
|
Error Base error for this module. |
|||
|
NewerCredentialStoreError The credential store is a newer version that supported. |
|||
|
_MultiStore A file backed store for multiple credentials. |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
logger = logging.getLogger(__name__)
|
|||
_multistores = {}
|
|||
_multistores_lock = threading.Lock()
|
|||
|
|||
Get a Storage instance for a credential. Args: filename: The JSON file storing a set of credentials client_id: The client_id for the credential user_agent: The user agent for the credential scope: string or iterable of strings, Scope(s) being requested warn_on_readonly: if True, log a warning if the store is readonly Returns: An object derived from client.Storage for getting/setting the credential.
|
Get a Storage instance for a credential using a single string as a key. Allows you to provide a string as a custom key that will be used for credential storage and retrieval. Args: filename: The JSON file storing a set of credentials key_string: A string to use as the key for storing this credential. warn_on_readonly: if True, log a warning if the store is readonly Returns: An object derived from client.Storage for getting/setting the credential.
|
Get a Storage instance for a credential using a dictionary as a key.
Allows you to provide a dictionary as a custom key that will be used for
credential storage and retrieval.
Args:
filename: The JSON file storing a set of credentials
key_dict: A dictionary to use as the key for storing this credential. There
is no ordering of the keys in the dictionary. Logically equivalent
dictionaries will produce equivalent storage keys.
warn_on_readonly: if True, log a warning if the store is readonly
Returns:
An object derived from client.Storage for getting/setting the
credential.
|
Gets all the registered credential keys in the given Multistore. Args: filename: The JSON file storing a set of credentials warn_on_readonly: if True, log a warning if the store is readonly Returns: A list of the credential keys present in the file. They are returned as dictionaries that can be passed into get_credential_storage_custom_key to get the actual credentials.
|
A helper method to initialize the multistore with proper locking. Args: filename: The JSON file storing a set of credentials warn_on_readonly: if True, log a warning if the store is readonly Returns: A multistore object
|
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Tue Aug 6 12:16:42 2013 | http://epydoc.sourceforge.net |