def sample_app(environ, start_response): """ A sample WSGI application that returns a 401 status code when the path ``/private`` is entered, triggering the authenticate middleware to prompt the user to sign in. If used with the authenticate middleware's form method, the path ``/signout`` will display a signed out message if ``authkit.cookie.signout = /signout`` is specified in the config file. If used with the authenticate middleware's forward method, the path ``/signin`` should be used to display the sign in form. The path ``/`` always displays the environment. """ if environ['PATH_INFO']=='/private': authorize_request(environ, RemoteUser()) if environ['PATH_INFO'] == '/signout': start_response('200 OK', [('Content-type', 'text/plain; charset=UTF-8')]) if environ.has_key('REMOTE_USER'): return ["Signed Out"] else: return ["Not signed in"] elif environ['PATH_INFO'] == '/signin': start_response('200 OK', [('Content-type', 'text/plain; charset=UTF-8')]) return ["Your application would display a \nsign in form here."] else: start_response('200 OK', [('Content-type', 'text/plain; charset=UTF-8')]) result = ['You Have Access To This Page.\n\nHere is the environment...\n\n'] for k,v in environ.items(): result.append('%s: %s\n'%(k,v)) return result
def _inner(self, *args, **kwargs): authorize_request(self.request.environ, permission) return func(self, *args, **kwargs)