Skip to content

Commit c8ff637

Browse files
committed
Update privilege worker docs with EA features
1 parent 7558682 commit c8ff637

2 files changed

Lines changed: 71 additions & 25 deletions

File tree

35.1 KB
Loading

main/docs/secure/call-apis-on-users-behalf/token-vault/privileged-worker-token-exchange-with-token-vault.mdx

Lines changed: 71 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,18 @@ Before configuring Privileged Worker Token Exchange for your client application:
2828

2929
## Configure client application
3030

31-
To configure the client applications privileged access to Token Vault, you need to provide a public key that will be used to verify a signed JWT as the subject token.
31+
To configure the client application's privileged access to Token Vault, you need to provide a public key that will be used to verify a signed JWT as the subject token.
3232

33+
<Tabs><Tab title="Auth0 Dashboard">
34+
35+
1. Navigate to **Applications > Applications** and select your application.
36+
2. Select the **Settings** tab, scroll to the **Privileged Worker** section, and toggle **Enable Privileged Worker** on. In the modal that appears, select an existing public key credential or upload a new one, then select **Save**.
37+
3. Once the credential is saved, enter at least one IP address or CIDR range in the **IP Allowlist** field that now appears.
38+
4. Select **Save Changes**.
39+
40+
<Frame>![Token Vault settings showing Enable Token Vault toggle and Credential selector](/docs/images/token-vault/token_vault_privileged_access_settings.png)</Frame>
41+
42+
</Tab><Tab title="Management API">
3343
Similar to [configuring JAR](/docs/get-started/applications/configure-jar#configure-jwt-secured-authorization-requests-jar), you can set the Token Vault privileged access public key when creating a new client:
3444

3545
```bash lines
@@ -69,16 +79,61 @@ Content-Type: application/json
6979
}
7080
```
7181

82+
The credential `id` is returned in the response when you created your client. If you need to look it up, retrieve it with a GET request:
83+
84+
```bash lines
85+
GET https://{yourDomain}.auth0.com/api/v2/clients/{yourClientId}
86+
Authorization: Bearer <YOUR_MANAGEMENT_API_ACCESS_TOKEN>
87+
```
88+
89+
The `token_vault_privileged_access.credentials[].id` field in the response contains the credential ID.
90+
91+
### Configure IP allowlist
92+
93+
To restrict which IP addresses may make Privileged Worker exchange requests, configure an `ip_allowlist` on your client. This binds the client credential to known server egress IPs, so a leaked credential cannot be used from an arbitrary IP address. Both IPv4 and IPv6 addresses and CIDR ranges are supported, with a maximum of 10 entries.
94+
95+
```bash lines
96+
PATCH https://{yourDomain}.auth0.com/api/v2/clients/{yourClientId}
97+
Authorization: Bearer <YOUR_MANAGEMENT_API_ACCESS_TOKEN>
98+
Content-Type: application/json
99+
{
100+
"token_vault_privileged_access": {
101+
"credentials": [{"id": "<YOUR_CREDENTIAL_ID>"}],
102+
"ip_allowlist": ["<YOUR_SERVER_IP_ADDRESS>"]
103+
}
104+
}
105+
```
106+
107+
</Tab></Tabs>
108+
109+
<Callout type="info">
110+
Configuring an `ip_allowlist` is required as part of the client configuration. Any Privileged Worker token exchange request from an IP not in the list will be rejected.
111+
</Callout>
112+
72113
## Create signed JWT subject token
73114

74115
After [configuring your client application with the public key](#configure-client-application), you need to create the subject token that will be exchanged for an access token for an external API. The subject token is a JSON Web Token (JWT) with the necessary claims. It is signed with the private key.
75116

76-
The JWT has a standard format and claims, where:
77-
- Header’s `typ` is `token-vault-req+jwt`
78-
- Header’s `kid` is optional if you have only one public key configured
79-
- Payload’s `sub` is the user ID for whom you want to get the token for
80-
- Payload’s `aud` is your tenant host
81-
- Payload’s `iss` is your client ID making the request
117+
The JWT has a standard format and claims:
118+
119+
**Header**
120+
121+
| Claim | Description |
122+
|-------|-------------|
123+
| `typ` | Required. Must be `token-vault-req+jwt`. |
124+
| `kid` | Optional. Only needed if you have multiple public keys configured. |
125+
126+
**Payload**
127+
128+
| Claim | Description |
129+
|-------|-------------|
130+
| `sub` | Required. The user ID for whom you want to get the token. |
131+
| `aud` | Required. Your tenant host. |
132+
| `iss` | Required. Your client ID making the request. |
133+
| `iat` | Optional. Issued-at timestamp. |
134+
| `exp` | Optional. Expiration timestamp. Tokens older than 60 seconds are rejected regardless. |
135+
| `jti` | Required. A unique identifier for this JWT (UUID v4 recommended) for replay protection. |
136+
| `audit_context` | Required. A human-readable string (1–256 characters) describing the business reason for this privileged access. |
82137

83138
The following is an example JWT:
84139

@@ -94,10 +149,16 @@ The following is an example JWT:
94149
iss: "<YOUR_CLIENT_ID>",
95150
iat: 1758799540,
96151
exp: 1758800540,
97-
nbf: 1758799540
152+
nbf: 1758799540,
153+
jti: "<UNIQUE_JWT_ID>",
154+
audit_context: "<REASON_FOR_ACCESS>"
98155
}
99156
```
100157

158+
<Callout type="warning">
159+
Do not include personally identifiable information (PII) in `audit_context`. This value is recorded in tenant logs and may be visible to administrators and log streaming destinations.
160+
</Callout>
161+
101162
The following code sample is a script that generates a signed JWT subject token:
102163

103164
```tsx lines
@@ -108,6 +169,8 @@ import * as jwt from 'jsonwebtoken';
108169
iss: CLIENT_ID,
109170
aud: 'https://' + TENANT_DOMAIN + '/',
110171
sub: USER_ID,
172+
jti: uuidv4(),
173+
audit_context: 'Automated nightly sync for compliance report',
111174
},
112175
privateKey,
113176
{
@@ -147,23 +210,6 @@ curl --request POST 'https://{yourDomain}/oauth/token' \
147210
| `requested_token_type` | The requested token type. For Privileged Worker Token Exchange, you can request an access or refresh token. |
148211
| `connection` | The connection name, in this case, `google-oauth2`. |
149212

150-
You should receive the access token stored in the Token Vault. You can similarly request the refresh token for the external API:
151-
152-
```bash lines
153-
curl --request POST 'https://{yourDomain}/oauth/token' \
154-
--header 'Content-Type: application/json' \
155-
--data '{
156-
"client_id": "<YOUR_CLIENT_ID>",
157-
"client_secret": "<YOUR_CLIENT_SECRET>",
158-
"subject_token": "<YOUR_SIGNED_JWT_BEARER>",
159-
"grant_type": "urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",
160-
"subject_token_type": "urn:ietf:params:oauth:token-type:jwt",
161-
"requested_token_type": "http://auth0.com/oauth/token-type/token-vault-refresh-token",
162-
"connection": "google-oauth2"
163-
}'
164-
```
165-
166-
167213

168214

169215

0 commit comments

Comments
 (0)