Github user necouchman commented on a diff in the pull request:
https://github.com/apache/guacamole-client/pull/181#discussion_r189133551
--- Diff:
extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/utility/QCParser.java
---
@@ -184,6 +184,43 @@ public static GuacamoleConfiguration
getConfiguration(String uri)
return parameters;
}
+ /**
+ * Parse the given string for username and password values,
+ * and return a map containing the username, password
+ * or both.
+ *
+ * @param userInfo
+ * The string to parse for username/password values.
+ *
+ * @return
+ * A map with the username, password, or both.
+ *
+ * @throws UnsupportedEncodingException
+ * If Java lacks UTF-8 support.
+ */
+ public static Map<String, String> parseUserInfo(String userInfo)
+ throws UnsupportedEncodingException {
+
+ Map<String, String> userInfoMap = new HashMap<String, String>();
+ Matcher userinfoMatcher = userinfoPattern.matcher(userInfo);
+
+ if (userinfoMatcher.matches()) {
+ String username = URLDecoder.decode(
+ userinfoMatcher.group(USERNAME_GROUP), "UTF-8");
+ String password = URLDecoder.decode(
+ userinfoMatcher.group(PASSWORD_GROUP), "UTF-8");
+
+ if (username != null && !username.isEmpty())
--- End diff --
Okay, moved the null check to prior to decoding it, so that should be
solved.
---