Skip to content

Commit 1cfce79

Browse files
committed
feat: support client kerberos options for flink sql
1 parent 4afb714 commit 1cfce79

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/catalog/FlinkTableFactory.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,22 @@ private static Configuration toFlussClientConfig(
243243
}
244244
});
245245

246+
// generate JAAS config if keytab and principal are present in flink table options
247+
String keytab = tableOptions.get(FlinkConnectorOptions.CLIENT_KERBEROS_KEYTAB.key());
248+
String principal = tableOptions.get(FlinkConnectorOptions.CLIENT_KERBEROS_PRINCIPAL.key());
249+
250+
if (keytab != null
251+
&& principal != null
252+
&& !flussConfig.containsKey(ConfigOptions.CLIENT_SASL_JAAS_CONFIG.key())) {
253+
String jaasConfig =
254+
String.format(
255+
"com.sun.security.auth.module.Krb5LoginModule required "
256+
+ "useKeyTab=true storeKey=true useTicketCache=false "
257+
+ "keyTab=\"%s\" principal=\"%s\";",
258+
keytab, principal);
259+
flussConfig.setString(ConfigOptions.CLIENT_SASL_JAAS_CONFIG.key(), jaasConfig);
260+
}
261+
246262
// Todo support LookupOptions.MAX_RETRIES. Currently, Fluss doesn't support connector level
247263
// retry. The option 'client.lookup.max-retries' is only for dealing with the
248264
// RetriableException return by server not all exceptions. Trace by:

0 commit comments

Comments
 (0)