using httpauth - which user just signed in?

2 views
Skip to first unread message

Kevin Coyner

unread,
Feb 7, 2007, 3:29:55 PM2/7/07
to cherryp...@googlegroups.com

I'm using the module httpauth in CP 3.0 to do basic authentication. I have a
working setup, but need to figure out one more thing ... Who is the user that
just signed in?

Here's a code snippet:

-------------------------------
import webpage, cherrypy, os, fetchusers
from cherrypy.lib import httpauth

class Members(webpage.Webpage):

_cp_config = {'tools.basic_auth.on': True,
'tools.basic_auth.realm': 'localhost',
'tools.basic_auth.users': fetchusers.fetch_users }

""" other stuff follows """
<snip>
-------------------------------

... where fetchusers.fetch_users is a dict of users/passwords.

I have about a 100 username/password combinations in fetchusers and this does
work. They can all authenticate.

But what I need to know is what user just signed in successfully. Is there a
way to retrieve this?

Thanks
Kevin

--
Kevin Coyner GnuPG key: 1024D/8CE11941

Sylvain Hellegouarch

unread,
Feb 7, 2007, 4:31:46 PM2/7/07
to cherryp...@googlegroups.com
Hi Kevin,

I agree this makes sense and was actually implemented in the
httpauthfilter itself recently thanks to a user asking as well :)

It is now implemented in CP3 as of rev1614:

See http://www.cherrypy.org/ticket/653

Hope that helps.
- Sylvain

Reply all
Reply to author
Forward
0 new messages