[Zope3-checkins] CVS: Zope3/src/zope/app/services - auth.py:1.8

Albertas Agejevas alga@codeworks.lt
Fri, 31 Jan 2003 06:03:36 -0500


Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv983/src/zope/app/services

Modified Files:
	auth.py 
Log Message:
Got a cheesy AuthenticationService actually working.

Added delegations with getNextService() to authenticate() and
getPrincipal() methods.


=== Zope3/src/zope/app/services/auth.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/services/auth.py:1.7	Fri Dec 27 15:16:34 2002
+++ Zope3/src/zope/app/services/auth.py	Fri Jan 31 06:03:34 2003
@@ -35,7 +35,8 @@
 from zope.app.interfaces.annotation import IAttributeAnnotatable
 from zope.app.attributeannotations import AttributeAnnotations
 from zope.app.security.grants.principalrole import principalRoleManager
-
+from zope.app.component.nextservice import getNextService
+from zope.proxy.context import ContextMethod
 
 
 class DuplicateLogin(Exception):
@@ -73,7 +74,12 @@
                     password = a.getPassword()
                     if p.validate(password):
                         return p
-        return None
+                    else:
+                        return None
+        next = getNextService(self, 'Authentication')
+        return next.authenticate(request)
+
+    authenticate = ContextMethod(authenticate)
 
     def unauthenticatedPrincipal(self):
         'See IAuthenticationService'
@@ -91,7 +97,10 @@
         try:
             return self._usersbyid[id]
         except KeyError:
-            raise NotFoundError(id)
+            next = getNextService(self, 'Authentication')
+            return next.getPrincipal(id)
+
+    getPrincipal = ContextMethod(getPrincipal)
 
     def getPrincipals(self, name):
         'See IAuthenticationService'