Skip to content

Commit 7887607

Browse files
authored
Fix/cte fixes (#436)
* Updated rate limits * Updated code samples + other fixes
1 parent 6f93b23 commit 7887607

File tree

12 files changed

+35
-29
lines changed

12 files changed

+35
-29
lines changed

main/docs/authenticate/cte-attack-protection.mdx

Whitespace-only changes.

main/docs/authenticate/cte-examples-and-use-cases.mdx

Whitespace-only changes.

main/docs/authenticate/cte-multi-factor-authentication.mdx

Whitespace-only changes.

main/docs/authenticate/custom-token-exchange/cte-example-use-cases.mdx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ Consider the following recommendations:
370370
* Use RSA with a minimum length of 2048 bits.
371371

372372
```javascript lines expandable
373-
const { jwtVerify } = require("jose");
373+
const { jwtVerify, importJWK } = require("jose");
374374

375375
const jwksUri = "https://example.com/.well-known/jwks.json";
376376
const fetchTimeout = 5000; // 5 seconds
@@ -434,14 +434,20 @@ exports.onExecuteCustomTokenExchange = async (event, api) => {
434434
*/
435435
async function getPublicKey(kid) {
436436
const cachedKey = api.cache.get(kid);
437+
let keyData;
438+
437439
if (!cachedKey) {
438440
console.log(`Key ${kid} not found in cache`);
439-
const key = await fetchKeyFromJWKS(kid);
440-
api.cache.set(kid, JSON.stringify(key), { ttl: 600000 });
441-
return key;
441+
keyData = await fetchKeyFromJWKS(kid);
442+
// Cache the stringified version
443+
api.cache.set(kid, JSON.stringify(keyData), { ttl: 600000 });
442444
} else {
443-
return JSON.parse(cachedKey.value);
445+
// Parse the raw JWK object from cache
446+
keyData = JSON.parse(cachedKey.value);
444447
}
448+
449+
//Convert the raw JWK object to a KeyLike object
450+
return await importJWK(keyData, keyData.alg);
445451
}
446452

447453
/**

main/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy/rate-limit-configurations/enterprise-public.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,21 @@ See below for the rate limits in the Enterprise subscription type.
143143
<td><a href="/docs/authenticate/custom-token-exchange">Custom Token Exchange</a></td>
144144
<td><code>POST</code></td>
145145
<td>15</td>
146-
<td>15/minute</td>
146+
<td>15/second</td>
147147
<td>Any request</td>
148148
</tr>
149149
<tr>
150150
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Write Token Exchange Profiles</a></td>
151151
<td><code>POST</code>, <code>PATCH</code>, <code>DELETE</code></td>
152152
<td>5</td>
153-
<td>100/minute</td>
153+
<td>100/second</td>
154154
<td>Any request</td>
155155
</tr>
156156
<tr>
157157
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Read Token Exchange Profiles</a></td>
158158
<td><code>GET</code></td>
159159
<td>20</td>
160-
<td>200/minute</td>
160+
<td>200/second</td>
161161
<td>Any request</td>
162162
</tr>
163163
</tbody>

main/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy/rate-limit-configurations/self-service-public.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,21 @@ See below for the rate limit policies for the Self service subscription type.
121121
<td><a href="/docs/authenticate/custom-token-exchange">Custom Token Exchange</a></td>
122122
<td><code>POST</code></td>
123123
<td>4</td>
124-
<td>4/minute</td>
124+
<td>4/second</td>
125125
<td>Any request</td>
126126
</tr>
127127
<tr>
128128
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Write Token Exchange Profiles</a></td>
129129
<td><code>POST</code>, <code>PATCH</code>, <code>DELETE</code></td>
130130
<td>5</td>
131-
<td>25/minute</td>
131+
<td>25/second</td>
132132
<td>Any request</td>
133133
</tr>
134134
<tr>
135135
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Read Token Exchange Profiles</a></td>
136136
<td><code>GET</code></td>
137137
<td>5</td>
138-
<td>50/minute</td>
138+
<td>50/second</td>
139139
<td>Any request</td>
140140
</tr>
141141
</tbody>

main/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy/rate-limit-configurations/tier-100-rps-private-cloud.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,21 @@ Therefore, we recommend deploying one tenant per private cloud environment for r
123123
<td><a href="/docs/authenticate/custom-token-exchange">Custom Token Exchange</a></td>
124124
<td><code>POST</code></td>
125125
<td>15</td>
126-
<td>15/minute</td>
126+
<td>15/second</td>
127127
<td>Any request</td>
128128
</tr>
129129
<tr>
130130
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Write Token Exchange Profiles</a></td>
131131
<td><code>POST</code>, <code>PATCH</code>, <code>DELETE</code></td>
132132
<td>5</td>
133-
<td>100/minute</td>
133+
<td>100/second</td>
134134
<td>Any request</td>
135135
</tr>
136136
<tr>
137137
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Read Token Exchange Profiles</a></td>
138138
<td><code>GET</code></td>
139139
<td>20</td>
140-
<td>200/minute</td>
140+
<td>200/second</td>
141141
<td>Any request</td>
142142
</tr>
143143
</tbody>

main/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy/rate-limit-configurations/tier-10000-rps-private-cloud.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,21 @@ Therefore, we recommend deploying one tenant per private cloud environment for r
124124
<td><a href="/docs/authenticate/custom-token-exchange">Custom Token Exchange</a></td>
125125
<td><code>POST</code></td>
126126
<td>1500</td>
127-
<td>1500/minute</td>
127+
<td>1500/second</td>
128128
<td>Any request</td>
129129
</tr>
130130
<tr>
131131
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Write Token Exchange Profiles</a></td>
132132
<td><code>POST</code>, <code>PATCH</code>, <code>DELETE</code></td>
133133
<td>15</td>
134-
<td>300/minute</td>
134+
<td>300/second</td>
135135
<td>Any request</td>
136136
</tr>
137137
<tr>
138138
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Read Token Exchange Profiles</a></td>
139139
<td><code>GET</code></td>
140140
<td>2000</td>
141-
<td>20000/minute</td>
141+
<td>20000/second</td>
142142
<td>Any request</td>
143143
</tr>
144144
</tbody>

main/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy/rate-limit-configurations/tier-1500-rps-private-cloud.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,21 @@ Therefore, we recommend deploying one tenant per private cloud environment for r
122122
<td><a href="/docs/authenticate/custom-token-exchange">Custom Token Exchange</a></td>
123123
<td><code>POST</code></td>
124124
<td>225</td>
125-
<td>225/minute</td>
125+
<td>225/second</td>
126126
<td>Any request</td>
127127
</tr>
128128
<tr>
129129
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Write Token Exchange Profiles</a></td>
130130
<td><code>POST</code>, <code>PATCH</code>, <code>DELETE</code></td>
131131
<td>15</td>
132-
<td>300/minute</td>
132+
<td>300/second</td>
133133
<td>Any request</td>
134134
</tr>
135135
<tr>
136136
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Read Token Exchange Profiles</a></td>
137137
<td><code>GET</code></td>
138138
<td>300</td>
139-
<td>3000/minute</td>
139+
<td>3000/second</td>
140140
<td>Any request</td>
141141
</tr>
142142
</tbody>

main/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy/rate-limit-configurations/tier-3000-rps-private-cloud.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,21 @@ Therefore, we recommend deploying one tenant per private cloud environment for r
130130
<td><a href="/docs/authenticate/custom-token-exchange">Custom Token Exchange</a></td>
131131
<td><code>POST</code></td>
132132
<td>450</td>
133-
<td>450/minute</td>
133+
<td>450/second</td>
134134
<td>Any request</td>
135135
</tr>
136136
<tr>
137137
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Write Token Exchange Profiles</a></td>
138138
<td><code>POST</code>, <code>PATCH</code>, <code>DELETE</code></td>
139139
<td>15</td>
140-
<td>300/minute</td>
140+
<td>300/second</td>
141141
<td>Any request</td>
142142
</tr>
143143
<tr>
144144
<td><a href="/docs/authenticate/custom-token-exchange/configure-custom-token-exchange#create-custom-token-exchange-profile">Read Token Exchange Profiles</a></td>
145145
<td><code>GET</code></td>
146146
<td>600</td>
147-
<td>6000/minute</td>
147+
<td>6000/second</td>
148148
<td>Any request</td>
149149
</tr>
150150
</tbody>

0 commit comments

Comments
 (0)