diff options
| author | ianb <devnull@localhost> | 2006-06-30 01:20:37 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2006-06-30 01:20:37 +0000 |
| commit | 9fbe95205d4a9d5ee875ce16c7ffd8ce4fb0b94d (patch) | |
| tree | afb00c51eab0501b7e2b6b16b343cad998dfcff0 /paste/auth | |
| parent | 89f9342f178a6b1b26ded65e6800c2eee97a2b6d (diff) | |
| download | paste-9fbe95205d4a9d5ee875ce16c7ffd8ce4fb0b94d.tar.gz | |
Patch from Brad Clements to add Paste Deploy support for paste.auth methods
Diffstat (limited to 'paste/auth')
| -rw-r--r-- | paste/auth/basic.py | 19 | ||||
| -rw-r--r-- | paste/auth/digest.py | 18 | ||||
| -rw-r--r-- | paste/auth/form.py | 18 |
3 files changed, 55 insertions, 0 deletions
diff --git a/paste/auth/basic.py b/paste/auth/basic.py index 8f0ecab..1a91e04 100644 --- a/paste/auth/basic.py +++ b/paste/auth/basic.py @@ -98,6 +98,25 @@ middleware = AuthBasicHandler __all__ = ['AuthBasicHandler'] +def make_basic(app, global_conf, realm, authfunc, **kw): + """ + Grant access via basic authentication + + Config looks like this:: + + [filter:grant] + use = egg:Paste#auth_basic + realm=myrealm + authfunc=somepackage.somemodule:somefunction + + """ + from paste.util.import_string import eval_import + import types + authfunc = eval_import(authfunc) + assert isinstance(authfunc, types.FunctionType), "authfunc must resolve to a function" + return AuthBasicHandler(app, realm, authfunc) + + if "__main__" == __name__: import doctest doctest.testmod(optionflags=doctest.ELLIPSIS) diff --git a/paste/auth/digest.py b/paste/auth/digest.py index 106f8e6..eae81a2 100644 --- a/paste/auth/digest.py +++ b/paste/auth/digest.py @@ -184,6 +184,24 @@ middleware = AuthDigestHandler __all__ = ['digest_password', 'AuthDigestHandler' ] +def make_digest(app, global_conf, realm, authfunc, **kw): + """ + Grant access via digest authentication + + Config looks like this:: + + [filter:grant] + use = egg:Paste#auth_digest + realm=myrealm + authfunc=somepackage.somemodule:somefunction + + """ + from paste.util.import_string import eval_import + import types + authfunc = eval_import(authfunc) + assert isinstance(authfunc, types.FunctionType), "authfunc must resolve to a function" + return AuthDigestHandler(app, realm, authfunc) + if "__main__" == __name__: import doctest doctest.testmod(optionflags=doctest.ELLIPSIS) diff --git a/paste/auth/form.py b/paste/auth/form.py index 4d660a7..f13abf8 100644 --- a/paste/auth/form.py +++ b/paste/auth/form.py @@ -121,6 +121,24 @@ middleware = AuthFormHandler __all__ = ['AuthFormHandler'] +def make_form(app, global_conf, realm, authfunc, **kw): + """ + Grant access via form authentication + + Config looks like this:: + + [filter:grant] + use = egg:Paste#auth_form + realm=myrealm + authfunc=somepackage.somemodule:somefunction + + """ + from paste.util.import_string import eval_import + import types + authfunc = eval_import(authfunc) + assert isinstance(authfunc, types.FunctionType), "authfunc must resolve to a function" + return AuthFormHandler(app, realm, authfunc) + if "__main__" == __name__: import doctest doctest.testmod(optionflags=doctest.ELLIPSIS) |
