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/narr | |
| 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/narr')
| -rw-r--r-- | docs/narr/security.rst | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/narr/security.rst b/docs/narr/security.rst index 10e9df78d..74149e6b0 100644 --- a/docs/narr/security.rst +++ b/docs/narr/security.rst @@ -69,7 +69,7 @@ A simple security policy might look like the following: from pyramid.security import Allowed, Denied class SessionSecurityPolicy: - def authenticated_identity(self, request): + def identity(self, request): """ Return app-specific user object. """ userid = request.session.get('userid') if userid is None: @@ -78,14 +78,14 @@ A simple security policy might look like the following: def authenticated_userid(self, request): """ Return a string ID for the user. """ - identity = self.authenticated_identity(request) + identity = self.identity(request) if identity is None: return None return string(identity.id) def permits(self, request, context, permission): """ Allow access to everything if signed in. """ - identity = self.authenticated_identity(request) + identity = self.identity(request) if identity is not None: return Allowed('User is signed in.') else: @@ -144,7 +144,7 @@ For example, our above security policy can leverage these helpers like so: def __init__(self): self.helper = SessionAuthenticationHelper() - def authenticated_identity(self, request): + def identity(self, request): """ Return app-specific user object. """ userid = self.helper.authenticated_userid(request) if userid is None: @@ -153,14 +153,14 @@ For example, our above security policy can leverage these helpers like so: def authenticated_userid(self, request): """ Return a string ID for the user. """ - identity = self.authenticated_identity(request) + identity = self.identity(request) if identity is None: return None return str(identity.id) def permits(self, request, context, permission): """ Allow access to everything if signed in. """ - identity = self.authenticated_identity(request) + identity = self.identity(request) if identity is not None: return Allowed('User is signed in.') else: @@ -249,7 +249,7 @@ might look like so: class SecurityPolicy: def permits(self, request, context, permission): - identity = self.authenticated_identity(request) + identity = self.identity(request) if identity is None: return Denied('User is not signed in.') |
