Fix compatibility with autobahn v0.6.0
authorFrederic PAUT <frederic.paut@linux.intel.com>
Thu, 25 Apr 2013 10:25:19 +0000 (12:25 +0200)
committerFrederic PAUT <frederic.paut@linux.intel.com>
Thu, 25 Apr 2013 10:25:19 +0000 (12:25 +0200)
cloudeebus/cloudeebus.js
cloudeebus/cloudeebus.py

index 1788cae..8f6e65c 100644 (file)
@@ -81,7 +81,7 @@ cloudeebus.connect = function(uri, manifest, successCB, errorCB) {
                if (manifest)
                        cloudeebus.wampSession.authreq(
                                        manifest.name, 
-                                       {permissions: JSON.stringify(manifest.permissions)}
+                                       {permissions: manifest.permissions}
                                ).then(onWAMPSessionChallengedCB, onWAMPSessionAuthErrorCB);
                else
                        cloudeebus.wampSession.authreq().then(function() {
index 70d0b6f..517b057 100755 (executable)
@@ -182,7 +182,9 @@ class CloudeebusService:
     support for sending DBus messages and registering for DBus signals
     '''
     def __init__(self, permissions):
-        self.permissions = permissions;
+        self.permissions = {};
+        self.permissions['permissions'] = permissions['permissions']
+        self.permissions['authextra'] = permissions['authextra']
         self.proxyObjects = {}
         self.proxyMethods = {}
         self.pendingCalls = []
@@ -196,7 +198,7 @@ class CloudeebusService:
         if not self.proxyObjects.has_key(id):
             if not OPENDOOR:
                 # check permissions, array.index throws exception
-                self.permissions.index(serviceName)
+                self.permissions['permissions'].index(serviceName)
             bus = cache.dbusConnexion(busName)
             self.proxyObjects[id] = bus.get_object(serviceName, objectName)
         return self.proxyObjects[id]
@@ -223,7 +225,7 @@ class CloudeebusService:
         
         if not OPENDOOR:
             # check permissions, array.index throws exception
-            self.permissions.index(list[1])
+            self.permissions['permissions'].index(list[1])
         
         # check if a handler exists
         sigId = "#".join(list)
@@ -288,15 +290,15 @@ class CloudeebusServerProtocol(WampCraServerProtocol):
     
     
     def getAuthPermissions(self, key, extra):
-        return json.loads(extra.get("permissions", "[]"))
-    
+         return {'permissions': extra.get("permissions", None),
+                 'authextra': extra.get("authextra", None)}   
     
     def getAuthSecret(self, key):
         secret = CREDENTIALS.get(key, None)
         if secret is None:
             return None
         # secret must be of str type to be hashed
-        return secret.encode('utf-8')
+        return str(secret)
     
 
     def onAuthenticated(self, key, permissions):
@@ -315,8 +317,8 @@ class CloudeebusServerProtocol(WampCraServerProtocol):
             if key is None:
                 raise Exception("Authentication failed")
             # check permissions, array.index throws exception
-            for req in permissions:
-                WHITELIST.index(req)
+            for req in permissions['permissions']:
+                    WHITELIST.index(req);
         # create cloudeebus service instance
         self.cloudeebusService = CloudeebusService(permissions)
         # register it for RPC