Skip to content

Commit

Permalink
add auth user conf for trino engine
Browse files Browse the repository at this point in the history
  • Loading branch information
lsm1 committed Jan 12, 2024
1 parent bffbdbd commit 8b3c0de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/configuration/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<ul> <li>JSON: the events will be written to the location of kyuubi.engine.event.json.log.path</li> <li>JDBC: to be done</li> <li>CUSTOM: to be done.</li></ul> | seq | 1.7.0 |
| kyuubi.engine.trino.extra.classpath | &lt;undefined&gt; | 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 | &lt;undefined&gt; | The extra Java options for the Trino query engine | string | 1.6.0 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class TrinoSessionImpl(
private val username: String = sessionConf
.getOption(KyuubiReservedKeys.KYUUBI_SESSION_USER_KEY).getOrElse(currentUser)

private val trinoUser: String = sessionConf
.get(KyuubiConf.ENGINE_TRINO_CONNECTION_USER).getOrElse(username)

var trinoContext: TrinoContext = _
private var clientSession: ClientSession = _
private var catalogName: String = _
Expand Down Expand Up @@ -141,7 +144,7 @@ class TrinoSessionImpl(
require(
serverScheme.equalsIgnoreCase("https"),
"Trino engine using username/password requires HTTPS to be enabled")
builder.addInterceptor(OkHttpUtil.basicAuth(username, password))
builder.addInterceptor(OkHttpUtil.basicAuth(trinoUser, password))
}

builder.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 8b3c0de

Please sign in to comment.