diff options
| author | Theron Luhn <theron@luhn.com> | 2020-10-13 23:08:00 -0700 |
|---|---|---|
| committer | Theron Luhn <theron@luhn.com> | 2020-10-13 23:08:00 -0700 |
| commit | ab80ac7996bf792ddf3fbcce639e4b6714b401e6 (patch) | |
| tree | 1b54439857877acda31c0460c0dfb92648daf0b8 /docs/tutorials/wiki | |
| parent | ee7ca28cc51cf40d1190144834704e287c9fc72d (diff) | |
| download | pyramid-ab80ac7996bf792ddf3fbcce639e4b6714b401e6.tar.gz pyramid-ab80ac7996bf792ddf3fbcce639e4b6714b401e6.tar.bz2 pyramid-ab80ac7996bf792ddf3fbcce639e4b6714b401e6.zip | |
Rename `ISecurityPolicy.authenticated_identity` to `identity`
Diffstat (limited to 'docs/tutorials/wiki')
| -rw-r--r-- | docs/tutorials/wiki/authorization.rst | 2 | ||||
| -rw-r--r-- | docs/tutorials/wiki/src/authorization/tutorial/security.py | 6 | ||||
| -rw-r--r-- | docs/tutorials/wiki/src/tests/tutorial/security.py | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/docs/tutorials/wiki/authorization.rst b/docs/tutorials/wiki/authorization.rst index 3c9913d8c..9c685639d 100644 --- a/docs/tutorials/wiki/authorization.rst +++ b/docs/tutorials/wiki/authorization.rst @@ -88,7 +88,7 @@ The security policy controls several aspects of authentication and authorization Identifying logged-in users ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The ``MySecurityPolicy.authenticated_identity`` method inspects the ``request`` and determines if it came from an authenticated user. +The ``MySecurityPolicy.identity`` method inspects the ``request`` and determines if it came from an authenticated user. It does this by utilizing the :class:`pyramid.authentication.AuthTktCookieHelper` class which stores the :term:`identity` in a cryptographically-signed cookie. If a ``request`` does contain an identity, then we perform a final check to determine if the user is valid in our current ``USERS`` store. diff --git a/docs/tutorials/wiki/src/authorization/tutorial/security.py b/docs/tutorials/wiki/src/authorization/tutorial/security.py index f4445578e..6c091b4a6 100644 --- a/docs/tutorials/wiki/src/authorization/tutorial/security.py +++ b/docs/tutorials/wiki/src/authorization/tutorial/security.py @@ -28,13 +28,13 @@ class MySecurityPolicy: self.authtkt = AuthTktCookieHelper(secret) self.acl = ACLHelper() - def authenticated_identity(self, request): + def identity(self, request): identity = self.authtkt.identify(request) if identity is not None and identity['userid'] in USERS: return identity def authenticated_userid(self, request): - identity = self.authenticated_identity(request) + identity = self.identity(request) if identity is not None: return identity['userid'] @@ -50,7 +50,7 @@ class MySecurityPolicy: def effective_principals(self, request): principals = [Everyone] - identity = self.authenticated_identity(request) + identity = self.identity(request) if identity is not None: principals.append(Authenticated) principals.append('u:' + identity['userid']) diff --git a/docs/tutorials/wiki/src/tests/tutorial/security.py b/docs/tutorials/wiki/src/tests/tutorial/security.py index f4445578e..6c091b4a6 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/security.py +++ b/docs/tutorials/wiki/src/tests/tutorial/security.py @@ -28,13 +28,13 @@ class MySecurityPolicy: self.authtkt = AuthTktCookieHelper(secret) self.acl = ACLHelper() - def authenticated_identity(self, request): + def identity(self, request): identity = self.authtkt.identify(request) if identity is not None and identity['userid'] in USERS: return identity def authenticated_userid(self, request): - identity = self.authenticated_identity(request) + identity = self.identity(request) if identity is not None: return identity['userid'] @@ -50,7 +50,7 @@ class MySecurityPolicy: def effective_principals(self, request): principals = [Everyone] - identity = self.authenticated_identity(request) + identity = self.identity(request) if identity is not None: principals.append(Authenticated) principals.append('u:' + identity['userid']) |
