You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by fl...@apache.org on 2018/08/30 14:31:19 UTC
[35/50] tinkerpop git commit: TINKERPOP-1977 Fix license,
typo and default serialization format
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-1774
Commit: e61fcf1c639ee02482f339c691cdbcabe281bc72
Parents: a561ee0
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Aug 23 10:16:17 2018 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
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 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 */
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/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
index b8f104d..72c73ba 100644
--- 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
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
'use strict';
const Authenticator = require('./authenticator');
@@ -26,6 +27,7 @@ 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.
+ * @param {string} [authzid] Optional id
* @constructor
*/
constructor(username, password, authzid) {
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/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 cdf56e1..e93a7af 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
@@ -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 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');
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e61fcf1c/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 04deee7..15836ba 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-v3.0+json';
+const defaultMimeType = 'application/vnd.gremlin-v2.0+json';
class DriverRemoteConnection extends RemoteConnection {
/**