Package openid :: Package store :: Module interface :: Class OpenIDStore
[frames | no frames]

Type OpenIDStore

object --+
         |
        OpenIDStore

Known Subclasses:
FileOpenIDStore, SQLStore

This is the interface for the store objects the OpenID library uses. It is a single class that provides all of the persistence mechanisms that the OpenID library needs, for both servers and consumers.
Method Summary
NoneType storeAssociation(self, server_url, association)
This method puts a Association object into storage, retrievable by server URL and handle.
Association or NoneType getAssociation(self, server_url, handle)
This method returns an Association object from storage that matches the server URL and, if specified, handle.
bool or int removeAssociation(self, server_url, handle)
This method removes the matching association if it's found, and returns whether the association was removed or not.
bool useNonce(self, server_url, timestamp, salt)
Called when using a nonce.
  cleanup(self)
Shortcut for cleanupNonces(), cleanupAssociations().
int cleanupAssociations(self)
Remove expired associations from the store.
int cleanupNonces(self)
Remove expired nonces from the store.
Inherited from object: __init__, __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Method Details

storeAssociation(self, server_url, association)

This method puts a Association object into storage, retrievable by server URL and handle.
Parameters:
server_url - The URL of the identity server that this association is with. Because of the way the server portion of the library uses this interface, don't assume there are any limitations on the character set of the input string. In particular, expect to see unescaped non-url-safe characters in the server_url field.
           (type=str)
association - The Association to store.
           (type=Association)
Returns:
None
           (type=NoneType)

getAssociation(self, server_url, handle=None)

This method returns an Association object from storage that matches the server URL and, if specified, handle. It returns None if no such association is found or if the matching association is expired.

If no handle is specified, the store may return any association which matches the server URL. If multiple associations are valid, the recommended return value for this method is the one most recently issued.

This method is allowed (and encouraged) to garbage collect expired associations when found. This method must not return expired associations.
Parameters:
server_url - The URL of the identity server to get the association for. Because of the way the server portion of the library uses this interface, don't assume there are any limitations on the character set of the input string. In particular, expect to see unescaped non-url-safe characters in the server_url field.
           (type=str)
handle - This optional parameter is the handle of the specific association to get. If no specific handle is provided, any valid association matching the server URL is returned.
           (type=str or NoneType)
Returns:
The Association for the given identity server.
           (type=Association or NoneType)

removeAssociation(self, server_url, handle)

This method removes the matching association if it's found, and returns whether the association was removed or not.
Parameters:
server_url - The URL of the identity server the association to remove belongs to. Because of the way the server portion of the library uses this interface, don't assume there are any limitations on the character set of the input string. In particular, expect to see unescaped non-url-safe characters in the server_url field.
           (type=str)
handle - This is the handle of the association to remove. If there isn't an association found that matches both the given URL and handle, then there was no matching handle found.
           (type=str)
Returns:
Returns whether or not the given association existed.
           (type=bool or int)

useNonce(self, server_url, timestamp, salt)

Called when using a nonce.

This method should return True if the nonce has not been used before, and store it for a while to make sure nobody tries to use the same value again. If the nonce has already been used or the timestamp is not current, return False.

You may use openid.store.nonce.SKEW for your timestamp window.
Parameters:
server_url - The URL of the server from which the nonce originated.
           (type=str)
timestamp - The time that the nonce was created (to the nearest second), in seconds since January 1 1970 UTC.
           (type=int)
salt - A random string that makes two nonces from the same server issued during the same second unique.
           (type=str)
Returns:
Whether or not the nonce was valid.
           (type=bool)

cleanup(self)

Shortcut for cleanupNonces(), cleanupAssociations().

This method is not called in the normal operation of the library. It provides a way for store admins to keep their storage from filling up with expired data.

cleanupAssociations(self)

Remove expired associations from the store.

This method is not called in the normal operation of the library. It provides a way for store admins to keep their storage from filling up with expired data.
Returns:
the number of associations expired.
           (type=int)

cleanupNonces(self)

Remove expired nonces from the store.

Discards any nonce from storage that is old enough that its timestamp would not pass useNonce.

This method is not called in the normal operation of the library. It provides a way for store admins to keep their storage from filling up with expired data.
Returns:
the number of nonces expired.
           (type=int)

Generated by Epydoc 2.1 on Fri Jun 6 15:54:34 2008 http://epydoc.sf.net