[Zope-CVS] CVS: Products/PluggableAuthService/plugins - HTTPBasicAuthHelper.py:1.6.2.2

Zachery Bir zbir at urbanape.com
Wed Oct 13 21:47:53 EDT 2004


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

Modified Files:
      Tag: pre-1_0_3-zbir-challenge-branch
	HTTPBasicAuthHelper.py 
Log Message:
Declare a known protocol that other plugins can use to co-operate with.

use 'addHeader' rather than 'setHeader' to play co-operatively.


=== Products/PluggableAuthService/plugins/HTTPBasicAuthHelper.py 1.6.2.1 => 1.6.2.2 ===
--- Products/PluggableAuthService/plugins/HTTPBasicAuthHelper.py:1.6.2.1	Fri Oct  8 10:23:05 2004
+++ Products/PluggableAuthService/plugins/HTTPBasicAuthHelper.py	Wed Oct 13 21:47:52 2004
@@ -36,7 +36,7 @@
 
 def addHTTPBasicAuthHelper( dispatcher, id, title=None, REQUEST=None ):
 
-    """ Add a HTTP Basic Auth Helper to a Pluggable Auth Service. 
+    """ Add a HTTP Basic Auth Helper to a Pluggable Auth Service.
     """
     sp = HTTPBasicAuthHelper( id, title )
     dispatcher._setObject( sp.getId(), sp )
@@ -61,6 +61,8 @@
 
     security = ClassSecurityInfo()
 
+    protocol = "http" # The PAS challenge 'protocol' we use.
+
     def __init__( self, id, title=None ):
         self._setId( id )
         self.title = title
@@ -94,7 +96,8 @@
         """
         realm = response.realm
         if realm:
-            response.setHeader('WWW-Authenticate', 'basic realm="%s"' % realm, 1)
+            response.addHeader('WWW-Authenticate',
+                               'basic realm="%s"' % realm, 1)
         m = "<strong>You are not authorized to access this resource.</strong>"
         if response.debug_mode:
             if response._auth:
@@ -105,7 +108,7 @@
         response.setBody(m, is_error=1)
         response.setStatus(401)
         return 1
- 
+
     security.declarePrivate( 'resetCredentials' )
     def resetCredentials( self, request, response ):
 



More information about the Zope-CVS mailing list