[Zope-CVS] CVS: Products/PluggableAuthService - PluggableAuthService.py:1.18.2.3

Zachery Bir zbir at urbanape.com
Thu Oct 14 12:06:05 EDT 2004


Update of /cvs-repository/Products/PluggableAuthService
In directory cvs.zope.org:/tmp/cvs-serv20314

Modified Files:
      Tag: pre-1_0_3-zbir-challenge-branch
	PluggableAuthService.py 
Log Message:
Prevent challenge from firing twice when Unauthorized exceptions are raised.


=== Products/PluggableAuthService/PluggableAuthService.py 1.18.2.2 => 1.18.2.3 ===
--- Products/PluggableAuthService/PluggableAuthService.py:1.18.2.2	Fri Oct  8 11:15:52 2004
+++ Products/PluggableAuthService/PluggableAuthService.py	Thu Oct 14 12:06:04 2004
@@ -1101,6 +1101,7 @@
         stack.append(resp._unauthorized)
         resp._unauthorized_stack = stack
         resp._unauthorized = self._unauthorized
+        resp._has_challenged = False
 
     #
     # Response override
@@ -1108,10 +1109,14 @@
     def _unauthorized(self):
         req = self.REQUEST
         resp = req['RESPONSE']
+        if resp._has_challenged: # Been here already
+            return
         if not self.challenge(req, resp):
             # Need to fall back here
             resp = self._cleanupResponse()
             resp._unauthorized()
+        else:
+            resp._has_challenged = True
 
     def challenge(self, request, response):
         # Go through all challenge plugins



More information about the Zope-CVS mailing list