Skip to content

Instantly share code, notes, and snippets.

@djoreilly
Created March 20, 2013 22:04
Show Gist options
  • Save djoreilly/5208944 to your computer and use it in GitHub Desktop.
Save djoreilly/5208944 to your computer and use it in GitHub Desktop.
webob middleware layer
from webob.dec import wsgify
from webob import exc
@wsgify.middleware
def auth_filter(request, app):
if request.headers.get('X-Auth-Token') != 'open-sesame':
return exc.HTTPForbidden()
return app(request)
def filter_factory(global_config, **local_config):
return auth_filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment