From 9e16165069ca277d99ea91b9e282f8e9484e23cd Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Mon, 9 Jun 2014 20:27:24 -0400 Subject: [PATCH] Add default authentication and authorization libraries. --- xonstat/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xonstat/__init__.py b/xonstat/__init__.py index 3053367..37c661e 100644 --- a/xonstat/__init__.py +++ b/xonstat/__init__.py @@ -1,5 +1,7 @@ import sqlahelper from pyramid_beaker import set_cache_regions_from_settings +from pyramid.authentication import AuthTktAuthenticationPolicy +from pyramid.authorization import ACLAuthorizationPolicy from pyramid.config import Configurator from pyramid.httpexceptions import HTTPNotFound from pyramid.renderers import JSONP @@ -22,6 +24,12 @@ def main(global_config, **settings): config = Configurator(settings=settings) + # authentication and authorization policies + authn_policy = AuthTktAuthenticationPolicy('secret', hashalg='sha512') + authz_policy = ACLAuthorizationPolicy() + config.set_authentication_policy(authn_policy) + config.set_authorization_policy(authz_policy) + config.add_renderer('jsonp', JSONP(param_name='callback')) # for static assets -- 2.39.2