Skip to content
campadrenalin edited this page Feb 14, 2012 · 1 revision

ConcurrenTree.model.auth

Auth

Allows you to call authobj.load(uname, pword) and authobj[uname] to get a Storage object with a cryptographic backend. But you can just treat it like any regular old Storage object, the nice thing is the actual storage medium and crypto are abstracted away by the Storage class.

To use it, you need an object that fulfills the StorageMaker interface, which has three functions:

make(username, password) # Creates a Storage object based on uname and pword
new(username, password, key=None) # Creates a new user record in permanent storage
verify(username, password) # Verify that a u/p combo is correct

Pass that into the constructor. The Auth object, in turn, will handle caching, which you can access via the dict interface.

Methods:
* __init__(storage_maker)
* load(username, password) # Load storage object into cache
* verify(username, password) # Verify login validity
* new(username, password, key=None) # Create a new user in the storage backend

Python Library

Clone this wiki locally