diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-07-01 08:13:25 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-07-01 08:13:25 +0000 |
| commit | 0688dad3e51361e3274650f39897100063f89459 (patch) | |
| tree | 585ba59c6ddef0aef171116eb682a0a64220b756 /docs/tutorials/bfgwiki2/src | |
| parent | dd7614a8e486735b7106331ca6b86229115de249 (diff) | |
| download | pyramid-0688dad3e51361e3274650f39897100063f89459.tar.gz pyramid-0688dad3e51361e3274650f39897100063f89459.tar.bz2 pyramid-0688dad3e51361e3274650f39897100063f89459.zip | |
- Deprecate the ``authentication_policy`` and ``authorization_policy``
arguments to ``repoze.bfg.router.make_app``. Instead, developers
should use the various authentication policy ZCML directives
(``repozewho1authenticationpolicy``,
``remoteuserauthenticationpolicy`` and
``authtktauthenticationpolicy``) and the `aclauthorizationpolicy``
authorization policy directive as described in the changes to the
"Security" narrative documentation chapter and the wiki tutorials.
Diffstat (limited to 'docs/tutorials/bfgwiki2/src')
3 files changed, 15 insertions, 13 deletions
diff --git a/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml b/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml index 2904b0793..65b29019b 100644 --- a/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml +++ b/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml @@ -53,4 +53,10 @@ <forbidden view=".login.login"/> + <authtktauthenticationpolicy + secret="sosecret" + /> + + <aclauthorizationpolicy/> + </configure> diff --git a/docs/tutorials/bfgwiki2/src/authorization/tutorial/run.py b/docs/tutorials/bfgwiki2/src/authorization/tutorial/run.py index 301f00312..a8ab1ce82 100644 --- a/docs/tutorials/bfgwiki2/src/authorization/tutorial/run.py +++ b/docs/tutorials/bfgwiki2/src/authorization/tutorial/run.py @@ -1,5 +1,4 @@ from repoze.bfg.router import make_app -from repoze.bfg.authentication import AuthTktAuthenticationPolicy import tutorial from tutorial.models import DBSession @@ -26,16 +25,5 @@ def app(global_config, **kw): raise ValueError("No 'db_string' value in application configuration.") initialize_sql(db_string) - authpolicy = AuthTktAuthenticationPolicy('seekr!t', callback=groupfinder) - - return make_app(RootFactory, tutorial, authentication_policy=authpolicy, - options=kw) - -USERS = {'editor':'editor', - 'viewer':'viewer'} -GROUPS = {'editor':['group.editors']} - -def groupfinder(userid, request): - if userid in USERS: - return GROUPS.get(userid, []) + return make_app(RootFactory, tutorial, options=kw) diff --git a/docs/tutorials/bfgwiki2/src/authorization/tutorial/security.py b/docs/tutorials/bfgwiki2/src/authorization/tutorial/security.py new file mode 100644 index 000000000..791367183 --- /dev/null +++ b/docs/tutorials/bfgwiki2/src/authorization/tutorial/security.py @@ -0,0 +1,8 @@ +USERS = {'editor':'editor', + 'viewer':'viewer'} +GROUPS = {'editor':['group.editors']} + +def groupfinder(userid, request): + if userid in USERS: + return GROUPS.get(userid, []) + |
