--- a/src/pyams_security/utility.py Fri Oct 05 15:50:09 2018 +0200
+++ b/src/pyams_security/utility.py Thu Nov 08 15:23:22 2018 +0100
@@ -12,30 +12,27 @@
__docformat__ = 'restructuredtext'
-
-# import standard library
import logging
logger = logging.getLogger('PyAMS (security)')
from functools import lru_cache
-# import interfaces
-from pyams_security.interfaces import ISecurityManager, ICredentialsPlugin, IAuthenticationPlugin, \
- IDirectoryPlugin, AuthenticatedPrincipalEvent, IProtectedObject, IGroupsAwareDirectoryPlugin
+from beaker.cache import cache_region
+from pyramid.authentication import AuthTktCookieHelper
+from pyramid.decorator import reify
from pyramid.interfaces import IAuthenticationPolicy
+from pyramid.location import lineage
+from pyramid.security import Authenticated, Everyone
+from zope.container.folder import Folder
+from zope.interface import implementer
+from zope.schema.fieldproperty import FieldProperty
-# import packages
-from pyams_security.principal import UnknownPrincipal, MissingPrincipal
+from pyams_security.interfaces import AuthenticatedPrincipalEvent, IAuthenticationPlugin, ICredentialsPlugin, \
+ IDirectoryPlugin, IGroupsAwareDirectoryPlugin, IProtectedObject, ISecurityManager
+from pyams_security.principal import MissingPrincipal, UnknownPrincipal
from pyams_utils.registry import query_utility
from pyams_utils.request import check_request, request_property
from pyams_utils.wsgi import wsgi_environ_cache
-from pyramid.authentication import AuthTktCookieHelper
-from pyramid.decorator import reify
-from pyramid.location import lineage
-from pyramid.security import Everyone, Authenticated
-from zope.container.folder import Folder
-from zope.interface import implementer
-from zope.schema.fieldproperty import FieldProperty
@implementer(ISecurityManager)
@@ -133,7 +130,7 @@
if principal is not None:
return principal.id
- # @cache_region('short', 'security_plugins_principals')
+ @cache_region('short', 'security_plugins_principals')
def _get_plugins_principals(self, principal_id):
principals = set()
# get direct principals
@@ -213,7 +210,7 @@
"""
def __init__(self, secret,
- credentials=('http', ),
+ credentials=('http',),
cookie_name='auth_ticket',
secure=False,
include_ip=False,