summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheron Luhn <theron@luhn.com>2019-12-14 18:57:03 -0600
committerTheron Luhn <theron@luhn.com>2019-12-14 18:57:38 -0600
commit495da107e3da765649957a0c03561648ea75e26b (patch)
treef5e69819cd6fc5da8f052517d25603235c103591
parent0f1ef0d4885ab2fd99d1cf2ccc92886c5519f651 (diff)
downloadpyramid-495da107e3da765649957a0c03561648ea75e26b.tar.gz
pyramid-495da107e3da765649957a0c03561648ea75e26b.tar.bz2
pyramid-495da107e3da765649957a0c03561648ea75e26b.zip
Correct implementation of Request.unauthenticated_userid.
New implementation was not backwards compatible. This brings back the old implementation, except changing to pull from ISecurityPolicy.authenticated_userid when applicable. Also undeprecated the method again.
-rw-r--r--src/pyramid/security.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/pyramid/security.py b/src/pyramid/security.py
index 053ff5818..838bcebbd 100644
--- a/src/pyramid/security.py
+++ b/src/pyramid/security.py
@@ -376,18 +376,14 @@ class AuthenticationAPIMixin(object):
associated with the userid exists in persistent storage.
"""
- policy = _get_security_policy(self)
- if policy is None:
+ authn = _get_authentication_policy(self)
+ security = _get_security_policy(self)
+ if authn is not None:
+ return authn.unauthenticated_userid(self)
+ elif security is not None:
+ return security.authenticated_userid(self)
+ else:
return None
- return policy.authenticated_userid(self)
-
- unauthenticated_userid = deprecated(
- unauthenticated_userid,
- 'The new security policy has removed the concept of unauthenticated '
- 'userid. See https://docs.pylonsproject.org/projects/pyramid/en/latest'
- '/whatsnew-2.0.html#upgrading-authentication-authorization '
- 'for more information.',
- )
@property
def effective_principals(self):