Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class JdbcConnectionParams {
public static final String AUTH_KERBEROS_AUTH_TYPE_FROM_KEYTAB = "fromKeytab";
public static final String AUTH_KERBEROS_AUTH_TYPE_FROM_SUBJECT = "fromSubject";
public static final String AUTH_KERBEROS_AUTH_TYPE_FROM_TICKET_CACHE = "fromTicketCache";
public static final String AUTH_KERBEROS_ENABLE_CANONICAL_HOSTNAME_CHECK =
"kerberosEnableCanonicalHostnameCheck";
public static final String AUTH_TYPE_JWT = "jwt";
public static final String AUTH_TYPE_JWT_KEY = "jwt";
public static final String AUTH_JWT_ENV = "JWT";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ public KyuubiConnection(String uri, Properties info) throws SQLException {
// hive_conf_list -> hiveConfMap
// hive_var_list -> hiveVarMap
if (isKerberosAuthMode()) {
host = Utils.getCanonicalHostName(connParams.getHost());
if (isEnableCanonicalHostnameCheck()) {
host = Utils.getCanonicalHostName(connParams.getHost());
} else {
host = connParams.getHost();
}
} else {
host = connParams.getHost();
}
Expand Down Expand Up @@ -213,7 +217,7 @@ public KyuubiConnection(String uri, Properties info) throws SQLException {
}
// Update with new values
jdbcUriString = connParams.getJdbcUriString();
if (isKerberosAuthMode()) {
if (isKerberosAuthMode() && isEnableCanonicalHostnameCheck()) {
host = Utils.getCanonicalHostName(connParams.getHost());
} else {
host = connParams.getHost();
Expand Down Expand Up @@ -1003,6 +1007,12 @@ private boolean isKerberosAuthMode() {
return isSaslAuthMode() && hasSessionValue(AUTH_PRINCIPAL);
}

private boolean isEnableCanonicalHostnameCheck() {
return Boolean.parseBoolean(
sessConfMap.getOrDefault(
JdbcConnectionParams.AUTH_KERBEROS_ENABLE_CANONICAL_HOSTNAME_CHECK, "true"));
}

private Subject createSubject() {
if (isKeytabAuthMode()) {
String principal = sessConfMap.get(AUTH_KYUUBI_CLIENT_PRINCIPAL);
Expand Down
Loading