On 22.09.2007, at 19:16, Philipp von Weitershausen wrote:
Jodok Batlogg wrote:I have written a custom authenticator in my application toauthenticate a login against a PostgreSQL database. In the site I haveconfigured a PAU with a session credentials plugin and my custom authenticator plugin. I found out that with configuration, EVERY browser request is triggering my custom authenticator, which means a query of thedatabase. I'd rather expect only the first login will send a databaserequest, and before one logs out, subsequent requests will no longer be authenticated.exactly, that's the default behavior. and it needs to be that way.in case the credentials are beeing changed or privileges are beeing revoked there are several use cases where you can't cache.Does the PAU have a mechanism to cache the authentication before the user is logged out? Otherwise the authentication would be a highly inefficient process.you need to implement caching on your own... just do something like: from zope.app.cache.ram import RAMCache authCache = RAMCache()key = {'user': credentials['login'].encode('utf-8'), 'pass': credentials['password'].encode('utf-8')}result = authCache.query(self, key=key) if result is None: # perform database lookup authCache.set(result, self, key=key) return resultWhat's with the encoding to utf-8? Coudln't you simply use unicode?
well the snipped was just copied from our code. probably we receive the password somehow different.
it should be possible to use unicode jodok
Note that you can also use sessions. --http://worldcookery.com -- Professional Zope documentation and training_______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
-- "Readability counts." -- The Zen of Python, by Tim Peters Jodok Batlogg, Lovely Systems Schmelzhütterstraße 26a, 6850 Dornbirn, Austria phone: +43 5572 908060, fax: +43 5572 908060-77
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users