SVN: ldappas/trunk/ Get the ids right, plus another test.

Stephan Richter <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Log message for revision 30515:
  Get the ids right, plus another test.
  

Changed:
  U   ldappas/trunk/README.txt
  U   ldappas/trunk/authentication.py

-=-
Modified: ldappas/trunk/README.txt
===================================================================
--- ldappas/trunk/README.txt	2005-05-26 17:35:39 UTC (rev 30514)
+++ ldappas/trunk/README.txt	2005-05-26 17:48:17 UTC (rev 30515)
@@ -142,7 +142,7 @@
   True   
   >>> info = auth.principalInfo('ldap.42')   
   >>> info, info.login, info.title, info.description
-  (PrincipalInfo('42'), u'ok', u'the question', u'the question')
+  (PrincipalInfo('ldap.42'), u'ok', u'the question', u'the question')
 
 In user interfaces, you commonly want to search through the available
 principals for managment purposes. The authentication plugin provides an API
@@ -217,7 +217,7 @@
 the two plugins with it:
 
   >>> from zope.app import authentication
-  >>> pau = authentication.PluggableAuthentication()
+  >>> pau = authentication.PluggableAuthentication('pau.')
   >>> pau.credentialsPlugins = ('simple-creds', )
   >>> pau.authenticatorPlugins = ('ldap-authenticator', )
 
@@ -228,4 +228,12 @@
   >>> request = TestRequest(credentials={'login': 'ok', 'password': '42pw'})
   >>> principal = pau.authenticate(request)
   >>> principal
-  Principal(u'ldap.ok')
+  Principal(u'pau.ldap.ok')
+
+You can also ask the authentication utility about a particular principal, once
+you have its id:
+
+  >>> provideAdapter(principalfolder.FoundPrincipalFactory)
+
+  >>> pau.getPrincipal(u'pau.ldap.ok')
+  Principal(u'pau.ldap.ok')

Modified: ldappas/trunk/authentication.py
===================================================================
--- ldappas/trunk/authentication.py	2005-05-26 17:35:39 UTC (rev 30514)
+++ ldappas/trunk/authentication.py	2005-05-26 17:48:17 UTC (rev 30515)
@@ -149,7 +149,7 @@
         """See zope.app.authentication.interfaces.IAuthenticatorPlugin."""
         if not id.startswith(self.principalIdPrefix):   
             return None
-        id = id[len(self.principalIdPrefix):]
+        internal_id = id[len(self.principalIdPrefix):]
            
         da = self.getLDAPAdapter()
         if da is None:
@@ -160,7 +160,7 @@
             conn = da.connect()
         except ServerDown:
             return None
-        filter = filter_format('(%s=%s)', (self.idAttribute, id))
+        filter = filter_format('(%s=%s)', (self.idAttribute, internal_id))
         try:
             res = conn.search(self.searchBase, self.searchScope, filter=filter)
         except NoSuchObject:

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.