Package openid :: Package store :: Module sqlstore :: Class SQLiteStore
[frames] | no frames]

Class SQLiteStore

source code

           object --+        
                    |        
interface.OpenIDStore --+    
                        |    
                 SQLStore --+
                            |
                           SQLiteStore

This is an SQLite-based specialization of SQLStore.

To create an instance, see SQLStore.__init__. To create the tables it will use, see SQLStore.createTables.

All other methods are implementation details.

Instance Methods
 
blobDecode(self, buf)
Convert a blob as returned by the SQL engine into a str object.
source code
 
blobEncode(self, s)
Convert a str object into the necessary object for storing in the database as a blob.
source code
bool
useNonce(self, *args, **kwargs)
Return whether this nonce is present, and if it is, then remove it from the set.
source code

Inherited from SQLStore: __getattr__, __init__, cleanupAssociations, cleanupNonces, createTables, getAssociation, removeAssociation, storeAssociation, txn_cleanupAssociations, txn_cleanupNonces, txn_createTables, txn_getAssociation, txn_removeAssociation, txn_storeAssociation, txn_useNonce

Inherited from interface.OpenIDStore: cleanup

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables
  create_nonce_sql = '\n CREATE TABLE %(nonces)s (\n s...
  create_assoc_sql = '\n CREATE TABLE %(associations)s\n (...
  set_assoc_sql = 'INSERT OR REPLACE INTO %(associations)s (serv...
  get_assocs_sql = 'SELECT handle, secret, issued, lifetime, ass...
  get_assoc_sql = 'SELECT handle, secret, issued, lifetime, asso...
  get_expired_sql = 'SELECT server_url FROM %(associations)s WHE...
  remove_assoc_sql = 'DELETE FROM %(associations)s WHERE server_...
  clean_assoc_sql = 'DELETE FROM %(associations)s WHERE issued +...
  add_nonce_sql = 'INSERT INTO %(nonces)s VALUES (?, ?, ?);'
  clean_nonce_sql = 'DELETE FROM %(nonces)s WHERE timestamp < ?;'

Inherited from SQLStore: associations_table, nonces_table

Properties

Inherited from object: __class__

Method Details

blobDecode(self, buf)

source code 

Convert a blob as returned by the SQL engine into a str object.

str -> str

Overrides: SQLStore.blobDecode
(inherited documentation)

blobEncode(self, s)

source code 

Convert a str object into the necessary object for storing in the database as a blob.

Overrides: SQLStore.blobEncode
(inherited documentation)

useNonce(self, *args, **kwargs)

source code 

Return whether this nonce is present, and if it is, then remove it from the set.

str -> bool

Parameters:
  • server_url - The URL of the server from which the nonce originated.
  • timestamp - The time that the nonce was created (to the nearest second), in seconds since January 1 1970 UTC.
  • salt - A random string that makes two nonces from the same server issued during the same second unique.
Returns: bool
Whether or not the nonce was valid.
Overrides: interface.OpenIDStore.useNonce
(inherited documentation)

Class Variable Details

create_nonce_sql

Value:
'''
    CREATE TABLE %(nonces)s (
        server_url VARCHAR,
        timestamp INTEGER,
        salt CHAR(40),
        UNIQUE(server_url, timestamp, salt)
    );
    '''

create_assoc_sql

Value:
'''
    CREATE TABLE %(associations)s
    (
        server_url VARCHAR(2047),
        handle VARCHAR(255),
        secret BLOB(128),
        issued INTEGER,
        lifetime INTEGER,
...

set_assoc_sql

Value:
'INSERT OR REPLACE INTO %(associations)s (server_url, handle, secret, \
issued, lifetime, assoc_type) VALUES (?, ?, ?, ?, ?, ?);'

get_assocs_sql

Value:
'SELECT handle, secret, issued, lifetime, assoc_type FROM %(associatio\
ns)s WHERE server_url = ?;'

get_assoc_sql

Value:
'SELECT handle, secret, issued, lifetime, assoc_type FROM %(associatio\
ns)s WHERE server_url = ? AND handle = ?;'

get_expired_sql

Value:
'SELECT server_url FROM %(associations)s WHERE issued + lifetime < ?;'

remove_assoc_sql

Value:
'DELETE FROM %(associations)s WHERE server_url = ? AND handle = ?;'

clean_assoc_sql

Value:
'DELETE FROM %(associations)s WHERE issued + lifetime < ?;'