pyramid_cubicweb/defaults.py
author Christophe de Vienne <christophe@unlish.com>
Thu, 21 Aug 2014 21:43:24 +0200
changeset 11499 60a504740951
parent 11493 00e5cb9771c5
child 11506 bfc1aa1dba30
permissions -rw-r--r--
Convert cubicweb.NotFound to HTTPNotFound Related to #4291173

from pyramid.authentication import SessionAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.session import SignedCookieSessionFactory

from pyramid_cubicweb.core import get_principals


def includeme(config):
    config.set_session_factory(
        SignedCookieSessionFactory(
            secret=config.registry.settings['session.secret']
        ))

    config.set_authentication_policy(
        SessionAuthenticationPolicy(callback=get_principals))
    config.set_authorization_policy(ACLAuthorizationPolicy())

    config.include('pyramid_cubicweb.login')