You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/06/09 22:48:23 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #8062: Add username and password support to JDBC driver

Jackie-Jiang commented on code in PR #8062:
URL: https://github.com/apache/pinot/pull/8062#discussion_r894019953


##########
pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/utils/DriverUtils.java:
##########
@@ -90,6 +119,21 @@ public static String getControllerFromURL(String url) {
     return controllerUrl;
   }
 
+  public static Map<String, String> getURLParams(String url) {
+    if (url.toLowerCase().startsWith("jdbc:")) {

Review Comment:
   (minor) Use `regionMatch` for better performance



##########
pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/utils/DriverUtils.java:
##########
@@ -55,6 +68,22 @@ public static SSLContext getSSLContextFromJDBCProps(Properties properties) {
     return TlsUtils.getSslContext();
   }
 
+  public static void handleAuth(String url, Properties info, Map<String, String> headers)
+      throws SQLException {
+    Map<String, String> urlParams = DriverUtils.getURLParams(url);
+    info.putAll(urlParams);
+
+    if (info.contains(USER_PROPERTY) && !headers.containsKey(AUTH_HEADER)) {
+      String username = info.getProperty(USER_PROPERTY);
+      String password = info.getProperty(PASSWORD_PROPERTY, "");
+      if (StringUtils.isEmpty(password)) {

Review Comment:
   (minor) Should also check `username`?



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org