You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/08/24 21:44:35 UTC

[1/2] tinkerpop git commit: fixed authentification code in driver_remoteconnection

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1278 952c1c741 -> 21865d819


fixed authentification code in driver_remoteconnection


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/cb9d46a7
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/cb9d46a7
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/cb9d46a7

Branch: refs/heads/TINKERPOP-1278
Commit: cb9d46a754b6d7ec1d6fce4e4626deabcc1c1fc0
Parents: 952c1c7
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Aug 24 15:41:09 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Aug 24 15:41:09 2016 -0600

----------------------------------------------------------------------
 .../driver/driver_remote_connection.py          | 41 +++++++++-----------
 1 file changed, 19 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cb9d46a7/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
index 58342a2..3651ec8 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
@@ -115,8 +115,7 @@ class DriverRemoteConnection(RemoteConnection):
                 "aliases": {"g": self.traversal_source}
             }
         }
-        message = self._finalize_message(message)
-        return message
+        return DriverRemoteConnection._finalize_message(message)
 
     def _get_sideEffect_keys_message(self, request_id):
         message = {
@@ -133,8 +132,7 @@ class DriverRemoteConnection(RemoteConnection):
                 }
             }
         }
-        message = self._finalize_message(message)
-        return message
+        return DriverRemoteConnection._finalize_message(message)
 
     def _get_sideEffect_value_message(self, request_id, key):
         message = {
@@ -153,24 +151,10 @@ class DriverRemoteConnection(RemoteConnection):
                 "aliases": {"g": self.traversal_source}
             }
         }
-        message = self._finalize_message(message)
-        return message
+        return DriverRemoteConnection._finalize_message(message)
 
-    def _authenticate(self, username, password, processor):
-        auth = b"".join([b"\x00", username.encode("utf-8"),
-                         b"\x00", password.encode("utf-8")])
-        message = {
-            "requestId": str(uuid.uuid4()),
-            "op": "authentication",
-            "processor": "",
-            "args": {
-                "sasl": base64.b64encode(auth).decode()
-            }
-        }
-        message = self._finalize_message(message)
-        self._ws.send_message(message, binary=True)
-
-    def _finalize_message(self, message):
+    @staticmethod
+    def _finalize_message(message):
         message = json.dumps(message)
         mime_type = b"application/vnd.gremlin-v2.0+json"
         mime_len = b"\x21"
@@ -184,6 +168,19 @@ class Response:
         self._username = username
         self._password = password
 
+    def _authenticate(self, username, password):
+        auth = b"".join([b"\x00", username.encode("utf-8"),
+                         b"\x00", password.encode("utf-8")])
+        message = {
+            "requestId": str(uuid.uuid4()),
+            "op": "authentication",
+            "processor": "traversal",
+            "args": {
+                "sasl": base64.b64encode(auth).decode()
+            }
+        }
+        self._ws.send_message(DriverRemoteConnection._finalize_message(message), binary=True)
+
     @gen.coroutine
     def receive(self):
         if self._closed:
@@ -197,7 +194,7 @@ class Response:
         aggregateTo = "list" if "aggregateTo" not in meta else meta["aggregateTo"]
 
         if status_code == 407:
-            self._authenticate(self._username, self._password, self._processor)
+            self._authenticate(self._username, self._password)
             yield self.receive()
         elif status_code == 204:
             self._closed = True


[2/2] tinkerpop git commit: fixed authentification code in driver_remoteconnection

Posted by ok...@apache.org.
fixed authentification code in driver_remoteconnection


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/21865d81
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/21865d81
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/21865d81

Branch: refs/heads/TINKERPOP-1278
Commit: 21865d81948ea39fcd20fc3fb17cf2d9190aa625
Parents: cb9d46a
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Aug 24 15:44:32 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Aug 24 15:44:32 2016 -0600

----------------------------------------------------------------------
 .../jython/gremlin_python/driver/driver_remote_connection.py    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/21865d81/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
index 3651ec8..50a9944 100644
--- a/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/gremlin_python/driver/driver_remote_connection.py
@@ -172,7 +172,10 @@ class Response:
         auth = b"".join([b"\x00", username.encode("utf-8"),
                          b"\x00", password.encode("utf-8")])
         message = {
-            "requestId": str(uuid.uuid4()),
+            "requestId": {
+                "@type": "g:UUID",
+                "@value": str(uuid.uuid4())
+            },
             "op": "authentication",
             "processor": "traversal",
             "args": {