jbmusso / gremlin-javascript

JavaScript tools for graph processing in Node.js and the browser inspired by the Apache TinkerPop API
MIT License
214 stars 63 forks source link

buildChallengeResponse: SASL parameter is incorrectly set for Tinkerpop #88

Open codepope opened 7 years ago

codepope commented 7 years ago

When the BuildChallengeResponse is triggered it sets the SASL key as "SASL":

https://github.com/jbmusso/gremlin-javascript/blob/master/gremlin-client/src/GremlinClient.js#L246

But, examining the Tinkerpop server side, it is looking for the key in lower case "sasl". The difference means the server sees an authentication challenge response with no parameters and returns a 401 Unauthenticated.

I suggest changing the line into:

    var saslbase64=new Buffer('\0' + this.user + '\0' + this.password).toString('base64');
    var args = { sasl: saslbase64 };

Which also does a base64 encoding of the parameters to make them more resilient to string processing and encoding.

jbmusso commented 6 years ago

Thanks for catching this. I'll try to post a fix this weekend.

pfilion commented 6 years ago

Hi @jbmusso , we are also having the same problem and the suggested change by @codepope works :) . I'm asking politely if you are currently working on it or is this something we could help by doing the PR. Thanks

dpitera commented 6 years ago

Looks like this can be closed! Which also means #90 can be closed!

pluradj commented 6 years ago

Fix https://github.com/jbmusso/gremlin-javascript/commit/e9c45943371a788b0de5c53ac1d4d3199e4cceae merged on Dec 18, 2017