trino: add oidc auth for coordinator#33
Open
mehdibn wants to merge 2 commits into
Open
Conversation
a7f4b06 to
567c5b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TrinoDB Access via OIDC
Instructions on how to authenticate and interact with the TrinoDB service using the Command Line Interface (CLI) and the HTTP API.
Authentication with Authorization Flow for Human User
Trino is configured with OAuth2 authentication. Before performing any operations, you must obtain a valid access token.
Retrieving the Access Token
Log in to the Trino web interface.
Retrieve the token from your browser cookies:
__Secure-Trino-Oauth2-Token.Export the token as an environment variable for use in commands:
Connection Methods
1. Trino CLI
You can use the native
trinoCLI to run interactive queries. The following command connects to the Trino server securely using the exported token.Command:
trino \ --server=https://localhost:8443 \ --user=usera \ --access-token=$TOKEN \ --insecureParameters:
--server: The URL of the Trino coordinator. Uselocalhostif properly forwarded or running locally.--user: The username to identify as (e.g.,usera).--access-token: The OAuth2 bearer token.--insecure: Skips SSL certificate validation (useful for self-signed certificates in sandbox environments).2. HTTP API (cURL)
You can interact with Trino programmatically using
cURL. This is useful for testing connectivity or automating queries.Example: Show Catalogs
Header Details:
X-Trino-User: Specifies the effective user for the transaction.Authorization: Passes the Bearer token for authentication.Authentication with Client Credentials Flow for Service Account
Keycloak Side Configuration
You must create a specific "Client" for your application or automated script.
trino-m2m-app(for example).confidential.ON(This is the crucial option for M2M).OFF(No need for browser redirection).preferred_usernameorsubfield in the token, as Trino uses it to identify the user executing the query.Verification Example
To test the applicative user (M2M), follow these steps:
Obtain the Access Token:
Export the Token:
Test with cURL:
Test with Trino CLI: