[KYUUBI #5968] Support set authentication user for Trino engine
# 🔍 Description ## Issue References 🔗 This pull request fixes #5968 ## Describe Your Solution 🔧 Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. ## Types of changes 🔖 - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan 🧪 #### Behavior Without This Pull Request ⚰️ #### Behavior With This Pull Request 🎉 #### Related Unit Tests --- # Checklist 📝 - [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #5970 from lsm1/branch-kyuubi-5968. Closes #5968 580eb45d2 [senmiaoliu] fix style a36380cde [senmiaoliu] add auth user conf for trino engine Authored-by: senmiaoliu <senmiaoliu@trip.com> Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
parent
bd83f897bb
commit
777b784439
@ -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 | <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 |
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user