[Tutor] mod_python authentication

Benno Lang transmogribenno at gmail.com
Sat Dec 5 13:02:56 CET 2009


On Sat, Dec 5, 2009 at 8:26 PM, Rayon <evosweet at hotmail.com> wrote:
> I need to  setup a login page for a web application but I am not finding any
> code in the mod_python doc that shows me how to do this.
>
> What is need is the code to tell apache to get this login data from a login
> page.

If you want Apache to directly handle logins via HTTP auth then you
don't need to write any code, just configure your vhost or .htaccess
file (see for example the AuthUserFile directive).

OTOH if you want to build your own login system (e.g. with user
details stored in a database) then you:
1) Make a regular HTML form with username and password fields
2) Write whatever login processing code you need, and have the form
submit to it.
3) Check for an active login session on every page that requires
authentication, and redirect them back to the login form if necessary.

HTH,
benno.


More information about the Tutor mailing list