summaryrefslogtreecommitdiff
path: root/wsgitools/digest.py
diff options
context:
space:
mode:
Diffstat (limited to 'wsgitools/digest.py')
-rwxr-xr-xwsgitools/digest.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/wsgitools/digest.py b/wsgitools/digest.py
index a0eb973..7284c1c 100755
--- a/wsgitools/digest.py
+++ b/wsgitools/digest.py
@@ -38,14 +38,15 @@ class AuthTokenGenerator:
interface consists of beeing callable with a username and having a
realm attribute being a string."""
def __init__(self, realm, getpass):
- """Realm is a string according to RFC2617.
- The provided getpass function is called with a username and
- password is expected as result. None may be used as an invalid
- password."""
+ """
+ @param realm: is a string according to RFC2617.
+ @param getpass: this function is called with a username and password is
+ expected as result. None may be used as an invalid password."""
self.realm = realm
self.getpass = getpass
def __call__(self, username, algo="md5"):
- """Generates an authentification token from a username."""
+ """Generates an authentification token from a username.
+ @type username: str"""
assert algo.lower() in ["md5", "md5-sess"]
password = self.getpass(username)
if password is None:
@@ -58,15 +59,16 @@ class AuthDigestMiddleware:
"""Middleware partly implementing RFC2617. (md5-sess was omited)"""
algorithms = {"md5": lambda data: md5.new(data).hexdigest()}
def __init__(self, app, gentoken, maxage=300, maxuses=5):
- """app is the wsgi application to be served with authentification.
- gentoken has to have the same functionality and interface as the
+ """
+ @param app: is the wsgi application to be served with authentification.
+ @param gentoken: has to have the same functionality and interface as the
AuthTokenGenerator class.
- maxage is the number of seconds a nonce may be valid. Choosing a large
- value may result in more memory usage whereas a smaller value
- results in more requests. Defaults to 5 minutes.
- maxuses is the number of times a nonce may be used (with different nc
- values). A value of 1 makes nonces usable exactly once
- resulting in more requests. Defaults to 5.
+ @param maxage: is the number of seconds a nonce may be valid. Choosing a
+ large value may result in more memory usage whereas a smaller
+ value results in more requests. Defaults to 5 minutes.
+ @param maxuses: is the number of times a nonce may be used (with
+ different nc values). A value of 1 makes nonces usable exactly
+ once resulting in more requests. Defaults to 5.
"""
self.app = app
self.gentoken = gentoken