summaryrefslogtreecommitdiff
path: root/docs/designdefense.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2019-12-26 12:52:03 -0600
committerGitHub <noreply@github.com>2019-12-26 12:52:03 -0600
commit9e61a82458187abdd1747bbd8c38c6089b80b3ab (patch)
tree186792f43eef99b67eaa561ffa1993180ec45271 /docs/designdefense.rst
parent323cfbb45e6ee4b7462bbea9dcaa4e8258dd74f6 (diff)
parent1631386fe2d8ea0f7419812b9cab381c668d2ebb (diff)
downloadpyramid-9e61a82458187abdd1747bbd8c38c6089b80b3ab.tar.gz
pyramid-9e61a82458187abdd1747bbd8c38c6089b80b3ab.tar.bz2
pyramid-9e61a82458187abdd1747bbd8c38c6089b80b3ab.zip
Merge pull request #3550 from mmerickel/moar-security-policy
security policy docs and legacy policy improvements
Diffstat (limited to 'docs/designdefense.rst')
-rw-r--r--docs/designdefense.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/designdefense.rst b/docs/designdefense.rst
index 967a1aaed..0fa609aa1 100644
--- a/docs/designdefense.rst
+++ b/docs/designdefense.rst
@@ -199,11 +199,11 @@ Under its hood however, the implementation of ``authenticated_userid`` is this:
def authenticated_userid(request):
""" Return the userid of the currently authenticated user or
- ``None`` if there is no authentication policy in effect or there
+ ``None`` if there is no security policy in effect or there
is no currently authenticated user. """
registry = request.registry # the ZCA component registry
- policy = registry.queryUtility(IAuthenticationPolicy)
+ policy = registry.queryUtility(ISecurityPolicy)
if policy is None:
return None
return policy.authenticated_userid(request)
@@ -264,19 +264,19 @@ instead of the rule. So instead of:
.. code-block:: python
:linenos:
- from pyramid.interfaces import IAuthenticationPolicy
+ from pyramid.interfaces import ISecurityPolicy
from zope.component import getUtility
- policy = getUtility(IAuthenticationPolicy)
+ policy = getUtility(ISecurityPolicy)
:app:`Pyramid` code will usually do:
.. code-block:: python
:linenos:
- from pyramid.interfaces import IAuthenticationPolicy
+ from pyramid.interfaces import ISecurityPolicy
from pyramid.threadlocal import get_current_registry
registry = get_current_registry()
- policy = registry.getUtility(IAuthenticationPolicy)
+ policy = registry.getUtility(ISecurityPolicy)
While the latter is more verbose, it also arguably makes it more obvious what's
going on. All of the :app:`Pyramid` core code uses this pattern rather than