diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2011-04-05 16:07:22 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2011-04-05 16:07:22 -0400 |
commit | 7ddd256b16018b6967604ecf6cae94d4a0080ef8 (patch) | |
tree | 2c0c546d4c85786a610884eda3ce83a48a9dd108 /passlib/handlers/misc.py | |
parent | a4fce8f8e87530ae2b1de581a7e490176003e8a2 (diff) | |
download | passlib-7ddd256b16018b6967604ecf6cae94d4a0080ef8.tar.gz |
converted most handlers to use new helper classes.
* converted all ExtendedHandler & MultiBackendHandler subclasses
to use GenericHandler + appropriate mixins.
* converted most SimpleHandler subclasses to use StaticHandler.
* changed some hashes to parse_mc2/mc3 methods:
md5_crypt, apr_md5_crypt, most pbkdf2 hashes, sha1_crypt
* changed most hashes to coerce unicode hash strings -> ascii
* changed some internal attribute names for consistency
Diffstat (limited to 'passlib/handlers/misc.py')
-rw-r--r-- | passlib/handlers/misc.py | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/passlib/handlers/misc.py b/passlib/handlers/misc.py index 2a2d3c5..6deffd8 100644 --- a/passlib/handlers/misc.py +++ b/passlib/handlers/misc.py @@ -8,7 +8,7 @@ import logging; log = logging.getLogger(__name__) from warnings import warn #site #libs -from passlib.utils.handlers import SimpleHandler +import passlib.utils.handlers as uh #pkg #local __all__ = [ @@ -19,7 +19,7 @@ __all__ = [ #========================================================= #handler #========================================================= -class unix_fallback(SimpleHandler): +class unix_fallback(uh.StaticHandler): """This class fallback behavior for unix shadow files, and follows the :ref:`password-hash-api`. This class does not implement a hash, but instead provides fallback @@ -34,18 +34,14 @@ class unix_fallback(SimpleHandler): all passwords will be allowed through if the hash is an empty string. """ name = "unix_fallback" - setting_kwds = () context_kwds = ("enable_wildcard",) + _stub_config = "!" @classmethod def identify(cls, hash): return hash is not None @classmethod - def genconfig(cls): - return "!" - - @classmethod def genhash(cls, secret, hash, enable_wildcard=False): if secret is None: raise TypeError("secret must be string") @@ -59,14 +55,12 @@ class unix_fallback(SimpleHandler): raise ValueError("no hash provided") return enable_wildcard and not hash -class plaintext(SimpleHandler): +class plaintext(uh.StaticHandler): """This class stores passwords in plaintext, and follows the :ref:`password-hash-api`. Unicode passwords will be encoded using utf-8. """ name = "plaintext" - setting_kwds = () - context_kwds = () @classmethod def identify(cls, hash): @@ -80,12 +74,6 @@ class plaintext(SimpleHandler): secret = secret.encode("utf-8") return secret - @classmethod - def verify(cls, secret, hash): - if hash is None: - raise ValueError("no hash specified") - return hash == cls.genhash(secret, hash) - #========================================================= #eof #========================================================= |