Package turbogears :: Package identity :: Module saprovider :: Class SqlAlchemyIdentityProvider

Class SqlAlchemyIdentityProvider

source code

object --+
         |
        SqlAlchemyIdentityProvider

IdentityProvider that uses a model from a database (via SQLAlchemy).

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
encrypt_password(self, password) source code
 
create_provider_model(self)
Create the database tables if they don't already exist.
source code
 
validate_identity(self, user_name, password, visit_key)
Validate the identity represented by user_name using the password.
source code
 
validate_password(self, user, user_name, password)
Check the user_name and password against existing credentials.
source code
 
load_identity(self, visit_key)
Lookup the principal represented by user_name.
source code
 
anonymous_identity(self)
Return anonymous identity.
source code
 
authenticated_identity(self, user)
Construct Identity object for users with no visit_key.
source code

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

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

validate_identity(self, user_name, password, visit_key)

source code 
Validate the identity represented by user_name using the password.

Must return either None if the credentials weren't valid or an object
with the following properties:
    user_name: original user name
    user: a provider dependent object (TG_User or similar)
    groups: a set of group names
    permissions: a set of permission names

validate_password(self, user, user_name, password)

source code 

Check the user_name and password against existing credentials.

Note: user_name is not used here, but is required by external password validation schemes that might override this method. If you use SqlAlchemyIdentityProvider, but want to check the passwords against an external source (i.e. PAM, LDAP, Windows domain, etc), subclass SqlAlchemyIdentityProvider, and override this method.

load_identity(self, visit_key)

source code 
Lookup the principal represented by user_name.

Return None if there is no principal for the given user ID.

Must return an object with the following properties:
    user_name: original user name
    user: a provider dependent object (TG_User or similar)
    groups: a set of group names
    permissions: a set of permission names

anonymous_identity(self)

source code 
Return anonymous identity.

Must return an object with the following properties:
    user_name: original user name
    user: a provider dependent object (TG_User or similar)
    groups: a set of group names
    permissions: a set of permission names