mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
revert "zeppelin.jdbc.auth.kerberos.proxy.enable" behaviour
This commit is contained in:
parent
e2bdbb2ad9
commit
a348e969a3
2 changed files with 29 additions and 20 deletions
|
|
@ -169,6 +169,10 @@ There are more JDBC interpreter properties you can specify like below.
|
|||
<td>zeppelin.jdbc.keytab.location</td>
|
||||
<td>The path to the keytab file</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>zeppelin.jdbc.auth.kerberos.proxy.enable</td>
|
||||
<td>When auth type is Kerberos, enable/disable Kerberos proxy with the login user to get the connection. Default value is true.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>default.jceks.file</td>
|
||||
<td>jceks store path (e.g: jceks://file/tmp/zeppelin.jceks)</td>
|
||||
|
|
|
|||
|
|
@ -358,29 +358,34 @@ public class JDBCInterpreter extends Interpreter {
|
|||
JDBCSecurityImpl.createSecureConfiguration(property, authType);
|
||||
switch (authType) {
|
||||
case KERBEROS:
|
||||
if (url.trim().startsWith("jdbc:hive")) {
|
||||
if (user == null || "false".equalsIgnoreCase(
|
||||
property.getProperty("zeppelin.jdbc.auth.kerberos.proxy.enable"))) {
|
||||
connection = getConnectionFromPool(connectionUrl, user, propertyKey, 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);
|
||||
}
|
||||
if (url.trim().startsWith("jdbc:hive")) {
|
||||
connection = getConnectionFromPool(connectionUrl, user, propertyKey, 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 = propertyKey;
|
||||
try {
|
||||
connection = ugi.doAs(new PrivilegedExceptionAction<Connection>() {
|
||||
@Override
|
||||
public Connection run() throws Exception {
|
||||
return getConnectionFromPool(connectionUrl, user, poolKey, properties);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in doAs", e);
|
||||
throw new InterpreterException("Error in doAs", e);
|
||||
final String poolKey = propertyKey;
|
||||
try {
|
||||
connection = ugi.doAs(new PrivilegedExceptionAction<Connection>() {
|
||||
@Override
|
||||
public Connection run() throws Exception {
|
||||
return getConnectionFromPool(connectionUrl, user, poolKey, properties);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in doAs", e);
|
||||
throw new InterpreterException("Error in doAs", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue