diff --git a/docs/configuration/settings.md b/docs/configuration/settings.md
index fa329e6b48e..b203b0bdacb 100644
--- a/docs/configuration/settings.md
+++ b/docs/configuration/settings.md
@@ -194,6 +194,7 @@ You can configure the Kyuubi properties in `$KYUUBI_HOME/conf/kyuubi-defaults.co
| kyuubi.engine.trino.connection.truststore.password | <undefined> | The truststore password used for connecting to trino cluster | string | 1.8.0 |
| kyuubi.engine.trino.connection.truststore.path | <undefined> | The truststore path used for connecting to trino cluster | string | 1.8.0 |
| kyuubi.engine.trino.connection.truststore.type | <undefined> | The truststore type used for connecting to trino cluster | string | 1.8.0 |
+| kyuubi.engine.trino.connection.user | <undefined> | The user used for connecting to trino cluster | string | 1.9.0 |
| kyuubi.engine.trino.event.loggers | JSON | A comma-separated list of engine history loggers, where engine/session/operation etc events go.
- JSON: the events will be written to the location of kyuubi.engine.event.json.log.path
- JDBC: to be done
- CUSTOM: to be done.
| seq | 1.7.0 |
| kyuubi.engine.trino.extra.classpath | <undefined> | The extra classpath for the Trino query engine, for configuring other libs which may need by the Trino engine | string | 1.6.0 |
| kyuubi.engine.trino.java.options | <undefined> | The extra Java options for the Trino query engine | string | 1.6.0 |
diff --git a/externals/kyuubi-trino-engine/src/main/scala/org/apache/kyuubi/engine/trino/session/TrinoSessionImpl.scala b/externals/kyuubi-trino-engine/src/main/scala/org/apache/kyuubi/engine/trino/session/TrinoSessionImpl.scala
index 21aa921b9f2..674a67d0e38 100644
--- a/externals/kyuubi-trino-engine/src/main/scala/org/apache/kyuubi/engine/trino/session/TrinoSessionImpl.scala
+++ b/externals/kyuubi-trino-engine/src/main/scala/org/apache/kyuubi/engine/trino/session/TrinoSessionImpl.scala
@@ -54,7 +54,7 @@ class TrinoSessionImpl(
override val handle: SessionHandle =
conf.get(KYUUBI_SESSION_HANDLE_KEY).map(SessionHandle.fromUUID).getOrElse(SessionHandle())
- private val username: String = sessionConf
+ private val sessionUser: String = sessionConf
.getOption(KyuubiReservedKeys.KYUUBI_SESSION_USER_KEY).getOrElse(currentUser)
var trinoContext: TrinoContext = _
@@ -95,7 +95,7 @@ class TrinoSessionImpl(
ClientSession.builder()
.server(URI.create(connectionUrl))
- .principal(Optional.of(username))
+ .principal(Optional.of(sessionUser))
.source("kyuubi")
.catalog(catalogName)
.schema(databaseName)
@@ -133,7 +133,9 @@ class TrinoSessionImpl(
require(
serverScheme.equalsIgnoreCase("https"),
"Trino engine using username/password requires HTTPS to be enabled")
- builder.addInterceptor(OkHttpUtil.basicAuth(username, password))
+ val user: String = sessionConf
+ .get(KyuubiConf.ENGINE_TRINO_CONNECTION_USER).getOrElse(sessionUser)
+ builder.addInterceptor(OkHttpUtil.basicAuth(user, password))
}
builder.build()
diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
index 9f075275472..3eedfdded91 100644
--- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
+++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala
@@ -1388,6 +1388,13 @@ object KyuubiConf {
.stringConf
.createOptional
+ val ENGINE_TRINO_CONNECTION_USER: OptionalConfigEntry[String] =
+ buildConf("kyuubi.engine.trino.connection.user")
+ .doc("The user used for connecting to trino cluster")
+ .version("1.9.0")
+ .stringConf
+ .createOptional
+
val ENGINE_TRINO_CONNECTION_PASSWORD: OptionalConfigEntry[String] =
buildConf("kyuubi.engine.trino.connection.password")
.doc("The password used for connecting to trino cluster")