[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/authentication/ Restored use of IQueriableAuthenticator to lookup PAU queriables.

Garrett Smith garrett at mojave-corp.com
Fri Jul 29 19:40:50 EDT 2005


Log message for revision 37587:
  Restored use of IQueriableAuthenticator to lookup PAU queriables.

Changed:
  U   Zope3/trunk/src/zope/app/authentication/README.txt
  U   Zope3/trunk/src/zope/app/authentication/authentication.py
  U   Zope3/trunk/src/zope/app/authentication/configure.zcml
  U   Zope3/trunk/src/zope/app/authentication/interfaces.py

-=-
Modified: Zope3/trunk/src/zope/app/authentication/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/authentication/README.txt	2005-07-29 23:36:21 UTC (rev 37586)
+++ Zope3/trunk/src/zope/app/authentication/README.txt	2005-07-29 23:40:49 UTC (rev 37587)
@@ -679,8 +679,8 @@
 principals, we need to setup an adapter used by PAU:
 
   >>> provideAdapter(
-  ...     authentication.authentication.PluggableAuthenticationQueriable,
-  ...     provides=interfaces.IQuerySchemaSearch)
+  ...     authentication.authentication.QuerySchemaSearchAdapter,
+  ...     provides=interfaces.IQueriableAuthenticator)
 
 This adapter delegates search responsibility to an authenticator, but prepends
 the PAU prefix to any principal IDs returned in a search.
@@ -708,7 +708,7 @@
 Now, the PAU provides a single queriable:
 
   >>> list(pau.getQueriables()) # doctest: +ELLIPSIS
-  [('Queriable', ...PluggableAuthenticationQueriable object...)]
+  [('Queriable', ...QuerySchemaSearchAdapter object...)]
 
 We can use this queriable to search for our principal:
 

Modified: Zope3/trunk/src/zope/app/authentication/authentication.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/authentication.py	2005-07-29 23:36:21 UTC (rev 37586)
+++ Zope3/trunk/src/zope/app/authentication/authentication.py	2005-07-29 23:40:49 UTC (rev 37587)
@@ -90,12 +90,12 @@
 
     def getQueriables(self):
         for name in self.authenticatorPlugins:
-            authplugin = component.queryUtility(interfaces.IAuthenticatorPlugin,
-                name, context=self)
+            authplugin = component.queryUtility(
+                interfaces.IAuthenticatorPlugin, name, context=self)
             if authplugin is None:
                 continue
             queriable = component.queryMultiAdapter((authplugin, self),
-                interfaces.IQuerySchemaSearch)
+                interfaces.IQueriableAuthenticator)
             if queriable is not None:
                 yield name, queriable
 
@@ -145,25 +145,29 @@
                 next.logout(request)
 
 
-class PluggableAuthenticationQueriable(object):
-    """Performs principal searches on behald of a PAU.
+class QuerySchemaSearchAdapter(object):
+    """Performs schema-based principal searches on behalf of a PAU.
 
-    Delegates the search to the authenticator but prepends the PAU prefix to
-    the resulting principal IDs.
+    Delegates the search to the adapted authenticator (which also provides
+    IQuerySchemaSearch) and prepends the PAU prefix to the resulting principal
+    IDs.
     """
     component.adapts(
         interfaces.IQuerySchemaSearch,
         interfaces.IPluggableAuthentication)
 
-    zope.interface.implements(interfaces.IQuerySchemaSearch, ILocation)
+    zope.interface.implements(
+        interfaces.IQueriableAuthenticator,
+        interfaces.IQuerySchemaSearch,
+        ILocation)
 
-    def __init__(self, queriable, pau):
+    def __init__(self, authplugin, pau):
         self.__parent__ = pau
         self.__name__ = ''
-        self.queriable = queriable
+        self.authplugin = authplugin
         self.pau = pau
-        self.schema = queriable.schema
+        self.schema = authplugin.schema
 
     def search(self, query, start=None, batch_size=None):
-        for id in self.queriable.search(query, start, batch_size):
+        for id in self.authplugin.search(query, start, batch_size):
             yield self.pau.prefix + id

Modified: Zope3/trunk/src/zope/app/authentication/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/authentication/configure.zcml	2005-07-29 23:36:21 UTC (rev 37586)
+++ Zope3/trunk/src/zope/app/authentication/configure.zcml	2005-07-29 23:40:49 UTC (rev 37587)
@@ -17,8 +17,10 @@
   </localUtility>
 
   <adapter
-    provides=".interfaces.IQuerySchemaSearch"
-    factory=".authentication.PluggableAuthenticationQueriable" />
+    for=".interfaces.IQuerySchemaSearch
+         .interfaces.IPluggableAuthentication"
+    provides=".interfaces.IQueriableAuthenticator"
+    factory=".authentication.QuerySchemaSearchAdapter" />
 
   <!-- This explicit declaration is needed indirectly by vocabulary to make
     the interface available as an IInterface utility. This is bogus...the

Modified: Zope3/trunk/src/zope/app/authentication/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/interfaces.py	2005-07-29 23:36:21 UTC (rev 37586)
+++ Zope3/trunk/src/zope/app/authentication/interfaces.py	2005-07-29 23:40:49 UTC (rev 37587)
@@ -187,6 +187,10 @@
         self.info = info
 
 
+class IQueriableAuthenticator(zope.interface.Interface):
+    """Indicates the authenticator provides a search UI for principals."""
+
+
 class IQuerySchemaSearch(zope.interface.Interface):
     """An interface for searching using schema-constrained input."""
 



More information about the Zope3-Checkins mailing list