tinkerpop git commit: Added StackState and gremlinq as discussed on mailing list CTR

2018-08-23 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/master 581433d73 -> c9fcc139f


Added StackState and gremlinq as discussed on mailing list CTR


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

Branch: refs/heads/master
Commit: c9fcc139f60353fdc8773c9f128f02023c52255a
Parents: 581433d
Author: Stephen Mallette 
Authored: Thu Aug 23 12:52:41 2018 -0400
Committer: Stephen Mallette 
Committed: Thu Aug 23 12:52:41 2018 -0400

--
 docs/site/home/index.html | 2 ++
 1 file changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c9fcc139/docs/site/home/index.html
--
diff --git a/docs/site/home/index.html b/docs/site/home/index.html
index 6576c7d..8cb5dfa 100644
--- a/docs/site/home/index.html
+++ b/docs/site/home/index.html
@@ -274,6 +274,7 @@ limitations under the License.
 https://github.com/PommeVerte/gremlin-php;>gremlin-php (php) - A 
Gremlin Server driver for PHP.
 http://tinkerpop.apache.org/docs/current/reference/#gremlin-python;>gremlin-python
 (python) - Gremlin Server driver for Python.
 http://gremlinrestclient.readthedocs.org/en/latest/;>gremlinrestclient
 (python) - Python 2/3 library that uses HTTP to communicate with the Gremlin 
Server over REST.
+https://github.com/ExRam/ExRam.Gremlinq;>Gremlinq 
(.NET) - A strongly typed server driver.
 https://github.com/windj007/python-gremlin-rest;>python-gremlin-rest 
(python) - A REST-based client for Gremlin Server.
 https://github.com/coreyauger/reactive-gremlin;>reactive-gremlin 
(scala) - An Akka HTTP Websocket Connector.
 https://github.com/viagraphs/scalajs-gremlin-client;>scalajs-gremlin-client
 (scala) - A Gremlin-Server client with ad-hoc extensible, reactive, typeclass 
based API.
@@ -285,6 +286,7 @@ limitations under the License.
 https://www.exakat.io/;>exakat.io - Static 
analysis engine for PHP, powered by Gremlin.
 https://bricaud.github.io/graphexp/graphexp.html;>Graphexp - 
Interactive visualization of the Gremlin graph database with D3.js.
 http://www.pitneybowes.com/us/customer-information-management/data-integration-management/spectrum-data-hub-module.html;>Pitney
 Bowes Spectrum Data Hub Module - Uses Gremlin OLTP to query Neo4j-powered 
master data management based graph database.
+https://www.stackstate.com/;>StackState - 
Monitoring and AIOps allowing users to utilize Gremlin for analytical 
functions.
  
  
  Apache TinkerPop Committers



tinkerpop git commit: Minor fixups to links/spelling in upgrade docs CTR

2018-08-23 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/tp32 b08d0d856 -> 47e060047


Minor fixups to links/spelling in upgrade docs CTR


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

Branch: refs/heads/tp32
Commit: 47e060047a23403c5062a87adcb63d784513d730
Parents: b08d0d8
Author: Stephen Mallette 
Authored: Thu Aug 23 12:43:12 2018 -0400
Committer: Stephen Mallette 
Committed: Thu Aug 23 12:43:12 2018 -0400

--
 docs/src/upgrade/release-3.2.x-incubating.asciidoc | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/47e06004/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc 
b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 6f2aff8..c7ae1e2 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -29,7 +29,12 @@ Please see the 
link:https://github.com/apache/tinkerpop/blob/3.2.10/CHANGELOG.as
 
 === Upgrading for Users
 
-The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server. See: 
link:http://tinkerpop.apache.org/docs/current/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javasctipt]
+ SASL in Gremlin.Net
+
+The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1977[TINKERPOP-1977],
+link:http://tinkerpop.apache.org/docs/3.2.10/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javascript]
 
  Bulk Import and Export
 



[1/2] tinkerpop git commit: Minor fixups to links/spelling in upgrade docs CTR

2018-08-23 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/tp33 a87346840 -> 5ca699857


Minor fixups to links/spelling in upgrade docs CTR


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

Branch: refs/heads/tp33
Commit: 47e060047a23403c5062a87adcb63d784513d730
Parents: b08d0d8
Author: Stephen Mallette 
Authored: Thu Aug 23 12:43:12 2018 -0400
Committer: Stephen Mallette 
Committed: Thu Aug 23 12:43:12 2018 -0400

--
 docs/src/upgrade/release-3.2.x-incubating.asciidoc | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/47e06004/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc 
b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 6f2aff8..c7ae1e2 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -29,7 +29,12 @@ Please see the 
link:https://github.com/apache/tinkerpop/blob/3.2.10/CHANGELOG.as
 
 === Upgrading for Users
 
-The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server. See: 
link:http://tinkerpop.apache.org/docs/current/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javasctipt]
+ SASL in Gremlin.Net
+
+The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1977[TINKERPOP-1977],
+link:http://tinkerpop.apache.org/docs/3.2.10/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javascript]
 
  Bulk Import and Export
 



[3/3] tinkerpop git commit: Merge branch 'tp33'

2018-08-23 Thread spmallette
Merge branch 'tp33'


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

Branch: refs/heads/master
Commit: 581433d73cc8a6452054f39b29bea1bd7f9a0738
Parents: 62dc033 5ca6998
Author: Stephen Mallette 
Authored: Thu Aug 23 12:43:46 2018 -0400
Committer: Stephen Mallette 
Committed: Thu Aug 23 12:43:46 2018 -0400

--
 docs/src/upgrade/release-3.2.x-incubating.asciidoc | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
--




[1/3] tinkerpop git commit: Minor fixups to links/spelling in upgrade docs CTR

2018-08-23 Thread spmallette
Repository: tinkerpop
Updated Branches:
  refs/heads/master 62dc03388 -> 581433d73


Minor fixups to links/spelling in upgrade docs CTR


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

Branch: refs/heads/master
Commit: 47e060047a23403c5062a87adcb63d784513d730
Parents: b08d0d8
Author: Stephen Mallette 
Authored: Thu Aug 23 12:43:12 2018 -0400
Committer: Stephen Mallette 
Committed: Thu Aug 23 12:43:12 2018 -0400

--
 docs/src/upgrade/release-3.2.x-incubating.asciidoc | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/47e06004/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc 
b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 6f2aff8..c7ae1e2 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -29,7 +29,12 @@ Please see the 
link:https://github.com/apache/tinkerpop/blob/3.2.10/CHANGELOG.as
 
 === Upgrading for Users
 
-The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server. See: 
link:http://tinkerpop.apache.org/docs/current/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javasctipt]
+ SASL in Gremlin.Net
+
+The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1977[TINKERPOP-1977],
+link:http://tinkerpop.apache.org/docs/3.2.10/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javascript]
 
  Bulk Import and Export
 



[2/3] tinkerpop git commit: Merge branch 'tp32' into tp33

2018-08-23 Thread spmallette
Merge branch 'tp32' into tp33


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

Branch: refs/heads/master
Commit: 5ca69985731ef85fdf9c682634fdc51505fa8728
Parents: a873468 47e0600
Author: Stephen Mallette 
Authored: Thu Aug 23 12:43:35 2018 -0400
Committer: Stephen Mallette 
Committed: Thu Aug 23 12:43:35 2018 -0400

--
 docs/src/upgrade/release-3.2.x-incubating.asciidoc | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ca69985/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--



[2/2] tinkerpop git commit: Merge branch 'tp32' into tp33

2018-08-23 Thread spmallette
Merge branch 'tp32' into tp33


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

Branch: refs/heads/tp33
Commit: 5ca69985731ef85fdf9c682634fdc51505fa8728
Parents: a873468 47e0600
Author: Stephen Mallette 
Authored: Thu Aug 23 12:43:35 2018 -0400
Committer: Stephen Mallette 
Committed: Thu Aug 23 12:43:35 2018 -0400

--
 docs/src/upgrade/release-3.2.x-incubating.asciidoc | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ca69985/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--



[12/17] tinkerpop git commit: Fix for integration test Gremlin Server connection.

2018-08-23 Thread jorgebg
Fix for integration test Gremlin Server connection.


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

Branch: refs/heads/master
Commit: 8453b61cfd398fe53387439056315304bc22ea4f
Parents: 7a5cb9c
Author: Matthew Allen 
Authored: Sun Jul 29 16:02:12 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../src/main/javascript/gremlin-javascript/test/helper.js  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8453b61c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 25e9557..e1c24a3 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -33,7 +33,7 @@ exports.getConnection = function 
getConnection(traversalSource) {
 
 exports.getSecureConnectionWithAuthenticator = function 
getConnection(traversalSource) {
   const authenticator = new SaslAuthenticator({ mechanism: new 
SaslMechanismPlain(), username: 'stephen', password: 'password', authId: 
os.hostname() });
-  return new DriverRemoteConnection('wss://localhost:45941/gremlin', { 
+  return new DriverRemoteConnection('ws://localhost:45941/gremlin', { 
 traversalSource: traversalSource, 
 authenticator: authenticator, 
 rejectUnauthorized: false 



[16/17] tinkerpop git commit: Merge branch 'tp32' into tp33

2018-08-23 Thread jorgebg
Merge branch 'tp32' into tp33


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

Branch: refs/heads/master
Commit: a87346840db1ff86e8b899350ffe307449fd4ebd
Parents: 59fc032 b08d0d8
Author: Jorge Bay Gondra 
Authored: Thu Aug 23 14:50:35 2018 +0200
Committer: Jorge Bay Gondra 
Committed: Thu Aug 23 14:50:35 2018 +0200

--
 CHANGELOG.asciidoc  |  1 +
 docs/src/reference/gremlin-variants.asciidoc|  8 ++
 .../upgrade/release-3.2.x-incubating.asciidoc   |  2 +
 .../main/javascript/gremlin-javascript/index.js |  8 +-
 .../lib/driver/auth/authenticator.js| 38 
 .../auth/mechanisms/sasl-mechanism-base.js  | 52 +++
 .../auth/mechanisms/sasl-mechanism-plain.js | 96 
 .../auth/plain-text-sasl-authenticator.js   | 55 +++
 .../lib/driver/auth/sasl-authenticator.js   | 49 ++
 .../lib/driver/driver-remote-connection.js  | 85 ++---
 .../lib/driver/remote-connection.js |  5 +-
 .../javascript/gremlin-javascript/lib/utils.js  | 23 -
 .../gremlin-javascript/test/helper.js   | 11 +++
 .../integration/sasl-authentication-tests.js| 63 +
 14 files changed, 461 insertions(+), 35 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8734684/CHANGELOG.asciidoc
--

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8734684/docs/src/reference/gremlin-variants.asciidoc
--

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8734684/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8734684/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --cc 
gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index d862882,15836ba..04deee7
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@@ -31,9 -30,10 +30,10 @@@ const serializer = require('../structur
  const responseStatusCode = {
success: 200,
noContent: 204,
-   partialContent: 206
+   partialContent: 206,
+   authenticationChallenge:  407,
  };
 -const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
 +const defaultMimeType = 'application/vnd.gremlin-v3.0+json';
  
  class DriverRemoteConnection extends RemoteConnection {
/**



[11/17] tinkerpop git commit: Added PlainTextSaslAuthenticator helper and updated the tests to use it.

2018-08-23 Thread jorgebg
Added PlainTextSaslAuthenticator helper and updated the tests to use it.


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

Branch: refs/heads/master
Commit: cc57c2b886652bcdad127bb0358c9b85156b5156
Parents: 18598ba
Author: Matthew Allen 
Authored: Mon Aug 13 21:08:25 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../auth/plain-text-sasl-authenticator.js   | 53 
 .../lib/driver/auth/sasl-authenticator.js   |  2 +-
 .../gremlin-javascript/test/helper.js   |  7 ++-
 .../integration/sasl-authentication-tests.js|  9 +---
 4 files changed, 59 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
new file mode 100644
index 000..b8f104d
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+'use strict';
+
+const Authenticator = require('./authenticator');
+const SaslMechanismPlain = require('./mechanisms/sasl-mechanism-plain');
+
+class PlainTextSaslAuthenticator extends Authenticator {
+  /**
+   * Creates a new instance of PlainTextSaslAuthenticator.
+   * @param {string} username Username to log into the server.
+   * @param {string} password Password for the user.
+   * @constructor
+   */
+  constructor(username, password, authzid) {
+const options = {
+  mechanism: new SaslMechanismPlain({
+'username': username,
+'password': password,
+'authzid': authzid
+  })
+};
+
+super(options);
+  }
+  
+  /**
+   * Evaluates the challenge from the server and returns appropriate response.
+   * @param {String} challenge Challenge string presented by the server.
+   * @return {Object} A Promise that resolves to a valid sasl response object.
+   */
+  evaluateChallenge(challenge) {
+return this._options.mechanism.evaluateChallenge(challenge);
+  }
+}
+
+module.exports = PlainTextSaslAuthenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
index eb1fbe8..cdf56e1 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
@@ -23,7 +23,7 @@ class SaslAuthenticator extends Authenticator {
* @return {Object} A Promise that resolves to a valid sasl response object.
*/
   evaluateChallenge(challenge) {
-return 
Promise.resolve(this._options.mechanism.evaluateChallenge(challenge));
+return this._options.mechanism.evaluateChallenge(challenge);
   }
 }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 

[15/16] tinkerpop git commit: Merge branch 'TINKERPOP-1977' into tp32

2018-08-23 Thread jorgebg
Merge branch 'TINKERPOP-1977' into tp32


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

Branch: refs/heads/tp33
Commit: b08d0d8569a1a6fb13f3c015df3e69604df7b1e7
Parents: 675c077 e61fcf1
Author: Jorge Bay Gondra 
Authored: Thu Aug 23 14:50:14 2018 +0200
Committer: Jorge Bay Gondra 
Committed: Thu Aug 23 14:50:14 2018 +0200

--
 CHANGELOG.asciidoc  |  1 +
 docs/src/reference/gremlin-variants.asciidoc|  8 ++
 .../upgrade/release-3.2.x-incubating.asciidoc   |  2 +
 .../main/javascript/gremlin-javascript/index.js |  8 +-
 .../lib/driver/auth/authenticator.js| 38 
 .../auth/mechanisms/sasl-mechanism-base.js  | 52 +++
 .../auth/mechanisms/sasl-mechanism-plain.js | 96 
 .../auth/plain-text-sasl-authenticator.js   | 55 +++
 .../lib/driver/auth/sasl-authenticator.js   | 49 ++
 .../lib/driver/driver-remote-connection.js  | 85 ++---
 .../lib/driver/remote-connection.js |  5 +-
 .../javascript/gremlin-javascript/lib/utils.js  | 23 -
 .../gremlin-javascript/test/helper.js   | 11 +++
 .../integration/sasl-authentication-tests.js| 63 +
 14 files changed, 461 insertions(+), 35 deletions(-)
--




[12/16] tinkerpop git commit: Added PlainTextSaslAuthenticator helper and updated the tests to use it.

2018-08-23 Thread jorgebg
Added PlainTextSaslAuthenticator helper and updated the tests to use it.


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

Branch: refs/heads/tp33
Commit: cc57c2b886652bcdad127bb0358c9b85156b5156
Parents: 18598ba
Author: Matthew Allen 
Authored: Mon Aug 13 21:08:25 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../auth/plain-text-sasl-authenticator.js   | 53 
 .../lib/driver/auth/sasl-authenticator.js   |  2 +-
 .../gremlin-javascript/test/helper.js   |  7 ++-
 .../integration/sasl-authentication-tests.js|  9 +---
 4 files changed, 59 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
new file mode 100644
index 000..b8f104d
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+'use strict';
+
+const Authenticator = require('./authenticator');
+const SaslMechanismPlain = require('./mechanisms/sasl-mechanism-plain');
+
+class PlainTextSaslAuthenticator extends Authenticator {
+  /**
+   * Creates a new instance of PlainTextSaslAuthenticator.
+   * @param {string} username Username to log into the server.
+   * @param {string} password Password for the user.
+   * @constructor
+   */
+  constructor(username, password, authzid) {
+const options = {
+  mechanism: new SaslMechanismPlain({
+'username': username,
+'password': password,
+'authzid': authzid
+  })
+};
+
+super(options);
+  }
+  
+  /**
+   * Evaluates the challenge from the server and returns appropriate response.
+   * @param {String} challenge Challenge string presented by the server.
+   * @return {Object} A Promise that resolves to a valid sasl response object.
+   */
+  evaluateChallenge(challenge) {
+return this._options.mechanism.evaluateChallenge(challenge);
+  }
+}
+
+module.exports = PlainTextSaslAuthenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
index eb1fbe8..cdf56e1 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
@@ -23,7 +23,7 @@ class SaslAuthenticator extends Authenticator {
* @return {Object} A Promise that resolves to a valid sasl response object.
*/
   evaluateChallenge(challenge) {
-return 
Promise.resolve(this._options.mechanism.evaluateChallenge(challenge));
+return this._options.mechanism.evaluateChallenge(challenge);
   }
 }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 

[13/17] tinkerpop git commit: Updated documentation reflecting TINKERPOP-1977 changes. Added helper for auth to the gremlin-javascript exports.

2018-08-23 Thread jorgebg
Updated documentation reflecting TINKERPOP-1977 changes.
Added helper for auth to the gremlin-javascript exports.


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

Branch: refs/heads/master
Commit: a561ee01455757ed2948aab3eb46e327310ce73a
Parents: cc57c2b
Author: Matthew Allen 
Authored: Thu Aug 23 06:44:58 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:44:58 2018 +0100

--
 CHANGELOG.asciidoc  | 1 +
 docs/src/reference/gremlin-variants.asciidoc| 9 +
 docs/src/upgrade/release-3.2.x-incubating.asciidoc  | 2 ++
 .../src/main/javascript/gremlin-javascript/index.js | 6 +-
 4 files changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index eb1a6c5..f12c4ad 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -51,6 +51,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Fixed a bug in `TinkerGraphCountStrategy`, which didn't consider that 
certain map steps may not emit an element.
 * Fixed a bug in JavaScript GLV where DriverRemoteConnection close() method 
didn't returned a Promise instance.
 * Bumped to Jackson 2.9.6.
+* Sasl Plain Text Authentication added to Gremlin Javascript.
 
 [[release-3-2-9]]
 === TinkerPop 3.2.9 (Release Date: May 8, 2018)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/docs/src/reference/gremlin-variants.asciidoc
--
diff --git a/docs/src/reference/gremlin-variants.asciidoc 
b/docs/src/reference/gremlin-variants.asciidoc
index e8b4c21..290b39b 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -484,6 +484,15 @@ const graph = new Graph();
 const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin'));
 
 
+or for Gremlin Servers requiring SASL authentication
+
+[source,javascript]
+
+const graph = new Graph();
+const Authenicator = gremlin.driver.auth.PlainTextSaslAuthenicator;
+const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator: new 
Authenticator(username, password, optionalAuthzid) });
+
+
 When a traversal from the `GraphTraversalSource` is iterated, the 
traversal’s `Bytecode` is sent over the wire via
 the registered `RemoteConnection`. The bytecode is used to construct the 
equivalent traversal at the remote
 traversal source.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc 
b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index af03937..6f2aff8 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -29,6 +29,8 @@ Please see the 
link:https://github.com/apache/tinkerpop/blob/3.2.10/CHANGELOG.as
 
 === Upgrading for Users
 
+The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server. See: 
link:http://tinkerpop.apache.org/docs/current/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javasctipt]
+
  Bulk Import and Export
 
 TinkerPop has provided some general methods for importing and exporting data, 
but more and more graph providers are

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index d4c6d88..9cc6349 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,13 +31,17 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const PlainTextSaslAuthenticator = 
require('./lib/driver/auth/plain-text-sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: 

[14/17] tinkerpop git commit: TINKERPOP-1977 Fix license, typo and default serialization format

2018-08-23 Thread jorgebg
TINKERPOP-1977 Fix license, typo and default serialization format


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

Branch: refs/heads/master
Commit: e61fcf1c639ee02482f339c691cdbcabe281bc72
Parents: a561ee0
Author: Jorge Bay Gondra 
Authored: Thu Aug 23 10:16:17 2018 +0200
Committer: Jorge Bay Gondra 
Committed: Thu Aug 23 10:16:17 2018 +0200

--
 docs/src/reference/gremlin-variants.asciidoc |  7 +++
 .../main/javascript/gremlin-javascript/index.js  |  2 ++
 .../lib/driver/auth/authenticator.js | 19 +++
 .../driver/auth/plain-text-sasl-authenticator.js |  2 ++
 .../lib/driver/auth/sasl-authenticator.js| 19 +++
 .../lib/driver/driver-remote-connection.js   |  2 +-
 6 files changed, 46 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/docs/src/reference/gremlin-variants.asciidoc
--
diff --git a/docs/src/reference/gremlin-variants.asciidoc 
b/docs/src/reference/gremlin-variants.asciidoc
index 290b39b..5122136 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -484,13 +484,12 @@ const graph = new Graph();
 const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin'));
 
 
-or for Gremlin Servers requiring SASL authentication
+Gremlin-JavaScript supports plain text SASL authentication, you can set it on 
the connection options.
 
 [source,javascript]
 
-const graph = new Graph();
-const Authenicator = gremlin.driver.auth.PlainTextSaslAuthenicator;
-const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator: new 
Authenticator(username, password, optionalAuthzid) });
+const authenticator = new 
gremlin.driver.auth.PlainTextSaslAuthenticator('myuser', 'mypassword');
+const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator });
 
 
 When a traversal from the `GraphTraversalSource` is iterated, the 
traversal’s `Bytecode` is sent over the wire via

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index 9cc6349..c2e810d 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,6 +31,7 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const Authenticator = require('./lib/driver/auth/authenticator');
 const PlainTextSaslAuthenticator = 
require('./lib/driver/auth/plain-text-sasl-authenticator');
 
 module.exports = {
@@ -40,6 +41,7 @@ module.exports = {
 RemoteTraversal: rc.RemoteTraversal,
 DriverRemoteConnection: DriverRemoteConnection,
 auth: {
+  Authenticator: Authenticator,
   PlainTextSaslAuthenticator: PlainTextSaslAuthenticator
 }
   },

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
index b57e385..6b9b1c7 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
@@ -1,3 +1,22 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software 

[17/17] tinkerpop git commit: Merge branch 'tp33'

2018-08-23 Thread jorgebg
Merge branch 'tp33'


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

Branch: refs/heads/master
Commit: 62dc0338857f32c619eb0389ca92f0033d79cac9
Parents: fb14324 a873468
Author: Jorge Bay Gondra 
Authored: Thu Aug 23 14:50:52 2018 +0200
Committer: Jorge Bay Gondra 
Committed: Thu Aug 23 14:50:52 2018 +0200

--
 CHANGELOG.asciidoc  |  1 +
 docs/src/reference/gremlin-variants.asciidoc|  8 ++
 .../upgrade/release-3.2.x-incubating.asciidoc   |  2 +
 .../main/javascript/gremlin-javascript/index.js |  8 +-
 .../lib/driver/auth/authenticator.js| 38 
 .../auth/mechanisms/sasl-mechanism-base.js  | 52 +++
 .../auth/mechanisms/sasl-mechanism-plain.js | 96 
 .../auth/plain-text-sasl-authenticator.js   | 55 +++
 .../lib/driver/auth/sasl-authenticator.js   | 49 ++
 .../lib/driver/driver-remote-connection.js  | 85 ++---
 .../lib/driver/remote-connection.js |  5 +-
 .../javascript/gremlin-javascript/lib/utils.js  | 23 -
 .../gremlin-javascript/test/helper.js   | 11 +++
 .../integration/sasl-authentication-tests.js| 63 +
 14 files changed, 461 insertions(+), 35 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/62dc0338/CHANGELOG.asciidoc
--

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/62dc0338/docs/src/reference/gremlin-variants.asciidoc
--



[16/16] tinkerpop git commit: Merge branch 'tp32' into tp33

2018-08-23 Thread jorgebg
Merge branch 'tp32' into tp33


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

Branch: refs/heads/tp33
Commit: a87346840db1ff86e8b899350ffe307449fd4ebd
Parents: 59fc032 b08d0d8
Author: Jorge Bay Gondra 
Authored: Thu Aug 23 14:50:35 2018 +0200
Committer: Jorge Bay Gondra 
Committed: Thu Aug 23 14:50:35 2018 +0200

--
 CHANGELOG.asciidoc  |  1 +
 docs/src/reference/gremlin-variants.asciidoc|  8 ++
 .../upgrade/release-3.2.x-incubating.asciidoc   |  2 +
 .../main/javascript/gremlin-javascript/index.js |  8 +-
 .../lib/driver/auth/authenticator.js| 38 
 .../auth/mechanisms/sasl-mechanism-base.js  | 52 +++
 .../auth/mechanisms/sasl-mechanism-plain.js | 96 
 .../auth/plain-text-sasl-authenticator.js   | 55 +++
 .../lib/driver/auth/sasl-authenticator.js   | 49 ++
 .../lib/driver/driver-remote-connection.js  | 85 ++---
 .../lib/driver/remote-connection.js |  5 +-
 .../javascript/gremlin-javascript/lib/utils.js  | 23 -
 .../gremlin-javascript/test/helper.js   | 11 +++
 .../integration/sasl-authentication-tests.js| 63 +
 14 files changed, 461 insertions(+), 35 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8734684/CHANGELOG.asciidoc
--

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8734684/docs/src/reference/gremlin-variants.asciidoc
--

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8734684/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a8734684/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --cc 
gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index d862882,15836ba..04deee7
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@@ -31,9 -30,10 +30,10 @@@ const serializer = require('../structur
  const responseStatusCode = {
success: 200,
noContent: 204,
-   partialContent: 206
+   partialContent: 206,
+   authenticationChallenge:  407,
  };
 -const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
 +const defaultMimeType = 'application/vnd.gremlin-v3.0+json';
  
  class DriverRemoteConnection extends RemoteConnection {
/**



[13/16] tinkerpop git commit: Updated documentation reflecting TINKERPOP-1977 changes. Added helper for auth to the gremlin-javascript exports.

2018-08-23 Thread jorgebg
Updated documentation reflecting TINKERPOP-1977 changes.
Added helper for auth to the gremlin-javascript exports.


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

Branch: refs/heads/tp33
Commit: a561ee01455757ed2948aab3eb46e327310ce73a
Parents: cc57c2b
Author: Matthew Allen 
Authored: Thu Aug 23 06:44:58 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:44:58 2018 +0100

--
 CHANGELOG.asciidoc  | 1 +
 docs/src/reference/gremlin-variants.asciidoc| 9 +
 docs/src/upgrade/release-3.2.x-incubating.asciidoc  | 2 ++
 .../src/main/javascript/gremlin-javascript/index.js | 6 +-
 4 files changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index eb1a6c5..f12c4ad 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -51,6 +51,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Fixed a bug in `TinkerGraphCountStrategy`, which didn't consider that 
certain map steps may not emit an element.
 * Fixed a bug in JavaScript GLV where DriverRemoteConnection close() method 
didn't returned a Promise instance.
 * Bumped to Jackson 2.9.6.
+* Sasl Plain Text Authentication added to Gremlin Javascript.
 
 [[release-3-2-9]]
 === TinkerPop 3.2.9 (Release Date: May 8, 2018)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/docs/src/reference/gremlin-variants.asciidoc
--
diff --git a/docs/src/reference/gremlin-variants.asciidoc 
b/docs/src/reference/gremlin-variants.asciidoc
index e8b4c21..290b39b 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -484,6 +484,15 @@ const graph = new Graph();
 const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin'));
 
 
+or for Gremlin Servers requiring SASL authentication
+
+[source,javascript]
+
+const graph = new Graph();
+const Authenicator = gremlin.driver.auth.PlainTextSaslAuthenicator;
+const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator: new 
Authenticator(username, password, optionalAuthzid) });
+
+
 When a traversal from the `GraphTraversalSource` is iterated, the 
traversal’s `Bytecode` is sent over the wire via
 the registered `RemoteConnection`. The bytecode is used to construct the 
equivalent traversal at the remote
 traversal source.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc 
b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index af03937..6f2aff8 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -29,6 +29,8 @@ Please see the 
link:https://github.com/apache/tinkerpop/blob/3.2.10/CHANGELOG.as
 
 === Upgrading for Users
 
+The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server. See: 
link:http://tinkerpop.apache.org/docs/current/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javasctipt]
+
  Bulk Import and Export
 
 TinkerPop has provided some general methods for importing and exporting data, 
but more and more graph providers are

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index d4c6d88..9cc6349 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,13 +31,17 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const PlainTextSaslAuthenticator = 
require('./lib/driver/auth/plain-text-sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: 

[11/15] tinkerpop git commit: Added PlainTextSaslAuthenticator helper and updated the tests to use it.

2018-08-23 Thread jorgebg
Added PlainTextSaslAuthenticator helper and updated the tests to use it.


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

Branch: refs/heads/tp32
Commit: cc57c2b886652bcdad127bb0358c9b85156b5156
Parents: 18598ba
Author: Matthew Allen 
Authored: Mon Aug 13 21:08:25 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../auth/plain-text-sasl-authenticator.js   | 53 
 .../lib/driver/auth/sasl-authenticator.js   |  2 +-
 .../gremlin-javascript/test/helper.js   |  7 ++-
 .../integration/sasl-authentication-tests.js|  9 +---
 4 files changed, 59 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
new file mode 100644
index 000..b8f104d
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+'use strict';
+
+const Authenticator = require('./authenticator');
+const SaslMechanismPlain = require('./mechanisms/sasl-mechanism-plain');
+
+class PlainTextSaslAuthenticator extends Authenticator {
+  /**
+   * Creates a new instance of PlainTextSaslAuthenticator.
+   * @param {string} username Username to log into the server.
+   * @param {string} password Password for the user.
+   * @constructor
+   */
+  constructor(username, password, authzid) {
+const options = {
+  mechanism: new SaslMechanismPlain({
+'username': username,
+'password': password,
+'authzid': authzid
+  })
+};
+
+super(options);
+  }
+  
+  /**
+   * Evaluates the challenge from the server and returns appropriate response.
+   * @param {String} challenge Challenge string presented by the server.
+   * @return {Object} A Promise that resolves to a valid sasl response object.
+   */
+  evaluateChallenge(challenge) {
+return this._options.mechanism.evaluateChallenge(challenge);
+  }
+}
+
+module.exports = PlainTextSaslAuthenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
index eb1fbe8..cdf56e1 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
@@ -23,7 +23,7 @@ class SaslAuthenticator extends Authenticator {
* @return {Object} A Promise that resolves to a valid sasl response object.
*/
   evaluateChallenge(challenge) {
-return 
Promise.resolve(this._options.mechanism.evaluateChallenge(challenge));
+return this._options.mechanism.evaluateChallenge(challenge);
   }
 }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 

[15/15] tinkerpop git commit: Merge branch 'TINKERPOP-1977' into tp32

2018-08-23 Thread jorgebg
Merge branch 'TINKERPOP-1977' into tp32


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

Branch: refs/heads/tp32
Commit: b08d0d8569a1a6fb13f3c015df3e69604df7b1e7
Parents: 675c077 e61fcf1
Author: Jorge Bay Gondra 
Authored: Thu Aug 23 14:50:14 2018 +0200
Committer: Jorge Bay Gondra 
Committed: Thu Aug 23 14:50:14 2018 +0200

--
 CHANGELOG.asciidoc  |  1 +
 docs/src/reference/gremlin-variants.asciidoc|  8 ++
 .../upgrade/release-3.2.x-incubating.asciidoc   |  2 +
 .../main/javascript/gremlin-javascript/index.js |  8 +-
 .../lib/driver/auth/authenticator.js| 38 
 .../auth/mechanisms/sasl-mechanism-base.js  | 52 +++
 .../auth/mechanisms/sasl-mechanism-plain.js | 96 
 .../auth/plain-text-sasl-authenticator.js   | 55 +++
 .../lib/driver/auth/sasl-authenticator.js   | 49 ++
 .../lib/driver/driver-remote-connection.js  | 85 ++---
 .../lib/driver/remote-connection.js |  5 +-
 .../javascript/gremlin-javascript/lib/utils.js  | 23 -
 .../gremlin-javascript/test/helper.js   | 11 +++
 .../integration/sasl-authentication-tests.js| 63 +
 14 files changed, 461 insertions(+), 35 deletions(-)
--




[13/15] tinkerpop git commit: Updated documentation reflecting TINKERPOP-1977 changes. Added helper for auth to the gremlin-javascript exports.

2018-08-23 Thread jorgebg
Updated documentation reflecting TINKERPOP-1977 changes.
Added helper for auth to the gremlin-javascript exports.


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

Branch: refs/heads/tp32
Commit: a561ee01455757ed2948aab3eb46e327310ce73a
Parents: cc57c2b
Author: Matthew Allen 
Authored: Thu Aug 23 06:44:58 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:44:58 2018 +0100

--
 CHANGELOG.asciidoc  | 1 +
 docs/src/reference/gremlin-variants.asciidoc| 9 +
 docs/src/upgrade/release-3.2.x-incubating.asciidoc  | 2 ++
 .../src/main/javascript/gremlin-javascript/index.js | 6 +-
 4 files changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index eb1a6c5..f12c4ad 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -51,6 +51,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Fixed a bug in `TinkerGraphCountStrategy`, which didn't consider that 
certain map steps may not emit an element.
 * Fixed a bug in JavaScript GLV where DriverRemoteConnection close() method 
didn't returned a Promise instance.
 * Bumped to Jackson 2.9.6.
+* Sasl Plain Text Authentication added to Gremlin Javascript.
 
 [[release-3-2-9]]
 === TinkerPop 3.2.9 (Release Date: May 8, 2018)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/docs/src/reference/gremlin-variants.asciidoc
--
diff --git a/docs/src/reference/gremlin-variants.asciidoc 
b/docs/src/reference/gremlin-variants.asciidoc
index e8b4c21..290b39b 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -484,6 +484,15 @@ const graph = new Graph();
 const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin'));
 
 
+or for Gremlin Servers requiring SASL authentication
+
+[source,javascript]
+
+const graph = new Graph();
+const Authenicator = gremlin.driver.auth.PlainTextSaslAuthenicator;
+const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator: new 
Authenticator(username, password, optionalAuthzid) });
+
+
 When a traversal from the `GraphTraversalSource` is iterated, the 
traversal’s `Bytecode` is sent over the wire via
 the registered `RemoteConnection`. The bytecode is used to construct the 
equivalent traversal at the remote
 traversal source.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc 
b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index af03937..6f2aff8 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -29,6 +29,8 @@ Please see the 
link:https://github.com/apache/tinkerpop/blob/3.2.10/CHANGELOG.as
 
 === Upgrading for Users
 
+The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server. See: 
link:http://tinkerpop.apache.org/docs/current/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javasctipt]
+
  Bulk Import and Export
 
 TinkerPop has provided some general methods for importing and exporting data, 
but more and more graph providers are

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index d4c6d88..9cc6349 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,13 +31,17 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const PlainTextSaslAuthenticator = 
require('./lib/driver/auth/plain-text-sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: 

[tinkerpop] Git Push Summary

2018-08-23 Thread jorgebg
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1977 [deleted] e61fcf1c6


[03/17] tinkerpop git commit: Abstracted transport out of the authenticator class. Added authenticator and sasl implmentation to global export. Added more testing of the sasl authenticator implementat

2018-08-23 Thread jorgebg
Abstracted transport out of the authenticator class.
Added authenticator and sasl implmentation to global export.
Added more testing of the sasl authenticator implementation.


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

Branch: refs/heads/master
Commit: 6f65b92e7ac92cf4da105d9fef71ac51c6121013
Parents: c8ae3c8
Author: Matthew Allen 
Authored: Mon Jul 9 22:49:41 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:58 2018 +0100

--
 .../main/javascript/gremlin-javascript/index.js |  6 -
 .../lib/driver/authenticator.js |  4 +--
 .../lib/driver/driver-remote-connection.js  | 17 +++-
 .../lib/driver/remote-connection.js |  4 ++-
 .../lib/driver/sasl-authenticator.js| 27 +---
 .../integration/sasl-authentication-tests.js| 10 +++-
 6 files changed, 36 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index d4c6d88..5ada391 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,13 +31,17 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const Auth = require('./lib/driver/authenticator');
+const SaslAuth = require('./lib/driver/sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: rc.RemoteStrategy,
 RemoteTraversal: rc.RemoteTraversal,
-DriverRemoteConnection: DriverRemoteConnection
+DriverRemoteConnection: DriverRemoteConnection,
+Authenticator: Auth,
+SaslAuthenticator: SaslAuth
   },
   process: {
 Bytecode: Bytecode,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
index 053aecd..fe83077 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -6,9 +6,9 @@ class Authenticator {
 this._credentials = credentials;
   }
   
-  evaluateChallenge(ws, header) {
+  async evaluateChallenge(challenge) {
 throw new Error("evaluateChallenge should be implemented");
   }
 }
 
-module.exports = Authenticator;
\ No newline at end of file
+module.exports = Authenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 0f46745..facc0b8 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -105,24 +105,24 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /** @override */
-  submit(bytecode) {
+  submit(bytecode, op, args) {
 return this.open().then(() => new Promise((resolve, reject) => {
   const requestId = utils.getUuid();
   this._responseHandlers[requestId] = {
 callback: (err, result) => err ? reject(err) : resolve(result),
 result: null
   };
-  const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode)));
+  const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode, op, args)));
   this._ws.send(message);
 }));
   }
 
-  _getRequest(id, bytecode) {
+  _getRequest(id, bytecode, op, args) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },

[09/16] tinkerpop git commit: Added support for mechanism plugins for Sasl handler

2018-08-23 Thread jorgebg
Added support for mechanism plugins for Sasl handler


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

Branch: refs/heads/tp33
Commit: 7a5cb9c8053dbd303f70f5bbca95dcde528cf886
Parents: bdecf85
Author: Matthew Allen 
Authored: Sun Jul 29 15:59:08 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:26 2018 +0100

--
 .../auth/mechanisms/sasl-mechanism-base.js  | 36 +++
 .../auth/mechanisms/sasl-mechanism-plain.js | 37 
 .../lib/driver/driver-remote-connection.js  |  2 +-
 .../lib/driver/sasl-authenticator.js| 28 +++
 .../gremlin-javascript/test/helper.js   | 11 --
 5 files changed, 97 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
new file mode 100644
index 000..4b75778
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+'use strict';
+
+/** @abstract */
+class SaslMechanismBase {
+  get name() {
+return null;
+  }
+
+  setopts(options) {
+this._options = options;
+  }
+
+  evaluateChallenge(challenge) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = SaslMechanismBase;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
new file mode 100644
index 000..be418be
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
@@ -0,0 +1,37 @@
+'use strict';
+
+const SaslMechanismBase = require('./sasl-mechanism-base');
+
+class SaslMechanismPlain extends SaslMechanismBase {
+  get name() {
+return 'PLAIN';
+  }
+  
+  evaluateChallenge(challenge) {
+if (this._hasInitialResponse(challenge)) {
+  return Promise.resolve({ 'saslMechanism': this.name, 'sasl': 
this._saslArgument() });
+}
+
+return Promise.resolve({ 'sasl': this._saslArgument() });
+  }
+
+  _saslArgument() {
+if (this._options.username === undefined || this._options.username.length 
=== 0 
+  || this._options.password === undefined || this._options.password.length 
=== 0 ) {
+throw new Error('No Credentials Supplied');
+}
+
+const authstr = ((this._options.authId !== undefined && 
this._options.authId.length) ? this._options.authId : '')
+  + `\0${this._options.username}\0${this._options.password}`;
+return new Buffer(authstr).toString('base64');
+  }
+
+  _hasInitialResponse(challenge) {
+if (challenge === undefined || challenge === null) {
+  return false;
+}
+return true;
+  }
+}
+
+module.exports = SaslMechanismPlain;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff 

[07/17] tinkerpop git commit: Fix for incorrect code in _adaptArgs function.

2018-08-23 Thread jorgebg
Fix for incorrect code in _adaptArgs function.


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

Branch: refs/heads/master
Commit: 80987330fb9a724e7c94cf1c49f1bec1c8d125da
Parents: f67fea4
Author: Matthew Allen 
Authored: Fri Jul 13 00:58:52 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:59 2018 +0100

--
 .../gremlin-javascript/lib/driver/driver-remote-connection.js| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80987330/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index bec599b..c60492e 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -216,8 +216,8 @@ class DriverRemoteConnection extends RemoteConnection {
 
 if (args instanceof Object) {
   let newObj = {};
-  Object.keys(args).forEach((key, val) => {
-newObj[key] = this._adaptArgs(val);
+  Object.keys(args).forEach((key) => {
+newObj[key] = this._adaptArgs(args[key]);
   });
   return newObj;
 }



[01/16] tinkerpop git commit: Implementation of Sasl authentication.

2018-08-23 Thread jorgebg
Repository: tinkerpop
Updated Branches:
  refs/heads/tp33 59fc032f5 -> a87346840


Implementation of Sasl authentication.


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

Branch: refs/heads/tp33
Commit: 2a8b4b4ff5cf55b82fe2af8f8390724c6688467f
Parents: 675c077
Author: Matthew Allen 
Authored: Fri Jul 6 20:49:54 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:33:51 2018 +0100

--
 .../lib/driver/authenticator.js | 14 ++
 .../lib/driver/driver-remote-connection.js  | 44 ---
 .../lib/driver/sasl-authenticator.js| 45 
 .../javascript/gremlin-javascript/lib/utils.js  | 23 +-
 4 files changed, 99 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8b4b4f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
new file mode 100644
index 000..053aecd
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -0,0 +1,14 @@
+'use strict';
+
+/** @abstract */
+class Authenticator {
+  constructor(credentials) {
+this._credentials = credentials;
+  }
+  
+  evaluateChallenge(ws, header) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = Authenticator;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8b4b4f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 0f7cedb..153c278 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -22,7 +22,6 @@
  */
 'use strict';
 
-const crypto = require('crypto');
 const WebSocket = require('ws');
 const util = require('util');
 const RemoteConnection = require('./remote-connection').RemoteConnection;
@@ -31,7 +30,8 @@ const serializer = 
require('../structure/io/graph-serializer');
 const responseStatusCode = {
   success: 200,
   noContent: 204,
-  partialContent: 206
+  partialContent: 206,
+  authenticationChallenge:  407,
 };
 const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
 
@@ -48,6 +48,7 @@ class DriverRemoteConnection extends RemoteConnection {
* @param {Boolean} [options.rejectUnauthorized] Determines whether to 
verify or not the server certificate.
* @param {String} [options.traversalSource] The traversal source. Defaults 
to: 'g'.
* @param {GraphSONWriter} [options.writer] The writer to use.
+   * @param {Authenticator} [options.authenticator] The authentication handler 
to use.
* @constructor
*/
   constructor(url, options) {
@@ -76,7 +77,13 @@ class DriverRemoteConnection extends RemoteConnection {
 const mimeType = options.mimeType || defaultMimeType;
 this._header = String.fromCharCode(mimeType.length) + mimeType;
 this.isOpen = false;
+this.connectionError = false;
+this.connectionErrorMessage = '';
 this.traversalSource = options.traversalSource || 'g';
+
+if (options.authenticator) {
+  this._authenticator = options.authenticator;
+}
   }
 
   /**
@@ -102,7 +109,7 @@ class DriverRemoteConnection extends RemoteConnection {
   /** @override */
   submit(bytecode) {
 return this.open().then(() => new Promise((resolve, reject) => {
-  const requestId = getUuid();
+  const requestId = utils.getUuid();
   this._responseHandlers[requestId] = {
 callback: (err, result) => err ? reject(err) : resolve(result),
 result: null
@@ -112,12 +119,12 @@ class DriverRemoteConnection extends RemoteConnection {
 }));
   }
 
-  _getRequest(id, bytecode) {
+  _getRequest(id, bytecode, op, args) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
-  'op': 'bytecode',
+  'op': op || 'bytecode',
   'processor': 'traversal',
-  'args': {
+  'args': args || {
 'gremlin': this._writer.adaptObject(bytecode),
 'aliases': { 'g': 

[05/17] tinkerpop git commit: Submit can accept an existing requestId. Args supplied to _getRequest are run through the GraphSONWriter. Improved promise error handling on authenticator challenge. Tidy

2018-08-23 Thread jorgebg
Submit can accept an existing requestId.
Args supplied to _getRequest are run through the GraphSONWriter.
Improved promise error handling on authenticator challenge.
Tidying up of code formatting and documentation.
Integration test updated to use secure gremlin server port.


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

Branch: refs/heads/master
Commit: f67fea49da3ca788f39c3824c3398f1a7aae65f0
Parents: 0e05499
Author: Matthew Allen 
Authored: Wed Jul 11 21:38:56 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:55 2018 +0100

--
 .../lib/driver/driver-remote-connection.js  | 50 +++-
 .../lib/driver/remote-connection.js |  5 +-
 .../gremlin-javascript/test/helper.js   |  8 
 3 files changed, 49 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f67fea49/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index facc0b8..bec599b 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -105,19 +105,25 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /** @override */
-  submit(bytecode, op, args) {
+  submit(bytecode, op, args, requestId) {
 return this.open().then(() => new Promise((resolve, reject) => {
-  const requestId = utils.getUuid();
-  this._responseHandlers[requestId] = {
-callback: (err, result) => err ? reject(err) : resolve(result),
-result: null
-  };
+  if (requestId === null || requestId === undefined) {
+requestId = utils.getUuid();
+this._responseHandlers[requestId] = {
+  callback: (err, result) => err ? reject(err) : resolve(result),
+  result: null
+};
+  }
   const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode, op, args)));
   this._ws.send(message);
 }));
   }
 
   _getRequest(id, bytecode, op, args) {
+if (args) {
+  args = this._adaptArgs(args);
+}
+
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
   'op': op || 'bytecode',
@@ -158,12 +164,10 @@ class DriverRemoteConnection extends RemoteConnection {
 
 if (response.status.code === responseStatusCode.authenticationChallenge && 
this._authenticator) {
   this._authenticator.evaluateChallenge(response).then(res => {
-this.submit('', 'authentication', res);
-  }, err => {
-return handler.callback(err);
-  });
-   
-   return;
+return this.submit(null, 'authentication', res, response.requestId);
+  }).catch(handler.callback);
+
+  return;
 }
 else if (response.status.code >= 400) {
   // callback in error
@@ -200,6 +204,28 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /**
+   * Takes the given args map and ensures all arguments are passed through to 
_write.adaptObject
+   * @param {Object} args Map of arguments to process
+   * @returns {Object}
+   * @private
+   */
+  _adaptArgs(args) {
+if (Array.isArray(args)) {
+  return args.map(val => this._adaptArgs(val));
+}
+
+if (args instanceof Object) {
+  let newObj = {};
+  Object.keys(args).forEach((key, val) => {
+newObj[key] = this._adaptArgs(val);
+  });
+  return newObj;
+}
+
+return this._writer.adaptObject(args);
+  }
+
+  /**
* Closes the Connection.
* @return {Promise}
*/

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f67fea49/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
index 46918df..be6f962 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
@@ -34,10 +34,11 @@ class RemoteConnection {
* @abstract
* @param {Bytecode} 

[01/17] tinkerpop git commit: Implementation of Sasl authentication.

2018-08-23 Thread jorgebg
Repository: tinkerpop
Updated Branches:
  refs/heads/master fb14324fb -> 62dc03388


Implementation of Sasl authentication.


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

Branch: refs/heads/master
Commit: 2a8b4b4ff5cf55b82fe2af8f8390724c6688467f
Parents: 675c077
Author: Matthew Allen 
Authored: Fri Jul 6 20:49:54 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:33:51 2018 +0100

--
 .../lib/driver/authenticator.js | 14 ++
 .../lib/driver/driver-remote-connection.js  | 44 ---
 .../lib/driver/sasl-authenticator.js| 45 
 .../javascript/gremlin-javascript/lib/utils.js  | 23 +-
 4 files changed, 99 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8b4b4f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
new file mode 100644
index 000..053aecd
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -0,0 +1,14 @@
+'use strict';
+
+/** @abstract */
+class Authenticator {
+  constructor(credentials) {
+this._credentials = credentials;
+  }
+  
+  evaluateChallenge(ws, header) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = Authenticator;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8b4b4f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 0f7cedb..153c278 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -22,7 +22,6 @@
  */
 'use strict';
 
-const crypto = require('crypto');
 const WebSocket = require('ws');
 const util = require('util');
 const RemoteConnection = require('./remote-connection').RemoteConnection;
@@ -31,7 +30,8 @@ const serializer = 
require('../structure/io/graph-serializer');
 const responseStatusCode = {
   success: 200,
   noContent: 204,
-  partialContent: 206
+  partialContent: 206,
+  authenticationChallenge:  407,
 };
 const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
 
@@ -48,6 +48,7 @@ class DriverRemoteConnection extends RemoteConnection {
* @param {Boolean} [options.rejectUnauthorized] Determines whether to 
verify or not the server certificate.
* @param {String} [options.traversalSource] The traversal source. Defaults 
to: 'g'.
* @param {GraphSONWriter} [options.writer] The writer to use.
+   * @param {Authenticator} [options.authenticator] The authentication handler 
to use.
* @constructor
*/
   constructor(url, options) {
@@ -76,7 +77,13 @@ class DriverRemoteConnection extends RemoteConnection {
 const mimeType = options.mimeType || defaultMimeType;
 this._header = String.fromCharCode(mimeType.length) + mimeType;
 this.isOpen = false;
+this.connectionError = false;
+this.connectionErrorMessage = '';
 this.traversalSource = options.traversalSource || 'g';
+
+if (options.authenticator) {
+  this._authenticator = options.authenticator;
+}
   }
 
   /**
@@ -102,7 +109,7 @@ class DriverRemoteConnection extends RemoteConnection {
   /** @override */
   submit(bytecode) {
 return this.open().then(() => new Promise((resolve, reject) => {
-  const requestId = getUuid();
+  const requestId = utils.getUuid();
   this._responseHandlers[requestId] = {
 callback: (err, result) => err ? reject(err) : resolve(result),
 result: null
@@ -112,12 +119,12 @@ class DriverRemoteConnection extends RemoteConnection {
 }));
   }
 
-  _getRequest(id, bytecode) {
+  _getRequest(id, bytecode, op, args) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
-  'op': 'bytecode',
+  'op': op || 'bytecode',
   'processor': 'traversal',
-  'args': {
+  'args': args || {
 'gremlin': this._writer.adaptObject(bytecode),
 'aliases': { 'g': 

[09/17] tinkerpop git commit: Added support for mechanism plugins for Sasl handler

2018-08-23 Thread jorgebg
Added support for mechanism plugins for Sasl handler


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

Branch: refs/heads/master
Commit: 7a5cb9c8053dbd303f70f5bbca95dcde528cf886
Parents: bdecf85
Author: Matthew Allen 
Authored: Sun Jul 29 15:59:08 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:26 2018 +0100

--
 .../auth/mechanisms/sasl-mechanism-base.js  | 36 +++
 .../auth/mechanisms/sasl-mechanism-plain.js | 37 
 .../lib/driver/driver-remote-connection.js  |  2 +-
 .../lib/driver/sasl-authenticator.js| 28 +++
 .../gremlin-javascript/test/helper.js   | 11 --
 5 files changed, 97 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
new file mode 100644
index 000..4b75778
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+'use strict';
+
+/** @abstract */
+class SaslMechanismBase {
+  get name() {
+return null;
+  }
+
+  setopts(options) {
+this._options = options;
+  }
+
+  evaluateChallenge(challenge) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = SaslMechanismBase;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
new file mode 100644
index 000..be418be
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
@@ -0,0 +1,37 @@
+'use strict';
+
+const SaslMechanismBase = require('./sasl-mechanism-base');
+
+class SaslMechanismPlain extends SaslMechanismBase {
+  get name() {
+return 'PLAIN';
+  }
+  
+  evaluateChallenge(challenge) {
+if (this._hasInitialResponse(challenge)) {
+  return Promise.resolve({ 'saslMechanism': this.name, 'sasl': 
this._saslArgument() });
+}
+
+return Promise.resolve({ 'sasl': this._saslArgument() });
+  }
+
+  _saslArgument() {
+if (this._options.username === undefined || this._options.username.length 
=== 0 
+  || this._options.password === undefined || this._options.password.length 
=== 0 ) {
+throw new Error('No Credentials Supplied');
+}
+
+const authstr = ((this._options.authId !== undefined && 
this._options.authId.length) ? this._options.authId : '')
+  + `\0${this._options.username}\0${this._options.password}`;
+return new Buffer(authstr).toString('base64');
+  }
+
+  _hasInitialResponse(challenge) {
+if (challenge === undefined || challenge === null) {
+  return false;
+}
+return true;
+  }
+}
+
+module.exports = SaslMechanismPlain;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff 

[03/16] tinkerpop git commit: Abstracted transport out of the authenticator class. Added authenticator and sasl implmentation to global export. Added more testing of the sasl authenticator implementat

2018-08-23 Thread jorgebg
Abstracted transport out of the authenticator class.
Added authenticator and sasl implmentation to global export.
Added more testing of the sasl authenticator implementation.


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

Branch: refs/heads/tp33
Commit: 6f65b92e7ac92cf4da105d9fef71ac51c6121013
Parents: c8ae3c8
Author: Matthew Allen 
Authored: Mon Jul 9 22:49:41 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:58 2018 +0100

--
 .../main/javascript/gremlin-javascript/index.js |  6 -
 .../lib/driver/authenticator.js |  4 +--
 .../lib/driver/driver-remote-connection.js  | 17 +++-
 .../lib/driver/remote-connection.js |  4 ++-
 .../lib/driver/sasl-authenticator.js| 27 +---
 .../integration/sasl-authentication-tests.js| 10 +++-
 6 files changed, 36 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index d4c6d88..5ada391 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,13 +31,17 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const Auth = require('./lib/driver/authenticator');
+const SaslAuth = require('./lib/driver/sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: rc.RemoteStrategy,
 RemoteTraversal: rc.RemoteTraversal,
-DriverRemoteConnection: DriverRemoteConnection
+DriverRemoteConnection: DriverRemoteConnection,
+Authenticator: Auth,
+SaslAuthenticator: SaslAuth
   },
   process: {
 Bytecode: Bytecode,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
index 053aecd..fe83077 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -6,9 +6,9 @@ class Authenticator {
 this._credentials = credentials;
   }
   
-  evaluateChallenge(ws, header) {
+  async evaluateChallenge(challenge) {
 throw new Error("evaluateChallenge should be implemented");
   }
 }
 
-module.exports = Authenticator;
\ No newline at end of file
+module.exports = Authenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 0f46745..facc0b8 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -105,24 +105,24 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /** @override */
-  submit(bytecode) {
+  submit(bytecode, op, args) {
 return this.open().then(() => new Promise((resolve, reject) => {
   const requestId = utils.getUuid();
   this._responseHandlers[requestId] = {
 callback: (err, result) => err ? reject(err) : resolve(result),
 result: null
   };
-  const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode)));
+  const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode, op, args)));
   this._ws.send(message);
 }));
   }
 
-  _getRequest(id, bytecode) {
+  _getRequest(id, bytecode, op, args) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
- 

[07/16] tinkerpop git commit: Fix for incorrect code in _adaptArgs function.

2018-08-23 Thread jorgebg
Fix for incorrect code in _adaptArgs function.


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

Branch: refs/heads/tp33
Commit: 80987330fb9a724e7c94cf1c49f1bec1c8d125da
Parents: f67fea4
Author: Matthew Allen 
Authored: Fri Jul 13 00:58:52 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:59 2018 +0100

--
 .../gremlin-javascript/lib/driver/driver-remote-connection.js| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80987330/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index bec599b..c60492e 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -216,8 +216,8 @@ class DriverRemoteConnection extends RemoteConnection {
 
 if (args instanceof Object) {
   let newObj = {};
-  Object.keys(args).forEach((key, val) => {
-newObj[key] = this._adaptArgs(val);
+  Object.keys(args).forEach((key) => {
+newObj[key] = this._adaptArgs(args[key]);
   });
   return newObj;
 }



[05/16] tinkerpop git commit: Submit can accept an existing requestId. Args supplied to _getRequest are run through the GraphSONWriter. Improved promise error handling on authenticator challenge. Tidy

2018-08-23 Thread jorgebg
Submit can accept an existing requestId.
Args supplied to _getRequest are run through the GraphSONWriter.
Improved promise error handling on authenticator challenge.
Tidying up of code formatting and documentation.
Integration test updated to use secure gremlin server port.


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

Branch: refs/heads/tp33
Commit: f67fea49da3ca788f39c3824c3398f1a7aae65f0
Parents: 0e05499
Author: Matthew Allen 
Authored: Wed Jul 11 21:38:56 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:55 2018 +0100

--
 .../lib/driver/driver-remote-connection.js  | 50 +++-
 .../lib/driver/remote-connection.js |  5 +-
 .../gremlin-javascript/test/helper.js   |  8 
 3 files changed, 49 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f67fea49/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index facc0b8..bec599b 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -105,19 +105,25 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /** @override */
-  submit(bytecode, op, args) {
+  submit(bytecode, op, args, requestId) {
 return this.open().then(() => new Promise((resolve, reject) => {
-  const requestId = utils.getUuid();
-  this._responseHandlers[requestId] = {
-callback: (err, result) => err ? reject(err) : resolve(result),
-result: null
-  };
+  if (requestId === null || requestId === undefined) {
+requestId = utils.getUuid();
+this._responseHandlers[requestId] = {
+  callback: (err, result) => err ? reject(err) : resolve(result),
+  result: null
+};
+  }
   const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode, op, args)));
   this._ws.send(message);
 }));
   }
 
   _getRequest(id, bytecode, op, args) {
+if (args) {
+  args = this._adaptArgs(args);
+}
+
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
   'op': op || 'bytecode',
@@ -158,12 +164,10 @@ class DriverRemoteConnection extends RemoteConnection {
 
 if (response.status.code === responseStatusCode.authenticationChallenge && 
this._authenticator) {
   this._authenticator.evaluateChallenge(response).then(res => {
-this.submit('', 'authentication', res);
-  }, err => {
-return handler.callback(err);
-  });
-   
-   return;
+return this.submit(null, 'authentication', res, response.requestId);
+  }).catch(handler.callback);
+
+  return;
 }
 else if (response.status.code >= 400) {
   // callback in error
@@ -200,6 +204,28 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /**
+   * Takes the given args map and ensures all arguments are passed through to 
_write.adaptObject
+   * @param {Object} args Map of arguments to process
+   * @returns {Object}
+   * @private
+   */
+  _adaptArgs(args) {
+if (Array.isArray(args)) {
+  return args.map(val => this._adaptArgs(val));
+}
+
+if (args instanceof Object) {
+  let newObj = {};
+  Object.keys(args).forEach((key, val) => {
+newObj[key] = this._adaptArgs(val);
+  });
+  return newObj;
+}
+
+return this._writer.adaptObject(args);
+  }
+
+  /**
* Closes the Connection.
* @return {Promise}
*/

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f67fea49/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
index 46918df..be6f962 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
@@ -34,10 +34,11 @@ class RemoteConnection {
* @abstract
* @param {Bytecode} bytecode
 

[14/16] tinkerpop git commit: TINKERPOP-1977 Fix license, typo and default serialization format

2018-08-23 Thread jorgebg
TINKERPOP-1977 Fix license, typo and default serialization format


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

Branch: refs/heads/tp33
Commit: e61fcf1c639ee02482f339c691cdbcabe281bc72
Parents: a561ee0
Author: Jorge Bay Gondra 
Authored: Thu Aug 23 10:16:17 2018 +0200
Committer: Jorge Bay Gondra 
Committed: Thu Aug 23 10:16:17 2018 +0200

--
 docs/src/reference/gremlin-variants.asciidoc |  7 +++
 .../main/javascript/gremlin-javascript/index.js  |  2 ++
 .../lib/driver/auth/authenticator.js | 19 +++
 .../driver/auth/plain-text-sasl-authenticator.js |  2 ++
 .../lib/driver/auth/sasl-authenticator.js| 19 +++
 .../lib/driver/driver-remote-connection.js   |  2 +-
 6 files changed, 46 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/docs/src/reference/gremlin-variants.asciidoc
--
diff --git a/docs/src/reference/gremlin-variants.asciidoc 
b/docs/src/reference/gremlin-variants.asciidoc
index 290b39b..5122136 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -484,13 +484,12 @@ const graph = new Graph();
 const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin'));
 
 
-or for Gremlin Servers requiring SASL authentication
+Gremlin-JavaScript supports plain text SASL authentication, you can set it on 
the connection options.
 
 [source,javascript]
 
-const graph = new Graph();
-const Authenicator = gremlin.driver.auth.PlainTextSaslAuthenicator;
-const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator: new 
Authenticator(username, password, optionalAuthzid) });
+const authenticator = new 
gremlin.driver.auth.PlainTextSaslAuthenticator('myuser', 'mypassword');
+const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator });
 
 
 When a traversal from the `GraphTraversalSource` is iterated, the 
traversal’s `Bytecode` is sent over the wire via

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index 9cc6349..c2e810d 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,6 +31,7 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const Authenticator = require('./lib/driver/auth/authenticator');
 const PlainTextSaslAuthenticator = 
require('./lib/driver/auth/plain-text-sasl-authenticator');
 
 module.exports = {
@@ -40,6 +41,7 @@ module.exports = {
 RemoteTraversal: rc.RemoteTraversal,
 DriverRemoteConnection: DriverRemoteConnection,
 auth: {
+  Authenticator: Authenticator,
   PlainTextSaslAuthenticator: PlainTextSaslAuthenticator
 }
   },

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
index b57e385..6b9b1c7 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
@@ -1,3 +1,22 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software 

[10/16] tinkerpop git commit: Fix for integration test Gremlin Server connection.

2018-08-23 Thread jorgebg
Fix for integration test Gremlin Server connection.


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

Branch: refs/heads/tp33
Commit: 8453b61cfd398fe53387439056315304bc22ea4f
Parents: 7a5cb9c
Author: Matthew Allen 
Authored: Sun Jul 29 16:02:12 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../src/main/javascript/gremlin-javascript/test/helper.js  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8453b61c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 25e9557..e1c24a3 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -33,7 +33,7 @@ exports.getConnection = function 
getConnection(traversalSource) {
 
 exports.getSecureConnectionWithAuthenticator = function 
getConnection(traversalSource) {
   const authenticator = new SaslAuthenticator({ mechanism: new 
SaslMechanismPlain(), username: 'stephen', password: 'password', authId: 
os.hostname() });
-  return new DriverRemoteConnection('wss://localhost:45941/gremlin', { 
+  return new DriverRemoteConnection('ws://localhost:45941/gremlin', { 
 traversalSource: traversalSource, 
 authenticator: authenticator, 
 rejectUnauthorized: false 



[02/17] tinkerpop git commit: Unsaved changes uploaded

2018-08-23 Thread jorgebg
Unsaved changes uploaded


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

Branch: refs/heads/master
Commit: c8ae3c8cae9cbe7963fa4aea55ba4409cb73fd86
Parents: 2a8b4b4
Author: Matthew Allen 
Authored: Fri Jul 6 21:12:16 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:52 2018 +0100

--
 .../lib/driver/driver-remote-connection.js  | 10 ++--
 .../integration/sasl-authentication-tests.js| 59 
 2 files changed, 63 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8ae3c8c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 153c278..0f46745 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -33,7 +33,7 @@ const responseStatusCode = {
   partialContent: 206,
   authenticationChallenge:  407,
 };
-const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
+const defaultMimeType = 'application/vnd.gremlin-v3.0+json';
 
 class DriverRemoteConnection extends RemoteConnection {
   /**
@@ -77,8 +77,6 @@ class DriverRemoteConnection extends RemoteConnection {
 const mimeType = options.mimeType || defaultMimeType;
 this._header = String.fromCharCode(mimeType.length) + mimeType;
 this.isOpen = false;
-this.connectionError = false;
-this.connectionErrorMessage = '';
 this.traversalSource = options.traversalSource || 'g';
 
 if (options.authenticator) {
@@ -119,12 +117,12 @@ class DriverRemoteConnection extends RemoteConnection {
 }));
   }
 
-  _getRequest(id, bytecode, op, args) {
+  _getRequest(id, bytecode) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
-  'op': op || 'bytecode',
+  'op': 'bytecode',
   'processor': 'traversal',
-  'args': args || {
+  'args': {
 'gremlin': this._writer.adaptObject(bytecode),
 'aliases': { 'g': this.traversalSource }
   }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8ae3c8c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
new file mode 100644
index 000..c5dc48f
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const assert = require('assert');
+const Bytecode = require('../../lib/process/bytecode');
+const graphModule = require('../../lib/structure/graph');
+const helper = require('../helper');
+
+let connection;
+
+describe('DriverRemoteConnectionWithSaslAuthenticator', function () {
+  before(function () {
+connection = helper.getSecureConnectionWithAuthenticator('gmodern');
+return connection.open();
+  });
+  after(function () {
+return connection.close();
+  });
+  describe('#submit()', function () {
+it('should send the request with valid credentials and parse the 
response', function () {
+  return connection.submit(new Bytecode().addStep('V', []).addStep('tail', 
[]))
+.then(function 

[08/16] tinkerpop git commit: Switched from TLS sockets to normal socket on connection to gremlin secure server.

2018-08-23 Thread jorgebg
Switched from TLS sockets to normal socket on connection to gremlin secure 
server.


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

Branch: refs/heads/tp33
Commit: bdecf85fb5a0df9d11bffc948bd213921125e0de
Parents: 5e5a09b
Author: Matthew Allen 
Authored: Wed Jul 18 23:35:12 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:38:58 2018 +0100

--
 .../src/main/javascript/gremlin-javascript/test/helper.js   | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bdecf85f/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 99fea7f..5a90296 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -26,12 +26,9 @@ const DriverRemoteConnection = 
require('../lib/driver/driver-remote-connection')
 
 exports.getConnection = function getConnection(traversalSource) {
   return new DriverRemoteConnection('ws://localhost:45940/gremlin', { 
traversalSource: traversalSource });
-<<< HEAD
-===
 };
 
 exports.getSecureConnectionWithAuthenticator = function 
getConnection(traversalSource) {
   const authenticator = new SaslAuthenticator({ username: 'stephen', password: 
'password' });
-  return new DriverRemoteConnection('wss://localhost:45941/gremlin', { 
traversalSource: traversalSource, authenticator: authenticator, 
rejectUnauthorized: false });
->>> 65de11c3c8... Submit can accept an existing requestId.
+  return new DriverRemoteConnection('ws://localhost:45941/gremlin', { 
traversalSource: traversalSource, authenticator: authenticator, 
rejectUnauthorized: false });
 };
\ No newline at end of file



[10/17] tinkerpop git commit: Tidying-up of authenticator and integeration tests.

2018-08-23 Thread jorgebg
Tidying-up of authenticator and integeration tests.


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

Branch: refs/heads/master
Commit: 18598baff6039dd281bb18d42524c3f317d97218
Parents: 8453b61
Author: Matthew Allen 
Authored: Wed Aug 1 20:30:13 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../main/javascript/gremlin-javascript/index.js |  6 +-
 .../lib/driver/auth/authenticator.js| 19 +
 .../auth/mechanisms/sasl-mechanism-base.js  | 18 -
 .../auth/mechanisms/sasl-mechanism-plain.js | 81 +---
 .../lib/driver/auth/sasl-authenticator.js   | 30 
 .../lib/driver/authenticator.js | 14 
 .../lib/driver/sasl-authenticator.js| 30 
 .../gremlin-javascript/test/helper.js   |  4 +-
 .../integration/sasl-authentication-tests.js|  8 +-
 9 files changed, 143 insertions(+), 67 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index 5ada391..d4c6d88 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,17 +31,13 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
-const Auth = require('./lib/driver/authenticator');
-const SaslAuth = require('./lib/driver/sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: rc.RemoteStrategy,
 RemoteTraversal: rc.RemoteTraversal,
-DriverRemoteConnection: DriverRemoteConnection,
-Authenticator: Auth,
-SaslAuthenticator: SaslAuth
+DriverRemoteConnection: DriverRemoteConnection
   },
   process: {
 Bytecode: Bytecode,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
new file mode 100644
index 000..b57e385
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
@@ -0,0 +1,19 @@
+'use strict';
+
+/** @abstract */
+class Authenticator {
+  constructor(options) {
+this._options = options;
+  }
+  
+  /**
+   * @abstract
+   * Evaluates the challenge from the server and returns appropriate response.
+   * @param {String} challenge Challenge string presented by the server.
+   */
+  evaluateChallenge(challenge) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = Authenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
index 4b75778..b909cc8 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
@@ -20,17 +20,33 @@
 
 /** @abstract */
 class SaslMechanismBase {
+  constructor(options) {
+this.setopts(options);
+  }
+
+  /**
+   * Returns the name of the mechanism
+   */
   get name() {
 return null;
   }
 
+  /**
+   * Set the options for the mechanism
+   * @param {object} options Options specific to the mechanism
+   */
   setopts(options) {
 this._options = options;
   }
 
+  /**
+   * @abstract
+   * Evaluates the challenge from the server and returns appropriate response
+   * @param {String} challenge Challenge string presented by the server
+   */
   evaluateChallenge(challenge) {
 throw new 

[08/17] tinkerpop git commit: Switched from TLS sockets to normal socket on connection to gremlin secure server.

2018-08-23 Thread jorgebg
Switched from TLS sockets to normal socket on connection to gremlin secure 
server.


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

Branch: refs/heads/master
Commit: bdecf85fb5a0df9d11bffc948bd213921125e0de
Parents: 5e5a09b
Author: Matthew Allen 
Authored: Wed Jul 18 23:35:12 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:38:58 2018 +0100

--
 .../src/main/javascript/gremlin-javascript/test/helper.js   | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bdecf85f/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 99fea7f..5a90296 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -26,12 +26,9 @@ const DriverRemoteConnection = 
require('../lib/driver/driver-remote-connection')
 
 exports.getConnection = function getConnection(traversalSource) {
   return new DriverRemoteConnection('ws://localhost:45940/gremlin', { 
traversalSource: traversalSource });
-<<< HEAD
-===
 };
 
 exports.getSecureConnectionWithAuthenticator = function 
getConnection(traversalSource) {
   const authenticator = new SaslAuthenticator({ username: 'stephen', password: 
'password' });
-  return new DriverRemoteConnection('wss://localhost:45941/gremlin', { 
traversalSource: traversalSource, authenticator: authenticator, 
rejectUnauthorized: false });
->>> 65de11c3c8... Submit can accept an existing requestId.
+  return new DriverRemoteConnection('ws://localhost:45941/gremlin', { 
traversalSource: traversalSource, authenticator: authenticator, 
rejectUnauthorized: false });
 };
\ No newline at end of file



[04/17] tinkerpop git commit: Removed async keyword from Authenticator class for JS compatability.

2018-08-23 Thread jorgebg
Removed async keyword from Authenticator class for JS compatability.


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

Branch: refs/heads/master
Commit: 0e05499d1e131c318cc7bb8e486792ba38773dd5
Parents: 6f65b92
Author: Matthew Allen 
Authored: Tue Jul 10 10:47:14 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:59 2018 +0100

--
 .../main/javascript/gremlin-javascript/lib/driver/authenticator.js | 2 +-
 .../javascript/gremlin-javascript/lib/driver/sasl-authenticator.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e05499d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
index fe83077..c57cec5 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -6,7 +6,7 @@ class Authenticator {
 this._credentials = credentials;
   }
   
-  async evaluateChallenge(challenge) {
+  evaluateChallenge(challenge) {
 throw new Error("evaluateChallenge should be implemented");
   }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e05499d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
index d7db3de..fb4c5af 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
@@ -14,7 +14,7 @@ class SaslAuthenticator extends Authenticator {
 super(credentials);
   }
   
-  async evaluateChallenge(challenge) {
+  evaluateChallenge(challenge) {
 return Promise.resolve({ 'sasl': this.saslArgument() });
   }
 



[06/16] tinkerpop git commit: Updated Sasl test to remove gmodern traversal

2018-08-23 Thread jorgebg
Updated Sasl test to remove gmodern traversal


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

Branch: refs/heads/tp33
Commit: 5e5a09b35c4e897979c35be0dd3485c5900964e6
Parents: 8098733
Author: Matthew Allen 
Authored: Wed Jul 18 23:06:38 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:59 2018 +0100

--
 .../test/integration/sasl-authentication-tests.js   | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5e5a09b3/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
index d517d22..f38d087 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
@@ -31,7 +31,8 @@ let connection;
 
 describe('DriverRemoteConnectionWithSaslAuthenticator', function () {
   before(function () {
-connection = helper.getSecureConnectionWithAuthenticator('gmodern');
+this.timeout(2);
+connection = helper.getSecureConnectionWithAuthenticator(null);
 return connection.open();
   });
   after(function () {
@@ -43,11 +44,11 @@ describe('DriverRemoteConnectionWithSaslAuthenticator', 
function () {
 .then(function (response) {
   assert.ok(response);
   assert.ok(response.traversers);
-  assert.strictEqual(response.traversers.length, 1);
-  assert.ok(response.traversers[0].object instanceof 
graphModule.Vertex);
+  //assert.strictEqual(response.traversers.length, 1);
+  //assert.ok(response.traversers[0].object instanceof 
graphModule.Vertex);
 });
 });
-it('should send the request with invaid credentials and parse the response 
error', function () {
+it('should send the request with invalid credentials and parse the 
response error', function () {
   connection._authenticator.username = 'Bob';
   return connection.submit(new Bytecode().addStep('V', []).addStep('tail', 
[]))
 .catch(function (err) {



[04/16] tinkerpop git commit: Removed async keyword from Authenticator class for JS compatability.

2018-08-23 Thread jorgebg
Removed async keyword from Authenticator class for JS compatability.


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

Branch: refs/heads/tp33
Commit: 0e05499d1e131c318cc7bb8e486792ba38773dd5
Parents: 6f65b92
Author: Matthew Allen 
Authored: Tue Jul 10 10:47:14 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:59 2018 +0100

--
 .../main/javascript/gremlin-javascript/lib/driver/authenticator.js | 2 +-
 .../javascript/gremlin-javascript/lib/driver/sasl-authenticator.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e05499d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
index fe83077..c57cec5 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -6,7 +6,7 @@ class Authenticator {
 this._credentials = credentials;
   }
   
-  async evaluateChallenge(challenge) {
+  evaluateChallenge(challenge) {
 throw new Error("evaluateChallenge should be implemented");
   }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e05499d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
index d7db3de..fb4c5af 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
@@ -14,7 +14,7 @@ class SaslAuthenticator extends Authenticator {
 super(credentials);
   }
   
-  async evaluateChallenge(challenge) {
+  evaluateChallenge(challenge) {
 return Promise.resolve({ 'sasl': this.saslArgument() });
   }
 



[02/16] tinkerpop git commit: Unsaved changes uploaded

2018-08-23 Thread jorgebg
Unsaved changes uploaded


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

Branch: refs/heads/tp33
Commit: c8ae3c8cae9cbe7963fa4aea55ba4409cb73fd86
Parents: 2a8b4b4
Author: Matthew Allen 
Authored: Fri Jul 6 21:12:16 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:52 2018 +0100

--
 .../lib/driver/driver-remote-connection.js  | 10 ++--
 .../integration/sasl-authentication-tests.js| 59 
 2 files changed, 63 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8ae3c8c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 153c278..0f46745 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -33,7 +33,7 @@ const responseStatusCode = {
   partialContent: 206,
   authenticationChallenge:  407,
 };
-const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
+const defaultMimeType = 'application/vnd.gremlin-v3.0+json';
 
 class DriverRemoteConnection extends RemoteConnection {
   /**
@@ -77,8 +77,6 @@ class DriverRemoteConnection extends RemoteConnection {
 const mimeType = options.mimeType || defaultMimeType;
 this._header = String.fromCharCode(mimeType.length) + mimeType;
 this.isOpen = false;
-this.connectionError = false;
-this.connectionErrorMessage = '';
 this.traversalSource = options.traversalSource || 'g';
 
 if (options.authenticator) {
@@ -119,12 +117,12 @@ class DriverRemoteConnection extends RemoteConnection {
 }));
   }
 
-  _getRequest(id, bytecode, op, args) {
+  _getRequest(id, bytecode) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
-  'op': op || 'bytecode',
+  'op': 'bytecode',
   'processor': 'traversal',
-  'args': args || {
+  'args': {
 'gremlin': this._writer.adaptObject(bytecode),
 'aliases': { 'g': this.traversalSource }
   }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8ae3c8c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
new file mode 100644
index 000..c5dc48f
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const assert = require('assert');
+const Bytecode = require('../../lib/process/bytecode');
+const graphModule = require('../../lib/structure/graph');
+const helper = require('../helper');
+
+let connection;
+
+describe('DriverRemoteConnectionWithSaslAuthenticator', function () {
+  before(function () {
+connection = helper.getSecureConnectionWithAuthenticator('gmodern');
+return connection.open();
+  });
+  after(function () {
+return connection.close();
+  });
+  describe('#submit()', function () {
+it('should send the request with valid credentials and parse the 
response', function () {
+  return connection.submit(new Bytecode().addStep('V', []).addStep('tail', 
[]))
+.then(function (response) 

[06/17] tinkerpop git commit: Updated Sasl test to remove gmodern traversal

2018-08-23 Thread jorgebg
Updated Sasl test to remove gmodern traversal


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

Branch: refs/heads/master
Commit: 5e5a09b35c4e897979c35be0dd3485c5900964e6
Parents: 8098733
Author: Matthew Allen 
Authored: Wed Jul 18 23:06:38 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:59 2018 +0100

--
 .../test/integration/sasl-authentication-tests.js   | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5e5a09b3/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
index d517d22..f38d087 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
@@ -31,7 +31,8 @@ let connection;
 
 describe('DriverRemoteConnectionWithSaslAuthenticator', function () {
   before(function () {
-connection = helper.getSecureConnectionWithAuthenticator('gmodern');
+this.timeout(2);
+connection = helper.getSecureConnectionWithAuthenticator(null);
 return connection.open();
   });
   after(function () {
@@ -43,11 +44,11 @@ describe('DriverRemoteConnectionWithSaslAuthenticator', 
function () {
 .then(function (response) {
   assert.ok(response);
   assert.ok(response.traversers);
-  assert.strictEqual(response.traversers.length, 1);
-  assert.ok(response.traversers[0].object instanceof 
graphModule.Vertex);
+  //assert.strictEqual(response.traversers.length, 1);
+  //assert.ok(response.traversers[0].object instanceof 
graphModule.Vertex);
 });
 });
-it('should send the request with invaid credentials and parse the response 
error', function () {
+it('should send the request with invalid credentials and parse the 
response error', function () {
   connection._authenticator.username = 'Bob';
   return connection.submit(new Bytecode().addStep('V', []).addStep('tail', 
[]))
 .catch(function (err) {



[11/16] tinkerpop git commit: Tidying-up of authenticator and integeration tests.

2018-08-23 Thread jorgebg
Tidying-up of authenticator and integeration tests.


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

Branch: refs/heads/tp33
Commit: 18598baff6039dd281bb18d42524c3f317d97218
Parents: 8453b61
Author: Matthew Allen 
Authored: Wed Aug 1 20:30:13 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../main/javascript/gremlin-javascript/index.js |  6 +-
 .../lib/driver/auth/authenticator.js| 19 +
 .../auth/mechanisms/sasl-mechanism-base.js  | 18 -
 .../auth/mechanisms/sasl-mechanism-plain.js | 81 +---
 .../lib/driver/auth/sasl-authenticator.js   | 30 
 .../lib/driver/authenticator.js | 14 
 .../lib/driver/sasl-authenticator.js| 30 
 .../gremlin-javascript/test/helper.js   |  4 +-
 .../integration/sasl-authentication-tests.js|  8 +-
 9 files changed, 143 insertions(+), 67 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index 5ada391..d4c6d88 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,17 +31,13 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
-const Auth = require('./lib/driver/authenticator');
-const SaslAuth = require('./lib/driver/sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: rc.RemoteStrategy,
 RemoteTraversal: rc.RemoteTraversal,
-DriverRemoteConnection: DriverRemoteConnection,
-Authenticator: Auth,
-SaslAuthenticator: SaslAuth
+DriverRemoteConnection: DriverRemoteConnection
   },
   process: {
 Bytecode: Bytecode,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
new file mode 100644
index 000..b57e385
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
@@ -0,0 +1,19 @@
+'use strict';
+
+/** @abstract */
+class Authenticator {
+  constructor(options) {
+this._options = options;
+  }
+  
+  /**
+   * @abstract
+   * Evaluates the challenge from the server and returns appropriate response.
+   * @param {String} challenge Challenge string presented by the server.
+   */
+  evaluateChallenge(challenge) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = Authenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
index 4b75778..b909cc8 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
@@ -20,17 +20,33 @@
 
 /** @abstract */
 class SaslMechanismBase {
+  constructor(options) {
+this.setopts(options);
+  }
+
+  /**
+   * Returns the name of the mechanism
+   */
   get name() {
 return null;
   }
 
+  /**
+   * Set the options for the mechanism
+   * @param {object} options Options specific to the mechanism
+   */
   setopts(options) {
 this._options = options;
   }
 
+  /**
+   * @abstract
+   * Evaluates the challenge from the server and returns appropriate response
+   * @param {String} challenge Challenge string presented by the server
+   */
   evaluateChallenge(challenge) {
 throw new 

[02/15] tinkerpop git commit: Unsaved changes uploaded

2018-08-23 Thread jorgebg
Unsaved changes uploaded


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

Branch: refs/heads/tp32
Commit: c8ae3c8cae9cbe7963fa4aea55ba4409cb73fd86
Parents: 2a8b4b4
Author: Matthew Allen 
Authored: Fri Jul 6 21:12:16 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:52 2018 +0100

--
 .../lib/driver/driver-remote-connection.js  | 10 ++--
 .../integration/sasl-authentication-tests.js| 59 
 2 files changed, 63 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8ae3c8c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 153c278..0f46745 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -33,7 +33,7 @@ const responseStatusCode = {
   partialContent: 206,
   authenticationChallenge:  407,
 };
-const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
+const defaultMimeType = 'application/vnd.gremlin-v3.0+json';
 
 class DriverRemoteConnection extends RemoteConnection {
   /**
@@ -77,8 +77,6 @@ class DriverRemoteConnection extends RemoteConnection {
 const mimeType = options.mimeType || defaultMimeType;
 this._header = String.fromCharCode(mimeType.length) + mimeType;
 this.isOpen = false;
-this.connectionError = false;
-this.connectionErrorMessage = '';
 this.traversalSource = options.traversalSource || 'g';
 
 if (options.authenticator) {
@@ -119,12 +117,12 @@ class DriverRemoteConnection extends RemoteConnection {
 }));
   }
 
-  _getRequest(id, bytecode, op, args) {
+  _getRequest(id, bytecode) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
-  'op': op || 'bytecode',
+  'op': 'bytecode',
   'processor': 'traversal',
-  'args': args || {
+  'args': {
 'gremlin': this._writer.adaptObject(bytecode),
 'aliases': { 'g': this.traversalSource }
   }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8ae3c8c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
new file mode 100644
index 000..c5dc48f
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const assert = require('assert');
+const Bytecode = require('../../lib/process/bytecode');
+const graphModule = require('../../lib/structure/graph');
+const helper = require('../helper');
+
+let connection;
+
+describe('DriverRemoteConnectionWithSaslAuthenticator', function () {
+  before(function () {
+connection = helper.getSecureConnectionWithAuthenticator('gmodern');
+return connection.open();
+  });
+  after(function () {
+return connection.close();
+  });
+  describe('#submit()', function () {
+it('should send the request with valid credentials and parse the 
response', function () {
+  return connection.submit(new Bytecode().addStep('V', []).addStep('tail', 
[]))
+.then(function (response) 

[09/15] tinkerpop git commit: Added support for mechanism plugins for Sasl handler

2018-08-23 Thread jorgebg
Added support for mechanism plugins for Sasl handler


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

Branch: refs/heads/tp32
Commit: 7a5cb9c8053dbd303f70f5bbca95dcde528cf886
Parents: bdecf85
Author: Matthew Allen 
Authored: Sun Jul 29 15:59:08 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:26 2018 +0100

--
 .../auth/mechanisms/sasl-mechanism-base.js  | 36 +++
 .../auth/mechanisms/sasl-mechanism-plain.js | 37 
 .../lib/driver/driver-remote-connection.js  |  2 +-
 .../lib/driver/sasl-authenticator.js| 28 +++
 .../gremlin-javascript/test/helper.js   | 11 --
 5 files changed, 97 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
new file mode 100644
index 000..4b75778
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+'use strict';
+
+/** @abstract */
+class SaslMechanismBase {
+  get name() {
+return null;
+  }
+
+  setopts(options) {
+this._options = options;
+  }
+
+  evaluateChallenge(challenge) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = SaslMechanismBase;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
new file mode 100644
index 000..be418be
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
@@ -0,0 +1,37 @@
+'use strict';
+
+const SaslMechanismBase = require('./sasl-mechanism-base');
+
+class SaslMechanismPlain extends SaslMechanismBase {
+  get name() {
+return 'PLAIN';
+  }
+  
+  evaluateChallenge(challenge) {
+if (this._hasInitialResponse(challenge)) {
+  return Promise.resolve({ 'saslMechanism': this.name, 'sasl': 
this._saslArgument() });
+}
+
+return Promise.resolve({ 'sasl': this._saslArgument() });
+  }
+
+  _saslArgument() {
+if (this._options.username === undefined || this._options.username.length 
=== 0 
+  || this._options.password === undefined || this._options.password.length 
=== 0 ) {
+throw new Error('No Credentials Supplied');
+}
+
+const authstr = ((this._options.authId !== undefined && 
this._options.authId.length) ? this._options.authId : '')
+  + `\0${this._options.username}\0${this._options.password}`;
+return new Buffer(authstr).toString('base64');
+  }
+
+  _hasInitialResponse(challenge) {
+if (challenge === undefined || challenge === null) {
+  return false;
+}
+return true;
+  }
+}
+
+module.exports = SaslMechanismPlain;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff 

[10/15] tinkerpop git commit: Fix for integration test Gremlin Server connection.

2018-08-23 Thread jorgebg
Fix for integration test Gremlin Server connection.


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

Branch: refs/heads/tp32
Commit: 8453b61cfd398fe53387439056315304bc22ea4f
Parents: 7a5cb9c
Author: Matthew Allen 
Authored: Sun Jul 29 16:02:12 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../src/main/javascript/gremlin-javascript/test/helper.js  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8453b61c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 25e9557..e1c24a3 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -33,7 +33,7 @@ exports.getConnection = function 
getConnection(traversalSource) {
 
 exports.getSecureConnectionWithAuthenticator = function 
getConnection(traversalSource) {
   const authenticator = new SaslAuthenticator({ mechanism: new 
SaslMechanismPlain(), username: 'stephen', password: 'password', authId: 
os.hostname() });
-  return new DriverRemoteConnection('wss://localhost:45941/gremlin', { 
+  return new DriverRemoteConnection('ws://localhost:45941/gremlin', { 
 traversalSource: traversalSource, 
 authenticator: authenticator, 
 rejectUnauthorized: false 



[07/15] tinkerpop git commit: Fix for incorrect code in _adaptArgs function.

2018-08-23 Thread jorgebg
Fix for incorrect code in _adaptArgs function.


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

Branch: refs/heads/tp32
Commit: 80987330fb9a724e7c94cf1c49f1bec1c8d125da
Parents: f67fea4
Author: Matthew Allen 
Authored: Fri Jul 13 00:58:52 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:59 2018 +0100

--
 .../gremlin-javascript/lib/driver/driver-remote-connection.js| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80987330/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index bec599b..c60492e 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -216,8 +216,8 @@ class DriverRemoteConnection extends RemoteConnection {
 
 if (args instanceof Object) {
   let newObj = {};
-  Object.keys(args).forEach((key, val) => {
-newObj[key] = this._adaptArgs(val);
+  Object.keys(args).forEach((key) => {
+newObj[key] = this._adaptArgs(args[key]);
   });
   return newObj;
 }



[04/15] tinkerpop git commit: Removed async keyword from Authenticator class for JS compatability.

2018-08-23 Thread jorgebg
Removed async keyword from Authenticator class for JS compatability.


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

Branch: refs/heads/tp32
Commit: 0e05499d1e131c318cc7bb8e486792ba38773dd5
Parents: 6f65b92
Author: Matthew Allen 
Authored: Tue Jul 10 10:47:14 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:59 2018 +0100

--
 .../main/javascript/gremlin-javascript/lib/driver/authenticator.js | 2 +-
 .../javascript/gremlin-javascript/lib/driver/sasl-authenticator.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e05499d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
index fe83077..c57cec5 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -6,7 +6,7 @@ class Authenticator {
 this._credentials = credentials;
   }
   
-  async evaluateChallenge(challenge) {
+  evaluateChallenge(challenge) {
 throw new Error("evaluateChallenge should be implemented");
   }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e05499d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
index d7db3de..fb4c5af 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
@@ -14,7 +14,7 @@ class SaslAuthenticator extends Authenticator {
 super(credentials);
   }
   
-  async evaluateChallenge(challenge) {
+  evaluateChallenge(challenge) {
 return Promise.resolve({ 'sasl': this.saslArgument() });
   }
 



[06/15] tinkerpop git commit: Updated Sasl test to remove gmodern traversal

2018-08-23 Thread jorgebg
Updated Sasl test to remove gmodern traversal


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

Branch: refs/heads/tp32
Commit: 5e5a09b35c4e897979c35be0dd3485c5900964e6
Parents: 8098733
Author: Matthew Allen 
Authored: Wed Jul 18 23:06:38 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:59 2018 +0100

--
 .../test/integration/sasl-authentication-tests.js   | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5e5a09b3/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
index d517d22..f38d087 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
@@ -31,7 +31,8 @@ let connection;
 
 describe('DriverRemoteConnectionWithSaslAuthenticator', function () {
   before(function () {
-connection = helper.getSecureConnectionWithAuthenticator('gmodern');
+this.timeout(2);
+connection = helper.getSecureConnectionWithAuthenticator(null);
 return connection.open();
   });
   after(function () {
@@ -43,11 +44,11 @@ describe('DriverRemoteConnectionWithSaslAuthenticator', 
function () {
 .then(function (response) {
   assert.ok(response);
   assert.ok(response.traversers);
-  assert.strictEqual(response.traversers.length, 1);
-  assert.ok(response.traversers[0].object instanceof 
graphModule.Vertex);
+  //assert.strictEqual(response.traversers.length, 1);
+  //assert.ok(response.traversers[0].object instanceof 
graphModule.Vertex);
 });
 });
-it('should send the request with invaid credentials and parse the response 
error', function () {
+it('should send the request with invalid credentials and parse the 
response error', function () {
   connection._authenticator.username = 'Bob';
   return connection.submit(new Bytecode().addStep('V', []).addStep('tail', 
[]))
 .catch(function (err) {



[12/15] tinkerpop git commit: Tidying-up of authenticator and integeration tests.

2018-08-23 Thread jorgebg
Tidying-up of authenticator and integeration tests.


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

Branch: refs/heads/tp32
Commit: 18598baff6039dd281bb18d42524c3f317d97218
Parents: 8453b61
Author: Matthew Allen 
Authored: Wed Aug 1 20:30:13 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../main/javascript/gremlin-javascript/index.js |  6 +-
 .../lib/driver/auth/authenticator.js| 19 +
 .../auth/mechanisms/sasl-mechanism-base.js  | 18 -
 .../auth/mechanisms/sasl-mechanism-plain.js | 81 +---
 .../lib/driver/auth/sasl-authenticator.js   | 30 
 .../lib/driver/authenticator.js | 14 
 .../lib/driver/sasl-authenticator.js| 30 
 .../gremlin-javascript/test/helper.js   |  4 +-
 .../integration/sasl-authentication-tests.js|  8 +-
 9 files changed, 143 insertions(+), 67 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index 5ada391..d4c6d88 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,17 +31,13 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
-const Auth = require('./lib/driver/authenticator');
-const SaslAuth = require('./lib/driver/sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: rc.RemoteStrategy,
 RemoteTraversal: rc.RemoteTraversal,
-DriverRemoteConnection: DriverRemoteConnection,
-Authenticator: Auth,
-SaslAuthenticator: SaslAuth
+DriverRemoteConnection: DriverRemoteConnection
   },
   process: {
 Bytecode: Bytecode,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
new file mode 100644
index 000..b57e385
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
@@ -0,0 +1,19 @@
+'use strict';
+
+/** @abstract */
+class Authenticator {
+  constructor(options) {
+this._options = options;
+  }
+  
+  /**
+   * @abstract
+   * Evaluates the challenge from the server and returns appropriate response.
+   * @param {String} challenge Challenge string presented by the server.
+   */
+  evaluateChallenge(challenge) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = Authenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
index 4b75778..b909cc8 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
@@ -20,17 +20,33 @@
 
 /** @abstract */
 class SaslMechanismBase {
+  constructor(options) {
+this.setopts(options);
+  }
+
+  /**
+   * Returns the name of the mechanism
+   */
   get name() {
 return null;
   }
 
+  /**
+   * Set the options for the mechanism
+   * @param {object} options Options specific to the mechanism
+   */
   setopts(options) {
 this._options = options;
   }
 
+  /**
+   * @abstract
+   * Evaluates the challenge from the server and returns appropriate response
+   * @param {String} challenge Challenge string presented by the server
+   */
   evaluateChallenge(challenge) {
 throw new 

[03/15] tinkerpop git commit: Abstracted transport out of the authenticator class. Added authenticator and sasl implmentation to global export. Added more testing of the sasl authenticator implementat

2018-08-23 Thread jorgebg
Abstracted transport out of the authenticator class.
Added authenticator and sasl implmentation to global export.
Added more testing of the sasl authenticator implementation.


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

Branch: refs/heads/tp32
Commit: 6f65b92e7ac92cf4da105d9fef71ac51c6121013
Parents: c8ae3c8
Author: Matthew Allen 
Authored: Mon Jul 9 22:49:41 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:58 2018 +0100

--
 .../main/javascript/gremlin-javascript/index.js |  6 -
 .../lib/driver/authenticator.js |  4 +--
 .../lib/driver/driver-remote-connection.js  | 17 +++-
 .../lib/driver/remote-connection.js |  4 ++-
 .../lib/driver/sasl-authenticator.js| 27 +---
 .../integration/sasl-authentication-tests.js| 10 +++-
 6 files changed, 36 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index d4c6d88..5ada391 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,13 +31,17 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const Auth = require('./lib/driver/authenticator');
+const SaslAuth = require('./lib/driver/sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: rc.RemoteStrategy,
 RemoteTraversal: rc.RemoteTraversal,
-DriverRemoteConnection: DriverRemoteConnection
+DriverRemoteConnection: DriverRemoteConnection,
+Authenticator: Auth,
+SaslAuthenticator: SaslAuth
   },
   process: {
 Bytecode: Bytecode,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
index 053aecd..fe83077 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -6,9 +6,9 @@ class Authenticator {
 this._credentials = credentials;
   }
   
-  evaluateChallenge(ws, header) {
+  async evaluateChallenge(challenge) {
 throw new Error("evaluateChallenge should be implemented");
   }
 }
 
-module.exports = Authenticator;
\ No newline at end of file
+module.exports = Authenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 0f46745..facc0b8 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -105,24 +105,24 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /** @override */
-  submit(bytecode) {
+  submit(bytecode, op, args) {
 return this.open().then(() => new Promise((resolve, reject) => {
   const requestId = utils.getUuid();
   this._responseHandlers[requestId] = {
 callback: (err, result) => err ? reject(err) : resolve(result),
 result: null
   };
-  const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode)));
+  const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode, op, args)));
   this._ws.send(message);
 }));
   }
 
-  _getRequest(id, bytecode) {
+  _getRequest(id, bytecode, op, args) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
- 

[08/15] tinkerpop git commit: Switched from TLS sockets to normal socket on connection to gremlin secure server.

2018-08-23 Thread jorgebg
Switched from TLS sockets to normal socket on connection to gremlin secure 
server.


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

Branch: refs/heads/tp32
Commit: bdecf85fb5a0df9d11bffc948bd213921125e0de
Parents: 5e5a09b
Author: Matthew Allen 
Authored: Wed Jul 18 23:35:12 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:38:58 2018 +0100

--
 .../src/main/javascript/gremlin-javascript/test/helper.js   | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bdecf85f/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 99fea7f..5a90296 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -26,12 +26,9 @@ const DriverRemoteConnection = 
require('../lib/driver/driver-remote-connection')
 
 exports.getConnection = function getConnection(traversalSource) {
   return new DriverRemoteConnection('ws://localhost:45940/gremlin', { 
traversalSource: traversalSource });
-<<< HEAD
-===
 };
 
 exports.getSecureConnectionWithAuthenticator = function 
getConnection(traversalSource) {
   const authenticator = new SaslAuthenticator({ username: 'stephen', password: 
'password' });
-  return new DriverRemoteConnection('wss://localhost:45941/gremlin', { 
traversalSource: traversalSource, authenticator: authenticator, 
rejectUnauthorized: false });
->>> 65de11c3c8... Submit can accept an existing requestId.
+  return new DriverRemoteConnection('ws://localhost:45941/gremlin', { 
traversalSource: traversalSource, authenticator: authenticator, 
rejectUnauthorized: false });
 };
\ No newline at end of file



[05/15] tinkerpop git commit: Submit can accept an existing requestId. Args supplied to _getRequest are run through the GraphSONWriter. Improved promise error handling on authenticator challenge. Tidy

2018-08-23 Thread jorgebg
Submit can accept an existing requestId.
Args supplied to _getRequest are run through the GraphSONWriter.
Improved promise error handling on authenticator challenge.
Tidying up of code formatting and documentation.
Integration test updated to use secure gremlin server port.


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

Branch: refs/heads/tp32
Commit: f67fea49da3ca788f39c3824c3398f1a7aae65f0
Parents: 0e05499
Author: Matthew Allen 
Authored: Wed Jul 11 21:38:56 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:55 2018 +0100

--
 .../lib/driver/driver-remote-connection.js  | 50 +++-
 .../lib/driver/remote-connection.js |  5 +-
 .../gremlin-javascript/test/helper.js   |  8 
 3 files changed, 49 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f67fea49/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index facc0b8..bec599b 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -105,19 +105,25 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /** @override */
-  submit(bytecode, op, args) {
+  submit(bytecode, op, args, requestId) {
 return this.open().then(() => new Promise((resolve, reject) => {
-  const requestId = utils.getUuid();
-  this._responseHandlers[requestId] = {
-callback: (err, result) => err ? reject(err) : resolve(result),
-result: null
-  };
+  if (requestId === null || requestId === undefined) {
+requestId = utils.getUuid();
+this._responseHandlers[requestId] = {
+  callback: (err, result) => err ? reject(err) : resolve(result),
+  result: null
+};
+  }
   const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode, op, args)));
   this._ws.send(message);
 }));
   }
 
   _getRequest(id, bytecode, op, args) {
+if (args) {
+  args = this._adaptArgs(args);
+}
+
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
   'op': op || 'bytecode',
@@ -158,12 +164,10 @@ class DriverRemoteConnection extends RemoteConnection {
 
 if (response.status.code === responseStatusCode.authenticationChallenge && 
this._authenticator) {
   this._authenticator.evaluateChallenge(response).then(res => {
-this.submit('', 'authentication', res);
-  }, err => {
-return handler.callback(err);
-  });
-   
-   return;
+return this.submit(null, 'authentication', res, response.requestId);
+  }).catch(handler.callback);
+
+  return;
 }
 else if (response.status.code >= 400) {
   // callback in error
@@ -200,6 +204,28 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /**
+   * Takes the given args map and ensures all arguments are passed through to 
_write.adaptObject
+   * @param {Object} args Map of arguments to process
+   * @returns {Object}
+   * @private
+   */
+  _adaptArgs(args) {
+if (Array.isArray(args)) {
+  return args.map(val => this._adaptArgs(val));
+}
+
+if (args instanceof Object) {
+  let newObj = {};
+  Object.keys(args).forEach((key, val) => {
+newObj[key] = this._adaptArgs(val);
+  });
+  return newObj;
+}
+
+return this._writer.adaptObject(args);
+  }
+
+  /**
* Closes the Connection.
* @return {Promise}
*/

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f67fea49/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
index 46918df..be6f962 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
@@ -34,10 +34,11 @@ class RemoteConnection {
* @abstract
* @param {Bytecode} bytecode
 

[01/15] tinkerpop git commit: Implementation of Sasl authentication.

2018-08-23 Thread jorgebg
Repository: tinkerpop
Updated Branches:
  refs/heads/tp32 675c07717 -> b08d0d856


Implementation of Sasl authentication.


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

Branch: refs/heads/tp32
Commit: 2a8b4b4ff5cf55b82fe2af8f8390724c6688467f
Parents: 675c077
Author: Matthew Allen 
Authored: Fri Jul 6 20:49:54 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:33:51 2018 +0100

--
 .../lib/driver/authenticator.js | 14 ++
 .../lib/driver/driver-remote-connection.js  | 44 ---
 .../lib/driver/sasl-authenticator.js| 45 
 .../javascript/gremlin-javascript/lib/utils.js  | 23 +-
 4 files changed, 99 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8b4b4f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
new file mode 100644
index 000..053aecd
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -0,0 +1,14 @@
+'use strict';
+
+/** @abstract */
+class Authenticator {
+  constructor(credentials) {
+this._credentials = credentials;
+  }
+  
+  evaluateChallenge(ws, header) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = Authenticator;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8b4b4f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 0f7cedb..153c278 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -22,7 +22,6 @@
  */
 'use strict';
 
-const crypto = require('crypto');
 const WebSocket = require('ws');
 const util = require('util');
 const RemoteConnection = require('./remote-connection').RemoteConnection;
@@ -31,7 +30,8 @@ const serializer = 
require('../structure/io/graph-serializer');
 const responseStatusCode = {
   success: 200,
   noContent: 204,
-  partialContent: 206
+  partialContent: 206,
+  authenticationChallenge:  407,
 };
 const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
 
@@ -48,6 +48,7 @@ class DriverRemoteConnection extends RemoteConnection {
* @param {Boolean} [options.rejectUnauthorized] Determines whether to 
verify or not the server certificate.
* @param {String} [options.traversalSource] The traversal source. Defaults 
to: 'g'.
* @param {GraphSONWriter} [options.writer] The writer to use.
+   * @param {Authenticator} [options.authenticator] The authentication handler 
to use.
* @constructor
*/
   constructor(url, options) {
@@ -76,7 +77,13 @@ class DriverRemoteConnection extends RemoteConnection {
 const mimeType = options.mimeType || defaultMimeType;
 this._header = String.fromCharCode(mimeType.length) + mimeType;
 this.isOpen = false;
+this.connectionError = false;
+this.connectionErrorMessage = '';
 this.traversalSource = options.traversalSource || 'g';
+
+if (options.authenticator) {
+  this._authenticator = options.authenticator;
+}
   }
 
   /**
@@ -102,7 +109,7 @@ class DriverRemoteConnection extends RemoteConnection {
   /** @override */
   submit(bytecode) {
 return this.open().then(() => new Promise((resolve, reject) => {
-  const requestId = getUuid();
+  const requestId = utils.getUuid();
   this._responseHandlers[requestId] = {
 callback: (err, result) => err ? reject(err) : resolve(result),
 result: null
@@ -112,12 +119,12 @@ class DriverRemoteConnection extends RemoteConnection {
 }));
   }
 
-  _getRequest(id, bytecode) {
+  _getRequest(id, bytecode, op, args) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
-  'op': 'bytecode',
+  'op': op || 'bytecode',
   'processor': 'traversal',
-  'args': {
+  'args': args || {
 'gremlin': this._writer.adaptObject(bytecode),
 'aliases': { 'g': 

[14/15] tinkerpop git commit: TINKERPOP-1977 Fix license, typo and default serialization format

2018-08-23 Thread jorgebg
TINKERPOP-1977 Fix license, typo and default serialization format


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

Branch: refs/heads/tp32
Commit: e61fcf1c639ee02482f339c691cdbcabe281bc72
Parents: a561ee0
Author: Jorge Bay Gondra 
Authored: Thu Aug 23 10:16:17 2018 +0200
Committer: Jorge Bay Gondra 
Committed: Thu Aug 23 10:16:17 2018 +0200

--
 docs/src/reference/gremlin-variants.asciidoc |  7 +++
 .../main/javascript/gremlin-javascript/index.js  |  2 ++
 .../lib/driver/auth/authenticator.js | 19 +++
 .../driver/auth/plain-text-sasl-authenticator.js |  2 ++
 .../lib/driver/auth/sasl-authenticator.js| 19 +++
 .../lib/driver/driver-remote-connection.js   |  2 +-
 6 files changed, 46 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/docs/src/reference/gremlin-variants.asciidoc
--
diff --git a/docs/src/reference/gremlin-variants.asciidoc 
b/docs/src/reference/gremlin-variants.asciidoc
index 290b39b..5122136 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -484,13 +484,12 @@ const graph = new Graph();
 const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin'));
 
 
-or for Gremlin Servers requiring SASL authentication
+Gremlin-JavaScript supports plain text SASL authentication, you can set it on 
the connection options.
 
 [source,javascript]
 
-const graph = new Graph();
-const Authenicator = gremlin.driver.auth.PlainTextSaslAuthenicator;
-const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator: new 
Authenticator(username, password, optionalAuthzid) });
+const authenticator = new 
gremlin.driver.auth.PlainTextSaslAuthenticator('myuser', 'mypassword');
+const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator });
 
 
 When a traversal from the `GraphTraversalSource` is iterated, the 
traversal’s `Bytecode` is sent over the wire via

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index 9cc6349..c2e810d 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,6 +31,7 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const Authenticator = require('./lib/driver/auth/authenticator');
 const PlainTextSaslAuthenticator = 
require('./lib/driver/auth/plain-text-sasl-authenticator');
 
 module.exports = {
@@ -40,6 +41,7 @@ module.exports = {
 RemoteTraversal: rc.RemoteTraversal,
 DriverRemoteConnection: DriverRemoteConnection,
 auth: {
+  Authenticator: Authenticator,
   PlainTextSaslAuthenticator: PlainTextSaslAuthenticator
 }
   },

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
index b57e385..6b9b1c7 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
@@ -1,3 +1,22 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software 

[13/14] tinkerpop git commit: Updated documentation reflecting TINKERPOP-1977 changes. Added helper for auth to the gremlin-javascript exports.

2018-08-23 Thread jorgebg
Updated documentation reflecting TINKERPOP-1977 changes.
Added helper for auth to the gremlin-javascript exports.


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

Branch: refs/heads/TINKERPOP-1977
Commit: a561ee01455757ed2948aab3eb46e327310ce73a
Parents: cc57c2b
Author: Matthew Allen 
Authored: Thu Aug 23 06:44:58 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:44:58 2018 +0100

--
 CHANGELOG.asciidoc  | 1 +
 docs/src/reference/gremlin-variants.asciidoc| 9 +
 docs/src/upgrade/release-3.2.x-incubating.asciidoc  | 2 ++
 .../src/main/javascript/gremlin-javascript/index.js | 6 +-
 4 files changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index eb1a6c5..f12c4ad 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -51,6 +51,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Fixed a bug in `TinkerGraphCountStrategy`, which didn't consider that 
certain map steps may not emit an element.
 * Fixed a bug in JavaScript GLV where DriverRemoteConnection close() method 
didn't returned a Promise instance.
 * Bumped to Jackson 2.9.6.
+* Sasl Plain Text Authentication added to Gremlin Javascript.
 
 [[release-3-2-9]]
 === TinkerPop 3.2.9 (Release Date: May 8, 2018)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/docs/src/reference/gremlin-variants.asciidoc
--
diff --git a/docs/src/reference/gremlin-variants.asciidoc 
b/docs/src/reference/gremlin-variants.asciidoc
index e8b4c21..290b39b 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -484,6 +484,15 @@ const graph = new Graph();
 const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin'));
 
 
+or for Gremlin Servers requiring SASL authentication
+
+[source,javascript]
+
+const graph = new Graph();
+const Authenicator = gremlin.driver.auth.PlainTextSaslAuthenicator;
+const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator: new 
Authenticator(username, password, optionalAuthzid) });
+
+
 When a traversal from the `GraphTraversalSource` is iterated, the 
traversal’s `Bytecode` is sent over the wire via
 the registered `RemoteConnection`. The bytecode is used to construct the 
equivalent traversal at the remote
 traversal source.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/docs/src/upgrade/release-3.2.x-incubating.asciidoc
--
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc 
b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index af03937..6f2aff8 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -29,6 +29,8 @@ Please see the 
link:https://github.com/apache/tinkerpop/blob/3.2.10/CHANGELOG.as
 
 === Upgrading for Users
 
+The Gremlin Javascript Driver now supports SASL Plain Text authentication 
against a Gremlin Server. See: 
link:http://tinkerpop.apache.org/docs/current/reference#gremlin-javascript[Reference
 Documentation - Gremlin Javasctipt]
+
  Bulk Import and Export
 
 TinkerPop has provided some general methods for importing and exporting data, 
but more and more graph providers are

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a561ee01/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index d4c6d88..9cc6349 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,13 +31,17 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const PlainTextSaslAuthenticator = 
require('./lib/driver/auth/plain-text-sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: 

[08/14] tinkerpop git commit: Switched from TLS sockets to normal socket on connection to gremlin secure server.

2018-08-23 Thread jorgebg
Switched from TLS sockets to normal socket on connection to gremlin secure 
server.


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

Branch: refs/heads/TINKERPOP-1977
Commit: bdecf85fb5a0df9d11bffc948bd213921125e0de
Parents: 5e5a09b
Author: Matthew Allen 
Authored: Wed Jul 18 23:35:12 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:38:58 2018 +0100

--
 .../src/main/javascript/gremlin-javascript/test/helper.js   | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bdecf85f/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 99fea7f..5a90296 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -26,12 +26,9 @@ const DriverRemoteConnection = 
require('../lib/driver/driver-remote-connection')
 
 exports.getConnection = function getConnection(traversalSource) {
   return new DriverRemoteConnection('ws://localhost:45940/gremlin', { 
traversalSource: traversalSource });
-<<< HEAD
-===
 };
 
 exports.getSecureConnectionWithAuthenticator = function 
getConnection(traversalSource) {
   const authenticator = new SaslAuthenticator({ username: 'stephen', password: 
'password' });
-  return new DriverRemoteConnection('wss://localhost:45941/gremlin', { 
traversalSource: traversalSource, authenticator: authenticator, 
rejectUnauthorized: false });
->>> 65de11c3c8... Submit can accept an existing requestId.
+  return new DriverRemoteConnection('ws://localhost:45941/gremlin', { 
traversalSource: traversalSource, authenticator: authenticator, 
rejectUnauthorized: false });
 };
\ No newline at end of file



[04/14] tinkerpop git commit: Removed async keyword from Authenticator class for JS compatability.

2018-08-23 Thread jorgebg
Removed async keyword from Authenticator class for JS compatability.


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

Branch: refs/heads/TINKERPOP-1977
Commit: 0e05499d1e131c318cc7bb8e486792ba38773dd5
Parents: 6f65b92
Author: Matthew Allen 
Authored: Tue Jul 10 10:47:14 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:59 2018 +0100

--
 .../main/javascript/gremlin-javascript/lib/driver/authenticator.js | 2 +-
 .../javascript/gremlin-javascript/lib/driver/sasl-authenticator.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e05499d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
index fe83077..c57cec5 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -6,7 +6,7 @@ class Authenticator {
 this._credentials = credentials;
   }
   
-  async evaluateChallenge(challenge) {
+  evaluateChallenge(challenge) {
 throw new Error("evaluateChallenge should be implemented");
   }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e05499d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
index d7db3de..fb4c5af 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/sasl-authenticator.js
@@ -14,7 +14,7 @@ class SaslAuthenticator extends Authenticator {
 super(credentials);
   }
   
-  async evaluateChallenge(challenge) {
+  evaluateChallenge(challenge) {
 return Promise.resolve({ 'sasl': this.saslArgument() });
   }
 



[02/14] tinkerpop git commit: Unsaved changes uploaded

2018-08-23 Thread jorgebg
Unsaved changes uploaded


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

Branch: refs/heads/TINKERPOP-1977
Commit: c8ae3c8cae9cbe7963fa4aea55ba4409cb73fd86
Parents: 2a8b4b4
Author: Matthew Allen 
Authored: Fri Jul 6 21:12:16 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:52 2018 +0100

--
 .../lib/driver/driver-remote-connection.js  | 10 ++--
 .../integration/sasl-authentication-tests.js| 59 
 2 files changed, 63 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8ae3c8c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 153c278..0f46745 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -33,7 +33,7 @@ const responseStatusCode = {
   partialContent: 206,
   authenticationChallenge:  407,
 };
-const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
+const defaultMimeType = 'application/vnd.gremlin-v3.0+json';
 
 class DriverRemoteConnection extends RemoteConnection {
   /**
@@ -77,8 +77,6 @@ class DriverRemoteConnection extends RemoteConnection {
 const mimeType = options.mimeType || defaultMimeType;
 this._header = String.fromCharCode(mimeType.length) + mimeType;
 this.isOpen = false;
-this.connectionError = false;
-this.connectionErrorMessage = '';
 this.traversalSource = options.traversalSource || 'g';
 
 if (options.authenticator) {
@@ -119,12 +117,12 @@ class DriverRemoteConnection extends RemoteConnection {
 }));
   }
 
-  _getRequest(id, bytecode, op, args) {
+  _getRequest(id, bytecode) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
-  'op': op || 'bytecode',
+  'op': 'bytecode',
   'processor': 'traversal',
-  'args': args || {
+  'args': {
 'gremlin': this._writer.adaptObject(bytecode),
 'aliases': { 'g': this.traversalSource }
   }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c8ae3c8c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
new file mode 100644
index 000..c5dc48f
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+/**
+ * @author Jorge Bay Gondra
+ */
+'use strict';
+
+const assert = require('assert');
+const Bytecode = require('../../lib/process/bytecode');
+const graphModule = require('../../lib/structure/graph');
+const helper = require('../helper');
+
+let connection;
+
+describe('DriverRemoteConnectionWithSaslAuthenticator', function () {
+  before(function () {
+connection = helper.getSecureConnectionWithAuthenticator('gmodern');
+return connection.open();
+  });
+  after(function () {
+return connection.close();
+  });
+  describe('#submit()', function () {
+it('should send the request with valid credentials and parse the 
response', function () {
+  return connection.submit(new Bytecode().addStep('V', []).addStep('tail', 
[]))
+.then(function 

[11/14] tinkerpop git commit: Fix for integration test Gremlin Server connection.

2018-08-23 Thread jorgebg
Fix for integration test Gremlin Server connection.


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

Branch: refs/heads/TINKERPOP-1977
Commit: 8453b61cfd398fe53387439056315304bc22ea4f
Parents: 7a5cb9c
Author: Matthew Allen 
Authored: Sun Jul 29 16:02:12 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../src/main/javascript/gremlin-javascript/test/helper.js  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8453b61c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 25e9557..e1c24a3 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
@@ -33,7 +33,7 @@ exports.getConnection = function 
getConnection(traversalSource) {
 
 exports.getSecureConnectionWithAuthenticator = function 
getConnection(traversalSource) {
   const authenticator = new SaslAuthenticator({ mechanism: new 
SaslMechanismPlain(), username: 'stephen', password: 'password', authId: 
os.hostname() });
-  return new DriverRemoteConnection('wss://localhost:45941/gremlin', { 
+  return new DriverRemoteConnection('ws://localhost:45941/gremlin', { 
 traversalSource: traversalSource, 
 authenticator: authenticator, 
 rejectUnauthorized: false 



[06/14] tinkerpop git commit: Updated Sasl test to remove gmodern traversal

2018-08-23 Thread jorgebg
Updated Sasl test to remove gmodern traversal


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

Branch: refs/heads/TINKERPOP-1977
Commit: 5e5a09b35c4e897979c35be0dd3485c5900964e6
Parents: 8098733
Author: Matthew Allen 
Authored: Wed Jul 18 23:06:38 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:59 2018 +0100

--
 .../test/integration/sasl-authentication-tests.js   | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5e5a09b3/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
index d517d22..f38d087 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js
@@ -31,7 +31,8 @@ let connection;
 
 describe('DriverRemoteConnectionWithSaslAuthenticator', function () {
   before(function () {
-connection = helper.getSecureConnectionWithAuthenticator('gmodern');
+this.timeout(2);
+connection = helper.getSecureConnectionWithAuthenticator(null);
 return connection.open();
   });
   after(function () {
@@ -43,11 +44,11 @@ describe('DriverRemoteConnectionWithSaslAuthenticator', 
function () {
 .then(function (response) {
   assert.ok(response);
   assert.ok(response.traversers);
-  assert.strictEqual(response.traversers.length, 1);
-  assert.ok(response.traversers[0].object instanceof 
graphModule.Vertex);
+  //assert.strictEqual(response.traversers.length, 1);
+  //assert.ok(response.traversers[0].object instanceof 
graphModule.Vertex);
 });
 });
-it('should send the request with invaid credentials and parse the response 
error', function () {
+it('should send the request with invalid credentials and parse the 
response error', function () {
   connection._authenticator.username = 'Bob';
   return connection.submit(new Bytecode().addStep('V', []).addStep('tail', 
[]))
 .catch(function (err) {



[01/14] tinkerpop git commit: Implementation of Sasl authentication.

2018-08-23 Thread jorgebg
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1977 [created] e61fcf1c6


Implementation of Sasl authentication.


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

Branch: refs/heads/TINKERPOP-1977
Commit: 2a8b4b4ff5cf55b82fe2af8f8390724c6688467f
Parents: 675c077
Author: Matthew Allen 
Authored: Fri Jul 6 20:49:54 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:33:51 2018 +0100

--
 .../lib/driver/authenticator.js | 14 ++
 .../lib/driver/driver-remote-connection.js  | 44 ---
 .../lib/driver/sasl-authenticator.js| 45 
 .../javascript/gremlin-javascript/lib/utils.js  | 23 +-
 4 files changed, 99 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8b4b4f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
new file mode 100644
index 000..053aecd
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -0,0 +1,14 @@
+'use strict';
+
+/** @abstract */
+class Authenticator {
+  constructor(credentials) {
+this._credentials = credentials;
+  }
+  
+  evaluateChallenge(ws, header) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = Authenticator;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2a8b4b4f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 0f7cedb..153c278 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -22,7 +22,6 @@
  */
 'use strict';
 
-const crypto = require('crypto');
 const WebSocket = require('ws');
 const util = require('util');
 const RemoteConnection = require('./remote-connection').RemoteConnection;
@@ -31,7 +30,8 @@ const serializer = 
require('../structure/io/graph-serializer');
 const responseStatusCode = {
   success: 200,
   noContent: 204,
-  partialContent: 206
+  partialContent: 206,
+  authenticationChallenge:  407,
 };
 const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
 
@@ -48,6 +48,7 @@ class DriverRemoteConnection extends RemoteConnection {
* @param {Boolean} [options.rejectUnauthorized] Determines whether to 
verify or not the server certificate.
* @param {String} [options.traversalSource] The traversal source. Defaults 
to: 'g'.
* @param {GraphSONWriter} [options.writer] The writer to use.
+   * @param {Authenticator} [options.authenticator] The authentication handler 
to use.
* @constructor
*/
   constructor(url, options) {
@@ -76,7 +77,13 @@ class DriverRemoteConnection extends RemoteConnection {
 const mimeType = options.mimeType || defaultMimeType;
 this._header = String.fromCharCode(mimeType.length) + mimeType;
 this.isOpen = false;
+this.connectionError = false;
+this.connectionErrorMessage = '';
 this.traversalSource = options.traversalSource || 'g';
+
+if (options.authenticator) {
+  this._authenticator = options.authenticator;
+}
   }
 
   /**
@@ -102,7 +109,7 @@ class DriverRemoteConnection extends RemoteConnection {
   /** @override */
   submit(bytecode) {
 return this.open().then(() => new Promise((resolve, reject) => {
-  const requestId = getUuid();
+  const requestId = utils.getUuid();
   this._responseHandlers[requestId] = {
 callback: (err, result) => err ? reject(err) : resolve(result),
 result: null
@@ -112,12 +119,12 @@ class DriverRemoteConnection extends RemoteConnection {
 }));
   }
 
-  _getRequest(id, bytecode) {
+  _getRequest(id, bytecode, op, args) {
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
-  'op': 'bytecode',
+  'op': op || 'bytecode',
   'processor': 'traversal',
-  'args': {
+  'args': args || {
 'gremlin': this._writer.adaptObject(bytecode),
 

[07/14] tinkerpop git commit: Fix for incorrect code in _adaptArgs function.

2018-08-23 Thread jorgebg
Fix for incorrect code in _adaptArgs function.


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

Branch: refs/heads/TINKERPOP-1977
Commit: 80987330fb9a724e7c94cf1c49f1bec1c8d125da
Parents: f67fea4
Author: Matthew Allen 
Authored: Fri Jul 13 00:58:52 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:59 2018 +0100

--
 .../gremlin-javascript/lib/driver/driver-remote-connection.js| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80987330/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index bec599b..c60492e 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -216,8 +216,8 @@ class DriverRemoteConnection extends RemoteConnection {
 
 if (args instanceof Object) {
   let newObj = {};
-  Object.keys(args).forEach((key, val) => {
-newObj[key] = this._adaptArgs(val);
+  Object.keys(args).forEach((key) => {
+newObj[key] = this._adaptArgs(args[key]);
   });
   return newObj;
 }



[05/14] tinkerpop git commit: Submit can accept an existing requestId. Args supplied to _getRequest are run through the GraphSONWriter. Improved promise error handling on authenticator challenge. Tidy

2018-08-23 Thread jorgebg
Submit can accept an existing requestId.
Args supplied to _getRequest are run through the GraphSONWriter.
Improved promise error handling on authenticator challenge.
Tidying up of code formatting and documentation.
Integration test updated to use secure gremlin server port.


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

Branch: refs/heads/TINKERPOP-1977
Commit: f67fea49da3ca788f39c3824c3398f1a7aae65f0
Parents: 0e05499
Author: Matthew Allen 
Authored: Wed Jul 11 21:38:56 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:37:55 2018 +0100

--
 .../lib/driver/driver-remote-connection.js  | 50 +++-
 .../lib/driver/remote-connection.js |  5 +-
 .../gremlin-javascript/test/helper.js   |  8 
 3 files changed, 49 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f67fea49/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index facc0b8..bec599b 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -105,19 +105,25 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /** @override */
-  submit(bytecode, op, args) {
+  submit(bytecode, op, args, requestId) {
 return this.open().then(() => new Promise((resolve, reject) => {
-  const requestId = utils.getUuid();
-  this._responseHandlers[requestId] = {
-callback: (err, result) => err ? reject(err) : resolve(result),
-result: null
-  };
+  if (requestId === null || requestId === undefined) {
+requestId = utils.getUuid();
+this._responseHandlers[requestId] = {
+  callback: (err, result) => err ? reject(err) : resolve(result),
+  result: null
+};
+  }
   const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode, op, args)));
   this._ws.send(message);
 }));
   }
 
   _getRequest(id, bytecode, op, args) {
+if (args) {
+  args = this._adaptArgs(args);
+}
+
 return ({
   'requestId': { '@type': 'g:UUID', '@value': id },
   'op': op || 'bytecode',
@@ -158,12 +164,10 @@ class DriverRemoteConnection extends RemoteConnection {
 
 if (response.status.code === responseStatusCode.authenticationChallenge && 
this._authenticator) {
   this._authenticator.evaluateChallenge(response).then(res => {
-this.submit('', 'authentication', res);
-  }, err => {
-return handler.callback(err);
-  });
-   
-   return;
+return this.submit(null, 'authentication', res, response.requestId);
+  }).catch(handler.callback);
+
+  return;
 }
 else if (response.status.code >= 400) {
   // callback in error
@@ -200,6 +204,28 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /**
+   * Takes the given args map and ensures all arguments are passed through to 
_write.adaptObject
+   * @param {Object} args Map of arguments to process
+   * @returns {Object}
+   * @private
+   */
+  _adaptArgs(args) {
+if (Array.isArray(args)) {
+  return args.map(val => this._adaptArgs(val));
+}
+
+if (args instanceof Object) {
+  let newObj = {};
+  Object.keys(args).forEach((key, val) => {
+newObj[key] = this._adaptArgs(val);
+  });
+  return newObj;
+}
+
+return this._writer.adaptObject(args);
+  }
+
+  /**
* Closes the Connection.
* @return {Promise}
*/

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f67fea49/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
index 46918df..be6f962 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/remote-connection.js
@@ -34,10 +34,11 @@ class RemoteConnection {
* @abstract
* @param {Bytecode} 

[12/14] tinkerpop git commit: Tidying-up of authenticator and integeration tests.

2018-08-23 Thread jorgebg
Tidying-up of authenticator and integeration tests.


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

Branch: refs/heads/TINKERPOP-1977
Commit: 18598baff6039dd281bb18d42524c3f317d97218
Parents: 8453b61
Author: Matthew Allen 
Authored: Wed Aug 1 20:30:13 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../main/javascript/gremlin-javascript/index.js |  6 +-
 .../lib/driver/auth/authenticator.js| 19 +
 .../auth/mechanisms/sasl-mechanism-base.js  | 18 -
 .../auth/mechanisms/sasl-mechanism-plain.js | 81 +---
 .../lib/driver/auth/sasl-authenticator.js   | 30 
 .../lib/driver/authenticator.js | 14 
 .../lib/driver/sasl-authenticator.js| 30 
 .../gremlin-javascript/test/helper.js   |  4 +-
 .../integration/sasl-authentication-tests.js|  8 +-
 9 files changed, 143 insertions(+), 67 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index 5ada391..d4c6d88 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,17 +31,13 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
-const Auth = require('./lib/driver/authenticator');
-const SaslAuth = require('./lib/driver/sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: rc.RemoteStrategy,
 RemoteTraversal: rc.RemoteTraversal,
-DriverRemoteConnection: DriverRemoteConnection,
-Authenticator: Auth,
-SaslAuthenticator: SaslAuth
+DriverRemoteConnection: DriverRemoteConnection
   },
   process: {
 Bytecode: Bytecode,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
new file mode 100644
index 000..b57e385
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
@@ -0,0 +1,19 @@
+'use strict';
+
+/** @abstract */
+class Authenticator {
+  constructor(options) {
+this._options = options;
+  }
+  
+  /**
+   * @abstract
+   * Evaluates the challenge from the server and returns appropriate response.
+   * @param {String} challenge Challenge string presented by the server.
+   */
+  evaluateChallenge(challenge) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = Authenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/18598baf/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
index 4b75778..b909cc8 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
@@ -20,17 +20,33 @@
 
 /** @abstract */
 class SaslMechanismBase {
+  constructor(options) {
+this.setopts(options);
+  }
+
+  /**
+   * Returns the name of the mechanism
+   */
   get name() {
 return null;
   }
 
+  /**
+   * Set the options for the mechanism
+   * @param {object} options Options specific to the mechanism
+   */
   setopts(options) {
 this._options = options;
   }
 
+  /**
+   * @abstract
+   * Evaluates the challenge from the server and returns appropriate response
+   * @param {String} challenge Challenge string presented by the server
+   */
   evaluateChallenge(challenge) {
 throw new 

[10/14] tinkerpop git commit: Added PlainTextSaslAuthenticator helper and updated the tests to use it.

2018-08-23 Thread jorgebg
Added PlainTextSaslAuthenticator helper and updated the tests to use it.


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

Branch: refs/heads/TINKERPOP-1977
Commit: cc57c2b886652bcdad127bb0358c9b85156b5156
Parents: 18598ba
Author: Matthew Allen 
Authored: Mon Aug 13 21:08:25 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:29 2018 +0100

--
 .../auth/plain-text-sasl-authenticator.js   | 53 
 .../lib/driver/auth/sasl-authenticator.js   |  2 +-
 .../gremlin-javascript/test/helper.js   |  7 ++-
 .../integration/sasl-authentication-tests.js|  9 +---
 4 files changed, 59 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
new file mode 100644
index 000..b8f104d
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/plain-text-sasl-authenticator.js
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+'use strict';
+
+const Authenticator = require('./authenticator');
+const SaslMechanismPlain = require('./mechanisms/sasl-mechanism-plain');
+
+class PlainTextSaslAuthenticator extends Authenticator {
+  /**
+   * Creates a new instance of PlainTextSaslAuthenticator.
+   * @param {string} username Username to log into the server.
+   * @param {string} password Password for the user.
+   * @constructor
+   */
+  constructor(username, password, authzid) {
+const options = {
+  mechanism: new SaslMechanismPlain({
+'username': username,
+'password': password,
+'authzid': authzid
+  })
+};
+
+super(options);
+  }
+  
+  /**
+   * Evaluates the challenge from the server and returns appropriate response.
+   * @param {String} challenge Challenge string presented by the server.
+   * @return {Object} A Promise that resolves to a valid sasl response object.
+   */
+  evaluateChallenge(challenge) {
+return this._options.mechanism.evaluateChallenge(challenge);
+  }
+}
+
+module.exports = PlainTextSaslAuthenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
index eb1fbe8..cdf56e1 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/sasl-authenticator.js
@@ -23,7 +23,7 @@ class SaslAuthenticator extends Authenticator {
* @return {Object} A Promise that resolves to a valid sasl response object.
*/
   evaluateChallenge(challenge) {
-return 
Promise.resolve(this._options.mechanism.evaluateChallenge(challenge));
+return this._options.mechanism.evaluateChallenge(challenge);
   }
 }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/cc57c2b8/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/helper.js
index 

[14/14] tinkerpop git commit: TINKERPOP-1977 Fix license, typo and default serialization format

2018-08-23 Thread jorgebg
TINKERPOP-1977 Fix license, typo and default serialization format


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

Branch: refs/heads/TINKERPOP-1977
Commit: e61fcf1c639ee02482f339c691cdbcabe281bc72
Parents: a561ee0
Author: Jorge Bay Gondra 
Authored: Thu Aug 23 10:16:17 2018 +0200
Committer: Jorge Bay Gondra 
Committed: Thu Aug 23 10:16:17 2018 +0200

--
 docs/src/reference/gremlin-variants.asciidoc |  7 +++
 .../main/javascript/gremlin-javascript/index.js  |  2 ++
 .../lib/driver/auth/authenticator.js | 19 +++
 .../driver/auth/plain-text-sasl-authenticator.js |  2 ++
 .../lib/driver/auth/sasl-authenticator.js| 19 +++
 .../lib/driver/driver-remote-connection.js   |  2 +-
 6 files changed, 46 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/docs/src/reference/gremlin-variants.asciidoc
--
diff --git a/docs/src/reference/gremlin-variants.asciidoc 
b/docs/src/reference/gremlin-variants.asciidoc
index 290b39b..5122136 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -484,13 +484,12 @@ const graph = new Graph();
 const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin'));
 
 
-or for Gremlin Servers requiring SASL authentication
+Gremlin-JavaScript supports plain text SASL authentication, you can set it on 
the connection options.
 
 [source,javascript]
 
-const graph = new Graph();
-const Authenicator = gremlin.driver.auth.PlainTextSaslAuthenicator;
-const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator: new 
Authenticator(username, password, optionalAuthzid) });
+const authenticator = new 
gremlin.driver.auth.PlainTextSaslAuthenticator('myuser', 'mypassword');
+const g = graph.traversal().withRemote(new 
DriverRemoteConnection('ws://localhost:8182/gremlin', { authenticator });
 
 
 When a traversal from the `GraphTraversalSource` is iterated, the 
traversal’s `Bytecode` is sent over the wire via

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index 9cc6349..c2e810d 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,6 +31,7 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const Authenticator = require('./lib/driver/auth/authenticator');
 const PlainTextSaslAuthenticator = 
require('./lib/driver/auth/plain-text-sasl-authenticator');
 
 module.exports = {
@@ -40,6 +41,7 @@ module.exports = {
 RemoteTraversal: rc.RemoteTraversal,
 DriverRemoteConnection: DriverRemoteConnection,
 auth: {
+  Authenticator: Authenticator,
   PlainTextSaslAuthenticator: PlainTextSaslAuthenticator
 }
   },

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
index b57e385..6b9b1c7 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/authenticator.js
@@ -1,3 +1,22 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  

[03/14] tinkerpop git commit: Abstracted transport out of the authenticator class. Added authenticator and sasl implmentation to global export. Added more testing of the sasl authenticator implementat

2018-08-23 Thread jorgebg
Abstracted transport out of the authenticator class.
Added authenticator and sasl implmentation to global export.
Added more testing of the sasl authenticator implementation.


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

Branch: refs/heads/TINKERPOP-1977
Commit: 6f65b92e7ac92cf4da105d9fef71ac51c6121013
Parents: c8ae3c8
Author: Matthew Allen 
Authored: Mon Jul 9 22:49:41 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:36:58 2018 +0100

--
 .../main/javascript/gremlin-javascript/index.js |  6 -
 .../lib/driver/authenticator.js |  4 +--
 .../lib/driver/driver-remote-connection.js  | 17 +++-
 .../lib/driver/remote-connection.js |  4 ++-
 .../lib/driver/sasl-authenticator.js| 27 +---
 .../integration/sasl-authentication-tests.js| 10 +++-
 6 files changed, 36 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
--
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index d4c6d88..5ada391 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -31,13 +31,17 @@ const rc = require('./lib/driver/remote-connection');
 const Bytecode = require('./lib/process/bytecode');
 const utils = require('./lib/utils');
 const DriverRemoteConnection = 
require('./lib/driver/driver-remote-connection');
+const Auth = require('./lib/driver/authenticator');
+const SaslAuth = require('./lib/driver/sasl-authenticator');
 
 module.exports = {
   driver: {
 RemoteConnection: rc.RemoteConnection,
 RemoteStrategy: rc.RemoteStrategy,
 RemoteTraversal: rc.RemoteTraversal,
-DriverRemoteConnection: DriverRemoteConnection
+DriverRemoteConnection: DriverRemoteConnection,
+Authenticator: Auth,
+SaslAuthenticator: SaslAuth
   },
   process: {
 Bytecode: Bytecode,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
index 053aecd..fe83077 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/authenticator.js
@@ -6,9 +6,9 @@ class Authenticator {
 this._credentials = credentials;
   }
   
-  evaluateChallenge(ws, header) {
+  async evaluateChallenge(challenge) {
 throw new Error("evaluateChallenge should be implemented");
   }
 }
 
-module.exports = Authenticator;
\ No newline at end of file
+module.exports = Authenticator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6f65b92e/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index 0f46745..facc0b8 100644
--- 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -105,24 +105,24 @@ class DriverRemoteConnection extends RemoteConnection {
   }
 
   /** @override */
-  submit(bytecode) {
+  submit(bytecode, op, args) {
 return this.open().then(() => new Promise((resolve, reject) => {
   const requestId = utils.getUuid();
   this._responseHandlers[requestId] = {
 callback: (err, result) => err ? reject(err) : resolve(result),
 result: null
   };
-  const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode)));
+  const message = bufferFromString(this._header + 
JSON.stringify(this._getRequest(requestId, bytecode, op, args)));
   this._ws.send(message);
 }));
   }
 
-  _getRequest(id, bytecode) {
+  _getRequest(id, bytecode, op, args) {
 return ({
   'requestId': { '@type': 'g:UUID', 

[09/14] tinkerpop git commit: Added support for mechanism plugins for Sasl handler

2018-08-23 Thread jorgebg
Added support for mechanism plugins for Sasl handler


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

Branch: refs/heads/TINKERPOP-1977
Commit: 7a5cb9c8053dbd303f70f5bbca95dcde528cf886
Parents: bdecf85
Author: Matthew Allen 
Authored: Sun Jul 29 15:59:08 2018 +0100
Committer: Matthew Allen 
Committed: Thu Aug 23 06:39:26 2018 +0100

--
 .../auth/mechanisms/sasl-mechanism-base.js  | 36 +++
 .../auth/mechanisms/sasl-mechanism-plain.js | 37 
 .../lib/driver/driver-remote-connection.js  |  2 +-
 .../lib/driver/sasl-authenticator.js| 28 +++
 .../gremlin-javascript/test/helper.js   | 11 --
 5 files changed, 97 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
new file mode 100644
index 000..4b75778
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-base.js
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+'use strict';
+
+/** @abstract */
+class SaslMechanismBase {
+  get name() {
+return null;
+  }
+
+  setopts(options) {
+this._options = options;
+  }
+
+  evaluateChallenge(challenge) {
+throw new Error("evaluateChallenge should be implemented");
+  }
+}
+
+module.exports = SaslMechanismBase;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
--
diff --git 
a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
new file mode 100644
index 000..be418be
--- /dev/null
+++ 
b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js
@@ -0,0 +1,37 @@
+'use strict';
+
+const SaslMechanismBase = require('./sasl-mechanism-base');
+
+class SaslMechanismPlain extends SaslMechanismBase {
+  get name() {
+return 'PLAIN';
+  }
+  
+  evaluateChallenge(challenge) {
+if (this._hasInitialResponse(challenge)) {
+  return Promise.resolve({ 'saslMechanism': this.name, 'sasl': 
this._saslArgument() });
+}
+
+return Promise.resolve({ 'sasl': this._saslArgument() });
+  }
+
+  _saslArgument() {
+if (this._options.username === undefined || this._options.username.length 
=== 0 
+  || this._options.password === undefined || this._options.password.length 
=== 0 ) {
+throw new Error('No Credentials Supplied');
+}
+
+const authstr = ((this._options.authId !== undefined && 
this._options.authId.length) ? this._options.authId : '')
+  + `\0${this._options.username}\0${this._options.password}`;
+return new Buffer(authstr).toString('base64');
+  }
+
+  _hasInitialResponse(challenge) {
+if (challenge === undefined || challenge === null) {
+  return false;
+}
+return true;
+  }
+}
+
+module.exports = SaslMechanismPlain;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7a5cb9c8/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js