diff options
| author | Michael Merickel <michael@merickel.org> | 2019-12-30 13:29:25 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2019-12-30 13:29:25 -0600 |
| commit | 25439c2dbd4ff971e2a32ac96fc893de0bdcefd3 (patch) | |
| tree | 373621fc7f9e1239aa92782ee8fd733c3a512e1b /docs/narr | |
| parent | bd8f73be18f8f54daff34debd976a4b81be886aa (diff) | |
| download | pyramid-25439c2dbd4ff971e2a32ac96fc893de0bdcefd3.tar.gz pyramid-25439c2dbd4ff971e2a32ac96fc893de0bdcefd3.tar.bz2 pyramid-25439c2dbd4ff971e2a32ac96fc893de0bdcefd3.zip | |
rename identify(request) to authenticated_identity(request)
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 ac64cba0a..e3820ce19 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 identify(self, request): + def authenticated_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.identify(request) + identity = self.authenticated_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.identify(request) + identity = self.authenticated_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 identify(self, request): + def authenticated_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.identify(request) + identity = self.authenticated_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.identify(request) + identity = self.authenticated_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.identify(request) + identity = self.authenticated_identity(request) if identity is None: return Denied('User is not signed in.') |
