I have an application doing HTTP basic auth. It expects email address for
user name and a password. Soon after, I found out that Google Checkout
notification API that we use was also doing a HTTP basic auth but sends out
an "id:key" encoded authorization.
The digest auth was using a custom class I wrote called UsersFromDatabase
(not the same one that comes with authkit):
authkit.basic.authenticate.user.type = entic.lib.auth:UsersFromDatabase
authkit.basic.authenticate.user.data = entic.model
So basically, I have two different "clients" sending out two different
user/password types.
I started doing something like this:
def user_exists(self, mail):
"""
Returns ``True`` if a user exists with the given username, ``False``
otherwise. Usernames are case insensitive.
"""
# google checkout hack
if mail == "31893475848852":
return True
mail = mail.lower()
(uid, domain) = mail.split("@")
user =
self.meta.Session.query(self.model.User).filter_by(domain=domain).filter_by(uid=uid).first()
if user:
return True
return False
Is that the right approach? That seems kind of ugly though. Thanks.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.