Pyramid Security Extension
Project description
A simple pyramid extension to provides contexts based authentication policy. To register authentication methods:
from pyramid.security import remember, forget class Context(object): pass class ContextAuthenticationPolicy: def authenticated_userid(self, request): return unauthenticated_userid(request) def unauthenticated_userid(self, request): "A dummy example" return request.POST.get('userid') def effective_principals(self, request): if self.unauthenticated_userid(request): return ['User'] return [] def remember(self, request, prinicpal, **kw): return remember(request, prinicpal, **kw) def forget(self, request): return forget(request) def includeme(config): from pyramid_contextauth import get_authentication_policy policy = get_authentication_policy(config) policy.register_context(Context, ContextAuthenticationPolicy)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for pyramid_contextauth-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 507de7374465f3cae6caef37967f59abca3f4fd92f50cea399e0d2b85421373b |
|
MD5 | 3dd9603043ea46c54e07c1ec3e04811a |
|
BLAKE2b-256 | 37ad3be651825d5a1602ff92329b745b870d270d8d449bf68904f0d9f279c545 |