Package turbogears :: Package identity

Package identity

source code

The TurboGears identity management package.

Submodules

Classes
  All
Logical 'and' of all sub-predicates.
  Any
Logical 'or' of all sub-predicates.
  CompoundPredicate
A predicate composed of other predicates.
  NotAny
Locigal 'nor' of all sub-predicates.
  Predicate
Generic base class for testing true or false for a condition.
  SecureObject
  SecureResource
  from_host
Predicate for checking whether the visitor's host is a permitted host.
  from_any_host
Predicate for checking the visitor against a number of allowed hosts.
  in_all_groups
Predicate for requiring membership in a number of groups.
  in_any_group
Predicate for requiring membership in at least one group.
  in_group
Predicate for requiring a group.
  has_all_permissions
Predicate for checking whether the visitor has all permissions.
  has_any_permission
Predicate for checking whether visitor has at least one permission.
  has_permission
Predicate for checking whether visitor has a particular permission.
  not_anonymous
Predicate for checking whether current visitor is anonymous.
  IdentityConfigurationException
Incorrect configuration.
  IdentityException
Base class for all Identity exceptions.
  IdentityFailure
Identity failure.
  IdentityManagementNotEnabledException
User forgot to enable Identity management.
  RequestRequiredException
No request present.
Functions
 
create_default_provider()
Create default identity provider.
source code
 
encrypt_password(cleartext) source code
 
encrypt_pw_with_algorithm(algorithm, password)
Hash the given password with the specified algorithm.
source code
 
set_current_identity(identity) source code
 
set_current_provider(provider) source code
 
set_login_attempted(flag) source code
 
verify_identity_status()
A tool that sets response status based on identity's success or failure.
source code
 
was_login_attempted() source code
 
require(predicate, obj=None)
Function decorator checking requirements for the current user.
source code
 
get_identity_errors()
Get the identity errors from the CherryPy request or WSGI environment.
source code
 
get_failure_url(errors=None)
Get the identity failure URL from the configuration setting.
source code
 
set_identity_errors(errors)
Save the identity errors in the CherryPy request and WSGI environment.
source code
Variables
  current = IdentityWrapper()
  current_provider = ProviderWrapper()
Function Details

create_default_provider()

source code 

Create default identity provider.

Creates an identity provider according to what is found in the configuration file for the current TurboGears application

Returns an identity provider instance or raises an IdentityConfigurationException.

encrypt_pw_with_algorithm(algorithm, password)

source code 

Hash the given password with the specified algorithm.

Valid values for algorithm are 'md5' and 'sha1' or 'custom'. If the algorithm is 'custom', the config setting 'identity.custom_encryption' needs to be set to a dotted-notation path to a callable that takes an unencrypted password and gives back the password hash.

All other algorithms values will be essentially a no-op.

verify_identity_status()

source code 

A tool that sets response status based on identity's success or failure.

This is necessary since the status will be overridden by the result of forwarding the user to the login page.

Does not override status if the login controller errors out.

require(predicate, obj=None)

source code 

Function decorator checking requirements for the current user.

This function decorator checks whether the current user is a member of the groups specified and has the permissions required.