[Twisted-Python] Twisted-Web: Authenticating a usersite-wide ??

Thomas Weholt 2002 at weholt.org
Sat Jan 3 17:45:43 EST 2004


I got a problem using a custom-made web-application built upon Twisted. My problem is that when I ask a user for authentication, the cookie or whatever it is, is not available in the request-object for other sites than the one who asked for authentication. I want the user to login on one page, which sets the correct info so I can use request.getUser() and request.getPassword() later on all other pages to validate access to the requested resources.

In my RootResource I return something like this if I want the user authenticated:

request.setHeader('WWW-authenticate', 'Basic realm="%s"' % ("/"))
errpage = error.ErrorPage(http.UNAUTHORIZED, "Unauthorized", "401 Authentication required")
return errpage.render(request)

Is Basic realm = "/" correct if I want this authentication to be valid site-wide? What else can I use? What other approach can I use?

Happy for any hints or clues.

Thanks in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20040103/e5bb2e45/attachment.htm 

More information about the Twisted-Python mailing list