The equivalent in Webware would be something in the SitePage.awake() method, or something like LoginKit which I've found flexible enough for most any authentication I've needed to do. I also have a WSGI middleware for this (that I haven't used much), and http://www.pythonweb.org has something similar for WSGI.
This is how people tend to do it... but it only works in one environment. Which is one of several reasons there's so much pressure to have a homogenous environment. But I think it should be resolvable, at least on the Apache level, without binding it to any particular language or programming environment.