Skip to main content

This is a repoze.who IAuthenticator/IMetadataProvider plugin that can cache the results of other plugins using memcached. It’s useful for reducing load on e.g. a backend LDAP auth system.

To use it, give it the name of an authenticator and/or metadata provider whose results it should wrap:

[plugin:ldap]
use = my.ldap.authenticator

[plugin:cached_ldap]
use = repoze.who.plugins.memcached
authenticator_name = ldap

[authenticators]
plugins = cached_ldap ldap;unused

(The “ldap;unused” bit ensures that the wrapped ldap plugin still gets loaded, but is not used for matching any requests. Yeah, it’s yuck.)

To prevent a compromise of the cache from revealing auth credentials, this plugin calculates a HMAC hash of the items in the incoming identity and uses that as the cache key. This makes it possible to check the cache for a match to an incoming identity, while preventing the cache keys from being reversed back into a valid identity.

Items added to the identity by the wrapped plugin will be stored in the cached value and will not be encryped or obfuscated in any way.

The following configuration options are available:

  • memcached_urls: A list of URLs for the underlying memcached store.

  • authenticator_name: The name of an IAuthenticator plugin to wrap.

  • mdprovider_name: The name of an IMetadataProvider plugin to wrap.

  • key_items: A list of names from the identity dict that should be

    hashed to produce the cache key. These items should uniquely and validly identity a user. By default it will use all keys in the identity in sorted order.

  • value_items: A list of names from the identity dict that should be

    stored in the cache. These would typically be items of metadata such as the user’s email address. By default this will include all items that the wrapped plugin adds to the identity.

  • secret: A string used when calculating the HMAC the cache keys.

    All servers accessing a shared cache should use the same secret so they produce the same set of cache keys.

  • ttl: The time for which cache entries should persist, in seconds.

0.1.1 - 2012-01-30

  • Update license to MPL 2.0

0.1.0 - 2011-12-01

  • Initial release.

Release files for repoze.who.plugins.memcached 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repoze.who.plugins.memcached 0.1.1
File Size Uploaded
repoze.who.plugins.memcached-0.1.1.tar.gz 7.7 kB Details

Release files / repoze.who.plugins.memcached-0.1.1.tar.gz

Download URL repoze.who.plugins.memcached-0.1.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
02d1f7814360c1197810bf6ce59743da9d7c6370dd97aac950ec375a4b034a56
BLAKE2b-256 checksum
How to use checksums
d0539a40234a97dc40eae605f584a2ee784a9f960e52d7087ea3583184446894
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page