Skip to main content

Trino connector authentication

The connector authenticates to the Gravitino server with the same mechanisms as the Java client, configured in the Trino catalog file under the gravitino.client. prefix. The Datastrato Enterprise server accepts Basic and OAuth, so those are the two modes covered here. Without gravitino.client.authType the connector sends no credentials, and the server rejects its calls.

Quick start​

The example connects the connector to a server that signs users in with OAuth, using a client registered at the identity provider the server trusts. The connector requests a token with the client credentials grant and sends it on every call.

  1. Confirm the server accepts OAuth, as set up in How to authenticate.

  2. Add the OAuth settings to the catalog file on the coordinator. The token request goes to serverUri joined with path.

    etc/catalog/gravitino.properties
    connector.name=gravitino
    gravitino.uri=https://{gravitino_host}
    gravitino.metalake={metalake}
    gravitino.client.authType=oauth2
    gravitino.client.oauth2.serverUri=https://{idp_host}
    gravitino.client.oauth2.path={token_path}
    gravitino.client.oauth2.credential={client_id}:{client_secret}
    gravitino.client.oauth2.scope={scope}
  3. Restart Trino and list the catalogs. The metalake's catalogs appear next to gravitino.

    List catalogs through the connector
    SHOW CATALOGS;

    When only gravitino appears, the Trino server log shows whether the token request or the call to the server failed.

Basic authentication​

Basic authentication sends a user name and password from the server's local user store. The server must have Basic authentication enabled. See How to authenticate for server-side setup.

etc/catalog/gravitino.properties
connector.name=gravitino
gravitino.metalake={metalake}
gravitino.uri=https://{gravitino_host}
gravitino.client.authType=basic
gravitino.client.basic.username={username}
gravitino.client.basic.password={password}
PropertyDescriptionDefaultRequired
gravitino.client.authTypebasic(none)Yes
gravitino.client.basic.usernameUser name in the local user store(none)Yes when authType is basic
gravitino.client.basic.passwordPassword for that user(none)Yes when authType is basic

OAuth authentication​

The connector requests an access token from the identity provider with the client credentials grant and sends it on every call. The Quick start shows a complete catalog file. The identity provider must be reachable from the coordinator and every worker.

PropertyDescriptionDefaultRequired
gravitino.client.authTypeoauth2(none)Yes
gravitino.client.oauth2.serverUriBase address of the identity provider(none)Yes when authType is oauth2
gravitino.client.oauth2.pathToken endpoint path, joined to serverUri(none)Yes when authType is oauth2
gravitino.client.oauth2.credentialClient credentials as {client_id}:{client_secret}(none)Yes when authType is oauth2
gravitino.client.oauth2.scopeScope to request with the token(none)Yes when authType is oauth2

Session credential forwarding​

Setting gravitino.client.session.forwardUser=true creates a dedicated Gravitino client per Trino session user, so each user appears in the Gravitino audit log instead of the shared connector identity. Session forwarding requires authType=oauth2.

With oauth2, the connector presents the caller's own access token to Gravitino, so the server authorizes the end user rather than a shared service identity. The Trino coordinator must place that token in the session extra-credential named by gravitino.client.session.userTokenCredentialKey, which defaults to token. Coordinators that can do this include Starburst Enterprise through http-server.authentication.type=DELEGATED-OAUTH2. Open-source Trino cannot forward the token yet.

etc/catalog/gravitino.properties
connector.name=gravitino
gravitino.metalake={metalake}
gravitino.uri=https://{gravitino_host}
gravitino.client.authType=oauth2
gravitino.client.oauth2.serverUri=https://{idp_host}
gravitino.client.oauth2.path={token_path}
gravitino.client.oauth2.credential={client_id}:{client_secret}
gravitino.client.oauth2.scope={scope}
gravitino.client.session.forwardUser=true
PropertyDescriptionDefaultRequired
gravitino.client.session.forwardUserWhen true, calls Gravitino as the Trino session user for each queryfalseNo
gravitino.client.session.userTokenCredentialKeySession extra-credential holding the caller's OAuth access tokentokenNo
gravitino.client.session.cache.maxSizeMaximum number of per-user sessions kept in the cache500No
gravitino.client.session.cache.expireAfterAccessSecondsSeconds before an idle per-user session is evicted from the cache3600No