Set per-user token exchange and custom headers on a catalog
curl --request PUT \
--url https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"settings": {
"trusted_actors": [
"<string>"
],
"on_behalf_of_header": "X-Nx1-On-Behalf-Of",
"impersonation": {
"token_url": "<string>",
"name": "",
"grant_type": "",
"client_id": "",
"client_secret": "<string>",
"subject_param": "",
"subject_token_type": "",
"user_param": "",
"requested_token_type": "",
"audience": "",
"scope": "",
"resource": "",
"params": {},
"token_field": "",
"verify_tls": true
},
"steps": [
{
"token_url": "<string>",
"name": "",
"grant_type": "",
"client_id": "",
"client_secret": "<string>",
"subject_param": "",
"subject_token_type": "",
"user_param": "",
"requested_token_type": "",
"audience": "",
"scope": "",
"resource": "",
"params": {},
"token_field": "",
"verify_tls": true
}
],
"cache_skew_seconds": 60
},
"custom_headers": {}
}
'import requests
url = "https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange"
payload = {
"enabled": True,
"settings": {
"trusted_actors": ["<string>"],
"on_behalf_of_header": "X-Nx1-On-Behalf-Of",
"impersonation": {
"token_url": "<string>",
"name": "",
"grant_type": "",
"client_id": "",
"client_secret": "<string>",
"subject_param": "",
"subject_token_type": "",
"user_param": "",
"requested_token_type": "",
"audience": "",
"scope": "",
"resource": "",
"params": {},
"token_field": "",
"verify_tls": True
},
"steps": [
{
"token_url": "<string>",
"name": "",
"grant_type": "",
"client_id": "",
"client_secret": "<string>",
"subject_param": "",
"subject_token_type": "",
"user_param": "",
"requested_token_type": "",
"audience": "",
"scope": "",
"resource": "",
"params": {},
"token_field": "",
"verify_tls": True
}
],
"cache_skew_seconds": 60
},
"custom_headers": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
enabled: true,
settings: {
trusted_actors: ['<string>'],
on_behalf_of_header: 'X-Nx1-On-Behalf-Of',
impersonation: {
token_url: '<string>',
name: '',
grant_type: '',
client_id: '',
client_secret: '<string>',
subject_param: '',
subject_token_type: '',
user_param: '',
requested_token_type: '',
audience: '',
scope: '',
resource: '',
params: {},
token_field: '',
verify_tls: true
},
steps: [
{
token_url: '<string>',
name: '',
grant_type: '',
client_id: '',
client_secret: '<string>',
subject_param: '',
subject_token_type: '',
user_param: '',
requested_token_type: '',
audience: '',
scope: '',
resource: '',
params: {},
token_field: '',
verify_tls: true
}
],
cache_skew_seconds: 60
},
custom_headers: {}
})
};
fetch('https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'settings' => [
'trusted_actors' => [
'<string>'
],
'on_behalf_of_header' => 'X-Nx1-On-Behalf-Of',
'impersonation' => [
'token_url' => '<string>',
'name' => '',
'grant_type' => '',
'client_id' => '',
'client_secret' => '<string>',
'subject_param' => '',
'subject_token_type' => '',
'user_param' => '',
'requested_token_type' => '',
'audience' => '',
'scope' => '',
'resource' => '',
'params' => [
],
'token_field' => '',
'verify_tls' => true
],
'steps' => [
[
'token_url' => '<string>',
'name' => '',
'grant_type' => '',
'client_id' => '',
'client_secret' => '<string>',
'subject_param' => '',
'subject_token_type' => '',
'user_param' => '',
'requested_token_type' => '',
'audience' => '',
'scope' => '',
'resource' => '',
'params' => [
],
'token_field' => '',
'verify_tls' => true
]
],
'cache_skew_seconds' => 60
],
'custom_headers' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange"
payload := strings.NewReader("{\n \"enabled\": true,\n \"settings\": {\n \"trusted_actors\": [\n \"<string>\"\n ],\n \"on_behalf_of_header\": \"X-Nx1-On-Behalf-Of\",\n \"impersonation\": {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n },\n \"steps\": [\n {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n }\n ],\n \"cache_skew_seconds\": 60\n },\n \"custom_headers\": {}\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"settings\": {\n \"trusted_actors\": [\n \"<string>\"\n ],\n \"on_behalf_of_header\": \"X-Nx1-On-Behalf-Of\",\n \"impersonation\": {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n },\n \"steps\": [\n {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n }\n ],\n \"cache_skew_seconds\": 60\n },\n \"custom_headers\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"settings\": {\n \"trusted_actors\": [\n \"<string>\"\n ],\n \"on_behalf_of_header\": \"X-Nx1-On-Behalf-Of\",\n \"impersonation\": {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n },\n \"steps\": [\n {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n }\n ],\n \"cache_skew_seconds\": 60\n },\n \"custom_headers\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"error": "<string>",
"code": 500
}{
"error": "<string>",
"code": 500
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Catalogs
Set per-user token exchange and custom headers on a catalog
Set per-user token exchange (route the catalog through Gravitino, which runs this catalog’s own exchange chain) and its custom headers. A step’s client secret is write-only: leave it empty to keep the stored one, which is kept only while that step’s token URL and client id are unchanged. The Trino catalog is re-registered to match; Spark and Gravitino pick the change up live (Gravitino within its cache TTL, 30 s by default).
PUT
/
api
/
metastore
/
catalogs
/
{catalog_name}
/
token-exchange
Set per-user token exchange and custom headers on a catalog
curl --request PUT \
--url https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"enabled": true,
"settings": {
"trusted_actors": [
"<string>"
],
"on_behalf_of_header": "X-Nx1-On-Behalf-Of",
"impersonation": {
"token_url": "<string>",
"name": "",
"grant_type": "",
"client_id": "",
"client_secret": "<string>",
"subject_param": "",
"subject_token_type": "",
"user_param": "",
"requested_token_type": "",
"audience": "",
"scope": "",
"resource": "",
"params": {},
"token_field": "",
"verify_tls": true
},
"steps": [
{
"token_url": "<string>",
"name": "",
"grant_type": "",
"client_id": "",
"client_secret": "<string>",
"subject_param": "",
"subject_token_type": "",
"user_param": "",
"requested_token_type": "",
"audience": "",
"scope": "",
"resource": "",
"params": {},
"token_field": "",
"verify_tls": true
}
],
"cache_skew_seconds": 60
},
"custom_headers": {}
}
'import requests
url = "https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange"
payload = {
"enabled": True,
"settings": {
"trusted_actors": ["<string>"],
"on_behalf_of_header": "X-Nx1-On-Behalf-Of",
"impersonation": {
"token_url": "<string>",
"name": "",
"grant_type": "",
"client_id": "",
"client_secret": "<string>",
"subject_param": "",
"subject_token_type": "",
"user_param": "",
"requested_token_type": "",
"audience": "",
"scope": "",
"resource": "",
"params": {},
"token_field": "",
"verify_tls": True
},
"steps": [
{
"token_url": "<string>",
"name": "",
"grant_type": "",
"client_id": "",
"client_secret": "<string>",
"subject_param": "",
"subject_token_type": "",
"user_param": "",
"requested_token_type": "",
"audience": "",
"scope": "",
"resource": "",
"params": {},
"token_field": "",
"verify_tls": True
}
],
"cache_skew_seconds": 60
},
"custom_headers": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
enabled: true,
settings: {
trusted_actors: ['<string>'],
on_behalf_of_header: 'X-Nx1-On-Behalf-Of',
impersonation: {
token_url: '<string>',
name: '',
grant_type: '',
client_id: '',
client_secret: '<string>',
subject_param: '',
subject_token_type: '',
user_param: '',
requested_token_type: '',
audience: '',
scope: '',
resource: '',
params: {},
token_field: '',
verify_tls: true
},
steps: [
{
token_url: '<string>',
name: '',
grant_type: '',
client_id: '',
client_secret: '<string>',
subject_param: '',
subject_token_type: '',
user_param: '',
requested_token_type: '',
audience: '',
scope: '',
resource: '',
params: {},
token_field: '',
verify_tls: true
}
],
cache_skew_seconds: 60
},
custom_headers: {}
})
};
fetch('https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'settings' => [
'trusted_actors' => [
'<string>'
],
'on_behalf_of_header' => 'X-Nx1-On-Behalf-Of',
'impersonation' => [
'token_url' => '<string>',
'name' => '',
'grant_type' => '',
'client_id' => '',
'client_secret' => '<string>',
'subject_param' => '',
'subject_token_type' => '',
'user_param' => '',
'requested_token_type' => '',
'audience' => '',
'scope' => '',
'resource' => '',
'params' => [
],
'token_field' => '',
'verify_tls' => true
],
'steps' => [
[
'token_url' => '<string>',
'name' => '',
'grant_type' => '',
'client_id' => '',
'client_secret' => '<string>',
'subject_param' => '',
'subject_token_type' => '',
'user_param' => '',
'requested_token_type' => '',
'audience' => '',
'scope' => '',
'resource' => '',
'params' => [
],
'token_field' => '',
'verify_tls' => true
]
],
'cache_skew_seconds' => 60
],
'custom_headers' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange"
payload := strings.NewReader("{\n \"enabled\": true,\n \"settings\": {\n \"trusted_actors\": [\n \"<string>\"\n ],\n \"on_behalf_of_header\": \"X-Nx1-On-Behalf-Of\",\n \"impersonation\": {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n },\n \"steps\": [\n {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n }\n ],\n \"cache_skew_seconds\": 60\n },\n \"custom_headers\": {}\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"enabled\": true,\n \"settings\": {\n \"trusted_actors\": [\n \"<string>\"\n ],\n \"on_behalf_of_header\": \"X-Nx1-On-Behalf-Of\",\n \"impersonation\": {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n },\n \"steps\": [\n {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n }\n ],\n \"cache_skew_seconds\": 60\n },\n \"custom_headers\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/metastore/catalogs/{catalog_name}/token-exchange")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"enabled\": true,\n \"settings\": {\n \"trusted_actors\": [\n \"<string>\"\n ],\n \"on_behalf_of_header\": \"X-Nx1-On-Behalf-Of\",\n \"impersonation\": {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n },\n \"steps\": [\n {\n \"token_url\": \"<string>\",\n \"name\": \"\",\n \"grant_type\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"<string>\",\n \"subject_param\": \"\",\n \"subject_token_type\": \"\",\n \"user_param\": \"\",\n \"requested_token_type\": \"\",\n \"audience\": \"\",\n \"scope\": \"\",\n \"resource\": \"\",\n \"params\": {},\n \"token_field\": \"\",\n \"verify_tls\": true\n }\n ],\n \"cache_skew_seconds\": 60\n },\n \"custom_headers\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"error": "<string>",
"code": 500
}{
"error": "<string>",
"code": 500
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
OAuth2AuthorizationCodeBearerAPIKeyHeader
Body
application/json
Set per-user token exchange and custom headers on an existing Iceberg REST catalog.
Was this page helpful?

