/usr/share/pyshared/zope.authentication-3.7.1.egg-info/PKG-INFO is in python-zope.authentication 3.7.1-3fakesync1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | Metadata-Version: 1.0
Name: zope.authentication
Version: 3.7.1
Summary: Definition of authentication basics for the Zope Framework
Home-page: http://pypi.python.org/pypi/zope.authentication
Author: Zope Corporation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: This package provides a definition of authentication concepts for use in
Zope Framework.
Detailed Documentation
======================
==============
Logout Support
==============
Logout support is defined by a simple interface ILogout:
>>> from zope.authentication.interfaces import ILogout
that has a single 'logout' method.
The current use of ILogout is to adapt an IAuthentication component to ILogout
To illustrate, we'll create a simple logout implementation that adapts
IAuthentication:
>>> class SimpleLogout(object):
...
... adapts(IAuthentication)
... implements(ILogout)
...
... def __init__(self, auth):
... pass
...
... def logout(self, request):
... print 'User has logged out'
>>> provideAdapter(SimpleLogout)
and something to represent an authentication utility:
>>> class Authentication(object):
...
... implements(IAuthentication)
>>> auth = Authentication()
To perform a logout, we adapt auth to ILogout and call 'logout':
>>> logout = ILogout(auth)
>>> logout.logout(TestRequest())
User has logged out
The 'NoLogout' Adapter
----------------------
The class:
>>> from zope.authentication.logout import NoLogout
can be registered as a fallback provider of ILogout for IAuthentication
components that are not otherwise adaptable to ILogout. NoLogout's logout
method is a no-op:
>>> NoLogout(auth).logout(TestRequest())
Logout User Interface
---------------------
Because some authentication protocols do not formally support logout, it may
not be possible for a user to logout once he or she has logged in. In such
cases, it would be inappropriate to present a user interface for logging out.
Because logout support is site-configurable, Zope provides an adapter that,
when registered, indicates that the site is configured for logout:
>>> from zope.authentication.logout import LogoutSupported
This class merely serves as a flag as it implements ILogoutSupported:
>>> from zope.authentication.interfaces import ILogoutSupported
>>> ILogoutSupported.implementedBy(LogoutSupported)
True
>>> request = object()
>>> ILogoutSupported.providedBy(LogoutSupported(request))
True
===============
Principal Terms
===============
Principal Terms are used to support browser interfaces for searching principal
sources. They provide access to tokens and titles for values. The principal
terms view uses an authentication utility to get principal titles. Let's
create an authentication utility to demonstrate how this works:
>>> class Principal:
... def __init__(self, id, title):
... self.id, self.title = id, title
>>> from zope.interface import implements
>>> from zope.authentication.interfaces import IAuthentication
>>> from zope.authentication.interfaces import PrincipalLookupError
>>> class AuthUtility:
... implements(IAuthentication)
... data = {'jim': 'Jim Fulton', 'stephan': 'Stephan Richter'}
...
... def getPrincipal(self, id):
... title = self.data.get(id)
... if title is not None:
... return Principal(id, title)
... raise PrincipalLookupError
Now we need to install the authentication utility:
>>> from zope.component import provideUtility
>>> provideUtility(AuthUtility(), IAuthentication)
We need a principal source so that we can create a view from it.
>>> from zope.component import getUtility
>>> class PrincipalSource:
... def __contains__(self, id):
... auth = getUtility(IAuthentication)
... try:
... auth.getPrincipal(id)
... except PrincipalLookupError:
... return False
... else:
... return True
Now we can create an terms view:
>>> from zope.authentication.principal import PrincipalTerms
>>> terms = PrincipalTerms(PrincipalSource(), None)
Now we can ask the terms view for terms:
>>> term = terms.getTerm('stephan')
>>> term.title
'Stephan Richter'
>>> term.token
'c3RlcGhhbg__'
If we ask for a term that does not exist, we get a lookup error:
>>> terms.getTerm('bob')
Traceback (most recent call last):
...
LookupError: bob
If we have a token, we can get the principal id for it.
>>> terms.getValue('c3RlcGhhbg__')
'stephan'
=======
CHANGES
=======
3.7.1 (2010-04-30)
------------------
- Removed undeclared testing dependency on zope.testing.
3.7.0 (2009-03-14)
------------------
Initial release. This package was split off from ``zope.app.security`` to
provide a separate common interface definition for authentication utilities
without extra dependencies.
Keywords: zope security authentication
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Framework :: Zope3
|