summaryrefslogtreecommitdiff
path: root/paste/auth/form.py
diff options
context:
space:
mode:
authorcce <devnull@localhost>2006-02-24 06:24:10 +0000
committercce <devnull@localhost>2006-02-24 06:24:10 +0000
commit3ece86d36d841c3d5023f7bab029c0b2b235e7e7 (patch)
tree1244c60800daaf2b9d42d6960195909ff84f571f /paste/auth/form.py
parent29dda90805f7eb854bf0b9557a3d6f300e41fad3 (diff)
downloadpaste-3ece86d36d841c3d5023f7bab029c0b2b235e7e7.tar.gz
This updates the paste.auth.* modules to include
environ in the authentication callback functions. - auth.basic was modified to have a callback of authfunc(environ, username, password) - auth.digest was modified in a similar manner, authfunc(environ, realm, password) - auth.digest's digest_password also had it's arguments reversed to be consistent with the corresponding authfunc(); if you're going to break -- let's fix two things at once! - auth.form has a change similar to auth.basic These changes were suggested via Matthew Scott on the paste mailing list; only that I put the environ first to be consistent with other WSGI functions.
Diffstat (limited to 'paste/auth/form.py')
-rw-r--r--paste/auth/form.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/paste/auth/form.py b/paste/auth/form.py
index 6cab687..4d660a7 100644
--- a/paste/auth/form.py
+++ b/paste/auth/form.py
@@ -16,7 +16,7 @@ to put ``paste.auth.cookie`` in your application stack.
>>> from paste.httpserver import serve
>>> from paste.auth.cookie import AuthCookieHandler
>>> from paste.auth.form import AuthFormHandler
->>> def authfunc(username, password):
+>>> def authfunc(environ, username, password):
... return username == password
>>> serve(AuthCookieHandler(
... AuthFormHandler(dump_environ, authfunc)))
@@ -66,9 +66,9 @@ class AuthFormHandler:
``authfunc``
This is a mandatory user-defined function which takes a
- ``username`` and ``password`` for its first and second
- arguments respectively. It should return ``True`` if
- the user is authenticated.
+ ``environ``, ``username`` and ``password`` for its first
+ three arguments. It should return ``True`` if the user is
+ authenticated.
``template``
@@ -103,7 +103,7 @@ class AuthFormHandler:
username = formvars.get('username')
password = formvars.get('password')
if username and password:
- if self.authfunc(username,password):
+ if self.authfunc(environ, username, password):
environ['AUTH_TYPE'] = 'form'
environ['REMOTE_USER'] = username
environ['REQUEST_METHOD'] = 'GET'