Package pyxmpp2 :: Package sasl :: Module core :: Class PasswordDatabase
[hide private]

Class PasswordDatabase


Password database interface.

PasswordDatabase object is responsible for providing or verification of user authentication credentials on a server.

All the methods of the PasswordDatabase may be overridden in derived classes for specific authentication and authorization policy.

Nested Classes [hide private]
  __metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
Instance Methods [hide private]
unicode,`unicode` tuple.
get_password(self, username, acceptable_formats, properties)
Get the password for user authentication.
bool
check_password(self, username, password, properties)
Check the password validity.

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

Class Variables [hide private]
  __abstractmethods__ = frozenset([])
  _abc_cache = <_weakrefset.WeakSet object at 0x7f52caad4a90>
  _abc_negative_cache = <_weakrefset.WeakSet object at 0x7f52caa...
  _abc_negative_cache_version = 26
hash(x)
  _abc_registry = <_weakrefset.WeakSet object at 0x7f52caad4a50>
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

get_password(self, username, acceptable_formats, properties)

 

Get the password for user authentication.

By default returns (None, None) providing no password. Should be overridden in derived classes unless only check_password functionality is available.

Parameters:
  • username (unicode) - the username for which the password is requested.
  • acceptable_formats (sequence of unicode) - a sequence of acceptable formats of the password data. Could be "plain" (plain text password), "md5:user:realm:password" (MD5 hex digest of user:realm:password) or any other mechanism-specific encoding. This allows non-plain-text storage of passwords. But only "plain" format will work with all password authentication mechanisms.
  • properties (mapping) - mapping with authentication properties (those provided to the authenticator's start() method plus some already obtained via the mechanism).
Returns: unicode,`unicode` tuple.
the password and its encoding (format).

check_password(self, username, password, properties)

 

Check the password validity.

Used by plain-text authentication mechanisms.

Default implementation: retrieve a "plain" password for the username and realm using self.get_password and compare it with the password provided.

May be overridden e.g. to check the password against some external authentication mechanism (PAM, LDAP, etc.).

Parameters:
  • username (unicode) - the username for which the password verification is requested.
  • password (unicode) - the password to verify.
  • properties (mapping) - mapping with authentication properties (those provided to the authenticator's start() method plus some already obtained via the mechanism).
Returns: bool
True if the password is valid.

Class Variable Details [hide private]

_abc_negative_cache

Value:
<_weakrefset.WeakSet object at 0x7f52caad4b10>