@grow-codes/oidc 0.1.0 → 0.1.1
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/AGENTS.md +4 -2
- package/lib/chunk-2PTQBDJ6.cjs +890 -0
- package/lib/chunk-2PTQBDJ6.cjs.map +1 -0
- package/lib/chunk-HB2FEHOY.js +843 -0
- package/lib/chunk-HB2FEHOY.js.map +1 -0
- package/lib/index.cjs +169 -690
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +3 -3
- package/lib/index.d.ts +3 -3
- package/lib/index.js +6 -602
- package/lib/index.js.map +1 -1
- package/lib/testing/index.cjs +8 -5
- package/lib/testing/index.cjs.map +1 -1
- package/lib/testing/index.d.cts +4 -1
- package/lib/testing/index.d.ts +4 -1
- package/lib/testing/index.js +6 -3
- package/lib/testing/index.js.map +1 -1
- package/lib/{verifier-ERmLmytF.d.ts → verifier-AJ2o8XWA.d.cts} +13 -5
- package/lib/{verifier-ERmLmytF.d.cts → verifier-AJ2o8XWA.d.ts} +13 -5
- package/package.json +1 -1
- package/lib/chunk-4JJJPKI5.js +0 -233
- package/lib/chunk-4JJJPKI5.js.map +0 -1
- package/lib/chunk-WO2QXDBJ.cjs +0 -255
- package/lib/chunk-WO2QXDBJ.cjs.map +0 -1
package/lib/index.cjs
CHANGED
|
@@ -1,304 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2PTQBDJ6_cjs = require('./chunk-2PTQBDJ6.cjs');
|
|
4
4
|
var fs = require('fs');
|
|
5
5
|
var undici = require('undici');
|
|
6
|
-
var jose = require('jose');
|
|
7
6
|
var module$1 = require('module');
|
|
8
7
|
var path = require('path');
|
|
9
8
|
|
|
10
|
-
// src/core/redaction.ts
|
|
11
|
-
var REDACTED = "[REDACTED]";
|
|
12
|
-
var INSPECT = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
13
|
-
var SENSITIVE_HEADERS = /* @__PURE__ */ new Set([
|
|
14
|
-
"authorization",
|
|
15
|
-
"proxy-authorization",
|
|
16
|
-
"cookie",
|
|
17
|
-
"set-cookie"
|
|
18
|
-
]);
|
|
19
|
-
var SENSITIVE_HEADER_PARTS = [
|
|
20
|
-
"token",
|
|
21
|
-
"secret",
|
|
22
|
-
"password",
|
|
23
|
-
"api-key",
|
|
24
|
-
"apikey",
|
|
25
|
-
"key",
|
|
26
|
-
"auth",
|
|
27
|
-
"session",
|
|
28
|
-
"signature",
|
|
29
|
-
"credential"
|
|
30
|
-
];
|
|
31
|
-
var SENSITIVE_FIELD_PARTS = [
|
|
32
|
-
"password",
|
|
33
|
-
"passwd",
|
|
34
|
-
"secret",
|
|
35
|
-
"token",
|
|
36
|
-
"authorization",
|
|
37
|
-
"cookie",
|
|
38
|
-
"api_key",
|
|
39
|
-
"apikey",
|
|
40
|
-
"api-key",
|
|
41
|
-
"access_key",
|
|
42
|
-
"private_key",
|
|
43
|
-
"client_secret",
|
|
44
|
-
"credential",
|
|
45
|
-
"session",
|
|
46
|
-
"signature"
|
|
47
|
-
];
|
|
48
|
-
var MIN_SECRET_LENGTH = 4;
|
|
49
|
-
function isSensitiveHeader(name) {
|
|
50
|
-
const n = name.toLowerCase();
|
|
51
|
-
return SENSITIVE_HEADERS.has(n) || SENSITIVE_HEADER_PARTS.some((p) => n.includes(p));
|
|
52
|
-
}
|
|
53
|
-
var PATH_NAME = /path$/;
|
|
54
|
-
function isSensitiveField(name, extraKeys = []) {
|
|
55
|
-
const n = name.toLowerCase();
|
|
56
|
-
return !PATH_NAME.test(n) && SENSITIVE_FIELD_PARTS.some((p) => n.includes(p)) || extraKeys.some((k) => k !== "" && n.includes(k.toLowerCase()));
|
|
57
|
-
}
|
|
58
|
-
function headerEntries(headers) {
|
|
59
|
-
if (Symbol.iterator in headers) {
|
|
60
|
-
return Array.from(headers, ([k, v]) => [k, v]);
|
|
61
|
-
}
|
|
62
|
-
const out = [];
|
|
63
|
-
for (const [k, v] of Object.entries(headers)) {
|
|
64
|
-
if (v === void 0) continue;
|
|
65
|
-
out.push([k, typeof v === "string" ? v : v.join(", ")]);
|
|
66
|
-
}
|
|
67
|
-
return out;
|
|
68
|
-
}
|
|
69
|
-
function redactHeaders(headers) {
|
|
70
|
-
const out = {};
|
|
71
|
-
for (const [k, v] of headerEntries(headers)) {
|
|
72
|
-
out[k] = isSensitiveHeader(k) ? REDACTED : v;
|
|
73
|
-
}
|
|
74
|
-
return out;
|
|
75
|
-
}
|
|
76
|
-
function redactUrl(url) {
|
|
77
|
-
let parsed;
|
|
78
|
-
try {
|
|
79
|
-
parsed = new URL(url.toString());
|
|
80
|
-
} catch {
|
|
81
|
-
return redactQueryString(url.toString());
|
|
82
|
-
}
|
|
83
|
-
if (parsed.password !== "") parsed.password = REDACTED;
|
|
84
|
-
if (parsed.password === "" && parsed.username !== "" && parsed.username !== REDACTED) {
|
|
85
|
-
parsed.username = REDACTED;
|
|
86
|
-
}
|
|
87
|
-
const params = parsed.searchParams;
|
|
88
|
-
let changed = false;
|
|
89
|
-
const next = new URLSearchParams();
|
|
90
|
-
for (const [k, v] of params) {
|
|
91
|
-
if (isSensitiveField(k)) {
|
|
92
|
-
next.append(k, REDACTED);
|
|
93
|
-
changed = true;
|
|
94
|
-
} else {
|
|
95
|
-
next.append(k, v);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (changed) parsed.search = next.toString();
|
|
99
|
-
return parsed.toString().replaceAll(encodeURIComponent(REDACTED), REDACTED);
|
|
100
|
-
}
|
|
101
|
-
function redactQueryString(text) {
|
|
102
|
-
return text.replace(
|
|
103
|
-
/([?&])([^=&#?\s]+)=([^&#\s]*)/g,
|
|
104
|
-
(m, sep, k) => isSensitiveField(k) ? `${sep}${k}=${REDACTED}` : m
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
function redactFields(value, extraKeys = []) {
|
|
108
|
-
return redactValue(value, extraKeys, /* @__PURE__ */ new WeakMap());
|
|
109
|
-
}
|
|
110
|
-
function redactValue(value, extraKeys, seen) {
|
|
111
|
-
if (value === null || typeof value !== "object") return value;
|
|
112
|
-
if (value instanceof Date || value instanceof Uint8Array) return value;
|
|
113
|
-
const cached = seen.get(value);
|
|
114
|
-
if (cached !== void 0) return cached;
|
|
115
|
-
if (Array.isArray(value)) {
|
|
116
|
-
const arr = [];
|
|
117
|
-
seen.set(value, arr);
|
|
118
|
-
for (const item of value) arr.push(redactValue(item, extraKeys, seen));
|
|
119
|
-
return arr;
|
|
120
|
-
}
|
|
121
|
-
if (value instanceof Map) {
|
|
122
|
-
const map = /* @__PURE__ */ new Map();
|
|
123
|
-
seen.set(value, map);
|
|
124
|
-
for (const [k, v] of value) {
|
|
125
|
-
map.set(
|
|
126
|
-
k,
|
|
127
|
-
typeof k === "string" && isSensitiveField(k, extraKeys) ? REDACTED : redactValue(v, extraKeys, seen)
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
return map;
|
|
131
|
-
}
|
|
132
|
-
const out = {};
|
|
133
|
-
seen.set(value, out);
|
|
134
|
-
for (const [k, v] of Object.entries(value)) {
|
|
135
|
-
out[k] = isSensitiveField(k, extraKeys) ? REDACTED : redactValue(v, extraKeys, seen);
|
|
136
|
-
}
|
|
137
|
-
return out;
|
|
138
|
-
}
|
|
139
|
-
function redactText(text, knownSecrets = []) {
|
|
140
|
-
const values = /* @__PURE__ */ new Set();
|
|
141
|
-
for (const s of knownSecrets) {
|
|
142
|
-
const v = s instanceof Secret ? s.reveal() : s;
|
|
143
|
-
if (typeof v === "string" && v.length >= MIN_SECRET_LENGTH) values.add(v);
|
|
144
|
-
}
|
|
145
|
-
let out = text;
|
|
146
|
-
for (const v of [...values].sort((a, b) => b.length - a.length)) {
|
|
147
|
-
out = out.split(v).join(REDACTED);
|
|
148
|
-
}
|
|
149
|
-
return out;
|
|
150
|
-
}
|
|
151
|
-
var Secret = class _Secret {
|
|
152
|
-
#value;
|
|
153
|
-
constructor(value) {
|
|
154
|
-
this.#value = value;
|
|
155
|
-
}
|
|
156
|
-
/** Wraps a string (returns `undefined` for `undefined`/empty, keeps an existing Secret). */
|
|
157
|
-
static from(value) {
|
|
158
|
-
if (value === void 0 || value === null) return void 0;
|
|
159
|
-
if (value instanceof _Secret) return value;
|
|
160
|
-
return value === "" ? void 0 : new _Secret(value);
|
|
161
|
-
}
|
|
162
|
-
/** The wrapped value. */
|
|
163
|
-
reveal() {
|
|
164
|
-
return this.#value;
|
|
165
|
-
}
|
|
166
|
-
/** Constant-time-ish comparison with another value. */
|
|
167
|
-
equals(other) {
|
|
168
|
-
const a = this.#value;
|
|
169
|
-
const b = other instanceof _Secret ? other.reveal() : other;
|
|
170
|
-
if (a.length !== b.length) return false;
|
|
171
|
-
let diff = 0;
|
|
172
|
-
for (let i = 0; i < a.length; i++) diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
173
|
-
return diff === 0;
|
|
174
|
-
}
|
|
175
|
-
toString() {
|
|
176
|
-
return REDACTED;
|
|
177
|
-
}
|
|
178
|
-
toJSON() {
|
|
179
|
-
return REDACTED;
|
|
180
|
-
}
|
|
181
|
-
[INSPECT]() {
|
|
182
|
-
return REDACTED;
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
function redactError(err, knownSecrets = []) {
|
|
186
|
-
const secrets = [...knownSecrets];
|
|
187
|
-
if (err instanceof Error) {
|
|
188
|
-
const copy = new Error(redactText(redactQueryString(err.message), secrets));
|
|
189
|
-
copy.name = err.name;
|
|
190
|
-
const code = err.code;
|
|
191
|
-
if (typeof code === "string") copy.code = code;
|
|
192
|
-
if (err.cause !== void 0) copy.cause = redactError(err.cause, secrets);
|
|
193
|
-
return copy;
|
|
194
|
-
}
|
|
195
|
-
return new Error(redactText(String(err), secrets));
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// src/core/env.ts
|
|
199
|
-
var UNIT_MS = {
|
|
200
|
-
ns: 1e-6,
|
|
201
|
-
us: 1e-3,
|
|
202
|
-
\u00B5s: 1e-3,
|
|
203
|
-
ms: 1,
|
|
204
|
-
s: 1e3,
|
|
205
|
-
m: 6e4,
|
|
206
|
-
h: 36e5
|
|
207
|
-
};
|
|
208
|
-
var DURATION_UNITS = ["ns", "us", "\xB5s", "ms", "s", "m", "h"];
|
|
209
|
-
function parseDuration(raw) {
|
|
210
|
-
const text = raw.trim();
|
|
211
|
-
if (/^\d+$/.test(text)) return Number(text);
|
|
212
|
-
if (text === "") return void 0;
|
|
213
|
-
let total = 0;
|
|
214
|
-
let i = 0;
|
|
215
|
-
const isDigit = (at) => at < text.length && text.charCodeAt(at) >= 48 && text.charCodeAt(at) <= 57;
|
|
216
|
-
while (i < text.length) {
|
|
217
|
-
const start = i;
|
|
218
|
-
while (isDigit(i)) i += 1;
|
|
219
|
-
const intDigits = i - start;
|
|
220
|
-
if (text[i] === ".") {
|
|
221
|
-
i += 1;
|
|
222
|
-
const fracStart = i;
|
|
223
|
-
while (isDigit(i)) i += 1;
|
|
224
|
-
if (i === fracStart) return void 0;
|
|
225
|
-
} else if (intDigits === 0) {
|
|
226
|
-
return void 0;
|
|
227
|
-
}
|
|
228
|
-
const value = Number(text.slice(start, i));
|
|
229
|
-
const unit = DURATION_UNITS.find((u) => text.startsWith(u, i));
|
|
230
|
-
if (unit === void 0) return void 0;
|
|
231
|
-
total += value * UNIT_MS[unit];
|
|
232
|
-
i += unit.length;
|
|
233
|
-
}
|
|
234
|
-
return Math.round(total);
|
|
235
|
-
}
|
|
236
|
-
var TRUE_WORDS = /* @__PURE__ */ new Set(["true", "1", "yes", "on"]);
|
|
237
|
-
var FALSE_WORDS = /* @__PURE__ */ new Set(["false", "0", "no", "off"]);
|
|
238
|
-
function parseBool(raw) {
|
|
239
|
-
const text = raw.trim().toLowerCase();
|
|
240
|
-
if (TRUE_WORDS.has(text)) return true;
|
|
241
|
-
if (FALSE_WORDS.has(text)) return false;
|
|
242
|
-
return void 0;
|
|
243
|
-
}
|
|
244
|
-
function parseInteger(raw) {
|
|
245
|
-
const text = raw.trim();
|
|
246
|
-
if (!/^[+-]?\d+$/.test(text)) return void 0;
|
|
247
|
-
const n = Number(text);
|
|
248
|
-
return Number.isSafeInteger(n) ? n : void 0;
|
|
249
|
-
}
|
|
250
|
-
var EnvReader = class {
|
|
251
|
-
prefix;
|
|
252
|
-
#env;
|
|
253
|
-
/**
|
|
254
|
-
* @param prefix e.g. `"GROW_OIDC_"`.
|
|
255
|
-
* @param env environment map, defaults to `process.env`.
|
|
256
|
-
*/
|
|
257
|
-
constructor(prefix, env = process.env) {
|
|
258
|
-
this.prefix = prefix;
|
|
259
|
-
this.#env = env;
|
|
260
|
-
}
|
|
261
|
-
/** Finds the first present variable: `<prefix><name>`, then each vendor name. */
|
|
262
|
-
lookup(name, vendorNames = []) {
|
|
263
|
-
for (const candidate of [this.prefix + name, ...vendorNames]) {
|
|
264
|
-
const value = this.#env[candidate];
|
|
265
|
-
if (value !== void 0 && value !== "") return { name: candidate, value };
|
|
266
|
-
}
|
|
267
|
-
return void 0;
|
|
268
|
-
}
|
|
269
|
-
/** String value. */
|
|
270
|
-
string(name, vendorNames = []) {
|
|
271
|
-
return this.lookup(name, vendorNames)?.value;
|
|
272
|
-
}
|
|
273
|
-
/** Credential value wrapped in a {@link Secret}. */
|
|
274
|
-
secret(name, vendorNames = []) {
|
|
275
|
-
return Secret.from(this.string(name, vendorNames));
|
|
276
|
-
}
|
|
277
|
-
/** Duration in milliseconds (see {@link parseDuration}). */
|
|
278
|
-
duration(name, vendorNames = []) {
|
|
279
|
-
return this.#parse(name, vendorNames, parseDuration, "a duration such as 1500, 500ms or 10s");
|
|
280
|
-
}
|
|
281
|
-
/** Boolean (see {@link parseBool}). */
|
|
282
|
-
bool(name, vendorNames = []) {
|
|
283
|
-
return this.#parse(name, vendorNames, parseBool, "a boolean (true/false/1/0/yes/no/on/off)");
|
|
284
|
-
}
|
|
285
|
-
/** Integer. */
|
|
286
|
-
int(name, vendorNames = []) {
|
|
287
|
-
return this.#parse(name, vendorNames, parseInteger, "an integer");
|
|
288
|
-
}
|
|
289
|
-
#parse(name, vendorNames, parse, expected) {
|
|
290
|
-
const hit = this.lookup(name, vendorNames);
|
|
291
|
-
if (hit === void 0) return void 0;
|
|
292
|
-
const value = parse(hit.value);
|
|
293
|
-
if (value === void 0) {
|
|
294
|
-
throw new chunkWO2QXDBJ_cjs.ConfigError(
|
|
295
|
-
`invalid value in environment variable ${hit.name}: expected ${expected}`
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
return value;
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
|
|
302
9
|
// src/core/health.ts
|
|
303
10
|
var HEALTHY_WORDS = /* @__PURE__ */ new Set([
|
|
304
11
|
"ok",
|
|
@@ -330,14 +37,14 @@ async function probeHealth(probe) {
|
|
|
330
37
|
try {
|
|
331
38
|
return await probe();
|
|
332
39
|
} catch (err) {
|
|
333
|
-
if (err instanceof
|
|
334
|
-
if (err.code ===
|
|
40
|
+
if (err instanceof chunk2PTQBDJ6_cjs.OidcError) {
|
|
41
|
+
if (err.code === chunk2PTQBDJ6_cjs.ErrorCode.Cancelled || err.code === chunk2PTQBDJ6_cjs.ErrorCode.Config) throw err;
|
|
335
42
|
if (err.httpStatus !== void 0) {
|
|
336
43
|
return healthStatus("unhealthy", { httpStatus: err.httpStatus, error: err.code }, false);
|
|
337
44
|
}
|
|
338
45
|
return healthStatus("unreachable", { error: err.code }, false);
|
|
339
46
|
}
|
|
340
|
-
return healthStatus("unreachable", { error:
|
|
47
|
+
return healthStatus("unreachable", { error: chunk2PTQBDJ6_cjs.ErrorCode.Unavailable }, false);
|
|
341
48
|
}
|
|
342
49
|
}
|
|
343
50
|
|
|
@@ -527,7 +234,7 @@ function validateCommonConfig(config) {
|
|
|
527
234
|
if (config.proxy !== void 0 && !isHttpUrl(config.proxy)) {
|
|
528
235
|
problems.push("proxy must be an http or https URL");
|
|
529
236
|
}
|
|
530
|
-
if (problems.length > 0) throw new
|
|
237
|
+
if (problems.length > 0) throw new chunk2PTQBDJ6_cjs.ConfigError(`invalid configuration: ${problems.join("; ")}`);
|
|
531
238
|
}
|
|
532
239
|
function readCommonEnv(reader, vendor = {}) {
|
|
533
240
|
const out = {};
|
|
@@ -580,29 +287,29 @@ function mergeOptions(...layers) {
|
|
|
580
287
|
}
|
|
581
288
|
function describeCommonConfig(config) {
|
|
582
289
|
const headers = {};
|
|
583
|
-
for (const k of Object.keys(config.headers)) headers[k] = REDACTED;
|
|
290
|
+
for (const k of Object.keys(config.headers)) headers[k] = chunk2PTQBDJ6_cjs.REDACTED;
|
|
584
291
|
const out = {
|
|
585
|
-
url: redactUrl(config.url),
|
|
292
|
+
url: chunk2PTQBDJ6_cjs.redactUrl(config.url),
|
|
586
293
|
connectTimeoutMs: config.connectTimeoutMs,
|
|
587
294
|
requestTimeoutMs: config.requestTimeoutMs,
|
|
588
295
|
totalTimeoutMs: config.totalTimeoutMs,
|
|
589
296
|
retry: config.retry.toJSON(),
|
|
590
297
|
tls: {
|
|
591
298
|
...config.tls,
|
|
592
|
-
...config.tls.caCertPem === void 0 ? {} : { caCertPem: REDACTED }
|
|
299
|
+
...config.tls.caCertPem === void 0 ? {} : { caCertPem: chunk2PTQBDJ6_cjs.REDACTED }
|
|
593
300
|
},
|
|
594
301
|
headers
|
|
595
302
|
};
|
|
596
|
-
if (config.proxy !== void 0) out.proxy = redactUrl(config.proxy);
|
|
303
|
+
if (config.proxy !== void 0) out.proxy = chunk2PTQBDJ6_cjs.redactUrl(config.proxy);
|
|
597
304
|
if (config.userAgentSuffix !== void 0) out.userAgentSuffix = config.userAgentSuffix;
|
|
598
305
|
return out;
|
|
599
306
|
}
|
|
600
307
|
function secretValues(...values) {
|
|
601
|
-
return values.filter((v) => v instanceof Secret).map((s) => s.reveal());
|
|
308
|
+
return values.filter((v) => v instanceof chunk2PTQBDJ6_cjs.Secret).map((s) => s.reveal());
|
|
602
309
|
}
|
|
603
310
|
|
|
604
311
|
// src/core/version.ts
|
|
605
|
-
var SDK_VERSION = "0.1.
|
|
312
|
+
var SDK_VERSION = "0.1.1";
|
|
606
313
|
var PACKAGE_KEY = "oidc";
|
|
607
314
|
var LANGUAGE = "typescript";
|
|
608
315
|
var SDK_KIT_VERSION = "0.3.0";
|
|
@@ -695,7 +402,7 @@ var HttpTransport = class {
|
|
|
695
402
|
this.#logger = safeLogger(options.config.logger);
|
|
696
403
|
this.#hooks = options.config.hooks ?? {};
|
|
697
404
|
this.#fetch = undici.fetch;
|
|
698
|
-
this.#sleep = options.sleep ??
|
|
405
|
+
this.#sleep = options.sleep ?? chunk2PTQBDJ6_cjs.sleep;
|
|
699
406
|
this.#now = options.now ?? Date.now;
|
|
700
407
|
this.#requestIdHeaders = options.requestIdHeaders ?? DEFAULT_REQUEST_ID_HEADERS;
|
|
701
408
|
this.#dispatcher = options.dispatcher;
|
|
@@ -712,7 +419,7 @@ var HttpTransport = class {
|
|
|
712
419
|
* (cached reads, local helpers) call it first.
|
|
713
420
|
*/
|
|
714
421
|
ensureOpen(operation) {
|
|
715
|
-
if (this.#closed) throw new
|
|
422
|
+
if (this.#closed) throw new chunk2PTQBDJ6_cjs.CancelledError(`${operation}: client is closed`);
|
|
716
423
|
}
|
|
717
424
|
/** Builds the absolute URL for a path and query. */
|
|
718
425
|
buildUrl(path, query) {
|
|
@@ -736,7 +443,7 @@ var HttpTransport = class {
|
|
|
736
443
|
}
|
|
737
444
|
/** Redacts known secrets from a text (error messages, vendor text). */
|
|
738
445
|
redact(text) {
|
|
739
|
-
return redactText(text, this.#knownSecrets());
|
|
446
|
+
return chunk2PTQBDJ6_cjs.redactText(text, this.#knownSecrets());
|
|
740
447
|
}
|
|
741
448
|
#knownSecrets() {
|
|
742
449
|
return [...this.#options.knownSecrets?.() ?? []];
|
|
@@ -769,7 +476,7 @@ var HttpTransport = class {
|
|
|
769
476
|
try {
|
|
770
477
|
return await this.#request(options);
|
|
771
478
|
} catch (err) {
|
|
772
|
-
if (err instanceof
|
|
479
|
+
if (err instanceof chunk2PTQBDJ6_cjs.OidcError) err.message = this.redact(err.message);
|
|
773
480
|
throw err;
|
|
774
481
|
}
|
|
775
482
|
}
|
|
@@ -778,9 +485,9 @@ var HttpTransport = class {
|
|
|
778
485
|
const operation = options.operation ?? `${method} ${options.path.split("?")[0] ?? ""}`;
|
|
779
486
|
this.ensureOpen(operation);
|
|
780
487
|
const signal = options.signal;
|
|
781
|
-
if (signal?.aborted === true) throw new
|
|
488
|
+
if (signal?.aborted === true) throw new chunk2PTQBDJ6_cjs.CancelledError(`${operation}: cancelled`);
|
|
782
489
|
const url = this.buildUrl(options.path, options.query);
|
|
783
|
-
const safeUrl = redactUrl(url);
|
|
490
|
+
const safeUrl = chunk2PTQBDJ6_cjs.redactUrl(url);
|
|
784
491
|
const headers = this.#buildHeaders(options);
|
|
785
492
|
const body = options.json !== void 0 ? JSON.stringify(options.json) : options.body;
|
|
786
493
|
const idempotent = options.idempotent ?? isIdempotentMethod(method);
|
|
@@ -792,14 +499,14 @@ var HttpTransport = class {
|
|
|
792
499
|
for (let attempt = 1; ; attempt++) {
|
|
793
500
|
const remaining = deadline - this.#now();
|
|
794
501
|
if (remaining <= 0) {
|
|
795
|
-
throw new
|
|
502
|
+
throw new chunk2PTQBDJ6_cjs.TimeoutError(`${operation}: total timeout of ${totalTimeout} ms exceeded`);
|
|
796
503
|
}
|
|
797
504
|
const attemptTimeout = Math.min(requestTimeout, remaining);
|
|
798
505
|
const isTotal = attemptTimeout < requestTimeout;
|
|
799
506
|
safeCall(this.#hooks.onRequest, {
|
|
800
507
|
method,
|
|
801
508
|
url: safeUrl,
|
|
802
|
-
headers: redactHeaders(headers),
|
|
509
|
+
headers: chunk2PTQBDJ6_cjs.redactHeaders(headers),
|
|
803
510
|
attempt
|
|
804
511
|
});
|
|
805
512
|
this.#logger.debug("http request", { method, url: safeUrl, attempt });
|
|
@@ -848,7 +555,7 @@ var HttpTransport = class {
|
|
|
848
555
|
}
|
|
849
556
|
const retryAfter = res.status === 429 || res.status === 503 ? parseRetryAfter(res.headers.get("retry-after"), this.#now()) : void 0;
|
|
850
557
|
const reason = this.vendorText(res.text);
|
|
851
|
-
const defaultError =
|
|
558
|
+
const defaultError = chunk2PTQBDJ6_cjs.errorForStatus(operation, res.status, {
|
|
852
559
|
...reason === void 0 ? {} : { reason },
|
|
853
560
|
...requestId === void 0 ? {} : { requestId },
|
|
854
561
|
...retryAfter === void 0 ? {} : { retryAfterMs: retryAfter }
|
|
@@ -894,7 +601,7 @@ var HttpTransport = class {
|
|
|
894
601
|
attempt,
|
|
895
602
|
willRetry: false
|
|
896
603
|
});
|
|
897
|
-
throw new
|
|
604
|
+
throw new chunk2PTQBDJ6_cjs.TimeoutError(
|
|
898
605
|
`${operation}: total timeout of ${totalTimeout} ms exceeded after ${attempt} attempts`,
|
|
899
606
|
{
|
|
900
607
|
cause: failure,
|
|
@@ -921,7 +628,7 @@ var HttpTransport = class {
|
|
|
921
628
|
waitMs: Math.round(waitMs)
|
|
922
629
|
});
|
|
923
630
|
await this.#sleep(waitMs, signal).catch((err) => {
|
|
924
|
-
throw err instanceof
|
|
631
|
+
throw err instanceof chunk2PTQBDJ6_cjs.OidcError ? err : new chunk2PTQBDJ6_cjs.CancelledError(`${operation}: cancelled`);
|
|
925
632
|
});
|
|
926
633
|
}
|
|
927
634
|
}
|
|
@@ -996,30 +703,30 @@ var HttpTransport = class {
|
|
|
996
703
|
try {
|
|
997
704
|
return JSON.parse(text);
|
|
998
705
|
} catch {
|
|
999
|
-
throw new
|
|
706
|
+
throw new chunk2PTQBDJ6_cjs.UnavailableError(`invalid JSON in response (HTTP ${status})`, {
|
|
1000
707
|
retryable: false,
|
|
1001
708
|
httpStatus: status
|
|
1002
709
|
});
|
|
1003
710
|
}
|
|
1004
711
|
}
|
|
1005
712
|
#classify(err, operation, timeoutMs, isTotal, totalTimeout) {
|
|
1006
|
-
if (err instanceof
|
|
713
|
+
if (err instanceof chunk2PTQBDJ6_cjs.OidcError) return err;
|
|
1007
714
|
if (err instanceof AbortedAttempt) {
|
|
1008
|
-
if (err.kind === CANCEL) return new
|
|
1009
|
-
return isTotal ? new
|
|
715
|
+
if (err.kind === CANCEL) return new chunk2PTQBDJ6_cjs.CancelledError(`${operation}: cancelled`);
|
|
716
|
+
return isTotal ? new chunk2PTQBDJ6_cjs.TimeoutError(`${operation}: total timeout of ${totalTimeout} ms exceeded`) : new chunk2PTQBDJ6_cjs.TimeoutError(`${operation}: request timed out after ${timeoutMs} ms`);
|
|
1010
717
|
}
|
|
1011
|
-
const cause = redactError(err, this.#knownSecrets());
|
|
718
|
+
const cause = chunk2PTQBDJ6_cjs.redactError(err, this.#knownSecrets());
|
|
1012
719
|
const code = errorCode(err);
|
|
1013
720
|
if (code === "UND_ERR_CONNECT_TIMEOUT") {
|
|
1014
|
-
return new
|
|
721
|
+
return new chunk2PTQBDJ6_cjs.TimeoutError(
|
|
1015
722
|
`${operation}: connect timeout after ${this.#config.connectTimeoutMs} ms`,
|
|
1016
723
|
{ cause }
|
|
1017
724
|
);
|
|
1018
725
|
}
|
|
1019
726
|
if (code !== void 0 && TLS_CODE.test(code)) {
|
|
1020
|
-
return new
|
|
727
|
+
return new chunk2PTQBDJ6_cjs.UnavailableError(`${operation}: TLS error (${code})`, { cause, retryable: false });
|
|
1021
728
|
}
|
|
1022
|
-
return new
|
|
729
|
+
return new chunk2PTQBDJ6_cjs.UnavailableError(
|
|
1023
730
|
`${operation}: network error${code === void 0 ? "" : ` (${code})`}`,
|
|
1024
731
|
{ cause }
|
|
1025
732
|
);
|
|
@@ -1031,9 +738,9 @@ var HttpTransport = class {
|
|
|
1031
738
|
try {
|
|
1032
739
|
mapped = classify(response);
|
|
1033
740
|
} catch (err) {
|
|
1034
|
-
mapped = err instanceof
|
|
741
|
+
mapped = err instanceof chunk2PTQBDJ6_cjs.OidcError ? err : void 0;
|
|
1035
742
|
}
|
|
1036
|
-
if (mapped instanceof
|
|
743
|
+
if (mapped instanceof chunk2PTQBDJ6_cjs.OidcError) return mapped;
|
|
1037
744
|
}
|
|
1038
745
|
return void 0;
|
|
1039
746
|
}
|
|
@@ -1109,7 +816,7 @@ function redactSecretsInText(text) {
|
|
|
1109
816
|
}
|
|
1110
817
|
|
|
1111
818
|
// src/config.ts
|
|
1112
|
-
var
|
|
819
|
+
var INSPECT = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
1113
820
|
var CATALOG_PORT = "8000";
|
|
1114
821
|
var VENDOR_ENV = {
|
|
1115
822
|
url: [],
|
|
@@ -1147,7 +854,7 @@ var OidcConfig = class _OidcConfig {
|
|
|
1147
854
|
if (common.userAgentSuffix !== void 0) this.userAgentSuffix = common.userAgentSuffix;
|
|
1148
855
|
if (common.hooks !== void 0) this.hooks = common.hooks;
|
|
1149
856
|
if (common.logger !== void 0) this.logger = common.logger;
|
|
1150
|
-
const token = Secret.from(options.token);
|
|
857
|
+
const token = chunk2PTQBDJ6_cjs.Secret.from(options.token);
|
|
1151
858
|
if (token !== void 0) this.token = token;
|
|
1152
859
|
this.validate();
|
|
1153
860
|
Object.freeze(this);
|
|
@@ -1162,7 +869,7 @@ var OidcConfig = class _OidcConfig {
|
|
|
1162
869
|
* `GROW_OIDC_<NAME>` > vendor variables ({@link VENDOR_ENV}) > defaults.
|
|
1163
870
|
*/
|
|
1164
871
|
static fromEnv(overrides = {}, env = process.env) {
|
|
1165
|
-
const reader = new EnvReader(_OidcConfig.ENV_PREFIX, env);
|
|
872
|
+
const reader = new chunk2PTQBDJ6_cjs.EnvReader(_OidcConfig.ENV_PREFIX, env);
|
|
1166
873
|
const fromEnv = readCommonEnv(reader, VENDOR_ENV);
|
|
1167
874
|
const token = reader.secret("TOKEN", VENDOR_ENV.token);
|
|
1168
875
|
if (token !== void 0) fromEnv.token = token;
|
|
@@ -1173,7 +880,7 @@ var OidcConfig = class _OidcConfig {
|
|
|
1173
880
|
validate() {
|
|
1174
881
|
validateCommonConfig(this);
|
|
1175
882
|
if (this.token?.reveal().trim() === "")
|
|
1176
|
-
throw new
|
|
883
|
+
throw new chunk2PTQBDJ6_cjs.ConfigError("invalid configuration: token must not be blank");
|
|
1177
884
|
}
|
|
1178
885
|
/** Credential values to redact from error messages and logs. */
|
|
1179
886
|
knownSecrets() {
|
|
@@ -1181,12 +888,12 @@ var OidcConfig = class _OidcConfig {
|
|
|
1181
888
|
}
|
|
1182
889
|
/** Debug form with every credential redacted. */
|
|
1183
890
|
toJSON() {
|
|
1184
|
-
return { ...describeCommonConfig(this), token: this.token === void 0 ? null : REDACTED };
|
|
891
|
+
return { ...describeCommonConfig(this), token: this.token === void 0 ? null : chunk2PTQBDJ6_cjs.REDACTED };
|
|
1185
892
|
}
|
|
1186
893
|
toString() {
|
|
1187
894
|
return `OidcConfig(${JSON.stringify(this.toJSON())})`;
|
|
1188
895
|
}
|
|
1189
|
-
[
|
|
896
|
+
[INSPECT]() {
|
|
1190
897
|
return this.toString();
|
|
1191
898
|
}
|
|
1192
899
|
};
|
|
@@ -1253,7 +960,7 @@ var OidcClient = class _OidcClient {
|
|
|
1253
960
|
const start = performance.now();
|
|
1254
961
|
const doc = await this.#discovery("ping", options);
|
|
1255
962
|
if (typeof doc.userinfo_endpoint !== "string" || doc.userinfo_endpoint === "") {
|
|
1256
|
-
throw new
|
|
963
|
+
throw new chunk2PTQBDJ6_cjs.UnsupportedError("ping: the provider has no userinfo endpoint");
|
|
1257
964
|
}
|
|
1258
965
|
const token = this.config.token;
|
|
1259
966
|
await this.#transport.get(relativeEndpoint(this.config.url, doc.userinfo_endpoint), {
|
|
@@ -1268,7 +975,7 @@ var OidcClient = class _OidcClient {
|
|
|
1268
975
|
serverVersion(_options = {}) {
|
|
1269
976
|
return new Promise((_resolve, reject) => {
|
|
1270
977
|
this.#transport.ensureOpen("serverVersion");
|
|
1271
|
-
reject(new
|
|
978
|
+
reject(new chunk2PTQBDJ6_cjs.UnsupportedError("serverVersion: OpenID Connect providers expose no version"));
|
|
1272
979
|
});
|
|
1273
980
|
}
|
|
1274
981
|
async #discovery(operation, options) {
|
|
@@ -1284,309 +991,6 @@ var OidcClient = class _OidcClient {
|
|
|
1284
991
|
}
|
|
1285
992
|
};
|
|
1286
993
|
|
|
1287
|
-
// src/oidc/roles.ts
|
|
1288
|
-
var ROLE_OBJECT_KEYS = ["name", "code", "role", "value"];
|
|
1289
|
-
function claimAt(claims, path) {
|
|
1290
|
-
if (Object.hasOwn(claims, path)) return claims[path];
|
|
1291
|
-
let current = claims;
|
|
1292
|
-
for (const part of path.split(".")) {
|
|
1293
|
-
if (current === null || typeof current !== "object" || Array.isArray(current)) return void 0;
|
|
1294
|
-
const record = current;
|
|
1295
|
-
if (!Object.hasOwn(record, part)) return void 0;
|
|
1296
|
-
current = record[part];
|
|
1297
|
-
}
|
|
1298
|
-
return current;
|
|
1299
|
-
}
|
|
1300
|
-
function roleName(entry) {
|
|
1301
|
-
if (typeof entry === "string") return entry.trim() === "" ? void 0 : entry.trim();
|
|
1302
|
-
if (entry !== null && typeof entry === "object" && !Array.isArray(entry)) {
|
|
1303
|
-
const record = entry;
|
|
1304
|
-
for (const key of ROLE_OBJECT_KEYS) {
|
|
1305
|
-
const value = record[key];
|
|
1306
|
-
if (typeof value === "string" && value.trim() !== "") return value.trim();
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
return void 0;
|
|
1310
|
-
}
|
|
1311
|
-
function extractRoles(claims, rolesClaim = "roles") {
|
|
1312
|
-
const raw = claimAt(claims, rolesClaim);
|
|
1313
|
-
let names = [];
|
|
1314
|
-
if (typeof raw === "string") {
|
|
1315
|
-
names = raw.split(/[\s,]+/u);
|
|
1316
|
-
} else if (Array.isArray(raw)) {
|
|
1317
|
-
names = raw.map(roleName);
|
|
1318
|
-
}
|
|
1319
|
-
const out = [];
|
|
1320
|
-
for (const name of names) {
|
|
1321
|
-
if (name !== void 0 && name !== "" && !out.includes(name)) out.push(name);
|
|
1322
|
-
}
|
|
1323
|
-
return out;
|
|
1324
|
-
}
|
|
1325
|
-
function hasAnyRole(userRoles, required) {
|
|
1326
|
-
if (required.length === 0) return true;
|
|
1327
|
-
const have = new Set(userRoles.map((role) => role.toLowerCase()));
|
|
1328
|
-
return required.some((role) => have.has(role.toLowerCase()));
|
|
1329
|
-
}
|
|
1330
|
-
var DEFAULT_ALGORITHMS = ["RS256", "ES256", "EdDSA"];
|
|
1331
|
-
var DEFAULT_CLOCK_SKEW_MS = 6e4;
|
|
1332
|
-
var DEFAULT_JWKS_CACHE_TTL_MS = 6e5;
|
|
1333
|
-
var DEFAULT_JWKS_REFRESH_COOLDOWN_MS = 3e4;
|
|
1334
|
-
var DEFAULT_HTTP_TIMEOUT_MS = 1e4;
|
|
1335
|
-
function bearerToken(req) {
|
|
1336
|
-
if (req === null || req === void 0) return null;
|
|
1337
|
-
let value;
|
|
1338
|
-
if (req instanceof Headers) {
|
|
1339
|
-
value = req.get("authorization");
|
|
1340
|
-
} else if (req.headers instanceof Headers) {
|
|
1341
|
-
value = req.headers.get("authorization");
|
|
1342
|
-
} else {
|
|
1343
|
-
const headers = req.headers;
|
|
1344
|
-
const raw = headers.authorization ?? headers.Authorization;
|
|
1345
|
-
value = Array.isArray(raw) ? raw[0] : raw;
|
|
1346
|
-
}
|
|
1347
|
-
if (typeof value !== "string") return null;
|
|
1348
|
-
const match = /^\s*bearer\s+(\S+)\s*$/iu.exec(value);
|
|
1349
|
-
return match?.[1] ?? null;
|
|
1350
|
-
}
|
|
1351
|
-
var Verifier = class _Verifier {
|
|
1352
|
-
issuer;
|
|
1353
|
-
audience;
|
|
1354
|
-
rolesClaim;
|
|
1355
|
-
algorithms;
|
|
1356
|
-
clockSkewMs;
|
|
1357
|
-
#jwksUrl;
|
|
1358
|
-
#ttlMs;
|
|
1359
|
-
#cooldownMs;
|
|
1360
|
-
#timeoutMs;
|
|
1361
|
-
#fetch;
|
|
1362
|
-
#now;
|
|
1363
|
-
#resolvedJwksUrl;
|
|
1364
|
-
#keys;
|
|
1365
|
-
#inflight;
|
|
1366
|
-
constructor(options) {
|
|
1367
|
-
if (typeof options.issuer !== "string" || options.issuer.trim() === "") {
|
|
1368
|
-
throw new chunkWO2QXDBJ_cjs.ConfigError("oidc: issuer is required");
|
|
1369
|
-
}
|
|
1370
|
-
if (typeof options.audience !== "string" || options.audience.trim() === "") {
|
|
1371
|
-
throw new chunkWO2QXDBJ_cjs.ConfigError("oidc: audience is required");
|
|
1372
|
-
}
|
|
1373
|
-
const algorithms = options.algorithms ?? DEFAULT_ALGORITHMS;
|
|
1374
|
-
if (algorithms.length === 0 || algorithms.some((alg) => !DEFAULT_ALGORITHMS.includes(alg))) {
|
|
1375
|
-
throw new chunkWO2QXDBJ_cjs.ConfigError("oidc: algorithms must be a non-empty subset of RS256, ES256, EdDSA");
|
|
1376
|
-
}
|
|
1377
|
-
for (const [name, value] of [
|
|
1378
|
-
["clockSkewMs", options.clockSkewMs],
|
|
1379
|
-
["jwksCacheTtlMs", options.jwksCacheTtlMs],
|
|
1380
|
-
["jwksRefreshCooldownMs", options.jwksRefreshCooldownMs],
|
|
1381
|
-
["httpTimeoutMs", options.httpTimeoutMs]
|
|
1382
|
-
]) {
|
|
1383
|
-
if (value !== void 0 && (!Number.isFinite(value) || value < 0)) {
|
|
1384
|
-
throw new chunkWO2QXDBJ_cjs.ConfigError(`oidc: ${name} must be a non-negative number`);
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
this.issuer = options.issuer.trim();
|
|
1388
|
-
this.audience = options.audience.trim();
|
|
1389
|
-
this.rolesClaim = options.rolesClaim?.trim() || "roles";
|
|
1390
|
-
this.algorithms = [...algorithms];
|
|
1391
|
-
this.clockSkewMs = options.clockSkewMs ?? DEFAULT_CLOCK_SKEW_MS;
|
|
1392
|
-
this.#jwksUrl = options.jwksUrl?.trim() || void 0;
|
|
1393
|
-
if (this.#jwksUrl !== void 0) checkUrl("jwksUrl", this.#jwksUrl);
|
|
1394
|
-
checkUrl("issuer", this.issuer);
|
|
1395
|
-
this.#ttlMs = options.jwksCacheTtlMs ?? DEFAULT_JWKS_CACHE_TTL_MS;
|
|
1396
|
-
this.#cooldownMs = options.jwksRefreshCooldownMs ?? DEFAULT_JWKS_REFRESH_COOLDOWN_MS;
|
|
1397
|
-
this.#timeoutMs = options.httpTimeoutMs ?? DEFAULT_HTTP_TIMEOUT_MS;
|
|
1398
|
-
this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
1399
|
-
this.#now = options.now ?? Date.now;
|
|
1400
|
-
}
|
|
1401
|
-
/**
|
|
1402
|
-
* Builds a verifier from `GROW_AUTH_ISSUER` (required), `GROW_AUTH_AUDIENCE` (default
|
|
1403
|
-
* `GROW_AUTH_CLIENT_ID`), `GROW_AUTH_JWKS_URL`, `GROW_AUTH_ROLES_CLAIM` (default `roles`) and
|
|
1404
|
-
* `GROW_AUTH_CLOCK_SKEW` (duration, default 60s). Explicit `overrides` win.
|
|
1405
|
-
*/
|
|
1406
|
-
static fromEnv(overrides = {}, env = process.env) {
|
|
1407
|
-
const read = (name) => {
|
|
1408
|
-
const value = env[name]?.trim();
|
|
1409
|
-
return value === void 0 || value === "" ? void 0 : value;
|
|
1410
|
-
};
|
|
1411
|
-
const issuer = overrides.issuer ?? read("GROW_AUTH_ISSUER");
|
|
1412
|
-
if (issuer === void 0) throw new chunkWO2QXDBJ_cjs.ConfigError("oidc: GROW_AUTH_ISSUER is required");
|
|
1413
|
-
const audience = overrides.audience ?? read("GROW_AUTH_AUDIENCE") ?? read("GROW_AUTH_CLIENT_ID");
|
|
1414
|
-
if (audience === void 0) {
|
|
1415
|
-
throw new chunkWO2QXDBJ_cjs.ConfigError("oidc: GROW_AUTH_AUDIENCE (or GROW_AUTH_CLIENT_ID) is required");
|
|
1416
|
-
}
|
|
1417
|
-
let clockSkewMs = overrides.clockSkewMs;
|
|
1418
|
-
const skew = read("GROW_AUTH_CLOCK_SKEW");
|
|
1419
|
-
if (clockSkewMs === void 0 && skew !== void 0) {
|
|
1420
|
-
clockSkewMs = parseDuration(skew);
|
|
1421
|
-
if (clockSkewMs === void 0)
|
|
1422
|
-
throw new chunkWO2QXDBJ_cjs.ConfigError("oidc: GROW_AUTH_CLOCK_SKEW is not a duration");
|
|
1423
|
-
}
|
|
1424
|
-
const options = { ...overrides, issuer, audience };
|
|
1425
|
-
const jwksUrl = overrides.jwksUrl ?? read("GROW_AUTH_JWKS_URL");
|
|
1426
|
-
if (jwksUrl !== void 0) options.jwksUrl = jwksUrl;
|
|
1427
|
-
const rolesClaim = overrides.rolesClaim ?? read("GROW_AUTH_ROLES_CLAIM");
|
|
1428
|
-
if (rolesClaim !== void 0) options.rolesClaim = rolesClaim;
|
|
1429
|
-
if (clockSkewMs !== void 0) options.clockSkewMs = clockSkewMs;
|
|
1430
|
-
return new _Verifier(options);
|
|
1431
|
-
}
|
|
1432
|
-
/** Verifies a raw JWT access token and returns its user. */
|
|
1433
|
-
async verify(token) {
|
|
1434
|
-
if (typeof token !== "string" || token.split(".").length !== 3) {
|
|
1435
|
-
throw new chunkWO2QXDBJ_cjs.AuthenticationError("verify: malformed token");
|
|
1436
|
-
}
|
|
1437
|
-
let alg;
|
|
1438
|
-
let kid;
|
|
1439
|
-
try {
|
|
1440
|
-
({ alg, kid } = jose.decodeProtectedHeader(token));
|
|
1441
|
-
} catch {
|
|
1442
|
-
throw new chunkWO2QXDBJ_cjs.AuthenticationError("verify: malformed token header");
|
|
1443
|
-
}
|
|
1444
|
-
if (alg === void 0 || !this.algorithms.includes(alg)) {
|
|
1445
|
-
throw new chunkWO2QXDBJ_cjs.AuthenticationError(`verify: algorithm ${String(alg)} is not allowed`);
|
|
1446
|
-
}
|
|
1447
|
-
let entry = await this.#keySet(false);
|
|
1448
|
-
try {
|
|
1449
|
-
return await this.#verifyWith(token, entry);
|
|
1450
|
-
} catch (err) {
|
|
1451
|
-
if (!(err instanceof jose.errors.JWKSNoMatchingKey) || !this.#mayRefresh(entry)) {
|
|
1452
|
-
throw mapJoseError(err, kid);
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
entry = await this.#keySet(true);
|
|
1456
|
-
try {
|
|
1457
|
-
return await this.#verifyWith(token, entry);
|
|
1458
|
-
} catch (err) {
|
|
1459
|
-
throw mapJoseError(err, kid);
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
/** Verifies the bearer token of a request (`AuthenticationError` when there is none). */
|
|
1463
|
-
async verifyRequest(req) {
|
|
1464
|
-
const token = bearerToken(req);
|
|
1465
|
-
if (token === null) throw new chunkWO2QXDBJ_cjs.AuthenticationError("verify: missing bearer token");
|
|
1466
|
-
return this.verify(token);
|
|
1467
|
-
}
|
|
1468
|
-
/** Drops the cached JWKS so the next verification refetches it. */
|
|
1469
|
-
clearCache() {
|
|
1470
|
-
this.#keys = void 0;
|
|
1471
|
-
}
|
|
1472
|
-
async #verifyWith(token, entry) {
|
|
1473
|
-
const { payload } = await jose.jwtVerify(token, entry.getKey, {
|
|
1474
|
-
issuer: this.issuer,
|
|
1475
|
-
audience: this.audience,
|
|
1476
|
-
algorithms: [...this.algorithms],
|
|
1477
|
-
clockTolerance: Math.floor(this.clockSkewMs / 1e3),
|
|
1478
|
-
requiredClaims: ["exp", "sub"],
|
|
1479
|
-
currentDate: new Date(this.#now())
|
|
1480
|
-
});
|
|
1481
|
-
return this.#toUser(payload);
|
|
1482
|
-
}
|
|
1483
|
-
#toUser(payload) {
|
|
1484
|
-
const claims = { ...payload };
|
|
1485
|
-
const user = {
|
|
1486
|
-
sub: String(payload.sub),
|
|
1487
|
-
roles: extractRoles(claims, this.rolesClaim),
|
|
1488
|
-
claims
|
|
1489
|
-
};
|
|
1490
|
-
if (typeof claims.email === "string") user.email = claims.email;
|
|
1491
|
-
const name = typeof claims.name === "string" ? claims.name : claims.preferred_username;
|
|
1492
|
-
if (typeof name === "string") user.name = name;
|
|
1493
|
-
return user;
|
|
1494
|
-
}
|
|
1495
|
-
#mayRefresh(entry) {
|
|
1496
|
-
return this.#now() - entry.fetchedAt >= this.#cooldownMs;
|
|
1497
|
-
}
|
|
1498
|
-
async #keySet(force) {
|
|
1499
|
-
const cached = this.#keys;
|
|
1500
|
-
if (!force && cached !== void 0 && this.#now() - cached.fetchedAt < this.#ttlMs)
|
|
1501
|
-
return cached;
|
|
1502
|
-
if (this.#inflight !== void 0) return this.#inflight;
|
|
1503
|
-
const pending = this.#loadKeySet().finally(() => {
|
|
1504
|
-
this.#inflight = void 0;
|
|
1505
|
-
});
|
|
1506
|
-
this.#inflight = pending;
|
|
1507
|
-
return pending;
|
|
1508
|
-
}
|
|
1509
|
-
async #loadKeySet() {
|
|
1510
|
-
const url = await this.#jwksUri();
|
|
1511
|
-
const body = await this.#getJson(url, "jwks");
|
|
1512
|
-
if (body === null || typeof body !== "object" || !Array.isArray(body.keys)) {
|
|
1513
|
-
throw new chunkWO2QXDBJ_cjs.UnavailableError("jwks: response has no keys array");
|
|
1514
|
-
}
|
|
1515
|
-
const entry = {
|
|
1516
|
-
getKey: jose.createLocalJWKSet(body),
|
|
1517
|
-
fetchedAt: this.#now()
|
|
1518
|
-
};
|
|
1519
|
-
this.#keys = entry;
|
|
1520
|
-
return entry;
|
|
1521
|
-
}
|
|
1522
|
-
async #jwksUri() {
|
|
1523
|
-
if (this.#jwksUrl !== void 0) return this.#jwksUrl;
|
|
1524
|
-
if (this.#resolvedJwksUrl !== void 0) return this.#resolvedJwksUrl;
|
|
1525
|
-
const url = `${trimTrailingSlashes2(this.issuer)}/.well-known/openid-configuration`;
|
|
1526
|
-
const doc = await this.#getJson(url, "discovery");
|
|
1527
|
-
const jwksUri = doc?.jwks_uri;
|
|
1528
|
-
if (typeof jwksUri !== "string" || jwksUri === "") {
|
|
1529
|
-
throw new chunkWO2QXDBJ_cjs.UnavailableError("discovery: document has no jwks_uri");
|
|
1530
|
-
}
|
|
1531
|
-
this.#resolvedJwksUrl = jwksUri;
|
|
1532
|
-
return jwksUri;
|
|
1533
|
-
}
|
|
1534
|
-
async #getJson(url, operation) {
|
|
1535
|
-
let res;
|
|
1536
|
-
try {
|
|
1537
|
-
res = await this.#fetch(url, {
|
|
1538
|
-
headers: { accept: "application/json" },
|
|
1539
|
-
signal: AbortSignal.timeout(this.#timeoutMs)
|
|
1540
|
-
});
|
|
1541
|
-
} catch (err) {
|
|
1542
|
-
throw new chunkWO2QXDBJ_cjs.UnavailableError(`${operation}: request failed`, { cause: err });
|
|
1543
|
-
}
|
|
1544
|
-
if (!res.ok) {
|
|
1545
|
-
throw new chunkWO2QXDBJ_cjs.UnavailableError(`${operation}: unexpected response (HTTP ${res.status})`, {
|
|
1546
|
-
httpStatus: res.status
|
|
1547
|
-
});
|
|
1548
|
-
}
|
|
1549
|
-
try {
|
|
1550
|
-
return await res.json();
|
|
1551
|
-
} catch (err) {
|
|
1552
|
-
throw new chunkWO2QXDBJ_cjs.UnavailableError(`${operation}: response is not JSON`, { cause: err });
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
};
|
|
1556
|
-
function trimTrailingSlashes2(value) {
|
|
1557
|
-
let end = value.length;
|
|
1558
|
-
while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
|
|
1559
|
-
return value.slice(0, end);
|
|
1560
|
-
}
|
|
1561
|
-
function checkUrl(name, value) {
|
|
1562
|
-
let parsed;
|
|
1563
|
-
try {
|
|
1564
|
-
parsed = new URL(value);
|
|
1565
|
-
} catch {
|
|
1566
|
-
throw new chunkWO2QXDBJ_cjs.ConfigError(`oidc: ${name} is not a URL`);
|
|
1567
|
-
}
|
|
1568
|
-
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
1569
|
-
throw new chunkWO2QXDBJ_cjs.ConfigError(`oidc: ${name} must use http or https`);
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
function mapJoseError(err, kid) {
|
|
1573
|
-
if (err instanceof chunkWO2QXDBJ_cjs.OidcError) return err;
|
|
1574
|
-
if (err instanceof jose.errors.JWTExpired) return new chunkWO2QXDBJ_cjs.AuthenticationError("verify: token expired");
|
|
1575
|
-
if (err instanceof jose.errors.JWTClaimValidationFailed) {
|
|
1576
|
-
return new chunkWO2QXDBJ_cjs.AuthenticationError(`verify: claim ${err.claim} is invalid (${err.reason})`);
|
|
1577
|
-
}
|
|
1578
|
-
if (err instanceof jose.errors.JWKSNoMatchingKey) {
|
|
1579
|
-
return new chunkWO2QXDBJ_cjs.AuthenticationError(`verify: no key matches kid ${kid ?? "(none)"}`);
|
|
1580
|
-
}
|
|
1581
|
-
if (err instanceof jose.errors.JWKSMultipleMatchingKeys) {
|
|
1582
|
-
return new chunkWO2QXDBJ_cjs.AuthenticationError("verify: several keys match and none verified the signature");
|
|
1583
|
-
}
|
|
1584
|
-
if (err instanceof jose.errors.JWSSignatureVerificationFailed) {
|
|
1585
|
-
return new chunkWO2QXDBJ_cjs.AuthenticationError("verify: signature is invalid");
|
|
1586
|
-
}
|
|
1587
|
-
return new chunkWO2QXDBJ_cjs.AuthenticationError("verify: token is invalid", { cause: err });
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
994
|
// src/oidc/express.ts
|
|
1591
995
|
function deny(res, status, error) {
|
|
1592
996
|
if (status === 401) res.setHeader("WWW-Authenticate", 'Bearer error="invalid_token"');
|
|
@@ -1594,7 +998,7 @@ function deny(res, status, error) {
|
|
|
1594
998
|
}
|
|
1595
999
|
function expressAuth(verifier, options = {}) {
|
|
1596
1000
|
return async (req, res, next) => {
|
|
1597
|
-
const token = bearerToken(req);
|
|
1001
|
+
const token = chunk2PTQBDJ6_cjs.bearerToken(req);
|
|
1598
1002
|
if (token === null) {
|
|
1599
1003
|
if (options.optional === true) {
|
|
1600
1004
|
next();
|
|
@@ -1606,11 +1010,11 @@ function expressAuth(verifier, options = {}) {
|
|
|
1606
1010
|
try {
|
|
1607
1011
|
req.user = await verifier.verify(token);
|
|
1608
1012
|
} catch (err) {
|
|
1609
|
-
if (err instanceof
|
|
1013
|
+
if (err instanceof chunk2PTQBDJ6_cjs.UnavailableError) {
|
|
1610
1014
|
deny(res, 503, "auth_unavailable");
|
|
1611
1015
|
return;
|
|
1612
1016
|
}
|
|
1613
|
-
if (err instanceof
|
|
1017
|
+
if (err instanceof chunk2PTQBDJ6_cjs.OidcError) {
|
|
1614
1018
|
deny(res, 401, "unauthorized");
|
|
1615
1019
|
return;
|
|
1616
1020
|
}
|
|
@@ -1624,7 +1028,7 @@ function requireRoles(...roles) {
|
|
|
1624
1028
|
return (req, res, next) => {
|
|
1625
1029
|
const user = req.user;
|
|
1626
1030
|
if (user === void 0) deny(res, 401, "unauthorized");
|
|
1627
|
-
else if (!hasAnyRole(user.roles, roles)) deny(res, 403, "forbidden");
|
|
1031
|
+
else if (!chunk2PTQBDJ6_cjs.hasAnyRole(user.roles, roles)) deny(res, 403, "forbidden");
|
|
1628
1032
|
else next();
|
|
1629
1033
|
return Promise.resolve();
|
|
1630
1034
|
};
|
|
@@ -1710,7 +1114,7 @@ var NestAuthGuard = class {
|
|
|
1710
1114
|
/** Nest `CanActivate`. */
|
|
1711
1115
|
async canActivate(ctx) {
|
|
1712
1116
|
const req = ctx.switchToHttp().getRequest();
|
|
1713
|
-
const token = bearerToken(req);
|
|
1117
|
+
const token = chunk2PTQBDJ6_cjs.bearerToken(req);
|
|
1714
1118
|
if (token === null) {
|
|
1715
1119
|
if (this.#optional || isPublic(ctx)) return true;
|
|
1716
1120
|
throw httpError(401);
|
|
@@ -1720,8 +1124,8 @@ var NestAuthGuard = class {
|
|
|
1720
1124
|
return true;
|
|
1721
1125
|
} catch (err) {
|
|
1722
1126
|
if (isPublic(ctx)) return true;
|
|
1723
|
-
if (err instanceof
|
|
1724
|
-
if (err instanceof
|
|
1127
|
+
if (err instanceof chunk2PTQBDJ6_cjs.UnavailableError) throw httpError(503);
|
|
1128
|
+
if (err instanceof chunk2PTQBDJ6_cjs.OidcError) throw httpError(401);
|
|
1725
1129
|
throw err;
|
|
1726
1130
|
}
|
|
1727
1131
|
}
|
|
@@ -1739,153 +1143,228 @@ var RolesGuard = class {
|
|
|
1739
1143
|
if (required === void 0 || isPublic(ctx)) return true;
|
|
1740
1144
|
throw httpError(401);
|
|
1741
1145
|
}
|
|
1742
|
-
if (required === void 0 || hasAnyRole(user.roles, required)) return true;
|
|
1146
|
+
if (required === void 0 || chunk2PTQBDJ6_cjs.hasAnyRole(user.roles, required)) return true;
|
|
1743
1147
|
throw httpError(403);
|
|
1744
1148
|
}
|
|
1745
1149
|
};
|
|
1746
1150
|
|
|
1747
1151
|
Object.defineProperty(exports, "AuthenticationError", {
|
|
1748
1152
|
enumerable: true,
|
|
1749
|
-
get: function () { return
|
|
1153
|
+
get: function () { return chunk2PTQBDJ6_cjs.AuthenticationError; }
|
|
1750
1154
|
});
|
|
1751
1155
|
Object.defineProperty(exports, "CancelledError", {
|
|
1752
1156
|
enumerable: true,
|
|
1753
|
-
get: function () { return
|
|
1157
|
+
get: function () { return chunk2PTQBDJ6_cjs.CancelledError; }
|
|
1754
1158
|
});
|
|
1755
1159
|
Object.defineProperty(exports, "ConfigError", {
|
|
1756
1160
|
enumerable: true,
|
|
1757
|
-
get: function () { return
|
|
1161
|
+
get: function () { return chunk2PTQBDJ6_cjs.ConfigError; }
|
|
1758
1162
|
});
|
|
1759
1163
|
Object.defineProperty(exports, "ConflictError", {
|
|
1760
1164
|
enumerable: true,
|
|
1761
|
-
get: function () { return
|
|
1165
|
+
get: function () { return chunk2PTQBDJ6_cjs.ConflictError; }
|
|
1166
|
+
});
|
|
1167
|
+
Object.defineProperty(exports, "DEFAULT_ALGORITHMS", {
|
|
1168
|
+
enumerable: true,
|
|
1169
|
+
get: function () { return chunk2PTQBDJ6_cjs.DEFAULT_ALGORITHMS; }
|
|
1170
|
+
});
|
|
1171
|
+
Object.defineProperty(exports, "DEFAULT_CLOCK_SKEW_MS", {
|
|
1172
|
+
enumerable: true,
|
|
1173
|
+
get: function () { return chunk2PTQBDJ6_cjs.DEFAULT_CLOCK_SKEW_MS; }
|
|
1174
|
+
});
|
|
1175
|
+
Object.defineProperty(exports, "DEFAULT_HTTP_TIMEOUT_MS", {
|
|
1176
|
+
enumerable: true,
|
|
1177
|
+
get: function () { return chunk2PTQBDJ6_cjs.DEFAULT_HTTP_TIMEOUT_MS; }
|
|
1178
|
+
});
|
|
1179
|
+
Object.defineProperty(exports, "DEFAULT_JWKS_CACHE_TTL_MS", {
|
|
1180
|
+
enumerable: true,
|
|
1181
|
+
get: function () { return chunk2PTQBDJ6_cjs.DEFAULT_JWKS_CACHE_TTL_MS; }
|
|
1182
|
+
});
|
|
1183
|
+
Object.defineProperty(exports, "DEFAULT_JWKS_REFRESH_COOLDOWN_MS", {
|
|
1184
|
+
enumerable: true,
|
|
1185
|
+
get: function () { return chunk2PTQBDJ6_cjs.DEFAULT_JWKS_REFRESH_COOLDOWN_MS; }
|
|
1186
|
+
});
|
|
1187
|
+
Object.defineProperty(exports, "EnvReader", {
|
|
1188
|
+
enumerable: true,
|
|
1189
|
+
get: function () { return chunk2PTQBDJ6_cjs.EnvReader; }
|
|
1762
1190
|
});
|
|
1763
1191
|
Object.defineProperty(exports, "ErrorCode", {
|
|
1764
1192
|
enumerable: true,
|
|
1765
|
-
get: function () { return
|
|
1193
|
+
get: function () { return chunk2PTQBDJ6_cjs.ErrorCode; }
|
|
1194
|
+
});
|
|
1195
|
+
Object.defineProperty(exports, "MIN_SECRET_LENGTH", {
|
|
1196
|
+
enumerable: true,
|
|
1197
|
+
get: function () { return chunk2PTQBDJ6_cjs.MIN_SECRET_LENGTH; }
|
|
1766
1198
|
});
|
|
1767
1199
|
Object.defineProperty(exports, "NotFoundError", {
|
|
1768
1200
|
enumerable: true,
|
|
1769
|
-
get: function () { return
|
|
1201
|
+
get: function () { return chunk2PTQBDJ6_cjs.NotFoundError; }
|
|
1770
1202
|
});
|
|
1771
1203
|
Object.defineProperty(exports, "OidcError", {
|
|
1772
1204
|
enumerable: true,
|
|
1773
|
-
get: function () { return
|
|
1205
|
+
get: function () { return chunk2PTQBDJ6_cjs.OidcError; }
|
|
1774
1206
|
});
|
|
1775
1207
|
Object.defineProperty(exports, "PermissionDeniedError", {
|
|
1776
1208
|
enumerable: true,
|
|
1777
|
-
get: function () { return
|
|
1209
|
+
get: function () { return chunk2PTQBDJ6_cjs.PermissionDeniedError; }
|
|
1210
|
+
});
|
|
1211
|
+
Object.defineProperty(exports, "REDACTED", {
|
|
1212
|
+
enumerable: true,
|
|
1213
|
+
get: function () { return chunk2PTQBDJ6_cjs.REDACTED; }
|
|
1778
1214
|
});
|
|
1779
1215
|
Object.defineProperty(exports, "RateLimitError", {
|
|
1780
1216
|
enumerable: true,
|
|
1781
|
-
get: function () { return
|
|
1217
|
+
get: function () { return chunk2PTQBDJ6_cjs.RateLimitError; }
|
|
1218
|
+
});
|
|
1219
|
+
Object.defineProperty(exports, "SENSITIVE_FIELD_PARTS", {
|
|
1220
|
+
enumerable: true,
|
|
1221
|
+
get: function () { return chunk2PTQBDJ6_cjs.SENSITIVE_FIELD_PARTS; }
|
|
1222
|
+
});
|
|
1223
|
+
Object.defineProperty(exports, "Secret", {
|
|
1224
|
+
enumerable: true,
|
|
1225
|
+
get: function () { return chunk2PTQBDJ6_cjs.Secret; }
|
|
1782
1226
|
});
|
|
1783
1227
|
Object.defineProperty(exports, "TimeoutError", {
|
|
1784
1228
|
enumerable: true,
|
|
1785
|
-
get: function () { return
|
|
1229
|
+
get: function () { return chunk2PTQBDJ6_cjs.TimeoutError; }
|
|
1786
1230
|
});
|
|
1787
1231
|
Object.defineProperty(exports, "UnavailableError", {
|
|
1788
1232
|
enumerable: true,
|
|
1789
|
-
get: function () { return
|
|
1233
|
+
get: function () { return chunk2PTQBDJ6_cjs.UnavailableError; }
|
|
1790
1234
|
});
|
|
1791
1235
|
Object.defineProperty(exports, "UnsupportedError", {
|
|
1792
1236
|
enumerable: true,
|
|
1793
|
-
get: function () { return
|
|
1237
|
+
get: function () { return chunk2PTQBDJ6_cjs.UnsupportedError; }
|
|
1794
1238
|
});
|
|
1795
1239
|
Object.defineProperty(exports, "ValidationError", {
|
|
1796
1240
|
enumerable: true,
|
|
1797
|
-
get: function () { return
|
|
1241
|
+
get: function () { return chunk2PTQBDJ6_cjs.ValidationError; }
|
|
1242
|
+
});
|
|
1243
|
+
Object.defineProperty(exports, "Verifier", {
|
|
1244
|
+
enumerable: true,
|
|
1245
|
+
get: function () { return chunk2PTQBDJ6_cjs.Verifier; }
|
|
1246
|
+
});
|
|
1247
|
+
Object.defineProperty(exports, "bearerToken", {
|
|
1248
|
+
enumerable: true,
|
|
1249
|
+
get: function () { return chunk2PTQBDJ6_cjs.bearerToken; }
|
|
1250
|
+
});
|
|
1251
|
+
Object.defineProperty(exports, "claimAt", {
|
|
1252
|
+
enumerable: true,
|
|
1253
|
+
get: function () { return chunk2PTQBDJ6_cjs.claimAt; }
|
|
1798
1254
|
});
|
|
1799
1255
|
Object.defineProperty(exports, "codeForStatus", {
|
|
1800
1256
|
enumerable: true,
|
|
1801
|
-
get: function () { return
|
|
1257
|
+
get: function () { return chunk2PTQBDJ6_cjs.codeForStatus; }
|
|
1802
1258
|
});
|
|
1803
1259
|
Object.defineProperty(exports, "errorForCode", {
|
|
1804
1260
|
enumerable: true,
|
|
1805
|
-
get: function () { return
|
|
1261
|
+
get: function () { return chunk2PTQBDJ6_cjs.errorForCode; }
|
|
1806
1262
|
});
|
|
1807
1263
|
Object.defineProperty(exports, "errorForStatus", {
|
|
1808
1264
|
enumerable: true,
|
|
1809
|
-
get: function () { return
|
|
1265
|
+
get: function () { return chunk2PTQBDJ6_cjs.errorForStatus; }
|
|
1266
|
+
});
|
|
1267
|
+
Object.defineProperty(exports, "extractRoles", {
|
|
1268
|
+
enumerable: true,
|
|
1269
|
+
get: function () { return chunk2PTQBDJ6_cjs.extractRoles; }
|
|
1270
|
+
});
|
|
1271
|
+
Object.defineProperty(exports, "hasAnyRole", {
|
|
1272
|
+
enumerable: true,
|
|
1273
|
+
get: function () { return chunk2PTQBDJ6_cjs.hasAnyRole; }
|
|
1810
1274
|
});
|
|
1811
1275
|
Object.defineProperty(exports, "isOidcError", {
|
|
1812
1276
|
enumerable: true,
|
|
1813
|
-
get: function () { return
|
|
1277
|
+
get: function () { return chunk2PTQBDJ6_cjs.isOidcError; }
|
|
1278
|
+
});
|
|
1279
|
+
Object.defineProperty(exports, "isSensitiveField", {
|
|
1280
|
+
enumerable: true,
|
|
1281
|
+
get: function () { return chunk2PTQBDJ6_cjs.isSensitiveField; }
|
|
1282
|
+
});
|
|
1283
|
+
Object.defineProperty(exports, "isSensitiveHeader", {
|
|
1284
|
+
enumerable: true,
|
|
1285
|
+
get: function () { return chunk2PTQBDJ6_cjs.isSensitiveHeader; }
|
|
1286
|
+
});
|
|
1287
|
+
Object.defineProperty(exports, "parseBool", {
|
|
1288
|
+
enumerable: true,
|
|
1289
|
+
get: function () { return chunk2PTQBDJ6_cjs.parseBool; }
|
|
1290
|
+
});
|
|
1291
|
+
Object.defineProperty(exports, "parseDuration", {
|
|
1292
|
+
enumerable: true,
|
|
1293
|
+
get: function () { return chunk2PTQBDJ6_cjs.parseDuration; }
|
|
1294
|
+
});
|
|
1295
|
+
Object.defineProperty(exports, "parseInteger", {
|
|
1296
|
+
enumerable: true,
|
|
1297
|
+
get: function () { return chunk2PTQBDJ6_cjs.parseInteger; }
|
|
1814
1298
|
});
|
|
1815
1299
|
Object.defineProperty(exports, "pollUntil", {
|
|
1816
1300
|
enumerable: true,
|
|
1817
|
-
get: function () { return
|
|
1301
|
+
get: function () { return chunk2PTQBDJ6_cjs.pollUntil; }
|
|
1818
1302
|
});
|
|
1819
1303
|
Object.defineProperty(exports, "reasonForCode", {
|
|
1820
1304
|
enumerable: true,
|
|
1821
|
-
get: function () { return
|
|
1305
|
+
get: function () { return chunk2PTQBDJ6_cjs.reasonForCode; }
|
|
1306
|
+
});
|
|
1307
|
+
Object.defineProperty(exports, "redactError", {
|
|
1308
|
+
enumerable: true,
|
|
1309
|
+
get: function () { return chunk2PTQBDJ6_cjs.redactError; }
|
|
1310
|
+
});
|
|
1311
|
+
Object.defineProperty(exports, "redactFields", {
|
|
1312
|
+
enumerable: true,
|
|
1313
|
+
get: function () { return chunk2PTQBDJ6_cjs.redactFields; }
|
|
1314
|
+
});
|
|
1315
|
+
Object.defineProperty(exports, "redactHeaders", {
|
|
1316
|
+
enumerable: true,
|
|
1317
|
+
get: function () { return chunk2PTQBDJ6_cjs.redactHeaders; }
|
|
1318
|
+
});
|
|
1319
|
+
Object.defineProperty(exports, "redactText", {
|
|
1320
|
+
enumerable: true,
|
|
1321
|
+
get: function () { return chunk2PTQBDJ6_cjs.redactText; }
|
|
1322
|
+
});
|
|
1323
|
+
Object.defineProperty(exports, "redactUrl", {
|
|
1324
|
+
enumerable: true,
|
|
1325
|
+
get: function () { return chunk2PTQBDJ6_cjs.redactUrl; }
|
|
1822
1326
|
});
|
|
1823
1327
|
Object.defineProperty(exports, "sleep", {
|
|
1824
1328
|
enumerable: true,
|
|
1825
|
-
get: function () { return
|
|
1329
|
+
get: function () { return chunk2PTQBDJ6_cjs.sleep; }
|
|
1826
1330
|
});
|
|
1827
1331
|
Object.defineProperty(exports, "throwIfAborted", {
|
|
1828
1332
|
enumerable: true,
|
|
1829
|
-
get: function () { return
|
|
1333
|
+
get: function () { return chunk2PTQBDJ6_cjs.throwIfAborted; }
|
|
1830
1334
|
});
|
|
1831
|
-
exports.DEFAULT_ALGORITHMS = DEFAULT_ALGORITHMS;
|
|
1832
|
-
exports.DEFAULT_CLOCK_SKEW_MS = DEFAULT_CLOCK_SKEW_MS;
|
|
1833
|
-
exports.DEFAULT_HTTP_TIMEOUT_MS = DEFAULT_HTTP_TIMEOUT_MS;
|
|
1834
|
-
exports.DEFAULT_JWKS_CACHE_TTL_MS = DEFAULT_JWKS_CACHE_TTL_MS;
|
|
1835
|
-
exports.DEFAULT_JWKS_REFRESH_COOLDOWN_MS = DEFAULT_JWKS_REFRESH_COOLDOWN_MS;
|
|
1836
1335
|
exports.DEFAULT_REQUEST_ID_HEADERS = DEFAULT_REQUEST_ID_HEADERS;
|
|
1837
1336
|
exports.DEFAULT_TIMEOUTS = DEFAULT_TIMEOUTS;
|
|
1838
1337
|
exports.DISCOVERY_PATH = DISCOVERY_PATH;
|
|
1839
|
-
exports.EnvReader = EnvReader;
|
|
1840
1338
|
exports.HttpStatusError = HttpStatusError;
|
|
1841
1339
|
exports.HttpTransport = HttpTransport;
|
|
1842
1340
|
exports.LANGUAGE = LANGUAGE;
|
|
1843
1341
|
exports.MAX_VENDOR_TEXT = MAX_VENDOR_TEXT;
|
|
1844
|
-
exports.MIN_SECRET_LENGTH = MIN_SECRET_LENGTH;
|
|
1845
1342
|
exports.NestAuthGuard = NestAuthGuard;
|
|
1846
1343
|
exports.OidcClient = OidcClient;
|
|
1847
1344
|
exports.OidcConfig = OidcConfig;
|
|
1848
1345
|
exports.PACKAGE_KEY = PACKAGE_KEY;
|
|
1849
1346
|
exports.PUBLIC_KEY = PUBLIC_KEY;
|
|
1850
1347
|
exports.Public = Public;
|
|
1851
|
-
exports.REDACTED = REDACTED;
|
|
1852
1348
|
exports.ROLES_KEY = ROLES_KEY;
|
|
1853
1349
|
exports.RetryPolicy = RetryPolicy;
|
|
1854
1350
|
exports.Roles = Roles;
|
|
1855
1351
|
exports.RolesGuard = RolesGuard;
|
|
1856
1352
|
exports.SDK_KIT_VERSION = SDK_KIT_VERSION;
|
|
1857
1353
|
exports.SDK_VERSION = SDK_VERSION;
|
|
1858
|
-
exports.SENSITIVE_FIELD_PARTS = SENSITIVE_FIELD_PARTS;
|
|
1859
|
-
exports.Secret = Secret;
|
|
1860
1354
|
exports.VENDOR_ENV = VENDOR_ENV;
|
|
1861
|
-
exports.Verifier = Verifier;
|
|
1862
|
-
exports.bearerToken = bearerToken;
|
|
1863
|
-
exports.claimAt = claimAt;
|
|
1864
1355
|
exports.createDispatcher = createDispatcher;
|
|
1865
1356
|
exports.definedOnly = definedOnly;
|
|
1866
1357
|
exports.describeCommonConfig = describeCommonConfig;
|
|
1867
1358
|
exports.expressAuth = expressAuth;
|
|
1868
|
-
exports.extractRoles = extractRoles;
|
|
1869
|
-
exports.hasAnyRole = hasAnyRole;
|
|
1870
1359
|
exports.healthStatus = healthStatus;
|
|
1871
1360
|
exports.isHealthyWord = isHealthyWord;
|
|
1872
1361
|
exports.isIdempotentMethod = isIdempotentMethod;
|
|
1873
1362
|
exports.isRetryableStatus = isRetryableStatus;
|
|
1874
|
-
exports.isSensitiveField = isSensitiveField;
|
|
1875
|
-
exports.isSensitiveHeader = isSensitiveHeader;
|
|
1876
1363
|
exports.mergeOptions = mergeOptions;
|
|
1877
|
-
exports.parseBool = parseBool;
|
|
1878
|
-
exports.parseDuration = parseDuration;
|
|
1879
|
-
exports.parseInteger = parseInteger;
|
|
1880
1364
|
exports.parseRetryAfter = parseRetryAfter;
|
|
1881
1365
|
exports.probeHealth = probeHealth;
|
|
1882
1366
|
exports.readCommonEnv = readCommonEnv;
|
|
1883
|
-
exports.redactError = redactError;
|
|
1884
|
-
exports.redactFields = redactFields;
|
|
1885
|
-
exports.redactHeaders = redactHeaders;
|
|
1886
1367
|
exports.redactSecretsInText = redactSecretsInText;
|
|
1887
|
-
exports.redactText = redactText;
|
|
1888
|
-
exports.redactUrl = redactUrl;
|
|
1889
1368
|
exports.relativeEndpoint = relativeEndpoint;
|
|
1890
1369
|
exports.requireRoles = requireRoles;
|
|
1891
1370
|
exports.resetNestExceptionsForTests = resetNestExceptionsForTests;
|