[mod_python] Authentication

Peter McA'Nulty peter at webreply.com
Fri Aug 24 08:32:46 EST 2001


> ...even if the user is entering an area that's not protected. Not a very
nice sollution, but workable (perhaps)

The standard way of handling protected and unprotected data is something
like the config below.  You put protected files in one directory tree and
unprotected files in another tree (usually, the unprotected files include
all/most of your images, your css, etc)

<directory /apache/htdocs/vhostdir>
    PythonHandler pyhandler
    AddHandler python-program .py .phtml

    <directory /apache/htdocs/vhostdir/protected>
        PythonAuthenHandler authenhandler
        AuthType Basic
        AuthName "admin.dthk2"
        require valid-user
    </directory>

    <directory /apache/htdocs/vhostdir/UNprotected>
    </directory>
</directory>


----- Original Message -----
From: <riesch at nieuw.nl>
To: <mod_python at modpython.org>
Sent: Friday, August 24, 2001 4:12 AM
Subject: [mod_python] Authentication


> Hi there,
>
>
> I'm using the standard authentication now (with the authenhandler). This
all works fine, but I can't seem to figure out how to let a user logout.
I've tried to pass information about logout with the url. Something like:
>
> http://www.site.com/?logout
>
> def authenhandler(req):
>    form = util.FieldStorage(req, keep_blank_values=1)
>
>    if form.has_key(logout):
>       return apache.HTTP_UNAUTHORIZED
>
>    pw   = req.get_basic_auth_pw()
>    user = req.connection.user
>    if correct_user(user, pw):
>       return apache.OK
>    else:
>       return apache.HTTP_UNAUTHORIZED
>
>
>
> Unfortunately, this has the following effects:
> -
> The dialog pops up, even if the user is entering an area that's not
protected. Not a very nice sollution, but workable (perhaps)
> -
> The url stays the same, which causes that the 'form' keeps logout-key.
This results in repeatedly returing of HTTP_UNAUTHORIZED.
>
>
> Does anyone have experience with this, or have some hints or thoughts ?
>
>
> Thanks ahead,
> Richard
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list