msmith - in flumotion/branches/platform-3: . flumotion/component/base flumotion/component/consumers/httpstreamer flumotion/component/misc/httpfile

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Fri Jun 8 12:08:10 CEST 2007


Author: msmith
Date: Fri Jun  8 12:08:06 2007
New Revision: 5134

Modified:
   flumotion/branches/platform-3/ChangeLog
   flumotion/branches/platform-3/flumotion/component/base/http.py
   flumotion/branches/platform-3/flumotion/component/consumers/httpstreamer/http.py
   flumotion/branches/platform-3/flumotion/component/consumers/httpstreamer/http.xml
   flumotion/branches/platform-3/flumotion/component/misc/httpfile/httpfile.py
   flumotion/branches/platform-3/flumotion/component/misc/httpfile/httpfile.xml
Log:
        * flumotion/component/base/http.py:
        * flumotion/component/consumers/httpstreamer/http.py:
        * flumotion/component/consumers/httpstreamer/http.xml:
        * flumotion/component/misc/httpfile/httpfile.py:
        * flumotion/component/misc/httpfile/httpfile.xml:
          Add a nasty hack to permit clients through (optionally; not by
          default) if the bouncer is missing.



Modified: flumotion/branches/platform-3/ChangeLog
==============================================================================
--- flumotion/branches/platform-3/ChangeLog	(original)
+++ flumotion/branches/platform-3/ChangeLog	Fri Jun  8 12:08:06 2007
@@ -1,3 +1,13 @@
+2007-06-08  Michael Smith <msmith at fluendo.com>
+
+	* flumotion/component/base/http.py:
+	* flumotion/component/consumers/httpstreamer/http.py:
+	* flumotion/component/consumers/httpstreamer/http.xml:
+	* flumotion/component/misc/httpfile/httpfile.py:
+	* flumotion/component/misc/httpfile/httpfile.xml:
+	  Add a nasty hack to permit clients through (optionally; not by
+	  default) if the bouncer is missing.
+
 2007-06-07  Michael Smith <msmith at fluendo.com>
 
 	* flumotion/component/producers/playlist/playlist.py:

Modified: flumotion/branches/platform-3/flumotion/component/base/http.py
==============================================================================
--- flumotion/branches/platform-3/flumotion/component/base/http.py	(original)
+++ flumotion/branches/platform-3/flumotion/component/base/http.py	Fri Jun  8 12:08:06 2007
@@ -132,6 +132,10 @@
         self.requesterId = component.getName() # avatarId of streamer component
         self._defaultDuration = None   # default duration to use if the keycard
                                        # doesn't specify one.
+        self._permitOnMissingBouncer = False 
+
+    def setAllowAccessOnMissingBouncer(self, val):
+        self._permitOnMissingBouncer = val
         
     def setDomain(self, domain):
         """
@@ -242,7 +246,8 @@
     def startAuthentication(self, request):
         d = self.authenticate(request)
         d.addCallback(self._authenticatedCallback, request)
-        d.addErrback(self._authenticatedErrback, request)
+        d.addErrback(self._missingComponentErrback, request)
+        d.addErrback(self._notAuthenticatedErrback, request)
 
         return d
 
@@ -271,8 +276,16 @@
 
         return None
 
-    def _authenticatedErrback(self, failure, request):
-        failure.trap(errors.UnknownComponentError, errors.NotAuthenticatedError)
+    def _missingComponentErrback(self, failure, request):
+        failure.trap(errors.UnknownComponentError)
+        if self._permitOnMissingBouncer:
+            self.debug("Bouncer missing, permitting client through")
+            return None
+        self._handleUnauthorized(request)
+        return None
+
+    def _notAuthenticatedErrback(self, failure, request):
+        failure.trap(errors.NotAuthenticatedError)
         self._handleUnauthorized(request)
         return None
         

Modified: flumotion/branches/platform-3/flumotion/component/consumers/httpstreamer/http.py
==============================================================================
--- flumotion/branches/platform-3/flumotion/component/consumers/httpstreamer/http.py	(original)
+++ flumotion/branches/platform-3/flumotion/component/consumers/httpstreamer/http.py	Fri Jun  8 12:08:06 2007
@@ -466,6 +466,10 @@
                 filter.addIPFilter(f)
             self.resource.setLogFilter(filter)
 
+        if 'deny-default' in properties:
+            self.resource.setAllowAccessOnMissingBouncer(
+                not properties['deny-default'])
+
         self.type = properties.get('type', 'master')
         if self.type == 'slave':
             # already checked for these in do_check

Modified: flumotion/branches/platform-3/flumotion/component/consumers/httpstreamer/http.xml
==============================================================================
--- flumotion/branches/platform-3/flumotion/component/consumers/httpstreamer/http.xml	(original)
+++ flumotion/branches/platform-3/flumotion/component/consumers/httpstreamer/http.xml	Fri Jun  8 12:08:06 2007
@@ -26,6 +26,8 @@
                   description="Name of a bouncer in the atmosphere to authenticate against" />
         <property name="issuer-class" type="string"
                   description="Python class of the Keycard issuer to use" />
+        <property name="deny-default" type="bool"/>
+
         <property name="mount-point" type="string"
 		  description="The mount point the stream can be accessed on" />
 

Modified: flumotion/branches/platform-3/flumotion/component/misc/httpfile/httpfile.py
==============================================================================
--- flumotion/branches/platform-3/flumotion/component/misc/httpfile/httpfile.py	(original)
+++ flumotion/branches/platform-3/flumotion/component/misc/httpfile/httpfile.py	Fri Jun  8 12:08:06 2007
@@ -201,6 +201,10 @@
                 filter.addIPFilter(f)
             self._logfilter = filter
 
+        if 'deny-default' in props:
+            self.setAllowAccessOnMissingBouncer(
+                not props['deny-default'])
+
     def do_stop(self):
         if self._timeoutRequestsCallLater:
             self._timeoutRequestsCallLater.cancel()

Modified: flumotion/branches/platform-3/flumotion/component/misc/httpfile/httpfile.xml
==============================================================================
--- flumotion/branches/platform-3/flumotion/component/misc/httpfile/httpfile.xml	(original)
+++ flumotion/branches/platform-3/flumotion/component/misc/httpfile/httpfile.xml	Fri Jun  8 12:08:06 2007
@@ -34,6 +34,7 @@
                   description="Name of a bouncer in the atmosphere to authenticate against" />
         <property name="issuer-class" type="string"
                   description="Python class of the Keycard issuer to use" />
+        <property name="deny-default" type="bool"/>
    
         <property name="ip-filter" type="string" multiple="yes"
                   description="IP network-address/prefix-length to filter out of logs" />


More information about the flumotion-commit mailing list