Skip to content

Commit 33bfaff

Browse files
authored
Update Trino Getting-started example to use default authenticator (#877)
1 parent da26e4c commit 33bfaff

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

getting-started/trino/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ SELECT * FROM iceberg.tpch.test_polaris;
5353
```
5454

5555
## Note
56-
The Polaris catalog setup script uses the credential `principal:root;realm:default-realm`. This credential is used so users do not need to fetch credentials from Apache Polaris' console output.
56+
The Polaris in this example is started with realm `default-realm` and root credentials: `root:s3cr3t`.
5757

5858
An example catalog is created in Apache Polaris using the `curl` command. See `create-polaris-catalog.sh` for details.

getting-started/trino/create-polaris-catalog.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,23 @@
1717
# under the License.
1818
#
1919

20-
PRINCIPAL_TOKEN="principal:root;realm:default-realm"
20+
if ! output=$(curl -X POST -H "Polaris-Realm: default-realm" "http://polaris:8181/api/catalog/v1/oauth/tokens" \
21+
-d "grant_type=client_credentials" \
22+
-d "client_id=root" \
23+
-d "client_secret=s3cr3t" \
24+
-d "scope=PRINCIPAL_ROLE:ALL"); then
25+
logred "Error: Failed to retrieve bearer token"
26+
exit 1
27+
fi
28+
29+
token=$(echo "$output" | awk -F\" '{print $4}')
30+
31+
if [ "$token" == "unauthorized_client" ]; then
32+
logred "Error: Failed to retrieve bearer token"
33+
exit 1
34+
fi
35+
36+
PRINCIPAL_TOKEN=$token
2137

2238
# Use local filesystem by default
2339
curl -i -X POST -H "Authorization: Bearer $PRINCIPAL_TOKEN" -H 'Accept: application/json' -H 'Content-Type: application/json' \

getting-started/trino/docker-compose.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,8 @@ services:
3131
AZURE_TENANT_ID: $AZURE_TENANT_ID
3232
AZURE_CLIENT_ID: $AZURE_CLIENT_ID
3333
AZURE_CLIENT_SECRET: $AZURE_CLIENT_SECRET
34-
polaris.persistence.type: in-memory
35-
polaris.authentication.authenticator.type: test
36-
polaris.authentication.token-service.type: test
37-
polaris.authentication.token-broker.type: symmetric-key
38-
polaris.authentication.token-broker.symmetric-key.secret: polaris
39-
polaris.features.defaults."SUPPORTED_CATALOG_STORAGE_TYPES": '["FILE","S3","GCS","AZURE"]'
40-
polaris.realm-context.realms: default-realm,realm1
41-
quarkus.log.file.enable: false
34+
POLARIS_BOOTSTRAP_CREDENTIALS: default-realm,root,s3cr3t
35+
polaris.realm-context.realms: default-realm
4236
quarkus.otel.sdk.disabled: "true"
4337

4438
healthcheck:

getting-started/trino/trino-config/catalog/iceberg.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ connector.name=iceberg
2121
iceberg.catalog.type=rest
2222
iceberg.rest-catalog.uri=http://polaris:8181/api/catalog
2323
iceberg.rest-catalog.security=OAUTH2
24-
iceberg.rest-catalog.oauth2.token=principal:root;realm:default-realm
24+
iceberg.rest-catalog.oauth2.credential=root:s3cr3t
25+
iceberg.rest-catalog.oauth2.scope=PRINCIPAL_ROLE:ALL
2526
iceberg.rest-catalog.warehouse=polaris
2627
# Required to support local filesystem: https://trino.io/docs/current/object-storage.html#configuration
2728
fs.hadoop.enabled=true

0 commit comments

Comments
 (0)