[mod_python] Using mod_python for auth only

Graham Dumpleton grahamd at dscpl.com.au
Thu Dec 15 17:51:25 EST 2005


Josh Hoyt wrote ..
> Hello,
> 
> I'm using mod_python to implement a custom authorization handler. I
> have the authorization code working how I want it to work. Now I want
> to be able to use mod_python for authorization and specify a
> non-Python handler for the remainder of the request. Is it possible to
> use mod_python to handle just the authorization phase?
> 
> In case I didn't make myself clear, here is what I'd like to be able to
> do:
> 
>   <Files "foo">
>     SetHandler foo-handler
>     # Not SetHandler mod_python, because that removes the foo-handler
>     PythonAuthenHandler myhandler
>     Require valid-user
>   </Files>
> 
>   <Files "bar">
>     SetHandler bar-handler
>     PythonAuthenHandler myhandler
>     Require valid-user
>   </Files>

It should be possible to do what you want and the above is more or
less right. The mod_python authentication handler will not be called
by default though, the Apache configuration has to be such as to
cause it to be triggered. This generally requires AuthType directive,
plus Require directive. Eg:

  AuthType Basic
  AuthName "Restricted Files"
  Require valid-user
  PythonAuthenHandler myhandler

Graham



More information about the Mod_python mailing list