def __call__(self, environ, start_response): auth = environ.get('HTTP_AUTHORIZATION') if auth: scheme, data = auth.split(None, 1) assert scheme.lower() == 'basic' username, password = data.decode('base64').split(':', 1) # parse url kw, req = parse(environ) # use cork standard login way self.login(environ, req, username=username, password=password) environ['REMOTE_USER'] = username del environ['HTTP_AUTHORIZATION'] return BaseFilter.__call__(self, environ, start_response)