prabhjyotsingh commented on a change in pull request #3965:
URL: https://github.com/apache/zeppelin/pull/3965#discussion_r518573099
##########
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:
I see, line:534, sounds like it should work. let me test this latest
patch. Will update this thread.
----------------------------------------------------------------
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]