[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ Created a new
interface, IAuthentication, which is the
Jim Fulton
jim at zope.com
Tue Jan 11 16:33:40 EST 2005
Log message for revision 28789:
Created a new interface, IAuthentication, which is the
IAuthenticationUtility/IAuthenticationService interface sans
getPrincipals. The IAuthenticationUtility/IAuthenticationService and
the getPrincipals method are now deprecated. We now use IAuthentication.
Added a getPrincipals to the pluggable auth utility with a deprecation
warning.
Changed:
U Zope3/trunk/src/zope/app/exception/browser/tests/test_unauthorized.py
U Zope3/trunk/src/zope/app/pau/README.txt
U Zope3/trunk/src/zope/app/pau/browser/group_searching_with_empty_string.txt
U Zope3/trunk/src/zope/app/pau/browser/groupfolder.txt
U Zope3/trunk/src/zope/app/pau/browser/principalfolder.txt
U Zope3/trunk/src/zope/app/pau/groupfolder.txt
U Zope3/trunk/src/zope/app/pau/pau.py
U Zope3/trunk/src/zope/app/publication/zopepublication.py
U Zope3/trunk/src/zope/app/security/browser/auth.py
U Zope3/trunk/src/zope/app/security/browser/configure.zcml
U Zope3/trunk/src/zope/app/security/browser/principalterms.txt
U Zope3/trunk/src/zope/app/security/configure.zcml
U Zope3/trunk/src/zope/app/security/interfaces.py
U Zope3/trunk/src/zope/app/security/principal.py
U Zope3/trunk/src/zope/app/security/principalregistry.py
U Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py
U Zope3/trunk/src/zope/app/security/vocabulary.py
U Zope3/trunk/src/zope/app/securitypolicy/browser/granting.txt
U Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py
U Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py
U Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py
U Zope3/trunk/src/zope/app/securitypolicy/zopepolicy.txt
U Zope3/trunk/src/zope/app/zapi/README.txt
U Zope3/trunk/src/zope/app/zapi/__init__.py
-=-
Modified: Zope3/trunk/src/zope/app/exception/browser/tests/test_unauthorized.py
===================================================================
--- Zope3/trunk/src/zope/app/exception/browser/tests/test_unauthorized.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/exception/browser/tests/test_unauthorized.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -20,7 +20,7 @@
from zope.publisher.browser import TestRequest
from zope.app import zapi
from zope.app.tests import ztapi
-from zope.app.security.interfaces import IAuthenticationUtility, IPrincipal
+from zope.app.security.interfaces import IAuthentication, IPrincipal
from zope.app.container.contained import contained
from zope.app.exception.browser.unauthorized import Unauthorized
from zope.app.tests.placelesssetup import PlacelessSetup
@@ -43,7 +43,7 @@
return self.id
class DummyAuthUtility(object):
- implements(IAuthenticationUtility) # this is a lie
+ implements(IAuthentication) # this is a lie
def unauthorized(self, principal_id, request):
self.principal_id = principal_id
@@ -58,7 +58,7 @@
def setUp(self):
super(Test, self).setUp()
self.auth = DummyAuthUtility()
- ztapi.provideUtility(IAuthenticationUtility, self.auth)
+ ztapi.provideUtility(IAuthentication, self.auth)
def tearDown(self):
super(Test, self).tearDown()
Modified: Zope3/trunk/src/zope/app/pau/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/pau/README.txt 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/pau/README.txt 2005-01-11 21:33:39 UTC (rev 28789)
@@ -322,11 +322,11 @@
a fake utility.
>>> from zope.app.utility.utility import testingNextUtility
- >>> from zope.app.security.interfaces import IAuthenticationUtility
+ >>> from zope.app.security.interfaces import IAuthentication
>>> class FakeAuthUtility:
...
- ... zope.interface.implements(IAuthenticationUtility)
+ ... zope.interface.implements(IAuthentication)
...
... lastGetPrincipalCall = lastUnauthorizedCall = None
...
@@ -337,11 +337,11 @@
... self.lastUnauthorizedCall = id
>>> nextauth = FakeAuthUtility()
- >>> testingNextUtility(auth, nextauth, IAuthenticationUtility)
+ >>> testingNextUtility(auth, nextauth, IAuthentication)
>>> auth.getPrincipal('123')
- >>> '123' == nextauth.lastGetPrincipalCall
- True
+ >>> nextauth.lastGetPrincipalCall
+ '123'
Issuing a challenge
===================
Modified: Zope3/trunk/src/zope/app/pau/browser/group_searching_with_empty_string.txt
===================================================================
--- Zope3/trunk/src/zope/app/pau/browser/group_searching_with_empty_string.txt 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/pau/browser/group_searching_with_empty_string.txt 2005-01-11 21:33:39 UTC (rev 28789)
@@ -29,7 +29,7 @@
... -----------------------------8474411127918531132143183931
... Content-Disposition: form-data; name="field.interface"
...
- ... zope.app.security.interfaces.IAuthenticationUtility
+ ... zope.app.security.interfaces.IAuthentication
... -----------------------------8474411127918531132143183931
... Content-Disposition: form-data; name="field.interface-empty-marker"
...
Modified: Zope3/trunk/src/zope/app/pau/browser/groupfolder.txt
===================================================================
--- Zope3/trunk/src/zope/app/pau/browser/groupfolder.txt 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/pau/browser/groupfolder.txt 2005-01-11 21:33:39 UTC (rev 28789)
@@ -368,7 +368,7 @@
... -----------------------------1649392783947785437368129046
... Content-Disposition: form-data; name="field.interface"
...
- ... zope.app.security.interfaces.IAuthenticationUtility
+ ... zope.app.security.interfaces.IAuthentication
... -----------------------------1649392783947785437368129046
... Content-Disposition: form-data; name="field.interface-empty-marker"
...
Modified: Zope3/trunk/src/zope/app/pau/browser/principalfolder.txt
===================================================================
--- Zope3/trunk/src/zope/app/pau/browser/principalfolder.txt 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/pau/browser/principalfolder.txt 2005-01-11 21:33:39 UTC (rev 28789)
@@ -142,7 +142,7 @@
... -----------------------------1649392783947785437368129046
... Content-Disposition: form-data; name="field.interface"
...
- ... zope.app.security.interfaces.IAuthenticationUtility
+ ... zope.app.security.interfaces.IAuthentication
... -----------------------------1649392783947785437368129046
... Content-Disposition: form-data; name="field.interface-empty-marker"
...
Modified: Zope3/trunk/src/zope/app/pau/groupfolder.txt
===================================================================
--- Zope3/trunk/src/zope/app/pau/groupfolder.txt 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/pau/groupfolder.txt 2005-01-11 21:33:39 UTC (rev 28789)
@@ -23,7 +23,7 @@
we'll create a sample authentication service:
>>> import zope.interface
- >>> from zope.app.security.interfaces import IAuthenticationUtility
+ >>> from zope.app.security.interfaces import IAuthentication
>>> from zope.app.pau.groupfolder import setGroupsForPrincipal
>>> class Principal:
@@ -37,7 +37,7 @@
>>> class Principals:
...
- ... zope.interface.implements(IAuthenticationUtility)
+ ... zope.interface.implements(IAuthentication)
...
... def __init__(self, groups):
... self.principals = {
@@ -72,7 +72,7 @@
`principals` dictionary and a groups folder.
>>> principals = Principals(groups)
- >>> ztapi.provideUtility(IAuthenticationUtility, principals)
+ >>> ztapi.provideUtility(IAuthentication, principals)
Now we can set the principals on the group:
Modified: Zope3/trunk/src/zope/app/pau/pau.py
===================================================================
--- Zope3/trunk/src/zope/app/pau/pau.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/pau/pau.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -25,7 +25,7 @@
from zope.app import zapi
-from zope.app.security.interfaces import IAuthenticationUtility
+from zope.app.security.interfaces import IAuthentication
from zope.app.utility.utility import queryNextUtility
from zope.app.container.contained import Contained
from zope.app.utility.interfaces import ILocalUtility
@@ -75,7 +75,7 @@
class PAU(object):
- zope.interface.implements(IPAU, IAuthenticationUtility, ISourceQueriables)
+ zope.interface.implements(IPAU, IAuthentication, ISourceQueriables)
authenticators = extractors = challengers = factories = searchers = ()
@@ -165,11 +165,20 @@
def _delegate(self, meth, *args):
# delegate to next AU
- next = queryNextUtility(self, IAuthenticationUtility)
+ next = queryNextUtility(self, IAuthentication)
if next is None:
return None
return getattr(next, meth)(*args)
+ # BBB
+ def getPrincipals(self, name):
+ import warnings
+ warnings.warn(
+ "The getPrincipals method has been deprecicated. "
+ "It will be removed in Zope X3.3. "
+ "You'll find no principals here.",
+ DeprecationWarning, stacklevel=2)
+ return ()
class LocalPAU(PAU, Persistent, Contained):
zope.interface.implements(IPAU, ILocation, ILocalUtility)
Modified: Zope3/trunk/src/zope/app/publication/zopepublication.py
===================================================================
--- Zope3/trunk/src/zope/app/publication/zopepublication.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/publication/zopepublication.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -48,7 +48,7 @@
from zope.app.publication.publicationtraverse import PublicationTraverse
from zope.app.security.principalregistry import principalRegistry as prin_reg
from zope.app.security.interfaces import IUnauthenticatedPrincipal
-from zope.app.security.interfaces import IAuthenticationUtility
+from zope.app.security.interfaces import IAuthentication
from zope.app.site.interfaces import ISite
from zope.app.traversing.interfaces import IPhysicallyLocatable
@@ -97,7 +97,7 @@
try:
utils = sm.getService(zapi.servicenames.Utilities)
- auth = utils.getUtility(IAuthenticationUtility)
+ auth = utils.getUtility(IAuthentication)
except ComponentLookupError:
# No auth utility here
return
Modified: Zope3/trunk/src/zope/app/security/browser/auth.py
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/auth.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/security/browser/auth.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -18,7 +18,7 @@
from zope.interface import implements
from zope.i18n import translate
from zope.app.publisher.interfaces.http import ILogin, ILogout
-from zope.app.security.interfaces import IAuthenticationUtility
+from zope.app.security.interfaces import IAuthentication
from zope.app.security.principalregistry import UnauthenticatedPrincipal
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.proxy import removeAllProxies
@@ -28,7 +28,7 @@
search_label = _('search-button', 'Search')
class AuthUtilitySearchView(object):
- __used_for__ = IAuthenticationUtility
+ __used_for__ = IAuthentication
def __init__(self, context, request):
self.context = context
Modified: Zope3/trunk/src/zope/app/security/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/configure.zcml 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/security/browser/configure.zcml 2005-01-11 21:33:39 UTC (rev 28789)
@@ -3,7 +3,7 @@
xmlns:browser="http://namespaces.zope.org/browser">
<adapter
- for="zope.app.security.interfaces.IAuthenticationUtility
+ for="zope.app.security.interfaces.IAuthentication
zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.app.form.browser.interfaces.ISourceQueryView"
factory="zope.app.security.browser.auth.AuthUtilitySearchView"
Modified: Zope3/trunk/src/zope/app/security/browser/principalterms.txt
===================================================================
--- Zope3/trunk/src/zope/app/security/browser/principalterms.txt 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/security/browser/principalterms.txt 2005-01-11 21:33:39 UTC (rev 28789)
@@ -11,10 +11,10 @@
... self.id, self.title = id, title
>>> from zope.interface import implements
- >>> from zope.app.security.interfaces import IAuthenticationUtility
+ >>> from zope.app.security.interfaces import IAuthentication
>>> from zope.app.security.interfaces import PrincipalLookupError
>>> class AuthUtility:
- ... implements(IAuthenticationUtility)
+ ... implements(IAuthentication)
... data = {'jim': 'Jim Fulton', 'stephan': 'Stephan Richter'}
...
... def getPrincipal(self, id):
@@ -26,14 +26,14 @@
Now we need to install the authentication utility:
>>> from zope.app.tests import ztapi
- >>> ztapi.provideUtility(IAuthenticationUtility, AuthUtility())
+ >>> ztapi.provideUtility(IAuthentication, AuthUtility())
We need a principal source so that we can create a view from it.
>>> from zope.app import zapi
>>> class PrincipalSource:
... def __contains__(self, id):
- ... auth = zapi.getUtility(IAuthenticationUtility)
+ ... auth = zapi.getUtility(IAuthentication)
... try:
... auth.getPrincipal(id)
... except PrincipalLookupError:
Modified: Zope3/trunk/src/zope/app/security/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/security/configure.zcml 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/security/configure.zcml 2005-01-11 21:33:39 UTC (rev 28789)
@@ -23,7 +23,7 @@
<include file="_protections.zcml" />
<utility
- provides=".interfaces.IAuthenticationUtility"
+ provides=".interfaces.IAuthentication"
component=".principalregistry.principalRegistry" />
<localUtility class=".permission.LocalPermission">
Modified: Zope3/trunk/src/zope/app/security/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/security/interfaces.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/security/interfaces.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -33,13 +33,13 @@
Authenticated principals are preferable to UnauthenticatedPrincipals.
"""
-class IAuthenticationUtility(Interface):
+class IAuthentication(Interface):
"""Provide support for establishing principals for requests.
This is implemented by performing protocol-specific actions, such as
issuing challenges or providing login interfaces.
- `IAuthenticationUtility` objects are used to implement authentication
+ `IAuthentication` objects are used to implement authentication
utilities. Because they implement services, they are expected to
collaborate with services in other contexts. Client code doesn't search a
context and call multiple services. Instead, client code will call the
@@ -119,11 +119,12 @@
object hierarchy.
"""
+class IAuthenticationUtility(IAuthentication):
+ """This interface is deprecated
+ """
+
def getPrincipals(name):
- """Get principals with matching names.
-
- Get an iterable object with the principals with names that are
- similar to (e.g. contain) the given name.
+ """This interface is deprecated
"""
############################################################################
@@ -134,7 +135,7 @@
class ILoginPassword(Interface):
"""A password based login.
- An `IAuthenticationUtility` would use this (adapting a request),
+ An `IAuthentication` would use this (adapting a request),
to discover the login/password passed from the user, or to
indicate that a login is required.
"""
Modified: Zope3/trunk/src/zope/app/security/principal.py
===================================================================
--- Zope3/trunk/src/zope/app/security/principal.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/security/principal.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -17,7 +17,7 @@
"""
from zope.app import zapi
from zope.app.security.interfaces import PrincipalLookupError
-from zope.app.security.interfaces import IAuthenticationUtility
+from zope.app.security.interfaces import IAuthentication
# BBB Backward Compatibility
from zope.exceptions import NotFoundError
@@ -25,7 +25,7 @@
def checkPrincipal(context, principal_id):
- auth = zapi.getUtility(IAuthenticationUtility, context=context)
+ auth = zapi.getUtility(IAuthentication, context=context)
try:
if auth.getPrincipal(principal_id):
return
Modified: Zope3/trunk/src/zope/app/security/principalregistry.py
===================================================================
--- Zope3/trunk/src/zope/app/security/principalregistry.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/security/principalregistry.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -20,7 +20,7 @@
from zope.app.security.interfaces import PrincipalLookupError
from zope.app import zapi
from zope.app.security.interfaces import ILoginPassword
-from zope.app.security.interfaces import IAuthenticationUtility, IPrincipal
+from zope.app.security.interfaces import IAuthentication, IPrincipal
from zope.app.security.interfaces import IUnauthenticatedPrincipal
from zope.app.container.contained import Contained, contained
from warnings import warn
@@ -30,9 +30,9 @@
class PrincipalRegistry(object):
- implements(IAuthenticationUtility)
+ implements(IAuthentication)
- # Methods implementing IAuthenticationUtility
+ # Methods implementing IAuthentication
def authenticate(self, request):
a = ILoginPassword(request, None)
Modified: Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/security/tests/test_securitydirectives.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -24,7 +24,7 @@
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.app.servicenames import Authentication
-from zope.app.security.interfaces import IAuthenticationUtility, IPermission
+from zope.app.security.interfaces import IAuthentication, IPermission
from zope.app.security.principalregistry import principalRegistry
from zope.app.security.settings import Allow
import zope.app.security.tests
@@ -34,7 +34,7 @@
def setUp(self):
super(TestBase, self).setUp()
- ztapi.provideUtility(IAuthenticationUtility, principalRegistry)
+ ztapi.provideUtility(IAuthentication, principalRegistry)
class TestPrincipalDirective(TestBase, unittest.TestCase):
Modified: Zope3/trunk/src/zope/app/security/vocabulary.py
===================================================================
--- Zope3/trunk/src/zope/app/security/vocabulary.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/security/vocabulary.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -22,7 +22,7 @@
from zope.interface import implements
from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
from zope.schema.interfaces import ISourceQueriables
-from zope.app.security.interfaces import IPermission, IAuthenticationUtility
+from zope.app.security.interfaces import IPermission, IAuthentication
from zope.app.security.interfaces import PrincipalLookupError
from zope.app.utility.utility import queryNextUtility
@@ -147,7 +147,7 @@
>>> zapi.getUtility = temp
"""
- auth = zapi.getUtility(IAuthenticationUtility)
+ auth = zapi.getUtility(IAuthentication)
try:
auth.getPrincipal(id)
except PrincipalLookupError:
@@ -174,27 +174,27 @@
authentication utilities to look for queriables.
>>> class DummyUtility1:
- ... implements(IAuthenticationUtility)
+ ... implements(IAuthentication)
... __parent__ = None
... def __repr__(self): return 'dummy1'
>>> dummy1 = DummyUtility1()
>>> class DummyUtility2:
- ... implements(ISourceQueriables, IAuthenticationUtility)
+ ... implements(ISourceQueriables, IAuthentication)
... __parent__ = None
... def getQueriables(self):
... return ('1', 1), ('2', 2), ('3', 3)
>>> dummy2 = DummyUtility2()
>>> class DummyUtility3(DummyUtility2):
- ... implements(IAuthenticationUtility)
+ ... implements(IAuthentication)
... def getQueriables(self):
... return ('4', 4),
>>> dummy3 = DummyUtility3()
>>> from zope.app.utility.utility import testingNextUtility
- >>> testingNextUtility(dummy1, dummy2, IAuthenticationUtility)
- >>> testingNextUtility(dummy2, dummy3, IAuthenticationUtility)
+ >>> testingNextUtility(dummy1, dummy2, IAuthentication)
+ >>> testingNextUtility(dummy2, dummy3, IAuthentication)
>>> temp = zapi.getUtility
>>> zapi.getUtility = lambda iface: dummy1
@@ -206,7 +206,7 @@
>>> zapi.getUtility = temp
"""
i = 0
- auth = zapi.getUtility(IAuthenticationUtility)
+ auth = zapi.getUtility(IAuthentication)
while True:
queriables = ISourceQueriables(auth, None)
if queriables is None:
@@ -214,7 +214,7 @@
else:
for qid, queriable in queriables.getQueriables():
yield unicode(i)+'.'+unicode(qid), queriable
- auth = queryNextUtility(auth, IAuthenticationUtility)
+ auth = queryNextUtility(auth, IAuthentication)
if auth is None:
break
i += 1
Modified: Zope3/trunk/src/zope/app/securitypolicy/browser/granting.txt
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/browser/granting.txt 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/securitypolicy/browser/granting.txt 2005-01-11 21:33:39 UTC (rev 28789)
@@ -30,11 +30,11 @@
>>> class Principal:
... def __init__(self, id, title): self.id, self.title = id, title
- >>> from zope.app.security.interfaces import IAuthenticationUtility
+ >>> from zope.app.security.interfaces import IAuthentication
>>> from zope.app.security.interfaces import PrincipalLookupError
>>> from zope.interface import implements
>>> class AuthUtility:
- ... implements(IAuthenticationUtility)
+ ... implements(IAuthentication)
... data = {'jim': Principal('jim', 'Jim Fulton'),
... 'stephan': Principal('stephan', 'Stephan Richter')}
...
@@ -49,7 +49,7 @@
... for principal in self.data.values()
... if search in principal.title]
- >>> ztapi.provideUtility(IAuthenticationUtility, AuthUtility())
+ >>> ztapi.provideUtility(IAuthentication, AuthUtility())
- Security-related Adapters
@@ -92,7 +92,7 @@
>>> from zope.app.security.browser.auth import AuthUtilitySearchView
>>> from zope.app.form.browser.interfaces import ISourceQueryView
- >>> ztapi.browserViewProviding(IAuthenticationUtility,
+ >>> ztapi.browserViewProviding(IAuthentication,
... AuthUtilitySearchView,
... ISourceQueryView)
Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalpermissionmanager.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -22,7 +22,7 @@
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.app.security.interfaces import IPermission
-from zope.app.security.interfaces import IAuthenticationUtility
+from zope.app.security.interfaces import IAuthentication
from zope.app.security.permission import Permission
from zope.app.servicenames import Authentication
@@ -42,7 +42,7 @@
def setUp(self):
super(Test, self).setUp()
- ztapi.provideUtility(IAuthenticationUtility, principalRegistry)
+ ztapi.provideUtility(IAuthentication, principalRegistry)
def _make_principal(self, id=None, title=None):
Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_principalrolemanager.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -21,7 +21,7 @@
from zope.app.tests import ztapi
from zope.app.tests.placelesssetup import PlacelessSetup
-from zope.app.security.interfaces import IAuthenticationUtility
+from zope.app.security.interfaces import IAuthentication
from zope.app.security.settings import Allow, Deny
from zope.app.security.principalregistry import principalRegistry
@@ -38,7 +38,7 @@
def setUp(self):
super(Test, self).setUp()
- ztapi.provideUtility(IAuthenticationUtility, principalRegistry)
+ ztapi.provideUtility(IAuthentication, principalRegistry)
def _make_principal(self, id=None, title=None):
p = principalRegistry.definePrincipal(
Modified: Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/securitypolicy/tests/test_securitydirectives.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -26,7 +26,7 @@
from zope.app.tests.placelesssetup import PlacelessSetup
from zope.app.security.interfaces import IPermission
-from zope.app.security.interfaces import IAuthenticationUtility
+from zope.app.security.interfaces import IAuthentication
from zope.app.security.permission import Permission
from zope.app.security.settings import Allow
from zope.app.security.principalregistry import principalRegistry
@@ -52,7 +52,7 @@
def setUp(self):
super(TestBase, self).setUp()
- ztapi.provideUtility(IAuthenticationUtility, principalRegistry)
+ ztapi.provideUtility(IAuthentication, principalRegistry)
class TestRoleDirective(TestBase, unittest.TestCase):
Modified: Zope3/trunk/src/zope/app/securitypolicy/zopepolicy.txt
===================================================================
--- Zope3/trunk/src/zope/app/securitypolicy/zopepolicy.txt 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/securitypolicy/zopepolicy.txt 2005-01-11 21:33:39 UTC (rev 28789)
@@ -497,16 +497,16 @@
For our examples here, we'll create and register a stub principal
authentication service:
- >>> from zope.app.security.interfaces import IAuthenticationUtility
+ >>> from zope.app.security.interfaces import IAuthentication
>>> class FauxPrincipals(dict):
- ... zope.interface.implements(IAuthenticationUtility)
+ ... zope.interface.implements(IAuthentication)
... def getPrincipal(self, id):
... return self[id]
>>> auth = FauxPrincipals()
>>> from zope.app.tests import ztapi
- >>> ztapi.provideUtility(IAuthenticationUtility, auth)
+ >>> ztapi.provideUtility(IAuthentication, auth)
>>> from zope.app import zapi
Let's define a group:
Modified: Zope3/trunk/src/zope/app/zapi/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/zapi/README.txt 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/zapi/README.txt 2005-01-11 21:33:39 UTC (rev 28789)
@@ -18,19 +18,19 @@
Traceback (most recent call last):
...
ComponentLookupError:
- (<InterfaceClass zope.app.security.interfaces.IAuthenticationUtility>, '')
+ (<InterfaceClass zope.app.security.interfaces.IAuthentication>, '')
But if we provide an authentication service:
>>> import zope.interface
- >>> from zope.app.security.interfaces import IAuthenticationUtility
+ >>> from zope.app.security.interfaces import IAuthentication
>>> class FakeAuthenticationUtility:
- ... zope.interface.implements(IAuthenticationUtility)
+ ... zope.interface.implements(IAuthentication)
>>> fake = FakeAuthenticationUtility()
>>> from zope.app.tests import ztapi
- >>> ztapi.provideUtility(IAuthenticationUtility, fake)
+ >>> ztapi.provideUtility(IAuthentication, fake)
Then we should be able to get the service back when we ask for the
principals:
Modified: Zope3/trunk/src/zope/app/zapi/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/zapi/__init__.py 2005-01-11 21:29:58 UTC (rev 28788)
+++ Zope3/trunk/src/zope/app/zapi/__init__.py 2005-01-11 21:33:39 UTC (rev 28789)
@@ -38,6 +38,6 @@
name = getName
def principals():
- from zope.app.security.interfaces import IAuthenticationUtility
- return getUtility(IAuthenticationUtility)
+ from zope.app.security.interfaces import IAuthentication
+ return getUtility(IAuthentication)
More information about the Zope3-Checkins
mailing list