arshilkxwork commented on code in PR #3290:
URL: https://github.com/apache/hugegraph/pull/3290#discussion_r4237084888
##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java:
##########
@@ -159,7 +159,7 @@ private Pair<String, String> toUserPass(String auth) {
String encoded = auth.substring(basic.length());
byte[] userPass = this.decoder.decode(encoded);
String authorization = new String(userPass, UTF8);
- split = authorization.split(":");
+ split = authorization.split(":", 2);
Review Comment:
Added `CypherApiTest#testBasicAuthWithColonPassword` in 5e5be9c. It creates
a user with the password `a:b:c`, grants its group READ and EXECUTE on the
graph (the query needs both), and calls the Cypher endpoint with a hand-built
UTF-8 Basic header. It expects a successful result, and 401 for a wrong
password. Against the old `split(":")` it fails with 500, `The
'user-password-pair' can't be null`.
##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/cypher/CypherAPI.java:
##########
@@ -159,7 +159,7 @@ private Pair<String, String> toUserPass(String auth) {
String encoded = auth.substring(basic.length());
byte[] userPass = this.decoder.decode(encoded);
String authorization = new String(userPass, UTF8);
- split = authorization.split(":");
+ split = authorization.split(":", 2);
Review Comment:
Added `CypherApiTest#testBasicAuthWithColonPassword` in 5e5be9c. It creates
a user with the password `a:b:c`, grants its group READ and EXECUTE on the
graph (the query needs both), and calls the Cypher endpoint with a hand-built
UTF-8 Basic header. It expects a successful result, and 401 for a wrong
password. Against the old `split(":")` it fails with 500, `The
'user-password-pair' can't be null`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]