Skip to content

Commit 2997dd9

Browse files
authored
bump npm auth0 packages (#2031)
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
1 parent 9e96d09 commit 2997dd9

File tree

6 files changed

+68
-538
lines changed

6 files changed

+68
-538
lines changed

cluster/pulumi/canton-network/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"version": "1.0.0",
44
"main": "src/index.ts",
55
"dependencies": {
6+
"@google-cloud/storage": "^6.11.0",
67
"@kubernetes/client-node": "^0.18.1",
7-
"@types/auth0": "^3.3.2",
8-
"auth0": "^3.4.0",
9-
"ip": "^1.1.9",
108
"@lfdecentralizedtrust/splice-pulumi-common": "1.0.0",
119
"@lfdecentralizedtrust/splice-pulumi-common-sv": "1.0.0",
1210
"@lfdecentralizedtrust/splice-pulumi-common-validator": "1.0.0",
13-
"@google-cloud/storage": "^6.11.0"
11+
"@types/auth0": "^3.3.2",
12+
"auth0": "^4.28.0",
13+
"ip": "^1.1.9"
1414
},
1515
"scripts": {
1616
"fix": "npm run format:fix && npm run lint:fix",

cluster/pulumi/common/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"@pulumi/pulumi": "3.173.0",
1212
"@pulumi/random": "4.18.2",
1313
"@pulumi/std": "2.2.0",
14-
"@types/auth0": "3.3.2",
15-
"auth0": "^3.4.0",
14+
"@types/auth0": "^3.3.11",
15+
"auth0": "^4.28.0",
1616
"dotenv": "^16.4.5",
1717
"dotenv-expand": "^11.0.6",
1818
"js-yaml": "^4.1.0",

cluster/pulumi/common/src/auth0.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as pulumi from '@pulumi/pulumi';
55
import { KubeConfig, CoreV1Api } from '@kubernetes/client-node';
66
import { getSecretVersionOutput } from '@pulumi/gcp/secretmanager';
77
import { Output } from '@pulumi/pulumi';
8-
import { AuthenticationClient, ManagementClient, TokenResponse } from 'auth0';
8+
import { AuthenticationClient, ManagementClient, TokenSet } from 'auth0';
99

1010
import type {
1111
Auth0Client,
@@ -66,7 +66,7 @@ export class Auth0Fetch implements Auth0Client {
6666
domain: this.cfg.auth0Domain,
6767
clientId: this.cfg.auth0MgtClientId,
6868
clientSecret: this.cfg.auth0MgtClientSecret,
69-
scope: 'read:clients read:client_keys',
69+
// scope: 'read:clients read:client_keys',
7070
retry: {
7171
enabled: true,
7272
maxRetries: 10,
@@ -77,15 +77,16 @@ export class Auth0Fetch implements Auth0Client {
7777
let page = 0;
7878
/* eslint-disable no-constant-condition */
7979
while (true) {
80-
const clients = await client.getClients({
80+
const clients = await client.clients.getAll({
8181
per_page: 50, // Even though 50 is the default, if it's not given explicitly, the page argument is ignored
8282
page: page++,
8383
});
84-
if (clients.length === 0) {
84+
85+
if (clients.data.length === 0) {
8586
return secrets;
8687
}
8788

88-
for (const client of clients) {
89+
for (const client of clients.data) {
8990
if (client.client_id && client.client_secret) {
9091
secrets.set(client.client_id, client as Auth0ClientSecret);
9192
}
@@ -211,11 +212,11 @@ export class Auth0Fetch implements Auth0Client {
211212
clientSecret: clientSecret,
212213
});
213214

214-
const tokenResponse = await auth0.clientCredentialsGrant({
215+
const tokenResponse = await auth0.oauth.clientCredentialsGrant({
215216
audience: aud,
216217
});
217218

218-
const { expires_in } = tokenResponse;
219+
const { expires_in } = tokenResponse.data;
219220

220221
if (expires_in < REQUIRED_TOKEN_LIFETIME) {
221222
/* If you see this error, you either need to decrease the required token
@@ -230,12 +231,12 @@ export class Auth0Fetch implements Auth0Client {
230231

231232
const expiry = addTimeSeconds(now, expires_in);
232233

233-
await this.cacheNewToken(clientId, expiry, tokenResponse);
234+
await this.cacheNewToken(clientId, expiry, tokenResponse.data);
234235

235-
return tokenResponse.access_token;
236+
return tokenResponse.data.access_token;
236237
}
237238

238-
private async cacheNewToken(clientId: string, expiry: Date, tokenResponse: TokenResponse) {
239+
private async cacheNewToken(clientId: string, expiry: Date, tokenResponse: TokenSet) {
239240
await pulumi.log.debug(
240241
'Caching access token for Auth0 client: ' + clientId + ' expiry: ' + expiry.toJSON()
241242
);

cluster/pulumi/gcp/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"main": "src/index.ts",
55
"dependencies": {
66
"@kubernetes/client-node": "^0.18.1",
7-
"@types/auth0": "^3.3.2",
8-
"auth0": "^3.4.0",
9-
"@lfdecentralizedtrust/splice-pulumi-common": "1.0.0"
7+
"@lfdecentralizedtrust/splice-pulumi-common": "1.0.0",
8+
"@types/auth0": "^3.3.11",
9+
"auth0": "^4.28.0"
1010
},
1111
"scripts": {
1212
"fix": "npm run format:fix && npm run lint:fix",

0 commit comments

Comments
 (0)