prabhjyotsingh commented on a change in pull request #3965:
URL: https://github.com/apache/zeppelin/pull/3965#discussion_r518284030



##########
File path: jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
##########
@@ -500,54 +501,21 @@ public Connection getConnection(String dbPrefix, 
InterpreterContext context)
     setUserProperty(dbPrefix, context);
 
     final Properties properties = 
jdbcUserConfigurations.getPropertyMap(dbPrefix);
-    final String url = properties.getProperty(URL_KEY);
+    String url = properties.getProperty(URL_KEY);
+    String principal = getProperty("zeppelin.jdbc.principal");
+    if (!StringUtils.isBlank(principal) && !url.contains("principal=")) {
+      url = url + ";principal=" + principal;
+    }
 
     if (isEmpty(getProperty("zeppelin.jdbc.auth.type"))) {
       connection = getConnectionFromPool(url, user, dbPrefix, properties);
     } else {
       UserGroupInformation.AuthenticationMethod authType =
-          JDBCSecurityImpl.getAuthtype(getProperties());
+          JDBCSecurityImpl.getAuthType(getProperties());
 
       final String connectionUrl = appendProxyUserToURL(url, user, dbPrefix);
-
       JDBCSecurityImpl.createSecureConfiguration(getProperties(), authType);
-      switch (authType) {
-        case KERBEROS:
-          if (user == null || "false".equalsIgnoreCase(
-              getProperty("zeppelin.jdbc.auth.kerberos.proxy.enable"))) {
-            connection = getConnectionFromPool(connectionUrl, user, dbPrefix, 
properties);
-          } else {
-            if 
(basePropertiesMap.get(dbPrefix).containsKey("proxy.user.property")) {
-              connection = getConnectionFromPool(connectionUrl, user, 
dbPrefix, properties);
-            } else {
-              UserGroupInformation ugi = null;
-              try {
-                ugi = UserGroupInformation.createProxyUser(
-                    user, UserGroupInformation.getCurrentUser());
-              } catch (Exception e) {
-                LOGGER.error("Error in getCurrentUser", e);
-                throw new InterpreterException("Error in getCurrentUser", e);
-              }
-
-              final String poolKey = dbPrefix;
-              try {
-                connection = ugi.doAs(new 
PrivilegedExceptionAction<Connection>() {

Review comment:
       This Kerberos case looks important? Will the "doas" case continue to 
work for hive/phoenix without this?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to