[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/pas/ New challenger that returned Unauthorized, if the user is already logged

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Oct 12 04:00:43 EDT 2004


Log message for revision 27985:
  New challenger that returned Unauthorized, if the user is already logged 
  in. Also allow to edit the used Realm for Basic Auth.
  


Changed:
  U   Zope3/trunk/src/zope/app/pas/browser/configure.zcml
  U   Zope3/trunk/src/zope/app/pas/httpplugins.py
  U   Zope3/trunk/src/zope/app/pas/tests.py


-=-
Modified: Zope3/trunk/src/zope/app/pas/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/pas/browser/configure.zcml	2004-10-12 07:56:51 UTC (rev 27984)
+++ Zope3/trunk/src/zope/app/pas/browser/configure.zcml	2004-10-12 08:00:42 UTC (rev 27985)
@@ -20,6 +20,11 @@
 
   </pages>
 
+  <editform
+      schema="..httpplugins.IHTTPBasicAuthRealm"
+      label="Change Realm"
+      name="edit.html"
+      permission="zope.ManageServices"
+      menu="zmi_views" title="Edit" />
 
-
 </zope:configure>

Modified: Zope3/trunk/src/zope/app/pas/httpplugins.py
===================================================================
--- Zope3/trunk/src/zope/app/pas/httpplugins.py	2004-10-12 07:56:51 UTC (rev 27984)
+++ Zope3/trunk/src/zope/app/pas/httpplugins.py	2004-10-12 08:00:42 UTC (rev 27985)
@@ -18,8 +18,9 @@
 __docformat__ = "reStructuredText"
 import base64
 from persistent import Persistent
-from zope.interface import implements
+from zope.interface import implements, Interface
 from zope.publisher.interfaces.http import IHTTPRequest
+from zope.schema import TextLine 
 
 from zope.app.container.contained import Contained
 from interfaces import IExtractionPlugin, IChallengePlugin
@@ -64,6 +65,18 @@
         return None
 
 
+class IHTTPBasicAuthRealm(Interface):
+    """HTTP Basic Auth Realm
+
+    Represents the realm string that is used during basic HTTP authentication
+    """
+
+    realm = TextLine(title=u'Realm',
+                     description=u'HTTP Basic Authentication Realm',
+                     required=True,
+                     default=u'Zope3')
+    
+
 class HTTPBasicAuthChallenger(Persistent, Contained):
     """A Basic HTTP Authentication Challenge Plugin
 
@@ -89,7 +102,7 @@
     >>> challenger.challenge(request, response) is None
     True
     """
-    implements(IChallengePlugin)
+    implements(IChallengePlugin, IHTTPBasicAuthRealm)
 
     realm = 'Zope3'
     protocol = 'http auth'

Modified: Zope3/trunk/src/zope/app/pas/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/pas/tests.py	2004-10-12 07:56:51 UTC (rev 27984)
+++ Zope3/trunk/src/zope/app/pas/tests.py	2004-10-12 08:00:42 UTC (rev 27985)
@@ -52,6 +52,7 @@
 
 def test_suite():
     return unittest.TestSuite((
+        doctest.DocTestSuite('zope.app.pas.generic'),
         doctest.DocTestSuite('zope.app.pas.httpplugins'),
         doctest.DocTestSuite('zope.app.pas.zodb'),
         doctest.DocTestSuite('zope.app.pas.principalplugins'),



More information about the Zope3-Checkins mailing list