skip to navigation
skip to content

Not Logged In

pyramid_contextauth 0.0.1

Pyramid Security Extension

Latest Version: 0.7.3

A simple pyramid extension to provides contexts based authentication policy. To register authentication methods:

from pyramid.security import remember, forget

class Context(object):
    pass

def authenticated_userid(request):
    return unauthenticated_userid(request)

def unauthenticated_userid(request):
    "A dummy example"
    return request.POST.get('userid')

def effective_principals(request):
    if unauthenticated_userid(request):
        return ['User']
    return []

def includeme(config):
    from pyramid_contextauth import get_authentication_policy
    policy = get_authentication_policy(config)
    policy.register_context(
        Context,
        authenticated_userid,
        unauthenticated_userid,
        effective_principals,
        remember,
        forget
        )
 
File Type Py Version Uploaded on Size
pyramid_contextauth-0.0.1.tar.gz (md5) Source 2013-02-14 3KB
  • Downloads (All Versions):
  • 30 downloads in the last day
  • 374 downloads in the last week
  • 4201 downloads in the last month