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-- |
11492
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
1 |
from pyramid.authentication import SessionAuthenticationPolicy |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
2 |
from pyramid.authorization import ACLAuthorizationPolicy |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
3 |
from pyramid.session import SignedCookieSessionFactory |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
4 |
|
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
5 |
from pyramid_cubicweb.core import get_principals |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
6 |
|
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
7 |
|
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
8 |
def includeme(config): |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
9 |
config.set_session_factory( |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
10 |
SignedCookieSessionFactory( |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
11 |
secret=config.registry.settings['session.secret'] |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
12 |
)) |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
13 |
|
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
14 |
config.set_authentication_policy( |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
15 |
SessionAuthenticationPolicy(callback=get_principals)) |
b0b8942cdb80
Separate into 4 modules
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
16 |
config.set_authorization_policy(ACLAuthorizationPolicy()) |
11493
00e5cb9771c5
Put the login view in a separate module.
Christophe de Vienne <christophe@unlish.com>
parents:
11492
diff
changeset
|
17 |
|
00e5cb9771c5
Put the login view in a separate module.
Christophe de Vienne <christophe@unlish.com>
parents:
11492
diff
changeset
|
18 |
config.include('pyramid_cubicweb.login') |