auth0 6.3.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -15
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/lib/errors.d.ts +0 -18
- package/dist/cjs/lib/errors.js +1 -25
- package/dist/cjs/lib/middleware/auth0-client-telemetry.d.ts +3 -7
- package/dist/cjs/lib/middleware/auth0-client-telemetry.js +1 -25
- package/dist/cjs/lib/models.d.ts +0 -24
- package/dist/cjs/lib/models.js +0 -53
- package/dist/cjs/management/Client.d.ts +3 -0
- package/dist/cjs/management/Client.js +45 -40
- package/dist/cjs/management/api/errors/UnprocessableEntityError.d.ts +5 -0
- package/dist/cjs/management/api/errors/UnprocessableEntityError.js +54 -0
- package/dist/cjs/management/api/errors/index.d.ts +1 -0
- package/dist/cjs/management/api/errors/index.js +1 -0
- package/dist/cjs/management/api/requests/requests.d.ts +91 -0
- package/dist/cjs/management/api/resources/connections/client/Client.d.ts +2 -0
- package/dist/cjs/management/api/resources/connections/client/Client.js +6 -0
- package/dist/cjs/management/api/resources/connections/resources/scimConfiguration/client/Client.d.ts +1 -0
- package/dist/cjs/management/api/resources/connections/resources/scimConfiguration/client/Client.js +3 -0
- package/dist/cjs/management/api/resources/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/index.js +2 -1
- package/dist/cjs/management/api/resources/keys/resources/networkAcls/client/Client.d.ts +17 -0
- package/dist/cjs/management/api/resources/keys/resources/networkAcls/client/Client.js +60 -0
- package/dist/cjs/management/api/resources/organizationTemplates/client/Client.d.ts +106 -0
- package/dist/cjs/management/api/resources/organizationTemplates/client/Client.js +411 -0
- package/dist/cjs/management/api/resources/organizationTemplates/client/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/organizationTemplates/client/index.js +2 -0
- package/dist/cjs/management/api/resources/organizationTemplates/exports.d.ts +2 -0
- package/dist/cjs/management/api/resources/organizationTemplates/exports.js +21 -0
- package/dist/cjs/management/api/resources/organizationTemplates/index.d.ts +1 -0
- package/dist/cjs/{lib → management/api/resources/organizationTemplates}/index.js +1 -2
- package/dist/cjs/management/api/resources/organizations/client/Client.d.ts +3 -0
- package/dist/cjs/management/api/resources/organizations/client/Client.js +7 -2
- package/dist/cjs/management/api/resources/organizations/resources/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/organizations/resources/index.js +2 -1
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/client/Client.d.ts +63 -0
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/client/Client.js +232 -0
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/client/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/client/index.js +2 -0
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/exports.d.ts +2 -0
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/exports.js +21 -0
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/index.js +17 -0
- package/dist/cjs/management/api/resources/users/resources/organizations/client/Client.d.ts +17 -0
- package/dist/cjs/management/api/resources/users/resources/organizations/client/Client.js +19 -0
- package/dist/cjs/management/api/types/types.d.ts +8896 -2027
- package/dist/cjs/management/api/types/types.js +1455 -166
- package/dist/cjs/management/version.d.ts +1 -1
- package/dist/cjs/management/version.js +1 -1
- package/dist/cjs/management/wrapper/ManagementClient.d.ts +9 -2
- package/dist/cjs/management/wrapper/ManagementClient.js +0 -1
- package/dist/cjs/management/wrapper/token-provider.d.ts +4 -2
- package/dist/cjs/management/wrapper/token-provider.js +142 -11
- package/dist/cjs/utils.d.ts +0 -18
- package/dist/cjs/utils.js +1 -32
- package/dist/esm/index.d.mts +0 -2
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/lib/errors.d.mts +0 -18
- package/dist/esm/lib/errors.mjs +0 -22
- package/dist/esm/lib/middleware/auth0-client-telemetry.d.mts +3 -7
- package/dist/esm/lib/middleware/auth0-client-telemetry.mjs +1 -25
- package/dist/esm/lib/models.d.mts +0 -24
- package/dist/esm/lib/models.mjs +1 -49
- package/dist/esm/management/Client.d.mts +3 -0
- package/dist/esm/management/Client.mjs +5 -0
- package/dist/esm/management/api/errors/UnprocessableEntityError.d.mts +5 -0
- package/dist/esm/management/api/errors/UnprocessableEntityError.mjs +17 -0
- package/dist/esm/management/api/errors/index.d.mts +1 -0
- package/dist/esm/management/api/errors/index.mjs +1 -0
- package/dist/esm/management/api/requests/requests.d.mts +91 -0
- package/dist/esm/management/api/resources/connections/client/Client.d.mts +2 -0
- package/dist/esm/management/api/resources/connections/client/Client.mjs +6 -0
- package/dist/esm/management/api/resources/connections/resources/scimConfiguration/client/Client.d.mts +1 -0
- package/dist/esm/management/api/resources/connections/resources/scimConfiguration/client/Client.mjs +3 -0
- package/dist/esm/management/api/resources/index.d.mts +1 -0
- package/dist/esm/management/api/resources/index.mjs +1 -0
- package/dist/esm/management/api/resources/keys/resources/networkAcls/client/Client.d.mts +17 -0
- package/dist/esm/management/api/resources/keys/resources/networkAcls/client/Client.mjs +60 -0
- package/dist/esm/management/api/resources/organizationTemplates/client/Client.d.mts +106 -0
- package/dist/esm/management/api/resources/organizationTemplates/client/Client.mjs +374 -0
- package/dist/esm/management/api/resources/organizationTemplates/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/organizationTemplates/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/organizationTemplates/exports.d.mts +2 -0
- package/dist/esm/management/api/resources/organizationTemplates/exports.mjs +3 -0
- package/dist/esm/management/api/resources/organizationTemplates/index.d.mts +1 -0
- package/dist/esm/management/api/resources/organizationTemplates/index.mjs +1 -0
- package/dist/esm/management/api/resources/organizations/client/Client.d.mts +3 -0
- package/dist/esm/management/api/resources/organizations/client/Client.mjs +5 -0
- package/dist/esm/management/api/resources/organizations/resources/index.d.mts +1 -0
- package/dist/esm/management/api/resources/organizations/resources/index.mjs +1 -0
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/Client.d.mts +63 -0
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/Client.mjs +195 -0
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/exports.d.mts +2 -0
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/exports.mjs +3 -0
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/index.d.mts +1 -0
- package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/index.mjs +1 -0
- package/dist/esm/management/api/resources/users/resources/organizations/client/Client.d.mts +17 -0
- package/dist/esm/management/api/resources/users/resources/organizations/client/Client.mjs +19 -0
- package/dist/esm/management/api/types/types.d.mts +8896 -2027
- package/dist/esm/management/api/types/types.mjs +1434 -150
- package/dist/esm/management/version.d.mts +1 -1
- package/dist/esm/management/version.mjs +1 -1
- package/dist/esm/management/wrapper/ManagementClient.d.mts +9 -2
- package/dist/esm/management/wrapper/ManagementClient.mjs +0 -1
- package/dist/esm/management/wrapper/token-provider.d.mts +4 -2
- package/dist/esm/management/wrapper/token-provider.mjs +142 -11
- package/dist/esm/utils.d.mts +0 -18
- package/dist/esm/utils.mjs +0 -30
- package/package.json +23 -2
- package/reference.md +688 -28
- package/dist/cjs/auth/backchannel.d.ts +0 -158
- package/dist/cjs/auth/backchannel.js +0 -135
- package/dist/cjs/auth/base-auth-api.d.ts +0 -41
- package/dist/cjs/auth/base-auth-api.js +0 -109
- package/dist/cjs/auth/client-authentication.d.ts +0 -27
- package/dist/cjs/auth/client-authentication.js +0 -82
- package/dist/cjs/auth/database.d.ts +0 -157
- package/dist/cjs/auth/database.js +0 -94
- package/dist/cjs/auth/id-token-validator.d.ts +0 -18
- package/dist/cjs/auth/id-token-validator.js +0 -158
- package/dist/cjs/auth/index.d.ts +0 -65
- package/dist/cjs/auth/index.js +0 -80
- package/dist/cjs/auth/oauth.d.ts +0 -462
- package/dist/cjs/auth/oauth.js +0 -280
- package/dist/cjs/auth/passwordless.d.ts +0 -165
- package/dist/cjs/auth/passwordless.js +0 -173
- package/dist/cjs/auth/tokenExchange.d.ts +0 -166
- package/dist/cjs/auth/tokenExchange.js +0 -74
- package/dist/cjs/lib/index.d.ts +0 -3
- package/dist/cjs/lib/runtime.d.ts +0 -61
- package/dist/cjs/lib/runtime.js +0 -222
- package/dist/cjs/userinfo/index.d.ts +0 -87
- package/dist/cjs/userinfo/index.js +0 -104
- package/dist/esm/auth/backchannel.d.mts +0 -158
- package/dist/esm/auth/backchannel.mjs +0 -131
- package/dist/esm/auth/base-auth-api.d.mts +0 -41
- package/dist/esm/auth/base-auth-api.mjs +0 -103
- package/dist/esm/auth/client-authentication.d.mts +0 -27
- package/dist/esm/auth/client-authentication.mjs +0 -45
- package/dist/esm/auth/database.d.mts +0 -157
- package/dist/esm/auth/database.mjs +0 -90
- package/dist/esm/auth/id-token-validator.d.mts +0 -18
- package/dist/esm/auth/id-token-validator.mjs +0 -120
- package/dist/esm/auth/index.d.mts +0 -65
- package/dist/esm/auth/index.mjs +0 -60
- package/dist/esm/auth/oauth.d.mts +0 -462
- package/dist/esm/auth/oauth.mjs +0 -276
- package/dist/esm/auth/passwordless.d.mts +0 -165
- package/dist/esm/auth/passwordless.mjs +0 -169
- package/dist/esm/auth/tokenExchange.d.mts +0 -166
- package/dist/esm/auth/tokenExchange.mjs +0 -70
- package/dist/esm/lib/index.d.mts +0 -3
- package/dist/esm/lib/index.mjs +0 -2
- package/dist/esm/lib/runtime.d.mts +0 -61
- package/dist/esm/lib/runtime.mjs +0 -201
- package/dist/esm/userinfo/index.d.mts +0 -87
- package/dist/esm/userinfo/index.mjs +0 -98
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "7.0.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "
|
|
1
|
+
export const SDK_VERSION = "7.0.0";
|
|
@@ -15,7 +15,7 @@ export declare namespace ManagementClient {
|
|
|
15
15
|
* @group Management API
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
|
-
interface ManagementClientOptions extends Omit<FernClient.Options, "token" | "environment" | "fetcher" | "baseUrl"
|
|
18
|
+
interface ManagementClientOptions extends Omit<FernClient.Options, "token" | "environment" | "fetcher" | "baseUrl"> {
|
|
19
19
|
/** Auth0 domain (e.g., 'your-tenant.auth0.com') */
|
|
20
20
|
domain: string;
|
|
21
21
|
/**
|
|
@@ -114,7 +114,14 @@ export declare namespace ManagementClient {
|
|
|
114
114
|
clientAssertionSigningKey: string;
|
|
115
115
|
/** Algorithm for signing the client assertion. Defaults to RS256 */
|
|
116
116
|
clientAssertionSigningAlg?: string;
|
|
117
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Enable mTLS for token endpoint calls.
|
|
119
|
+
*
|
|
120
|
+
* mTLS (RFC 8705) is a transport-layer concern that is independent of the client
|
|
121
|
+
* authentication method: a client authenticating with `private_key_jwt` can still present a
|
|
122
|
+
* TLS client certificate to obtain a certificate-bound access token. This mirrors v6, which
|
|
123
|
+
* added the `mtls.` endpoint alias from `useMTLS` alone regardless of the auth method.
|
|
124
|
+
*/
|
|
118
125
|
useMTLS?: boolean;
|
|
119
126
|
}
|
|
120
127
|
/**
|
|
@@ -71,7 +71,6 @@ export class ManagementClient extends FernClient {
|
|
|
71
71
|
const token = createTokenSupplier(_options);
|
|
72
72
|
// Temporarily remove fetcher from options to avoid people passing it for now
|
|
73
73
|
delete _options.fetcher;
|
|
74
|
-
delete _options.fetch;
|
|
75
74
|
// Prepare the base client options
|
|
76
75
|
let clientOptions = Object.assign(Object.assign({}, _options), { baseUrl,
|
|
77
76
|
headers,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ManagementClient } from "./ManagementClient.mjs";
|
|
1
|
+
import type { ManagementClient } from "./ManagementClient.mjs";
|
|
2
2
|
export declare class TokenProvider {
|
|
3
3
|
private readonly options;
|
|
4
|
-
private authenticationClient;
|
|
5
4
|
private expiresAt;
|
|
6
5
|
private accessToken;
|
|
7
6
|
private pending;
|
|
@@ -12,4 +11,7 @@ export declare class TokenProvider {
|
|
|
12
11
|
audience: string;
|
|
13
12
|
});
|
|
14
13
|
getAccessToken(): Promise<string>;
|
|
14
|
+
private fetchToken;
|
|
15
|
+
private buildClientAssertion;
|
|
16
|
+
private buildTelemetryHeader;
|
|
15
17
|
}
|
|
@@ -7,30 +7,161 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import { base64url, importPKCS8, SignJWT } from "jose";
|
|
11
|
+
import { generateClientInfo } from "../../utils.mjs";
|
|
12
|
+
import { ManagementError } from "../errors/ManagementError.mjs";
|
|
13
|
+
const LEEWAY = 10 * 1000; // 10s refresh-ahead in ms
|
|
12
14
|
export class TokenProvider {
|
|
13
15
|
constructor(options) {
|
|
14
16
|
this.options = options;
|
|
15
17
|
this.expiresAt = 0;
|
|
16
18
|
this.accessToken = "";
|
|
17
|
-
|
|
19
|
+
// Validate domain: must be a bare hostname, no slashes or query strings.
|
|
20
|
+
if (/[/?#]/.test(options.domain)) {
|
|
21
|
+
throw new Error(`ManagementClient: invalid domain "${options.domain}". Provide a bare hostname, e.g. "tenant.auth0.com".`);
|
|
22
|
+
}
|
|
23
|
+
if (options.useMTLS) {
|
|
24
|
+
const { fetch: customFetch } = options;
|
|
25
|
+
if (!customFetch) {
|
|
26
|
+
throw new Error("ManagementClient: useMTLS requires a custom fetch implementation. " +
|
|
27
|
+
"Provide a `fetch` option configured with your mTLS client certificate.");
|
|
28
|
+
}
|
|
29
|
+
// mTLS (RFC 8705) is a transport-layer concern independent of the client authentication
|
|
30
|
+
// method. It combines with both `clientSecret` and `clientAssertionSigningKey`: the TLS
|
|
31
|
+
// client certificate yields a certificate-bound token regardless of how the client
|
|
32
|
+
// authenticates. v6 supported this, so no auth-method restriction is imposed here.
|
|
33
|
+
}
|
|
18
34
|
}
|
|
19
35
|
getAccessToken() {
|
|
20
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
37
|
if (!this.accessToken || Date.now() > this.expiresAt - LEEWAY) {
|
|
22
|
-
this.pending =
|
|
23
|
-
|
|
24
|
-
this.authenticationClient.oauth.clientCredentialsGrant({
|
|
25
|
-
audience: this.options.audience,
|
|
26
|
-
});
|
|
27
|
-
const { data: { access_token: accessToken, expires_in: expiresIn }, } = yield this.pending.finally(() => {
|
|
38
|
+
this.pending = this.pending || this.fetchToken();
|
|
39
|
+
const result = yield this.pending.finally(() => {
|
|
28
40
|
delete this.pending;
|
|
29
41
|
});
|
|
30
|
-
this.expiresAt =
|
|
31
|
-
this.accessToken = accessToken;
|
|
42
|
+
this.expiresAt = result.expiresAt;
|
|
43
|
+
this.accessToken = result.accessToken;
|
|
32
44
|
}
|
|
33
45
|
return this.accessToken;
|
|
34
46
|
});
|
|
35
47
|
}
|
|
48
|
+
fetchToken() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const { domain, clientId, audience } = this.options;
|
|
52
|
+
const tokenUrl = this.options.useMTLS ? `https://mtls.${domain}/oauth/token` : `https://${domain}/oauth/token`;
|
|
53
|
+
const body = new URLSearchParams({
|
|
54
|
+
grant_type: "client_credentials",
|
|
55
|
+
client_id: clientId,
|
|
56
|
+
audience,
|
|
57
|
+
});
|
|
58
|
+
if ("clientSecret" in this.options) {
|
|
59
|
+
body.set("client_secret", this.options.clientSecret);
|
|
60
|
+
}
|
|
61
|
+
else if ("clientAssertionSigningKey" in this.options) {
|
|
62
|
+
const assertion = yield this.buildClientAssertion(domain, clientId);
|
|
63
|
+
body.set("client_assertion", assertion);
|
|
64
|
+
body.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer");
|
|
65
|
+
}
|
|
66
|
+
// Build request headers. Start with user-supplied plain-string headers so they can be
|
|
67
|
+
// overridden by SDK-controlled values (Content-Type, Auth0-Client) set below.
|
|
68
|
+
// Supplier-function headers (Fern's Supplier<string | null | undefined> type) are skipped —
|
|
69
|
+
// they require async resolution and are not supported on the token endpoint path.
|
|
70
|
+
const userHeaders = (_a = this.options.headers) !== null && _a !== void 0 ? _a : {};
|
|
71
|
+
const headers = {};
|
|
72
|
+
for (const [key, value] of Object.entries(userHeaders)) {
|
|
73
|
+
if (typeof value === "string") {
|
|
74
|
+
headers[key.toLowerCase()] = value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
headers["content-type"] = "application/x-www-form-urlencoded";
|
|
78
|
+
const telemetryHeader = this.buildTelemetryHeader();
|
|
79
|
+
if (telemetryHeader) {
|
|
80
|
+
headers["auth0-client"] = telemetryHeader;
|
|
81
|
+
}
|
|
82
|
+
// Use custom fetch for mTLS, else global fetch.
|
|
83
|
+
// `fetch` is defined on BaseClientOptions (src/management/BaseClient.ts) which is Fern-generated.
|
|
84
|
+
// If that file is regenerated, verify `fetch?: typeof fetch` is still present — token acquisition
|
|
85
|
+
// for mTLS depends on it being forwarded here.
|
|
86
|
+
const { fetch: customFetch } = this.options;
|
|
87
|
+
const fetcher = customFetch !== null && customFetch !== void 0 ? customFetch : fetch;
|
|
88
|
+
let response;
|
|
89
|
+
try {
|
|
90
|
+
response = yield fetcher(tokenUrl, {
|
|
91
|
+
method: "POST",
|
|
92
|
+
headers,
|
|
93
|
+
body: body.toString(),
|
|
94
|
+
signal: AbortSignal.timeout(10000),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
// Built-in fetch aborts with a "TimeoutError"; node-fetch (used on the mTLS path with a
|
|
99
|
+
// custom fetch) aborts with an "AbortError". Match both so a token-request timeout maps
|
|
100
|
+
// to a 408 regardless of the underlying fetch implementation.
|
|
101
|
+
if (err instanceof Error && (err.name === "TimeoutError" || err.name === "AbortError")) {
|
|
102
|
+
throw new ManagementError({
|
|
103
|
+
message: "ManagementClient: token request timed out",
|
|
104
|
+
statusCode: 408,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
throw err;
|
|
108
|
+
}
|
|
109
|
+
if (!response.ok) {
|
|
110
|
+
// Read the body exactly once. `response.json()` followed by `response.text()` throws
|
|
111
|
+
// "Body has already been read", which would swallow non-JSON error payloads (e.g. proxy
|
|
112
|
+
// or WAF 502s). Read text, then attempt to parse it as JSON.
|
|
113
|
+
const raw = yield response.text().catch(() => "");
|
|
114
|
+
let errorBody;
|
|
115
|
+
try {
|
|
116
|
+
errorBody = raw ? JSON.parse(raw) : response.statusText;
|
|
117
|
+
}
|
|
118
|
+
catch (_b) {
|
|
119
|
+
errorBody = raw || response.statusText;
|
|
120
|
+
}
|
|
121
|
+
throw new ManagementError({
|
|
122
|
+
message: "ManagementClient: token request failed",
|
|
123
|
+
statusCode: response.status,
|
|
124
|
+
body: errorBody,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const json = (yield response.json());
|
|
128
|
+
return {
|
|
129
|
+
accessToken: json.access_token,
|
|
130
|
+
expiresAt: Date.now() + json.expires_in * 1000,
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
buildClientAssertion(domain, clientId) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
const { clientAssertionSigningKey, clientAssertionSigningAlg = "RS256" } = this
|
|
137
|
+
.options;
|
|
138
|
+
const key = yield importPKCS8(clientAssertionSigningKey, clientAssertionSigningAlg);
|
|
139
|
+
const now = Math.floor(Date.now() / 1000);
|
|
140
|
+
return new SignJWT({})
|
|
141
|
+
.setProtectedHeader({ alg: clientAssertionSigningAlg })
|
|
142
|
+
.setIssuedAt(now)
|
|
143
|
+
.setIssuer(clientId)
|
|
144
|
+
.setSubject(clientId)
|
|
145
|
+
.setAudience(`https://${domain}/`)
|
|
146
|
+
.setExpirationTime(now + 180) // 3 min lifetime
|
|
147
|
+
.setJti(crypto.randomUUID())
|
|
148
|
+
.sign(key);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
buildTelemetryHeader() {
|
|
152
|
+
var _a;
|
|
153
|
+
const opts = this.options;
|
|
154
|
+
if (opts.telemetry === false)
|
|
155
|
+
return null;
|
|
156
|
+
const nodeAuth0Info = generateClientInfo();
|
|
157
|
+
const info = opts.clientInfo
|
|
158
|
+
? { name: opts.clientInfo.name, version: String((_a = opts.clientInfo.version) !== null && _a !== void 0 ? _a : nodeAuth0Info.version) }
|
|
159
|
+
: { name: nodeAuth0Info.name, version: nodeAuth0Info.version };
|
|
160
|
+
// NOTE: auth0-auth-js TelemetryConfig does not support env fields.
|
|
161
|
+
// The runtime fingerprint (env.node / env.cloudflare-workers) present in the
|
|
162
|
+
// original node-auth0 Auth0-Client header is intentionally omitted here.
|
|
163
|
+
// This is a known, accepted delta vs the pre-v7 token request telemetry shape.
|
|
164
|
+
// Use jose's base64url encoder for runtime portability (Buffer is Node-only).
|
|
165
|
+
return base64url.encode(new TextEncoder().encode(JSON.stringify(info)));
|
|
166
|
+
}
|
|
36
167
|
}
|
package/dist/esm/utils.d.mts
CHANGED
|
@@ -5,21 +5,3 @@ export declare const generateClientInfo: () => {
|
|
|
5
5
|
[x: string]: string;
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
|
-
/**
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
|
-
export declare const mtlsPrefix = "mtls";
|
|
12
|
-
type SyncGetter<T> = () => T;
|
|
13
|
-
type AsyncGetter<T> = () => Promise<T>;
|
|
14
|
-
/**
|
|
15
|
-
* Resolves a value that can be a static value, a synchronous function, or an asynchronous function.
|
|
16
|
-
*
|
|
17
|
-
* @template T - The type of the value to be resolved.
|
|
18
|
-
* @param {T | SyncGetter<T> | AsyncGetter<T>} value - The value to be resolved. It can be:
|
|
19
|
-
* - A static value of type T.
|
|
20
|
-
* - A synchronous function that returns a value of type T.
|
|
21
|
-
* - An asynchronous function that returns a Promise of type T.
|
|
22
|
-
* @returns {Promise<T>} A promise that resolves to the value of type T.
|
|
23
|
-
*/
|
|
24
|
-
export declare const resolveValueToPromise: <T>(value: T | SyncGetter<T> | AsyncGetter<T>) => Promise<T>;
|
|
25
|
-
export {};
|
package/dist/esm/utils.mjs
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { SDK_VERSION as version } from "./management/version.mjs";
|
|
11
2
|
import { RUNTIME } from "./management/core/index.mjs";
|
|
12
3
|
export const generateClientInfo = () => {
|
|
@@ -22,24 +13,3 @@ export const generateClientInfo = () => {
|
|
|
22
13
|
},
|
|
23
14
|
};
|
|
24
15
|
};
|
|
25
|
-
/**
|
|
26
|
-
* @private
|
|
27
|
-
*/
|
|
28
|
-
export const mtlsPrefix = "mtls";
|
|
29
|
-
/**
|
|
30
|
-
* Resolves a value that can be a static value, a synchronous function, or an asynchronous function.
|
|
31
|
-
*
|
|
32
|
-
* @template T - The type of the value to be resolved.
|
|
33
|
-
* @param {T | SyncGetter<T> | AsyncGetter<T>} value - The value to be resolved. It can be:
|
|
34
|
-
* - A static value of type T.
|
|
35
|
-
* - A synchronous function that returns a value of type T.
|
|
36
|
-
* - An asynchronous function that returns a Promise of type T.
|
|
37
|
-
* @returns {Promise<T>} A promise that resolves to the value of type T.
|
|
38
|
-
*/
|
|
39
|
-
export const resolveValueToPromise = (value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
if (typeof value === "function") {
|
|
41
|
-
const result = value(); // Call the function
|
|
42
|
-
return result instanceof Promise ? result : Promise.resolve(result); // Handle sync/async
|
|
43
|
-
}
|
|
44
|
-
return Promise.resolve(value); // Static value
|
|
45
|
-
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -254,6 +254,17 @@
|
|
|
254
254
|
},
|
|
255
255
|
"default": "./dist/cjs/management/api/resources/networkAcls/exports.js"
|
|
256
256
|
},
|
|
257
|
+
"./organizationTemplates": {
|
|
258
|
+
"import": {
|
|
259
|
+
"types": "./dist/esm/management/api/resources/organizationTemplates/exports.d.mts",
|
|
260
|
+
"default": "./dist/esm/management/api/resources/organizationTemplates/exports.mjs"
|
|
261
|
+
},
|
|
262
|
+
"require": {
|
|
263
|
+
"types": "./dist/cjs/management/api/resources/organizationTemplates/exports.d.ts",
|
|
264
|
+
"default": "./dist/cjs/management/api/resources/organizationTemplates/exports.js"
|
|
265
|
+
},
|
|
266
|
+
"default": "./dist/cjs/management/api/resources/organizationTemplates/exports.js"
|
|
267
|
+
},
|
|
257
268
|
"./organizations": {
|
|
258
269
|
"import": {
|
|
259
270
|
"types": "./dist/esm/management/api/resources/organizations/exports.d.mts",
|
|
@@ -1156,6 +1167,17 @@
|
|
|
1156
1167
|
},
|
|
1157
1168
|
"default": "./dist/cjs/management/api/resources/organizations/resources/members/exports.js"
|
|
1158
1169
|
},
|
|
1170
|
+
"./organizations/organizationTemplate": {
|
|
1171
|
+
"import": {
|
|
1172
|
+
"types": "./dist/esm/management/api/resources/organizations/resources/organizationTemplate/exports.d.mts",
|
|
1173
|
+
"default": "./dist/esm/management/api/resources/organizations/resources/organizationTemplate/exports.mjs"
|
|
1174
|
+
},
|
|
1175
|
+
"require": {
|
|
1176
|
+
"types": "./dist/cjs/management/api/resources/organizations/resources/organizationTemplate/exports.d.ts",
|
|
1177
|
+
"default": "./dist/cjs/management/api/resources/organizations/resources/organizationTemplate/exports.js"
|
|
1178
|
+
},
|
|
1179
|
+
"default": "./dist/cjs/management/api/resources/organizations/resources/organizationTemplate/exports.js"
|
|
1180
|
+
},
|
|
1159
1181
|
"./organizations/groups": {
|
|
1160
1182
|
"import": {
|
|
1161
1183
|
"types": "./dist/esm/management/api/resources/organizations/resources/groups/exports.d.mts",
|
|
@@ -1710,7 +1732,6 @@
|
|
|
1710
1732
|
"validate": "yarn lint:check && yarn format --check && yarn build && yarn test && yarn lint:package"
|
|
1711
1733
|
},
|
|
1712
1734
|
"dependencies": {
|
|
1713
|
-
"uuid": "^11.1.1",
|
|
1714
1735
|
"jose": "^5.0.0",
|
|
1715
1736
|
"auth0-legacy": "npm:auth0@^4.37.1"
|
|
1716
1737
|
},
|