Hi,
I've set up web2py using tornado server like this:
web2py_app =
tornado.wsgi.WSGIContainer(gluon.main.appfactory(logfilename=None,
profilerfilename=None))
application = tornado.web.Application([
(r"/async", MyHandler),
(r".*", FallbackHandler, dict(fallback=web2py_app)),
])
I'm using tornado handlers to make asynchronous calls using ajax from
views served by web2py.Now I'd like to protect my calls using auth
from web2py. I've been doing some experiments and I'd like to reuse
the auth module from web2py. In order to create an instance of Auth
you need instances of Request,Response and Session (right?). The
problem is that I need to do this in a tornado handler (doesn't have
web2py env). Is there some easy way to create these instances?
If that is not possible I've been thinking about another way, but that
would require re-inventing the wheel. I can read a cookie set by
web2py to find out logged in user's id. Then I could make my own
queries to auth dababase, but I'd like to avoid that.
Any help would be greatly appreciated.