diff options
author | Joar Wandborg <git@wandborg.com> | 2012-09-13 20:59:00 +0200 |
---|---|---|
committer | Joar Wandborg <git@wandborg.com> | 2012-09-13 20:59:00 +0200 |
commit | a062149e90731cfd730d8a539a32354065a8c9e8 (patch) | |
tree | 244a4b117db4594a72d9d04d152648ffcca02134 /mediagoblin/tools | |
parent | f46e2a4db9e70aba473bec537300103c9102ef1a (diff) | |
download | mediagoblin-a062149e90731cfd730d8a539a32354065a8c9e8.tar.lz mediagoblin-a062149e90731cfd730d8a539a32354065a8c9e8.tar.xz mediagoblin-a062149e90731cfd730d8a539a32354065a8c9e8.zip |
Created API plugin, moved api_auth to the API plugin
Diffstat (limited to 'mediagoblin/tools')
-rw-r--r-- | mediagoblin/tools/pluginapi.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/mediagoblin/tools/pluginapi.py b/mediagoblin/tools/pluginapi.py index f0c8bbc8..7c1e108b 100644 --- a/mediagoblin/tools/pluginapi.py +++ b/mediagoblin/tools/pluginapi.py @@ -209,32 +209,3 @@ def get_config(key): return plugin_section.get(key, {}) -def api_auth(controller): - @wraps(controller) - def wrapper(request, *args, **kw): - auth_candidates = [] - - for auth in PluginManager().get_hook_callables('auth'): - _log.debug('Plugin auth: {0}'.format(auth)) - if auth.trigger(request): - auth_candidates.append(auth) - - # If we can't find any authentication methods, we should not let them - # pass. - if not auth_candidates: - from webob import exc - return exc.HTTPForbidden() - - # For now, just select the first one in the list - auth = auth_candidates[0] - - _log.debug('Using {0} to authorize request {1}'.format( - auth, request.url)) - - if not auth(request, *args, **kw): - from webob import exc - return exc.HTTPForbidden() - - return controller(request, *args, **kw) - - return wrapper |