@apicurio/common-ui-components 2.0.10 → 2.0.12
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/dist/main.js +335 -308
- package/package.json +18 -18
package/dist/main.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import j, { createContext as gt, useContext as ut, useState as T, useEffect as pe, memo as Pe, forwardRef as ne, useCallback as Ne, useMemo as qe } from "react";
|
|
2
2
|
import { jsx as a, jsxs as v, Fragment as Re } from "react/jsx-runtime";
|
|
3
|
-
import { useInterval as _t, Tooltip as pt, EmptyState as
|
|
4
|
-
import { EllipsisVIcon as Nt, ChevronDownIcon as qt, ChevronRightIcon as Dt, ErrorCircleOIcon as Lt, SearchIcon as
|
|
5
|
-
import { DateTime as
|
|
6
|
-
import { Tr as
|
|
3
|
+
import { useInterval as _t, Tooltip as pt, EmptyState as oe, EmptyStateVariant as ft, EmptyStateHeader as ae, EmptyStateBody as ve, Spinner as te, Alert as wt, Dropdown as mt, MenuToggle as Je, DropdownList as vt, Divider as Ke, DropdownItem as St, Select as yt, SelectOption as bt, TextInput as ce, Button as le, TextArea as kt, AboutModal as Tt, TextContent as It, Text as De, TextVariants as Le, TextList as $e, TextListItem as b, Modal as Ue, Form as Be, FormGroup as He, Progress as Et, EmptyStateIcon as ze, ChipGroup as Ct, Chip as Pt, InputGroup as Rt, ButtonVariant as Ut, Pagination as xt, PaginationVariant as At, Skeleton as Ot } from "@patternfly/react-core";
|
|
4
|
+
import { EllipsisVIcon as Nt, ChevronDownIcon as qt, ChevronRightIcon as Dt, ErrorCircleOIcon as Lt, SearchIcon as $t } from "@patternfly/react-icons";
|
|
5
|
+
import { DateTime as ie } from "luxon";
|
|
6
|
+
import { Tr as de, Td as xe, Th as Ht, Table as jt, Thead as Ft, Tbody as Mt, ActionsColumn as Wt } from "@patternfly/react-table";
|
|
7
7
|
import Jt from "use-resize-observer";
|
|
8
8
|
const Kt = gt({
|
|
9
9
|
type: "none"
|
|
10
10
|
});
|
|
11
|
-
class
|
|
11
|
+
class Z extends Error {
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
Z.prototype.name = "InvalidTokenError";
|
|
14
14
|
function Bt(e) {
|
|
15
15
|
return decodeURIComponent(atob(e).replace(/(.)/g, (t, s) => {
|
|
16
16
|
let i = s.charCodeAt(0).toString(16).toUpperCase();
|
|
@@ -39,21 +39,21 @@ function zt(e) {
|
|
|
39
39
|
}
|
|
40
40
|
function Vt(e, t) {
|
|
41
41
|
if (typeof e != "string")
|
|
42
|
-
throw new
|
|
42
|
+
throw new Z("Invalid token specified: must be a string");
|
|
43
43
|
t || (t = {});
|
|
44
44
|
const s = t.header === !0 ? 0 : 1, i = e.split(".")[s];
|
|
45
45
|
if (typeof i != "string")
|
|
46
|
-
throw new
|
|
46
|
+
throw new Z(`Invalid token specified: missing part #${s + 1}`);
|
|
47
47
|
let r;
|
|
48
48
|
try {
|
|
49
49
|
r = zt(i);
|
|
50
50
|
} catch (n) {
|
|
51
|
-
throw new
|
|
51
|
+
throw new Z(`Invalid token specified: invalid base64 for part #${s + 1} (${n.message})`);
|
|
52
52
|
}
|
|
53
53
|
try {
|
|
54
54
|
return JSON.parse(r);
|
|
55
55
|
} catch (n) {
|
|
56
|
-
throw new
|
|
56
|
+
throw new Z(`Invalid token specified: invalid json for part #${s + 1} (${n.message})`);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
var Gt = {
|
|
@@ -65,39 +65,39 @@ var Gt = {
|
|
|
65
65
|
},
|
|
66
66
|
error: () => {
|
|
67
67
|
}
|
|
68
|
-
},
|
|
68
|
+
}, $, H, he = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.ERROR = 1] = "ERROR", e[e.WARN = 2] = "WARN", e[e.INFO = 3] = "INFO", e[e.DEBUG = 4] = "DEBUG", e))(he || {});
|
|
69
69
|
((e) => {
|
|
70
70
|
function t() {
|
|
71
|
-
|
|
71
|
+
$ = 3, H = Gt;
|
|
72
72
|
}
|
|
73
73
|
e.reset = t;
|
|
74
74
|
function s(r) {
|
|
75
75
|
if (!(0 <= r && r <= 4))
|
|
76
76
|
throw new Error("Invalid log level");
|
|
77
|
-
|
|
77
|
+
$ = r;
|
|
78
78
|
}
|
|
79
79
|
e.setLevel = s;
|
|
80
80
|
function i(r) {
|
|
81
81
|
H = r;
|
|
82
82
|
}
|
|
83
83
|
e.setLogger = i;
|
|
84
|
-
})(
|
|
85
|
-
var
|
|
84
|
+
})(he || (he = {}));
|
|
85
|
+
var p = class D {
|
|
86
86
|
constructor(t) {
|
|
87
87
|
this._name = t;
|
|
88
88
|
}
|
|
89
89
|
/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
|
|
90
90
|
debug(...t) {
|
|
91
|
-
|
|
91
|
+
$ >= 4 && H.debug(D._format(this._name, this._method), ...t);
|
|
92
92
|
}
|
|
93
93
|
info(...t) {
|
|
94
|
-
|
|
94
|
+
$ >= 3 && H.info(D._format(this._name, this._method), ...t);
|
|
95
95
|
}
|
|
96
96
|
warn(...t) {
|
|
97
|
-
|
|
97
|
+
$ >= 2 && H.warn(D._format(this._name, this._method), ...t);
|
|
98
98
|
}
|
|
99
99
|
error(...t) {
|
|
100
|
-
|
|
100
|
+
$ >= 1 && H.error(D._format(this._name, this._method), ...t);
|
|
101
101
|
}
|
|
102
102
|
/* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
|
|
103
103
|
throw(t) {
|
|
@@ -118,27 +118,27 @@ var _ = class D {
|
|
|
118
118
|
/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
|
|
119
119
|
// helpers for static class methods
|
|
120
120
|
static debug(t, ...s) {
|
|
121
|
-
|
|
121
|
+
$ >= 4 && H.debug(D._format(t), ...s);
|
|
122
122
|
}
|
|
123
123
|
static info(t, ...s) {
|
|
124
|
-
|
|
124
|
+
$ >= 3 && H.info(D._format(t), ...s);
|
|
125
125
|
}
|
|
126
126
|
static warn(t, ...s) {
|
|
127
|
-
|
|
127
|
+
$ >= 2 && H.warn(D._format(t), ...s);
|
|
128
128
|
}
|
|
129
129
|
static error(t, ...s) {
|
|
130
|
-
|
|
130
|
+
$ >= 1 && H.error(D._format(t), ...s);
|
|
131
131
|
}
|
|
132
132
|
/* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
|
|
133
133
|
};
|
|
134
|
-
|
|
135
|
-
var
|
|
134
|
+
he.reset();
|
|
135
|
+
var ge = class {
|
|
136
136
|
// IMPORTANT: doesn't validate the token
|
|
137
137
|
static decode(e) {
|
|
138
138
|
try {
|
|
139
139
|
return Vt(e);
|
|
140
140
|
} catch (t) {
|
|
141
|
-
throw
|
|
141
|
+
throw p.error("JwtUtils.decode", t), t;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
static async generateSignedJwt(e, t, s) {
|
|
@@ -152,7 +152,7 @@ var he = class {
|
|
|
152
152
|
), c = C.encodeBase64Url(new Uint8Array(o));
|
|
153
153
|
return `${n}.${c}`;
|
|
154
154
|
}
|
|
155
|
-
}, Qt = "10000000-1000-4000-8000-100000000000",
|
|
155
|
+
}, Qt = "10000000-1000-4000-8000-100000000000", Se = (e) => btoa([...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")), Ve = class L {
|
|
156
156
|
static _randomWord() {
|
|
157
157
|
const t = new Uint32Array(1);
|
|
158
158
|
return crypto.getRandomValues(t), t[0];
|
|
@@ -180,9 +180,9 @@ var he = class {
|
|
|
180
180
|
throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");
|
|
181
181
|
try {
|
|
182
182
|
const i = new TextEncoder().encode(t), r = await crypto.subtle.digest("SHA-256", i);
|
|
183
|
-
return
|
|
183
|
+
return Se(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
184
184
|
} catch (s) {
|
|
185
|
-
throw
|
|
185
|
+
throw p.error("CryptoUtils.generateCodeChallenge", s), s;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
@@ -190,7 +190,7 @@ var he = class {
|
|
|
190
190
|
*/
|
|
191
191
|
static generateBasicAuth(t, s) {
|
|
192
192
|
const r = new TextEncoder().encode([t, s].join(":"));
|
|
193
|
-
return
|
|
193
|
+
return Se(r);
|
|
194
194
|
}
|
|
195
195
|
/**
|
|
196
196
|
* Generates a hash of a string using a given algorithm
|
|
@@ -268,7 +268,7 @@ var he = class {
|
|
|
268
268
|
y: d.y
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
|
-
return await
|
|
271
|
+
return await ge.generateSignedJwt(h, l, r.privateKey);
|
|
272
272
|
} catch (d) {
|
|
273
273
|
throw d instanceof TypeError ? new Error(`Error exporting dpop public key: ${d.message}`) : d;
|
|
274
274
|
}
|
|
@@ -292,10 +292,10 @@ var he = class {
|
|
|
292
292
|
);
|
|
293
293
|
}
|
|
294
294
|
};
|
|
295
|
-
Ve.encodeBase64Url = (e) =>
|
|
295
|
+
Ve.encodeBase64Url = (e) => Se(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
296
296
|
var C = Ve, W = class {
|
|
297
297
|
constructor(e) {
|
|
298
|
-
this._name = e, this._callbacks = [], this._logger = new
|
|
298
|
+
this._name = e, this._callbacks = [], this._logger = new p(`Event('${this._name}')`);
|
|
299
299
|
}
|
|
300
300
|
addHandler(e) {
|
|
301
301
|
return this._callbacks.push(e), () => this.removeHandler(e);
|
|
@@ -309,7 +309,7 @@ var C = Ve, W = class {
|
|
|
309
309
|
for (const t of this._callbacks)
|
|
310
310
|
await t(...e);
|
|
311
311
|
}
|
|
312
|
-
},
|
|
312
|
+
}, je = class {
|
|
313
313
|
/**
|
|
314
314
|
* Populates a map of window features with a placement centered in front of
|
|
315
315
|
* the current window. If no explicit width is given, a default value is
|
|
@@ -322,11 +322,11 @@ var C = Ve, W = class {
|
|
|
322
322
|
static serialize(e) {
|
|
323
323
|
return Object.entries(e).filter(([, t]) => t != null).map(([t, s]) => `${t}=${typeof s != "boolean" ? s : s ? "yes" : "no"}`).join(",");
|
|
324
324
|
}
|
|
325
|
-
}, M = class
|
|
325
|
+
}, M = class re extends W {
|
|
326
326
|
constructor() {
|
|
327
|
-
super(...arguments), this._logger = new
|
|
328
|
-
const t = this._expiration -
|
|
329
|
-
this._logger.debug("timer completes in", t), this._expiration <=
|
|
327
|
+
super(...arguments), this._logger = new p(`Timer('${this._name}')`), this._timerHandle = null, this._expiration = 0, this._callback = () => {
|
|
328
|
+
const t = this._expiration - re.getEpochTime();
|
|
329
|
+
this._logger.debug("timer completes in", t), this._expiration <= re.getEpochTime() && (this.cancel(), super.raise());
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
332
|
// get the time
|
|
@@ -336,7 +336,7 @@ var C = Ve, W = class {
|
|
|
336
336
|
init(t) {
|
|
337
337
|
const s = this._logger.create("init");
|
|
338
338
|
t = Math.max(Math.floor(t), 1);
|
|
339
|
-
const i =
|
|
339
|
+
const i = re.getEpochTime() + t;
|
|
340
340
|
if (this.expiration === i && this._timerHandle) {
|
|
341
341
|
s.debug("skipping since already initialized for expiration at", this.expiration);
|
|
342
342
|
return;
|
|
@@ -351,17 +351,17 @@ var C = Ve, W = class {
|
|
|
351
351
|
cancel() {
|
|
352
352
|
this._logger.create("cancel"), this._timerHandle && (clearInterval(this._timerHandle), this._timerHandle = null);
|
|
353
353
|
}
|
|
354
|
-
},
|
|
354
|
+
}, ye = class {
|
|
355
355
|
static readParams(e, t = "query") {
|
|
356
356
|
if (!e) throw new TypeError("Invalid URL");
|
|
357
357
|
const i = new URL(e, "http://127.0.0.1")[t === "fragment" ? "hash" : "search"];
|
|
358
358
|
return new URLSearchParams(i.slice(1));
|
|
359
359
|
}
|
|
360
|
-
},
|
|
360
|
+
}, G = ";", B = class extends Error {
|
|
361
361
|
constructor(e, t) {
|
|
362
362
|
var s, i, r;
|
|
363
363
|
if (super(e.error_description || e.error || ""), this.form = t, this.name = "ErrorResponse", !e.error)
|
|
364
|
-
throw
|
|
364
|
+
throw p.error("ErrorResponse", "No error passed"), new Error("No error passed");
|
|
365
365
|
this.error = e.error, this.error_description = (s = e.error_description) != null ? s : null, this.error_uri = (i = e.error_uri) != null ? i : null, this.state = e.userState, this.session_state = (r = e.session_state) != null ? r : null, this.url_state = e.url_state;
|
|
366
366
|
}
|
|
367
367
|
}, Ae = class extends Error {
|
|
@@ -370,9 +370,9 @@ var C = Ve, W = class {
|
|
|
370
370
|
}
|
|
371
371
|
}, Xt = class {
|
|
372
372
|
constructor(e) {
|
|
373
|
-
this._logger = new
|
|
373
|
+
this._logger = new p("AccessTokenEvents"), this._expiringTimer = new M("Access token expiring"), this._expiredTimer = new M("Access token expired"), this._expiringNotificationTimeInSeconds = e.expiringNotificationTimeInSeconds;
|
|
374
374
|
}
|
|
375
|
-
load(e) {
|
|
375
|
+
async load(e) {
|
|
376
376
|
const t = this._logger.create("load");
|
|
377
377
|
if (e.access_token && e.expires_in !== void 0) {
|
|
378
378
|
const s = e.expires_in;
|
|
@@ -386,7 +386,7 @@ var C = Ve, W = class {
|
|
|
386
386
|
} else
|
|
387
387
|
this._expiringTimer.cancel(), this._expiredTimer.cancel();
|
|
388
388
|
}
|
|
389
|
-
unload() {
|
|
389
|
+
async unload() {
|
|
390
390
|
this._logger.debug("unload: canceling existing access token timers"), this._expiringTimer.cancel(), this._expiredTimer.cancel();
|
|
391
391
|
}
|
|
392
392
|
/**
|
|
@@ -415,7 +415,7 @@ var C = Ve, W = class {
|
|
|
415
415
|
}
|
|
416
416
|
}, Yt = class {
|
|
417
417
|
constructor(e, t, s, i, r) {
|
|
418
|
-
this._callback = e, this._client_id = t, this._intervalInSeconds = i, this._stopOnError = r, this._logger = new
|
|
418
|
+
this._callback = e, this._client_id = t, this._intervalInSeconds = i, this._stopOnError = r, this._logger = new p("CheckSessionIFrame"), this._timer = null, this._session_state = null, this._message = (o) => {
|
|
419
419
|
o.origin === this._frame_origin && o.source === this._frame.contentWindow && (o.data === "error" ? (this._logger.error("error message from check session op iframe"), this._stopOnError && this.stop()) : o.data === "changed" ? (this._logger.debug("changed message from check session op iframe"), this.stop(), this._callback()) : this._logger.debug(o.data + " message from check session op iframe"));
|
|
420
420
|
};
|
|
421
421
|
const n = new URL(s);
|
|
@@ -442,7 +442,7 @@ var C = Ve, W = class {
|
|
|
442
442
|
}
|
|
443
443
|
}, Ge = class {
|
|
444
444
|
constructor() {
|
|
445
|
-
this._logger = new
|
|
445
|
+
this._logger = new p("InMemoryWebStorage"), this._data = {};
|
|
446
446
|
}
|
|
447
447
|
clear() {
|
|
448
448
|
this._logger.create("clear"), this._data = {};
|
|
@@ -462,13 +462,13 @@ var C = Ve, W = class {
|
|
|
462
462
|
key(e) {
|
|
463
463
|
return Object.getOwnPropertyNames(this._data)[e];
|
|
464
464
|
}
|
|
465
|
-
},
|
|
465
|
+
}, be = class extends Error {
|
|
466
466
|
constructor(e, t) {
|
|
467
467
|
super(t), this.name = "ErrorDPoPNonce", this.nonce = e;
|
|
468
468
|
}
|
|
469
469
|
}, Oe = class {
|
|
470
470
|
constructor(e = [], t = null, s = {}) {
|
|
471
|
-
this._jwtHandler = t, this._extraHeaders = s, this._logger = new
|
|
471
|
+
this._jwtHandler = t, this._extraHeaders = s, this._logger = new p("JsonService"), this._contentTypes = [], this._contentTypes.push(...e, "application/json"), t && this._contentTypes.push("application/jwt");
|
|
472
472
|
}
|
|
473
473
|
async fetchWithTimeout(e, t = {}) {
|
|
474
474
|
const { timeoutInSeconds: s, ...i } = t;
|
|
@@ -494,7 +494,7 @@ var C = Ve, W = class {
|
|
|
494
494
|
const r = this._logger.create("getJson"), n = {
|
|
495
495
|
Accept: this._contentTypes.join(", ")
|
|
496
496
|
};
|
|
497
|
-
t && (r.debug("token passed, setting Authorization header"), n.Authorization = "Bearer " + t), this.
|
|
497
|
+
t && (r.debug("token passed, setting Authorization header"), n.Authorization = "Bearer " + t), this._appendExtraHeaders(n);
|
|
498
498
|
let o;
|
|
499
499
|
try {
|
|
500
500
|
r.debug("url:", e), o = await this.fetchWithTimeout(e, { method: "GET", headers: n, timeoutInSeconds: i, credentials: s });
|
|
@@ -527,52 +527,57 @@ var C = Ve, W = class {
|
|
|
527
527
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
528
528
|
...n
|
|
529
529
|
};
|
|
530
|
-
s !== void 0 && (c.Authorization = "Basic " + s), this.
|
|
530
|
+
s !== void 0 && (c.Authorization = "Basic " + s), this._appendExtraHeaders(c);
|
|
531
531
|
let l;
|
|
532
532
|
try {
|
|
533
533
|
o.debug("url:", e), l = await this.fetchWithTimeout(e, { method: "POST", headers: c, body: t, timeoutInSeconds: i, credentials: r });
|
|
534
|
-
} catch (
|
|
535
|
-
throw o.error("Network error"),
|
|
534
|
+
} catch (_) {
|
|
535
|
+
throw o.error("Network error"), _;
|
|
536
536
|
}
|
|
537
537
|
o.debug("HTTP response received, status", l.status);
|
|
538
538
|
const d = l.headers.get("Content-Type");
|
|
539
|
-
if (d && !this._contentTypes.find((
|
|
539
|
+
if (d && !this._contentTypes.find((_) => d.startsWith(_)))
|
|
540
540
|
throw new Error(`Invalid response Content-Type: ${d ?? "undefined"}, from URL: ${e}`);
|
|
541
541
|
const h = await l.text();
|
|
542
542
|
let g = {};
|
|
543
543
|
if (h)
|
|
544
544
|
try {
|
|
545
545
|
g = JSON.parse(h);
|
|
546
|
-
} catch (
|
|
547
|
-
throw o.error("Error parsing JSON response",
|
|
546
|
+
} catch (_) {
|
|
547
|
+
throw o.error("Error parsing JSON response", _), l.ok ? _ : new Error(`${l.statusText} (${l.status})`);
|
|
548
548
|
}
|
|
549
549
|
if (!l.ok) {
|
|
550
550
|
if (o.error("Error from server:", g), l.headers.has("dpop-nonce")) {
|
|
551
|
-
const
|
|
552
|
-
throw new
|
|
551
|
+
const _ = l.headers.get("dpop-nonce");
|
|
552
|
+
throw new be(_, `${JSON.stringify(g)}`);
|
|
553
553
|
}
|
|
554
554
|
throw g.error ? new B(g, t) : new Error(`${l.statusText} (${l.status}): ${JSON.stringify(g)}`);
|
|
555
555
|
}
|
|
556
556
|
return g;
|
|
557
557
|
}
|
|
558
|
-
|
|
558
|
+
_appendExtraHeaders(e) {
|
|
559
559
|
const t = this._logger.create("appendExtraHeaders"), s = Object.keys(this._extraHeaders), i = [
|
|
560
|
-
"authorization",
|
|
561
560
|
"accept",
|
|
562
561
|
"content-type"
|
|
562
|
+
], r = [
|
|
563
|
+
"authorization"
|
|
563
564
|
];
|
|
564
|
-
s.length !== 0 && s.forEach((
|
|
565
|
-
if (i.includes(
|
|
566
|
-
t.warn("Protected header could not be
|
|
565
|
+
s.length !== 0 && s.forEach((n) => {
|
|
566
|
+
if (i.includes(n.toLocaleLowerCase())) {
|
|
567
|
+
t.warn("Protected header could not be set", n, i);
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
if (r.includes(n.toLocaleLowerCase()) && Object.keys(e).includes(n)) {
|
|
571
|
+
t.warn("Header could not be overridden", n, r);
|
|
567
572
|
return;
|
|
568
573
|
}
|
|
569
|
-
const
|
|
570
|
-
|
|
574
|
+
const o = typeof this._extraHeaders[n] == "function" ? this._extraHeaders[n]() : this._extraHeaders[n];
|
|
575
|
+
o && o !== "" && (e[n] = o);
|
|
571
576
|
});
|
|
572
577
|
}
|
|
573
578
|
}, Zt = class {
|
|
574
579
|
constructor(e) {
|
|
575
|
-
this._settings = e, this._logger = new
|
|
580
|
+
this._settings = e, this._logger = new p("MetadataService"), this._signingKeys = null, this._metadata = null, this._metadataUrl = this._settings.metadataUrl, this._jsonService = new Oe(
|
|
576
581
|
["application/jwk-set+json"],
|
|
577
582
|
null,
|
|
578
583
|
this._settings.extraHeaders
|
|
@@ -589,7 +594,7 @@ var C = Ve, W = class {
|
|
|
589
594
|
throw e.throw(new Error("No authority or metadataUrl configured on settings")), null;
|
|
590
595
|
e.debug("getting metadata from", this._metadataUrl);
|
|
591
596
|
const t = await this._jsonService.getJson(this._metadataUrl, { credentials: this._fetchRequestCredentials, timeoutInSeconds: this._settings.requestTimeoutInSeconds });
|
|
592
|
-
return e.debug("merging remote JSON with seed metadata"), this._metadata = Object.assign({}, this._settings.metadataSeed
|
|
597
|
+
return e.debug("merging remote JSON with seed metadata"), this._metadata = Object.assign({}, t, this._settings.metadataSeed), this._metadata;
|
|
593
598
|
}
|
|
594
599
|
getIssuer() {
|
|
595
600
|
return this._getMetadataProperty("issuer");
|
|
@@ -642,7 +647,7 @@ var C = Ve, W = class {
|
|
|
642
647
|
prefix: e = "oidc.",
|
|
643
648
|
store: t = localStorage
|
|
644
649
|
} = {}) {
|
|
645
|
-
this._logger = new
|
|
650
|
+
this._logger = new p("WebStorageStateStore"), this._store = t, this._prefix = e;
|
|
646
651
|
}
|
|
647
652
|
async set(e, t) {
|
|
648
653
|
this._logger.create(`set('${e}')`), e = this._prefix + e, await this._store.setItem(e, t);
|
|
@@ -664,7 +669,7 @@ var C = Ve, W = class {
|
|
|
664
669
|
}
|
|
665
670
|
return t;
|
|
666
671
|
}
|
|
667
|
-
}, es = "code", ts = "openid", ss = "client_secret_post", is = 60 * 15,
|
|
672
|
+
}, es = "code", ts = "openid", ss = "client_secret_post", is = 60 * 15, ke = class {
|
|
668
673
|
constructor({
|
|
669
674
|
// metadata related
|
|
670
675
|
authority: e,
|
|
@@ -681,7 +686,7 @@ var C = Ve, W = class {
|
|
|
681
686
|
post_logout_redirect_uri: h,
|
|
682
687
|
client_authentication: g = ss,
|
|
683
688
|
// optional protocol
|
|
684
|
-
prompt:
|
|
689
|
+
prompt: _,
|
|
685
690
|
display: S,
|
|
686
691
|
max_age: x,
|
|
687
692
|
ui_locales: k,
|
|
@@ -692,37 +697,37 @@ var C = Ve, W = class {
|
|
|
692
697
|
filterProtocolClaims: P = !0,
|
|
693
698
|
loadUserInfo: F = !1,
|
|
694
699
|
requestTimeoutInSeconds: R,
|
|
695
|
-
staleStateAgeInSeconds:
|
|
700
|
+
staleStateAgeInSeconds: w = is,
|
|
696
701
|
mergeClaimsStrategy: E = { array: "replace" },
|
|
697
702
|
disablePKCE: U = !1,
|
|
698
703
|
// other behavior
|
|
699
704
|
stateStore: y,
|
|
700
705
|
revokeTokenAdditionalContentTypes: z,
|
|
701
706
|
fetchRequestCredentials: f,
|
|
702
|
-
refreshTokenAllowedScope:
|
|
707
|
+
refreshTokenAllowedScope: m,
|
|
703
708
|
// extra
|
|
704
709
|
extraQueryParams: q = {},
|
|
705
710
|
extraTokenParams: J = {},
|
|
706
711
|
extraHeaders: K = {},
|
|
707
|
-
dpop:
|
|
708
|
-
omitScopeWhenRequesting:
|
|
712
|
+
dpop: X,
|
|
713
|
+
omitScopeWhenRequesting: fe = !1
|
|
709
714
|
}) {
|
|
710
|
-
var
|
|
711
|
-
if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = r, this.signingKeys = i, this.client_id = n, this.client_secret = o, this.response_type = c, this.scope = l, this.redirect_uri = d, this.post_logout_redirect_uri = h, this.client_authentication = g, this.prompt =
|
|
715
|
+
var Y;
|
|
716
|
+
if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = r, this.signingKeys = i, this.client_id = n, this.client_secret = o, this.response_type = c, this.scope = l, this.redirect_uri = d, this.post_logout_redirect_uri = h, this.client_authentication = g, this.prompt = _, this.display = S, this.max_age = x, this.ui_locales = k, this.acr_values = A, this.resource = I, this.response_mode = N, this.filterProtocolClaims = P ?? !0, this.loadUserInfo = !!F, this.staleStateAgeInSeconds = w, this.mergeClaimsStrategy = E, this.omitScopeWhenRequesting = fe, this.disablePKCE = !!U, this.revokeTokenAdditionalContentTypes = z, this.fetchRequestCredentials = f || "same-origin", this.requestTimeoutInSeconds = R, y)
|
|
712
717
|
this.stateStore = y;
|
|
713
718
|
else {
|
|
714
|
-
const
|
|
715
|
-
this.stateStore = new Qe({ store:
|
|
719
|
+
const se = typeof window < "u" ? window.localStorage : new Ge();
|
|
720
|
+
this.stateStore = new Qe({ store: se });
|
|
716
721
|
}
|
|
717
|
-
if (this.refreshTokenAllowedScope =
|
|
722
|
+
if (this.refreshTokenAllowedScope = m, this.extraQueryParams = q, this.extraTokenParams = J, this.extraHeaders = K, this.dpop = X, this.dpop && !((Y = this.dpop) != null && Y.store))
|
|
718
723
|
throw new Error("A DPoPStore is required when dpop is enabled");
|
|
719
724
|
}
|
|
720
725
|
}, rs = class {
|
|
721
726
|
constructor(e, t) {
|
|
722
|
-
this._settings = e, this._metadataService = t, this._logger = new
|
|
727
|
+
this._settings = e, this._metadataService = t, this._logger = new p("UserInfoService"), this._getClaimsFromJwt = async (s) => {
|
|
723
728
|
const i = this._logger.create("_getClaimsFromJwt");
|
|
724
729
|
try {
|
|
725
|
-
const r =
|
|
730
|
+
const r = ge.decode(s);
|
|
726
731
|
return i.debug("JWT decoding successful"), r;
|
|
727
732
|
} catch (r) {
|
|
728
733
|
throw i.error("Error parsing JWT response"), r;
|
|
@@ -747,7 +752,7 @@ var C = Ve, W = class {
|
|
|
747
752
|
}
|
|
748
753
|
}, Xe = class {
|
|
749
754
|
constructor(e, t) {
|
|
750
|
-
this._settings = e, this._metadataService = t, this._logger = new
|
|
755
|
+
this._settings = e, this._metadataService = t, this._logger = new p("TokenClient"), this._jsonService = new Oe(
|
|
751
756
|
this._settings.revokeTokenAdditionalContentTypes,
|
|
752
757
|
null,
|
|
753
758
|
this._settings.extraHeaders
|
|
@@ -769,12 +774,12 @@ var C = Ve, W = class {
|
|
|
769
774
|
const o = this._logger.create("exchangeCode");
|
|
770
775
|
s || o.throw(new Error("A client_id is required")), t || o.throw(new Error("A redirect_uri is required")), n.code || o.throw(new Error("A code is required"));
|
|
771
776
|
const c = new URLSearchParams({ grant_type: e, redirect_uri: t });
|
|
772
|
-
for (const [g,
|
|
773
|
-
|
|
777
|
+
for (const [g, _] of Object.entries(n))
|
|
778
|
+
_ != null && c.set(g, _);
|
|
774
779
|
let l;
|
|
775
780
|
switch (this._settings.client_authentication) {
|
|
776
781
|
case "client_secret_basic":
|
|
777
|
-
if (
|
|
782
|
+
if (i == null)
|
|
778
783
|
throw o.throw(new Error("A client_secret is required")), null;
|
|
779
784
|
l = C.generateBasicAuth(s, i);
|
|
780
785
|
break;
|
|
@@ -814,7 +819,7 @@ var C = Ve, W = class {
|
|
|
814
819
|
let c;
|
|
815
820
|
switch (this._settings.client_authentication) {
|
|
816
821
|
case "client_secret_basic":
|
|
817
|
-
if (
|
|
822
|
+
if (s == null)
|
|
818
823
|
throw n.throw(new Error("A client_secret is required")), null;
|
|
819
824
|
c = C.generateBasicAuth(t, s);
|
|
820
825
|
break;
|
|
@@ -843,12 +848,12 @@ var C = Ve, W = class {
|
|
|
843
848
|
const o = this._logger.create("exchangeRefreshToken");
|
|
844
849
|
t || o.throw(new Error("A client_id is required")), n.refresh_token || o.throw(new Error("A refresh_token is required"));
|
|
845
850
|
const c = new URLSearchParams({ grant_type: e });
|
|
846
|
-
for (const [g,
|
|
847
|
-
Array.isArray(
|
|
851
|
+
for (const [g, _] of Object.entries(n))
|
|
852
|
+
Array.isArray(_) ? _.forEach((S) => c.append(g, S)) : _ != null && c.set(g, _);
|
|
848
853
|
let l;
|
|
849
854
|
switch (this._settings.client_authentication) {
|
|
850
855
|
case "client_secret_basic":
|
|
851
|
-
if (
|
|
856
|
+
if (s == null)
|
|
852
857
|
throw o.throw(new Error("A client_secret is required")), null;
|
|
853
858
|
l = C.generateBasicAuth(t, s);
|
|
854
859
|
break;
|
|
@@ -879,15 +884,15 @@ var C = Ve, W = class {
|
|
|
879
884
|
}
|
|
880
885
|
}, ns = class {
|
|
881
886
|
constructor(e, t, s) {
|
|
882
|
-
this._settings = e, this._metadataService = t, this._claimsService = s, this._logger = new
|
|
887
|
+
this._settings = e, this._metadataService = t, this._claimsService = s, this._logger = new p("ResponseValidator"), this._userInfoService = new rs(this._settings, this._metadataService), this._tokenClient = new Xe(this._settings, this._metadataService);
|
|
883
888
|
}
|
|
884
889
|
async validateSigninResponse(e, t, s) {
|
|
885
890
|
const i = this._logger.create("validateSigninResponse");
|
|
886
891
|
this._processSigninState(e, t), i.debug("state processed"), await this._processCode(e, t, s), i.debug("code processed"), e.isOpenId && this._validateIdTokenAttributes(e), i.debug("tokens validated"), await this._processClaims(e, t == null ? void 0 : t.skipUserInfo, e.isOpenId), i.debug("claims processed");
|
|
887
892
|
}
|
|
888
893
|
async validateCredentialsResponse(e, t) {
|
|
889
|
-
const s = this._logger.create("validateCredentialsResponse");
|
|
890
|
-
|
|
894
|
+
const s = this._logger.create("validateCredentialsResponse"), i = e.isOpenId && !!e.id_token;
|
|
895
|
+
i && this._validateIdTokenAttributes(e), s.debug("tokens validated"), await this._processClaims(e, t, i), s.debug("claims processed");
|
|
891
896
|
}
|
|
892
897
|
async validateRefreshResponse(e, t) {
|
|
893
898
|
var s, i;
|
|
@@ -939,19 +944,19 @@ var C = Ve, W = class {
|
|
|
939
944
|
var s;
|
|
940
945
|
const i = this._logger.create("_validateIdTokenAttributes");
|
|
941
946
|
i.debug("decoding ID Token JWT");
|
|
942
|
-
const r =
|
|
947
|
+
const r = ge.decode((s = e.id_token) != null ? s : "");
|
|
943
948
|
if (r.sub || i.throw(new Error("ID Token is missing a subject claim")), t) {
|
|
944
|
-
const n =
|
|
949
|
+
const n = ge.decode(t);
|
|
945
950
|
r.sub !== n.sub && i.throw(new Error("sub in id_token does not match current sub")), r.auth_time && r.auth_time !== n.auth_time && i.throw(new Error("auth_time in id_token does not match original auth_time")), r.azp && r.azp !== n.azp && i.throw(new Error("azp in id_token does not match original azp")), !r.azp && n.azp && i.throw(new Error("azp not in id_token, but present in original id_token"));
|
|
946
951
|
}
|
|
947
952
|
e.profile = r;
|
|
948
953
|
}
|
|
949
|
-
},
|
|
954
|
+
}, ue = class Te {
|
|
950
955
|
constructor(t) {
|
|
951
956
|
this.id = t.id || C.generateUUIDv4(), this.data = t.data, t.created && t.created > 0 ? this.created = t.created : this.created = M.getEpochTime(), this.request_type = t.request_type, this.url_state = t.url_state;
|
|
952
957
|
}
|
|
953
958
|
toStorageString() {
|
|
954
|
-
return new
|
|
959
|
+
return new p("State").create("toStorageString"), JSON.stringify({
|
|
955
960
|
id: this.id,
|
|
956
961
|
data: this.data,
|
|
957
962
|
created: this.created,
|
|
@@ -960,17 +965,17 @@ var C = Ve, W = class {
|
|
|
960
965
|
});
|
|
961
966
|
}
|
|
962
967
|
static fromStorageString(t) {
|
|
963
|
-
return
|
|
968
|
+
return p.createStatic("State", "fromStorageString"), Promise.resolve(new Te(JSON.parse(t)));
|
|
964
969
|
}
|
|
965
970
|
static async clearStaleState(t, s) {
|
|
966
|
-
const i =
|
|
971
|
+
const i = p.createStatic("State", "clearStaleState"), r = M.getEpochTime() - s, n = await t.getAllKeys();
|
|
967
972
|
i.debug("got keys", n);
|
|
968
973
|
for (let o = 0; o < n.length; o++) {
|
|
969
974
|
const c = n[o], l = await t.get(c);
|
|
970
975
|
let d = !1;
|
|
971
976
|
if (l)
|
|
972
977
|
try {
|
|
973
|
-
const h = await
|
|
978
|
+
const h = await Te.fromStorageString(l);
|
|
974
979
|
i.debug("got item from key:", c, h.created), h.created <= r && (d = !0);
|
|
975
980
|
} catch (h) {
|
|
976
981
|
i.error("Error parsing state for key:", c, h), d = !0;
|
|
@@ -980,20 +985,20 @@ var C = Ve, W = class {
|
|
|
980
985
|
d && (i.debug("removed item for key:", c), t.remove(c));
|
|
981
986
|
}
|
|
982
987
|
}
|
|
983
|
-
}, Ye = class
|
|
988
|
+
}, Ye = class Ie extends ue {
|
|
984
989
|
constructor(t) {
|
|
985
990
|
super(t), this.code_verifier = t.code_verifier, this.code_challenge = t.code_challenge, this.authority = t.authority, this.client_id = t.client_id, this.redirect_uri = t.redirect_uri, this.scope = t.scope, this.client_secret = t.client_secret, this.extraTokenParams = t.extraTokenParams, this.response_mode = t.response_mode, this.skipUserInfo = t.skipUserInfo;
|
|
986
991
|
}
|
|
987
992
|
static async create(t) {
|
|
988
993
|
const s = t.code_verifier === !0 ? C.generateCodeVerifier() : t.code_verifier || void 0, i = s ? await C.generateCodeChallenge(s) : void 0;
|
|
989
|
-
return new
|
|
994
|
+
return new Ie({
|
|
990
995
|
...t,
|
|
991
996
|
code_verifier: s,
|
|
992
997
|
code_challenge: i
|
|
993
998
|
});
|
|
994
999
|
}
|
|
995
1000
|
toStorageString() {
|
|
996
|
-
return new
|
|
1001
|
+
return new p("SigninState").create("toStorageString"), JSON.stringify({
|
|
997
1002
|
id: this.id,
|
|
998
1003
|
data: this.data,
|
|
999
1004
|
created: this.created,
|
|
@@ -1011,9 +1016,9 @@ var C = Ve, W = class {
|
|
|
1011
1016
|
});
|
|
1012
1017
|
}
|
|
1013
1018
|
static fromStorageString(t) {
|
|
1014
|
-
|
|
1019
|
+
p.createStatic("SigninState", "fromStorageString");
|
|
1015
1020
|
const s = JSON.parse(t);
|
|
1016
|
-
return
|
|
1021
|
+
return Ie.create(s);
|
|
1017
1022
|
}
|
|
1018
1023
|
}, Ze = class et {
|
|
1019
1024
|
constructor(t) {
|
|
@@ -1033,7 +1038,7 @@ var C = Ve, W = class {
|
|
|
1033
1038
|
request_type: d,
|
|
1034
1039
|
client_secret: h,
|
|
1035
1040
|
nonce: g,
|
|
1036
|
-
url_state:
|
|
1041
|
+
url_state: _,
|
|
1037
1042
|
resource: S,
|
|
1038
1043
|
skipUserInfo: x,
|
|
1039
1044
|
extraQueryParams: k,
|
|
@@ -1058,7 +1063,7 @@ var C = Ve, W = class {
|
|
|
1058
1063
|
const R = await Ye.create({
|
|
1059
1064
|
data: c,
|
|
1060
1065
|
request_type: d,
|
|
1061
|
-
url_state:
|
|
1066
|
+
url_state: _,
|
|
1062
1067
|
code_verifier: !I,
|
|
1063
1068
|
client_id: i,
|
|
1064
1069
|
authority: s,
|
|
@@ -1068,24 +1073,24 @@ var C = Ve, W = class {
|
|
|
1068
1073
|
scope: o,
|
|
1069
1074
|
extraTokenParams: A,
|
|
1070
1075
|
skipUserInfo: x
|
|
1071
|
-
}),
|
|
1072
|
-
|
|
1076
|
+
}), w = new URL(t);
|
|
1077
|
+
w.searchParams.append("client_id", i), w.searchParams.append("redirect_uri", r), w.searchParams.append("response_type", n), P || w.searchParams.append("scope", o), g && w.searchParams.append("nonce", g), N && w.searchParams.append("dpop_jkt", N);
|
|
1073
1078
|
let E = R.id;
|
|
1074
|
-
|
|
1079
|
+
_ && (E = `${E}${G}${_}`), w.searchParams.append("state", E), R.code_challenge && (w.searchParams.append("code_challenge", R.code_challenge), w.searchParams.append("code_challenge_method", "S256")), S && (Array.isArray(S) ? S : [S]).forEach((y) => w.searchParams.append("resource", y));
|
|
1075
1080
|
for (const [U, y] of Object.entries({ response_mode: l, ...F, ...k }))
|
|
1076
|
-
y != null &&
|
|
1081
|
+
y != null && w.searchParams.append(U, y.toString());
|
|
1077
1082
|
return new et({
|
|
1078
|
-
url:
|
|
1083
|
+
url: w.href,
|
|
1079
1084
|
state: R
|
|
1080
1085
|
});
|
|
1081
1086
|
}
|
|
1082
1087
|
};
|
|
1083
|
-
Ze._logger = new
|
|
1084
|
-
var os = Ze, as = "openid",
|
|
1088
|
+
Ze._logger = new p("SigninRequest");
|
|
1089
|
+
var os = Ze, as = "openid", we = class {
|
|
1085
1090
|
constructor(e) {
|
|
1086
1091
|
if (this.access_token = "", this.token_type = "", this.profile = {}, this.state = e.get("state"), this.session_state = e.get("session_state"), this.state) {
|
|
1087
|
-
const t = decodeURIComponent(this.state).split(
|
|
1088
|
-
this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(
|
|
1092
|
+
const t = decodeURIComponent(this.state).split(G);
|
|
1093
|
+
this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(G));
|
|
1089
1094
|
}
|
|
1090
1095
|
this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri"), this.code = e.get("code");
|
|
1091
1096
|
}
|
|
@@ -1108,19 +1113,28 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1108
1113
|
post_logout_redirect_uri: i,
|
|
1109
1114
|
extraQueryParams: r,
|
|
1110
1115
|
request_type: n,
|
|
1111
|
-
client_id: o
|
|
1116
|
+
client_id: o,
|
|
1117
|
+
url_state: c
|
|
1112
1118
|
}) {
|
|
1113
|
-
if (this._logger = new
|
|
1119
|
+
if (this._logger = new p("SignoutRequest"), !e)
|
|
1114
1120
|
throw this._logger.error("ctor: No url passed"), new Error("url");
|
|
1115
|
-
const
|
|
1116
|
-
s &&
|
|
1117
|
-
|
|
1118
|
-
d
|
|
1119
|
-
|
|
1121
|
+
const l = new URL(e);
|
|
1122
|
+
if (s && l.searchParams.append("id_token_hint", s), o && l.searchParams.append("client_id", o), i && (l.searchParams.append("post_logout_redirect_uri", i), t || c)) {
|
|
1123
|
+
this.state = new ue({ data: t, request_type: n, url_state: c });
|
|
1124
|
+
let d = this.state.id;
|
|
1125
|
+
c && (d = `${d}${G}${c}`), l.searchParams.append("state", d);
|
|
1126
|
+
}
|
|
1127
|
+
for (const [d, h] of Object.entries({ ...r }))
|
|
1128
|
+
h != null && l.searchParams.append(d, h.toString());
|
|
1129
|
+
this.url = l.href;
|
|
1120
1130
|
}
|
|
1121
1131
|
}, ls = class {
|
|
1122
1132
|
constructor(e) {
|
|
1123
|
-
this.state = e.get("state"), this.
|
|
1133
|
+
if (this.state = e.get("state"), this.state) {
|
|
1134
|
+
const t = decodeURIComponent(this.state).split(G);
|
|
1135
|
+
this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(G));
|
|
1136
|
+
}
|
|
1137
|
+
this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri");
|
|
1124
1138
|
}
|
|
1125
1139
|
}, ds = [
|
|
1126
1140
|
"nbf",
|
|
@@ -1134,7 +1148,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1134
1148
|
// https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken
|
|
1135
1149
|
], hs = ["sub", "iss", "aud", "exp", "iat"], gs = class {
|
|
1136
1150
|
constructor(e) {
|
|
1137
|
-
this._settings = e, this._logger = new
|
|
1151
|
+
this._settings = e, this._logger = new p("ClaimsService");
|
|
1138
1152
|
}
|
|
1139
1153
|
filterProtocolClaims(e) {
|
|
1140
1154
|
const t = { ...e };
|
|
@@ -1168,7 +1182,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1168
1182
|
}
|
|
1169
1183
|
}, us = class {
|
|
1170
1184
|
constructor(e, t) {
|
|
1171
|
-
this._logger = new
|
|
1185
|
+
this._logger = new p("OidcClient"), this.settings = e instanceof ke ? e : new ke(e), this.metadataService = t ?? new Zt(this.settings), this._claimsService = new gs(this.settings), this._validator = new ns(this.settings, this.metadataService, this._claimsService), this._tokenClient = new Xe(this.settings, this.metadataService);
|
|
1172
1186
|
}
|
|
1173
1187
|
async createSigninRequest({
|
|
1174
1188
|
state: e,
|
|
@@ -1183,7 +1197,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1183
1197
|
response_type: d = this.settings.response_type,
|
|
1184
1198
|
scope: h = this.settings.scope,
|
|
1185
1199
|
redirect_uri: g = this.settings.redirect_uri,
|
|
1186
|
-
prompt:
|
|
1200
|
+
prompt: _ = this.settings.prompt,
|
|
1187
1201
|
display: S = this.settings.display,
|
|
1188
1202
|
max_age: x = this.settings.max_age,
|
|
1189
1203
|
ui_locales: k = this.settings.ui_locales,
|
|
@@ -1193,7 +1207,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1193
1207
|
extraQueryParams: P = this.settings.extraQueryParams,
|
|
1194
1208
|
extraTokenParams: F = this.settings.extraTokenParams,
|
|
1195
1209
|
dpopJkt: R,
|
|
1196
|
-
omitScopeWhenRequesting:
|
|
1210
|
+
omitScopeWhenRequesting: w = this.settings.omitScopeWhenRequesting
|
|
1197
1211
|
}) {
|
|
1198
1212
|
const E = this._logger.create("createSigninRequest");
|
|
1199
1213
|
if (d !== "code")
|
|
@@ -1209,7 +1223,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1209
1223
|
scope: h,
|
|
1210
1224
|
state_data: e,
|
|
1211
1225
|
url_state: l,
|
|
1212
|
-
prompt:
|
|
1226
|
+
prompt: _,
|
|
1213
1227
|
display: S,
|
|
1214
1228
|
max_age: x,
|
|
1215
1229
|
ui_locales: k,
|
|
@@ -1228,14 +1242,14 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1228
1242
|
skipUserInfo: o,
|
|
1229
1243
|
nonce: c,
|
|
1230
1244
|
disablePKCE: this.settings.disablePKCE,
|
|
1231
|
-
omitScopeWhenRequesting:
|
|
1245
|
+
omitScopeWhenRequesting: w
|
|
1232
1246
|
});
|
|
1233
1247
|
await this.clearStaleState();
|
|
1234
1248
|
const z = y.state;
|
|
1235
1249
|
return await this.settings.stateStore.set(z.id, z.toStorageString()), y;
|
|
1236
1250
|
}
|
|
1237
1251
|
async readSigninResponseState(e, t = !1) {
|
|
1238
|
-
const s = this._logger.create("readSigninResponseState"), i = new
|
|
1252
|
+
const s = this._logger.create("readSigninResponseState"), i = new we(ye.readParams(e, this.settings.response_mode));
|
|
1239
1253
|
if (!i.state)
|
|
1240
1254
|
throw s.throw(new Error("No state in response")), null;
|
|
1241
1255
|
const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
|
|
@@ -1243,22 +1257,22 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1243
1257
|
throw s.throw(new Error("No matching state found in storage")), null;
|
|
1244
1258
|
return { state: await Ye.fromStorageString(r), response: i };
|
|
1245
1259
|
}
|
|
1246
|
-
async processSigninResponse(e, t) {
|
|
1247
|
-
const
|
|
1248
|
-
if (
|
|
1249
|
-
const
|
|
1250
|
-
t = { ...t, DPoP:
|
|
1260
|
+
async processSigninResponse(e, t, s = !0) {
|
|
1261
|
+
const i = this._logger.create("processSigninResponse"), { state: r, response: n } = await this.readSigninResponseState(e, s);
|
|
1262
|
+
if (i.debug("received state from storage; validating response"), this.settings.dpop && this.settings.dpop.store) {
|
|
1263
|
+
const o = await this.getDpopProof(this.settings.dpop.store);
|
|
1264
|
+
t = { ...t, DPoP: o };
|
|
1251
1265
|
}
|
|
1252
1266
|
try {
|
|
1253
|
-
await this._validator.validateSigninResponse(
|
|
1254
|
-
} catch (
|
|
1255
|
-
if (
|
|
1256
|
-
const
|
|
1257
|
-
t.DPoP =
|
|
1267
|
+
await this._validator.validateSigninResponse(n, r, t);
|
|
1268
|
+
} catch (o) {
|
|
1269
|
+
if (o instanceof be && this.settings.dpop) {
|
|
1270
|
+
const c = await this.getDpopProof(this.settings.dpop.store, o.nonce);
|
|
1271
|
+
t.DPoP = c, await this._validator.validateSigninResponse(n, r, t);
|
|
1258
1272
|
} else
|
|
1259
|
-
throw
|
|
1273
|
+
throw o;
|
|
1260
1274
|
}
|
|
1261
|
-
return
|
|
1275
|
+
return n;
|
|
1262
1276
|
}
|
|
1263
1277
|
async getDpopProof(e, t) {
|
|
1264
1278
|
let s, i;
|
|
@@ -1275,7 +1289,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1275
1289
|
skipUserInfo: s = !1,
|
|
1276
1290
|
extraTokenParams: i = {}
|
|
1277
1291
|
}) {
|
|
1278
|
-
const r = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...i }), n = new
|
|
1292
|
+
const r = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...i }), n = new we(new URLSearchParams());
|
|
1279
1293
|
return Object.assign(n, r), await this._validator.validateCredentialsResponse(n, s), n;
|
|
1280
1294
|
}
|
|
1281
1295
|
async useRefreshToken({
|
|
@@ -1312,7 +1326,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1312
1326
|
...n
|
|
1313
1327
|
});
|
|
1314
1328
|
} catch (g) {
|
|
1315
|
-
if (g instanceof
|
|
1329
|
+
if (g instanceof be && this.settings.dpop)
|
|
1316
1330
|
r.DPoP = await this.getDpopProof(this.settings.dpop.store, g.nonce), d = await this._tokenClient.exchangeRefreshToken({
|
|
1317
1331
|
refresh_token: e.refresh_token,
|
|
1318
1332
|
// provide the (possible filtered) scope list
|
|
@@ -1326,7 +1340,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1326
1340
|
else
|
|
1327
1341
|
throw g;
|
|
1328
1342
|
}
|
|
1329
|
-
const h = new
|
|
1343
|
+
const h = new we(new URLSearchParams());
|
|
1330
1344
|
return Object.assign(h, d), c.debug("validating response", h), await this._validator.validateRefreshResponse(h, {
|
|
1331
1345
|
...e,
|
|
1332
1346
|
// override the scope in the state handed over to the validator
|
|
@@ -1339,28 +1353,30 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1339
1353
|
id_token_hint: t,
|
|
1340
1354
|
client_id: s,
|
|
1341
1355
|
request_type: i,
|
|
1342
|
-
|
|
1343
|
-
|
|
1356
|
+
url_state: r,
|
|
1357
|
+
post_logout_redirect_uri: n = this.settings.post_logout_redirect_uri,
|
|
1358
|
+
extraQueryParams: o = this.settings.extraQueryParams
|
|
1344
1359
|
} = {}) {
|
|
1345
|
-
const
|
|
1346
|
-
if (!
|
|
1347
|
-
throw
|
|
1348
|
-
|
|
1349
|
-
const
|
|
1350
|
-
url:
|
|
1360
|
+
const c = this._logger.create("createSignoutRequest"), l = await this.metadataService.getEndSessionEndpoint();
|
|
1361
|
+
if (!l)
|
|
1362
|
+
throw c.throw(new Error("No end session endpoint")), null;
|
|
1363
|
+
c.debug("Received end session endpoint", l), !s && n && !t && (s = this.settings.client_id);
|
|
1364
|
+
const d = new cs({
|
|
1365
|
+
url: l,
|
|
1351
1366
|
id_token_hint: t,
|
|
1352
1367
|
client_id: s,
|
|
1353
|
-
post_logout_redirect_uri:
|
|
1368
|
+
post_logout_redirect_uri: n,
|
|
1354
1369
|
state_data: e,
|
|
1355
|
-
extraQueryParams:
|
|
1356
|
-
request_type: i
|
|
1370
|
+
extraQueryParams: o,
|
|
1371
|
+
request_type: i,
|
|
1372
|
+
url_state: r
|
|
1357
1373
|
});
|
|
1358
1374
|
await this.clearStaleState();
|
|
1359
|
-
const
|
|
1360
|
-
return
|
|
1375
|
+
const h = d.state;
|
|
1376
|
+
return h && (c.debug("Signout request has state to persist"), await this.settings.stateStore.set(h.id, h.toStorageString())), d;
|
|
1361
1377
|
}
|
|
1362
1378
|
async readSignoutResponseState(e, t = !1) {
|
|
1363
|
-
const s = this._logger.create("readSignoutResponseState"), i = new ls(
|
|
1379
|
+
const s = this._logger.create("readSignoutResponseState"), i = new ls(ye.readParams(e, this.settings.response_mode));
|
|
1364
1380
|
if (!i.state) {
|
|
1365
1381
|
if (s.debug("No state in response"), i.error)
|
|
1366
1382
|
throw s.warn("Response was error:", i.error), new B(i);
|
|
@@ -1369,14 +1385,14 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1369
1385
|
const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
|
|
1370
1386
|
if (!r)
|
|
1371
1387
|
throw s.throw(new Error("No matching state found in storage")), null;
|
|
1372
|
-
return { state: await
|
|
1388
|
+
return { state: await ue.fromStorageString(r), response: i };
|
|
1373
1389
|
}
|
|
1374
1390
|
async processSignoutResponse(e) {
|
|
1375
1391
|
const t = this._logger.create("processSignoutResponse"), { state: s, response: i } = await this.readSignoutResponseState(e, !0);
|
|
1376
1392
|
return s ? (t.debug("Received state from storage; validating response"), this._validator.validateSignoutResponse(i, s)) : t.debug("No state from storage; skipping response validation"), i;
|
|
1377
1393
|
}
|
|
1378
1394
|
clearStaleState() {
|
|
1379
|
-
return this._logger.create("clearStaleState"),
|
|
1395
|
+
return this._logger.create("clearStaleState"), ue.clearStaleState(this.settings.stateStore, this.settings.staleStateAgeInSeconds);
|
|
1380
1396
|
}
|
|
1381
1397
|
async revokeToken(e, t) {
|
|
1382
1398
|
return this._logger.create("revokeToken"), await this._tokenClient.revoke({
|
|
@@ -1386,7 +1402,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1386
1402
|
}
|
|
1387
1403
|
}, _s = class {
|
|
1388
1404
|
constructor(e) {
|
|
1389
|
-
this._userManager = e, this._logger = new
|
|
1405
|
+
this._userManager = e, this._logger = new p("SessionMonitor"), this._start = async (t) => {
|
|
1390
1406
|
const s = t.session_state;
|
|
1391
1407
|
if (!s)
|
|
1392
1408
|
return;
|
|
@@ -1458,7 +1474,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1458
1474
|
}
|
|
1459
1475
|
}
|
|
1460
1476
|
}
|
|
1461
|
-
},
|
|
1477
|
+
}, me = class st {
|
|
1462
1478
|
constructor(t) {
|
|
1463
1479
|
var s;
|
|
1464
1480
|
this.id_token = t.id_token, this.session_state = (s = t.session_state) != null ? s : null, this.access_token = t.access_token, this.refresh_token = t.refresh_token, this.token_type = t.token_type, this.scope = t.scope, this.profile = t.profile, this.expires_at = t.expires_at, this.state = t.userState, this.url_state = t.url_state;
|
|
@@ -1483,7 +1499,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1483
1499
|
return (s = (t = this.scope) == null ? void 0 : t.split(" ")) != null ? s : [];
|
|
1484
1500
|
}
|
|
1485
1501
|
toStorageString() {
|
|
1486
|
-
return new
|
|
1502
|
+
return new p("User").create("toStorageString"), JSON.stringify({
|
|
1487
1503
|
id_token: this.id_token,
|
|
1488
1504
|
session_state: this.session_state,
|
|
1489
1505
|
access_token: this.access_token,
|
|
@@ -1495,7 +1511,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1495
1511
|
});
|
|
1496
1512
|
}
|
|
1497
1513
|
static fromStorageString(t) {
|
|
1498
|
-
return
|
|
1514
|
+
return p.createStatic("User", "fromStorageString"), new st(JSON.parse(t));
|
|
1499
1515
|
}
|
|
1500
1516
|
}, Fe = "oidc-client", it = class {
|
|
1501
1517
|
constructor() {
|
|
@@ -1507,22 +1523,24 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1507
1523
|
throw new Error("Attempted to navigate on a disposed window");
|
|
1508
1524
|
t.debug("setting URL in window"), this._window.location.replace(e.url);
|
|
1509
1525
|
const { url: s, keepOpen: i } = await new Promise((r, n) => {
|
|
1510
|
-
const o = (
|
|
1511
|
-
var
|
|
1512
|
-
const
|
|
1513
|
-
if (!(
|
|
1526
|
+
const o = (l) => {
|
|
1527
|
+
var d;
|
|
1528
|
+
const h = l.data, g = (d = e.scriptOrigin) != null ? d : window.location.origin;
|
|
1529
|
+
if (!(l.origin !== g || (h == null ? void 0 : h.source) !== Fe)) {
|
|
1514
1530
|
try {
|
|
1515
|
-
const
|
|
1516
|
-
if (
|
|
1531
|
+
const _ = ye.readParams(h.url, e.response_mode).get("state");
|
|
1532
|
+
if (_ || t.warn("no state found in response url"), l.source !== this._window && _ !== e.state)
|
|
1517
1533
|
return;
|
|
1518
1534
|
} catch {
|
|
1519
1535
|
this._dispose(), n(new Error("Invalid response from window"));
|
|
1520
1536
|
}
|
|
1521
|
-
r(
|
|
1537
|
+
r(h);
|
|
1522
1538
|
}
|
|
1523
1539
|
};
|
|
1524
|
-
window.addEventListener("message", o, !1), this._disposeHandlers.add(() => window.removeEventListener("message", o, !1))
|
|
1525
|
-
|
|
1540
|
+
window.addEventListener("message", o, !1), this._disposeHandlers.add(() => window.removeEventListener("message", o, !1));
|
|
1541
|
+
const c = new BroadcastChannel(`oidc-client-popup-${e.state}`);
|
|
1542
|
+
c.addEventListener("message", o, !1), this._disposeHandlers.add(() => c.close()), this._disposeHandlers.add(this._abort.addHandler((l) => {
|
|
1543
|
+
this._dispose(), n(l);
|
|
1526
1544
|
}));
|
|
1527
1545
|
});
|
|
1528
1546
|
return t.debug("got response from window"), this._dispose(), i || this.close(), { url: s };
|
|
@@ -1534,18 +1552,28 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1534
1552
|
this._disposeHandlers.clear();
|
|
1535
1553
|
}
|
|
1536
1554
|
static _notifyParent(e, t, s = !1, i = window.location.origin) {
|
|
1537
|
-
|
|
1555
|
+
const r = {
|
|
1538
1556
|
source: Fe,
|
|
1539
1557
|
url: t,
|
|
1540
1558
|
keepOpen: s
|
|
1541
|
-
},
|
|
1559
|
+
}, n = new p("_notifyParent");
|
|
1560
|
+
if (e)
|
|
1561
|
+
n.debug("With parent. Using parent.postMessage."), e.postMessage(r, i);
|
|
1562
|
+
else {
|
|
1563
|
+
n.debug("No parent. Using BroadcastChannel.");
|
|
1564
|
+
const o = new URL(t).searchParams.get("state");
|
|
1565
|
+
if (!o)
|
|
1566
|
+
throw new Error("No parent and no state in URL. Can't complete notification.");
|
|
1567
|
+
const c = new BroadcastChannel(`oidc-client-popup-${o}`);
|
|
1568
|
+
c.postMessage(r), c.close();
|
|
1569
|
+
}
|
|
1542
1570
|
}
|
|
1543
1571
|
}, rt = {
|
|
1544
1572
|
location: !1,
|
|
1545
1573
|
toolbar: !1,
|
|
1546
1574
|
height: 640,
|
|
1547
1575
|
closePopupWindowAfterInSeconds: -1
|
|
1548
|
-
}, nt = "_blank", ps = 60, fs = 2, ot = 10,
|
|
1576
|
+
}, nt = "_blank", ps = 60, fs = 2, ot = 10, ws = class extends ke {
|
|
1549
1577
|
constructor(e) {
|
|
1550
1578
|
const {
|
|
1551
1579
|
popup_redirect_uri: t = e.redirect_uri,
|
|
@@ -1559,7 +1587,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1559
1587
|
requestTimeoutInSeconds: d,
|
|
1560
1588
|
silent_redirect_uri: h = e.redirect_uri,
|
|
1561
1589
|
silentRequestTimeoutInSeconds: g,
|
|
1562
|
-
automaticSilentRenew:
|
|
1590
|
+
automaticSilentRenew: _ = !0,
|
|
1563
1591
|
validateSubOnSilentRenew: S = !0,
|
|
1564
1592
|
includeIdTokenInSilentRenew: x = !1,
|
|
1565
1593
|
monitorSession: k = !1,
|
|
@@ -1569,11 +1597,11 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1569
1597
|
stopCheckSessionOnError: P = !0,
|
|
1570
1598
|
revokeTokenTypes: F = ["access_token", "refresh_token"],
|
|
1571
1599
|
revokeTokensOnSignout: R = !1,
|
|
1572
|
-
includeIdTokenInSilentSignout:
|
|
1600
|
+
includeIdTokenInSilentSignout: w = !1,
|
|
1573
1601
|
accessTokenExpiringNotificationTimeInSeconds: E = ps,
|
|
1574
1602
|
userStore: U
|
|
1575
1603
|
} = e;
|
|
1576
|
-
if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = s, this.popupWindowFeatures = i, this.popupWindowTarget = r, this.redirectMethod = n, this.redirectTarget = o, this.iframeNotifyParentOrigin = c, this.iframeScriptOrigin = l, this.silent_redirect_uri = h, this.silentRequestTimeoutInSeconds = g || d || ot, this.automaticSilentRenew =
|
|
1604
|
+
if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = s, this.popupWindowFeatures = i, this.popupWindowTarget = r, this.redirectMethod = n, this.redirectTarget = o, this.iframeNotifyParentOrigin = c, this.iframeScriptOrigin = l, this.silent_redirect_uri = h, this.silentRequestTimeoutInSeconds = g || d || ot, this.automaticSilentRenew = _, this.validateSubOnSilentRenew = S, this.includeIdTokenInSilentRenew = x, this.monitorSession = k, this.monitorAnonymousSession = A, this.checkSessionIntervalInSeconds = I, this.stopCheckSessionOnError = P, this.query_status_response_type = N, this.revokeTokenTypes = F, this.revokeTokensOnSignout = R, this.includeIdTokenInSilentSignout = w, this.accessTokenExpiringNotificationTimeInSeconds = E, U)
|
|
1577
1605
|
this.userStore = U;
|
|
1578
1606
|
else {
|
|
1579
1607
|
const y = typeof window < "u" ? window.sessionStorage : new Ge();
|
|
@@ -1584,7 +1612,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1584
1612
|
constructor({
|
|
1585
1613
|
silentRequestTimeoutInSeconds: t = ot
|
|
1586
1614
|
}) {
|
|
1587
|
-
super(), this._logger = new
|
|
1615
|
+
super(), this._logger = new p("IFrameWindow"), this._timeoutInSeconds = t, this._frame = at.createHiddenIframe(), this._window = this._frame.contentWindow;
|
|
1588
1616
|
}
|
|
1589
1617
|
static createHiddenIframe() {
|
|
1590
1618
|
const t = window.document.createElement("iframe");
|
|
@@ -1606,9 +1634,9 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1606
1634
|
static notifyParent(t, s) {
|
|
1607
1635
|
return super._notifyParent(window.parent, t, !1, s);
|
|
1608
1636
|
}
|
|
1609
|
-
},
|
|
1637
|
+
}, ms = class {
|
|
1610
1638
|
constructor(e) {
|
|
1611
|
-
this._settings = e, this._logger = new
|
|
1639
|
+
this._settings = e, this._logger = new p("IFrameNavigator");
|
|
1612
1640
|
}
|
|
1613
1641
|
async prepare({
|
|
1614
1642
|
silentRequestTimeoutInSeconds: e = this._settings.silentRequestTimeoutInSeconds
|
|
@@ -1624,9 +1652,9 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1624
1652
|
popupWindowFeatures: t = {},
|
|
1625
1653
|
popupSignal: s
|
|
1626
1654
|
}) {
|
|
1627
|
-
super(), this._logger = new
|
|
1628
|
-
const i =
|
|
1629
|
-
this._window = window.open(void 0, e,
|
|
1655
|
+
super(), this._logger = new p("PopupWindow");
|
|
1656
|
+
const i = je.center({ ...rt, ...t });
|
|
1657
|
+
this._window = window.open(void 0, e, je.serialize(i)), s && s.addEventListener("abort", () => {
|
|
1630
1658
|
var r;
|
|
1631
1659
|
this._abort.raise(new Error((r = s.reason) != null ? r : "Popup aborted"));
|
|
1632
1660
|
}), t.closePopupWindowAfterInSeconds && t.closePopupWindowAfterInSeconds > 0 && setTimeout(() => {
|
|
@@ -1641,21 +1669,19 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1641
1669
|
var t;
|
|
1642
1670
|
(t = this._window) == null || t.focus();
|
|
1643
1671
|
const s = setInterval(() => {
|
|
1644
|
-
(!this._window || this._window.closed) && this.
|
|
1645
|
-
}, vs);
|
|
1646
|
-
return this._disposeHandlers.add(
|
|
1672
|
+
(!this._window || this._window.closed) && (this._logger.debug("Popup closed by user or isolated by redirect"), i(), this._disposeHandlers.delete(i));
|
|
1673
|
+
}, vs), i = () => clearInterval(s);
|
|
1674
|
+
return this._disposeHandlers.add(i), await super.navigate(e);
|
|
1647
1675
|
}
|
|
1648
1676
|
close() {
|
|
1649
1677
|
this._window && (this._window.closed || (this._window.close(), this._abort.raise(new Error("Popup closed")))), this._window = null;
|
|
1650
1678
|
}
|
|
1651
1679
|
static notifyOpener(e, t) {
|
|
1652
|
-
|
|
1653
|
-
throw new Error("No window.opener. Can't complete notification.");
|
|
1654
|
-
return super._notifyParent(window.opener, e, t);
|
|
1680
|
+
super._notifyParent(window.opener, e, t), !t && !window.opener && window.close();
|
|
1655
1681
|
}
|
|
1656
1682
|
}, ys = class {
|
|
1657
1683
|
constructor(e) {
|
|
1658
|
-
this._settings = e, this._logger = new
|
|
1684
|
+
this._settings = e, this._logger = new p("PopupNavigator");
|
|
1659
1685
|
}
|
|
1660
1686
|
async prepare({
|
|
1661
1687
|
popupWindowFeatures: e = this._settings.popupWindowFeatures,
|
|
@@ -1669,7 +1695,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1669
1695
|
}
|
|
1670
1696
|
}, bs = class {
|
|
1671
1697
|
constructor(e) {
|
|
1672
|
-
this._settings = e, this._logger = new
|
|
1698
|
+
this._settings = e, this._logger = new p("RedirectNavigator");
|
|
1673
1699
|
}
|
|
1674
1700
|
async prepare({
|
|
1675
1701
|
redirectMethod: e = this._settings.redirectMethod,
|
|
@@ -1698,13 +1724,13 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1698
1724
|
}
|
|
1699
1725
|
}, ks = class extends Xt {
|
|
1700
1726
|
constructor(e) {
|
|
1701
|
-
super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new
|
|
1727
|
+
super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new p("UserManagerEvents"), this._userLoaded = new W("User loaded"), this._userUnloaded = new W("User unloaded"), this._silentRenewError = new W("Silent renew error"), this._userSignedIn = new W("User signed in"), this._userSignedOut = new W("User signed out"), this._userSessionChanged = new W("User session changed");
|
|
1702
1728
|
}
|
|
1703
1729
|
async load(e, t = !0) {
|
|
1704
|
-
super.load(e), t && await this._userLoaded.raise(e);
|
|
1730
|
+
await super.load(e), t && await this._userLoaded.raise(e);
|
|
1705
1731
|
}
|
|
1706
1732
|
async unload() {
|
|
1707
|
-
super.unload(), await this._userUnloaded.raise();
|
|
1733
|
+
await super.unload(), await this._userUnloaded.raise();
|
|
1708
1734
|
}
|
|
1709
1735
|
/**
|
|
1710
1736
|
* Add callback: Raised when a user session has been established (or re-established).
|
|
@@ -1807,7 +1833,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1807
1833
|
}
|
|
1808
1834
|
}, Ts = class {
|
|
1809
1835
|
constructor(e) {
|
|
1810
|
-
this._userManager = e, this._logger = new
|
|
1836
|
+
this._userManager = e, this._logger = new p("SilentRenewService"), this._isStarted = !1, this._retryTimer = new M("Retry Silent Renew"), this._tokenExpiring = async () => {
|
|
1811
1837
|
const t = this._logger.create("_tokenExpiring");
|
|
1812
1838
|
try {
|
|
1813
1839
|
await this._userManager.signinSilent(), t.debug("silent token renewal successful");
|
|
@@ -1840,7 +1866,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1840
1866
|
}
|
|
1841
1867
|
}, Es = class {
|
|
1842
1868
|
constructor(e, t, s, i) {
|
|
1843
|
-
this._logger = new
|
|
1869
|
+
this._logger = new p("UserManager"), this.settings = new ws(e), this._client = new us(e), this._redirectNavigator = t ?? new bs(this.settings), this._popupNavigator = s ?? new ys(this.settings), this._iframeNavigator = i ?? new ms(this.settings), this._events = new ks(this.settings), this._silentRenewService = new Ts(this), this.settings.automaticSilentRenew && this.startSilentRenew(), this._sessionMonitor = null, this.settings.monitorSession && (this._sessionMonitor = new _s(this));
|
|
1844
1870
|
}
|
|
1845
1871
|
/**
|
|
1846
1872
|
* Get object used to register for events raised by the `UserManager`.
|
|
@@ -1857,11 +1883,12 @@ var os = Ze, as = "openid", pe = class {
|
|
|
1857
1883
|
/**
|
|
1858
1884
|
* Load the `User` object for the currently authenticated user.
|
|
1859
1885
|
*
|
|
1886
|
+
* @param raiseEvent - If `true`, the `UserLoaded` event will be raised. Defaults to false.
|
|
1860
1887
|
* @returns A promise
|
|
1861
1888
|
*/
|
|
1862
|
-
async getUser() {
|
|
1863
|
-
const
|
|
1864
|
-
return
|
|
1889
|
+
async getUser(e = !1) {
|
|
1890
|
+
const t = this._logger.create("getUser"), s = await this._loadUser();
|
|
1891
|
+
return s ? (t.info("user loaded"), await this._events.load(s, e), s) : (t.info("user not found in storage"), null);
|
|
1865
1892
|
}
|
|
1866
1893
|
/**
|
|
1867
1894
|
* Remove from any storage the currently authenticated user.
|
|
@@ -2010,7 +2037,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
2010
2037
|
const t = await this._client.useRefreshToken({
|
|
2011
2038
|
timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds,
|
|
2012
2039
|
...e
|
|
2013
|
-
}), s = new
|
|
2040
|
+
}), s = new me({ ...e.state, ...t });
|
|
2014
2041
|
return await this.storeUser(s), await this._events.load(s), s;
|
|
2015
2042
|
}
|
|
2016
2043
|
/**
|
|
@@ -2111,7 +2138,6 @@ var os = Ze, as = "openid", pe = class {
|
|
|
2111
2138
|
case "interaction_required":
|
|
2112
2139
|
case "account_selection_required":
|
|
2113
2140
|
return t.info("success for anonymous user"), {
|
|
2114
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2115
2141
|
session_state: l.session_state
|
|
2116
2142
|
};
|
|
2117
2143
|
}
|
|
@@ -2141,7 +2167,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
2141
2167
|
return s.debug("got signin response"), await this._buildUser(r, t);
|
|
2142
2168
|
}
|
|
2143
2169
|
async _buildUser(e, t) {
|
|
2144
|
-
const s = this._logger.create("_buildUser"), i = new
|
|
2170
|
+
const s = this._logger.create("_buildUser"), i = new me(e);
|
|
2145
2171
|
if (t) {
|
|
2146
2172
|
if (t !== i.profile.sub)
|
|
2147
2173
|
throw s.debug("current user does not match user returned from signin. sub from signin:", i.profile.sub), new B({ ...e, error: "login_required" });
|
|
@@ -2284,7 +2310,6 @@ var os = Ze, as = "openid", pe = class {
|
|
|
2284
2310
|
for (const r of i)
|
|
2285
2311
|
await this._client.revokeToken(
|
|
2286
2312
|
e[r],
|
|
2287
|
-
// eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
2288
2313
|
r
|
|
2289
2314
|
), s.info(`${r} revoked successfully`), r !== "access_token" && (e[r] = null);
|
|
2290
2315
|
await this.storeUser(e), s.debug("user stored"), await this._events.load(e);
|
|
@@ -2306,7 +2331,7 @@ var os = Ze, as = "openid", pe = class {
|
|
|
2306
2331
|
}
|
|
2307
2332
|
async _loadUser() {
|
|
2308
2333
|
const e = this._logger.create("_loadUser"), t = await this.settings.userStore.get(this._userStoreKey);
|
|
2309
|
-
return t ? (e.debug("user storageString loaded"),
|
|
2334
|
+
return t ? (e.debug("user storageString loaded"), me.fromStorageString(t)) : (e.debug("no user storageString"), null);
|
|
2310
2335
|
}
|
|
2311
2336
|
async storeUser(e) {
|
|
2312
2337
|
const t = this._logger.create("storeUser");
|
|
@@ -2397,20 +2422,20 @@ const Us = (e) => (V = Rs(Cs, e), new Es({
|
|
|
2397
2422
|
const e = await (u == null ? void 0 : u.getUser());
|
|
2398
2423
|
return Promise.resolve(e == null ? void 0 : e.profile.preferred_username);
|
|
2399
2424
|
};
|
|
2400
|
-
let
|
|
2425
|
+
let Q, ee;
|
|
2401
2426
|
const Ls = async (e, t) => {
|
|
2402
2427
|
try {
|
|
2403
|
-
console.debug("[Auth] Setting Username and Password for BasicAuth"),
|
|
2428
|
+
console.debug("[Auth] Setting Username and Password for BasicAuth"), Q = e, ee = t;
|
|
2404
2429
|
} catch (s) {
|
|
2405
2430
|
console.error("[Auth] Error logging in using BasicAuth: ", s);
|
|
2406
2431
|
}
|
|
2407
|
-
},
|
|
2408
|
-
console.debug("[Auth] Logout for BasicAuth"),
|
|
2409
|
-
}, Hs = async () =>
|
|
2410
|
-
if (
|
|
2432
|
+
}, $s = async () => {
|
|
2433
|
+
console.debug("[Auth] Logout for BasicAuth"), Q = void 0, ee = void 0, window.location.reload();
|
|
2434
|
+
}, Hs = async () => Q !== void 0 && ee !== void 0, js = async () => Promise.resolve(Q), Fs = () => {
|
|
2435
|
+
if (Q !== void 0 && ee != null)
|
|
2411
2436
|
return {
|
|
2412
|
-
username:
|
|
2413
|
-
password:
|
|
2437
|
+
username: Q,
|
|
2438
|
+
password: ee
|
|
2414
2439
|
};
|
|
2415
2440
|
}, ct = () => {
|
|
2416
2441
|
const e = ut(Kt);
|
|
@@ -2437,9 +2462,9 @@ const Ls = async (e, t) => {
|
|
|
2437
2462
|
getToken: async () => {
|
|
2438
2463
|
},
|
|
2439
2464
|
getUsernameAndPassword: Fs,
|
|
2440
|
-
getUsername:
|
|
2465
|
+
getUsername: js,
|
|
2441
2466
|
login: Ls,
|
|
2442
|
-
logout:
|
|
2467
|
+
logout: $s
|
|
2443
2468
|
} : {
|
|
2444
2469
|
isOidcAuthEnabled: () => !1,
|
|
2445
2470
|
isBasicAuthEnabled: () => !1,
|
|
@@ -2451,37 +2476,37 @@ const Ls = async (e, t) => {
|
|
|
2451
2476
|
login: () => Promise.resolve(),
|
|
2452
2477
|
logout: () => Promise.resolve()
|
|
2453
2478
|
};
|
|
2454
|
-
},
|
|
2479
|
+
}, Ee = (e) => {
|
|
2455
2480
|
const [t, s] = T(""), [i, r] = T(""), n = e.format || "locale";
|
|
2456
2481
|
_t(() => {
|
|
2457
2482
|
n === "fromNow" && o();
|
|
2458
2483
|
}, 5e3);
|
|
2459
2484
|
const o = () => {
|
|
2460
2485
|
let c;
|
|
2461
|
-
if (e.date && typeof e.date == "string" ? c =
|
|
2486
|
+
if (e.date && typeof e.date == "string" ? c = ie.fromISO(e.date) : e.date && typeof e.date == "object" && (c = ie.fromJSDate(e.date)), c) {
|
|
2462
2487
|
const l = {
|
|
2463
2488
|
locale: e.locale
|
|
2464
2489
|
};
|
|
2465
|
-
s(n === "fromNow" ? c.toRelative() || "" : n === "locale" ? c.toLocaleString(
|
|
2490
|
+
s(n === "fromNow" ? c.toRelative() || "" : n === "locale" ? c.toLocaleString(ie.DATETIME_FULL, l) : c.toFormat(n, l)), r(c.toLocaleString(ie.DATETIME_FULL, l));
|
|
2466
2491
|
}
|
|
2467
2492
|
};
|
|
2468
|
-
return
|
|
2493
|
+
return pe(() => {
|
|
2469
2494
|
o();
|
|
2470
2495
|
}, [e.date]), n === "fromNow" ? /* @__PURE__ */ a(pt, { content: /* @__PURE__ */ a("span", { children: i }), children: /* @__PURE__ */ a("span", { children: t }) }) : /* @__PURE__ */ a("span", { children: t });
|
|
2471
|
-
}, Zs = (e) => /* @__PURE__ */ a(
|
|
2472
|
-
const n = () => !e || e.length === 0, o = t || /* @__PURE__ */ v(
|
|
2473
|
-
/* @__PURE__ */ a(
|
|
2474
|
-
/* @__PURE__ */ a(
|
|
2496
|
+
}, Zs = (e) => /* @__PURE__ */ a(Ee, { date: e.date, format: "fromNow" }), O = ({ condition: e, children: t }) => (typeof e == "boolean" ? e : e()) ? /* @__PURE__ */ a(j.Fragment, { children: t }) : /* @__PURE__ */ a(j.Fragment, {}), ei = ({ collection: e, emptyState: t, emptyStateTitle: s, emptyStateMessage: i, children: r }) => {
|
|
2497
|
+
const n = () => !e || e.length === 0, o = t || /* @__PURE__ */ v(oe, { variant: ft.xs, children: [
|
|
2498
|
+
/* @__PURE__ */ a(ae, { titleText: s || "None found", headingLevel: "h4" }),
|
|
2499
|
+
/* @__PURE__ */ a(ve, { children: i || "No items found." })
|
|
2475
2500
|
] });
|
|
2476
|
-
return n() ? /* @__PURE__ */ a(
|
|
2477
|
-
},
|
|
2478
|
-
const i = () => typeof e == "boolean" ? e : e(), r = t || /* @__PURE__ */ a(
|
|
2479
|
-
return i() ? /* @__PURE__ */ a(
|
|
2501
|
+
return n() ? /* @__PURE__ */ a(j.Fragment, { children: o }) : /* @__PURE__ */ a(j.Fragment, { children: r });
|
|
2502
|
+
}, _e = ({ isLoading: e, loadingComponent: t, children: s }) => {
|
|
2503
|
+
const i = () => typeof e == "boolean" ? e : e(), r = t || /* @__PURE__ */ a(te, {});
|
|
2504
|
+
return i() ? /* @__PURE__ */ a(j.Fragment, { children: r }) : /* @__PURE__ */ a(j.Fragment, { children: s });
|
|
2480
2505
|
}, ti = ({ toolbar: e, alwaysShowToolbar: t, emptyState: s, filteredEmptyState: i, isLoading: r, isError: n, loadingComponent: o, errorComponent: c, isEmpty: l, isFiltered: d, children: h }) => {
|
|
2481
2506
|
const g = t || !l || d || n;
|
|
2482
|
-
return c || (c = /* @__PURE__ */ a("div", { style: { padding: "15px", backgroundColor: "white" }, children: /* @__PURE__ */ a(
|
|
2507
|
+
return c || (c = /* @__PURE__ */ a("div", { style: { padding: "15px", backgroundColor: "white" }, children: /* @__PURE__ */ a(wt, { isInline: !0, variant: "danger", title: "Error: Something went wrong!", children: /* @__PURE__ */ a("p", { children: "Something went wrong with the action you attempted, but we're not sure what it was. Try reloading the page and hopef for a better result, or contact your admin to report the error." }) }) })), /* @__PURE__ */ v(j.Fragment, { children: [
|
|
2483
2508
|
/* @__PURE__ */ a(O, { condition: g, children: e }),
|
|
2484
|
-
/* @__PURE__ */ v(
|
|
2509
|
+
/* @__PURE__ */ v(_e, { isLoading: r, loadingComponent: o, children: [
|
|
2485
2510
|
/* @__PURE__ */ a(O, { condition: !l && !n, children: h }),
|
|
2486
2511
|
/* @__PURE__ */ a(O, { condition: l && d && !n, children: i }),
|
|
2487
2512
|
/* @__PURE__ */ a(O, { condition: l && !d && !n, children: s }),
|
|
@@ -2502,8 +2527,8 @@ const Ls = async (e, t) => {
|
|
|
2502
2527
|
appendTo: e.menuAppendTo
|
|
2503
2528
|
};
|
|
2504
2529
|
let c = /* @__PURE__ */ a(Nt, { title: e.label });
|
|
2505
|
-
return e.isKebab || (c = /* @__PURE__ */ a(
|
|
2506
|
-
|
|
2530
|
+
return e.isKebab || (c = /* @__PURE__ */ a(j.Fragment, { children: e.label })), /* @__PURE__ */ a(
|
|
2531
|
+
mt,
|
|
2507
2532
|
{
|
|
2508
2533
|
isOpen: t,
|
|
2509
2534
|
onSelect: i,
|
|
@@ -2591,7 +2616,7 @@ const Ls = async (e, t) => {
|
|
|
2591
2616
|
}, ri = (e) => {
|
|
2592
2617
|
const [t, s] = T(""), [i, r] = T(""), [n, o] = T(!1), [c, l] = T(), d = (k, A) => {
|
|
2593
2618
|
s(A);
|
|
2594
|
-
}, h = () => t != null && t.trim().length > 0, g = () => c != null && c.trim().length > 0,
|
|
2619
|
+
}, h = () => t != null && t.trim().length > 0, g = () => c != null && c.trim().length > 0, _ = () => {
|
|
2595
2620
|
o(!0), e.onUrlFetch(t).then((k) => {
|
|
2596
2621
|
l(void 0), r(k), o(!1), e.onChange(k, t);
|
|
2597
2622
|
}).catch((k) => {
|
|
@@ -2600,13 +2625,13 @@ const Ls = async (e, t) => {
|
|
|
2600
2625
|
}, S = () => {
|
|
2601
2626
|
s(""), r(""), e.onChange(void 0, void 0);
|
|
2602
2627
|
}, x = /* @__PURE__ */ v("div", { className: "url-upload-loading", style: lt, children: [
|
|
2603
|
-
/* @__PURE__ */ a(
|
|
2628
|
+
/* @__PURE__ */ a(te, { size: "md", className: "spinner", style: { marginRight: "5px" } }),
|
|
2604
2629
|
/* @__PURE__ */ a("span", { className: "spinner-message", children: "Loading URL content" })
|
|
2605
2630
|
] });
|
|
2606
2631
|
return /* @__PURE__ */ v("div", { className: "url-upload", "data-testid": e.testId, children: [
|
|
2607
2632
|
/* @__PURE__ */ v("div", { className: "url-upload-flex", style: { display: "flex" }, children: [
|
|
2608
2633
|
/* @__PURE__ */ a("div", { className: "url-upload-url", style: { flexGrow: 1 }, children: /* @__PURE__ */ a(
|
|
2609
|
-
|
|
2634
|
+
ce,
|
|
2610
2635
|
{
|
|
2611
2636
|
"data-testid": `${e.testId}-input`,
|
|
2612
2637
|
value: t,
|
|
@@ -2617,10 +2642,10 @@ const Ls = async (e, t) => {
|
|
|
2617
2642
|
"aria-label": "url input"
|
|
2618
2643
|
}
|
|
2619
2644
|
) }),
|
|
2620
|
-
/* @__PURE__ */ a("div", { className: "url-fetch-button", children: /* @__PURE__ */ a(
|
|
2621
|
-
/* @__PURE__ */ a("div", { className: "url-clear-button", children: /* @__PURE__ */ a(
|
|
2645
|
+
/* @__PURE__ */ a("div", { className: "url-fetch-button", children: /* @__PURE__ */ a(le, { "data-testid": `${e.testId}-fetch`, variant: "control", isDisabled: !h(), onClick: _, children: "Fetch" }) }),
|
|
2646
|
+
/* @__PURE__ */ a("div", { className: "url-clear-button", children: /* @__PURE__ */ a(le, { "data-testid": `${e.testId}-clear`, variant: "control", isDisabled: !h(), onClick: S, children: "Clear" }) })
|
|
2622
2647
|
] }),
|
|
2623
|
-
/* @__PURE__ */ a("div", { className: "url-upload-preview", children: /* @__PURE__ */ v(
|
|
2648
|
+
/* @__PURE__ */ a("div", { className: "url-upload-preview", children: /* @__PURE__ */ v(_e, { isLoading: n, loadingComponent: x, children: [
|
|
2624
2649
|
/* @__PURE__ */ a(O, { condition: g, children: /* @__PURE__ */ v("div", { className: "url-upload-error", style: Ws, children: [
|
|
2625
2650
|
/* @__PURE__ */ a("div", { children: "Error getting content from URL." }),
|
|
2626
2651
|
/* @__PURE__ */ a("div", { children: c })
|
|
@@ -2639,7 +2664,7 @@ const Ls = async (e, t) => {
|
|
|
2639
2664
|
] });
|
|
2640
2665
|
}, ni = (e) => {
|
|
2641
2666
|
const [t, s] = T(), [i, r] = T();
|
|
2642
|
-
return
|
|
2667
|
+
return pe(() => {
|
|
2643
2668
|
e.isOpen && (typeof e.frontendInfo == "function" ? e.frontendInfo().then(s) : s(e.frontendInfo), typeof e.backendInfo == "function" ? e.backendInfo().then(r) : r(e.backendInfo));
|
|
2644
2669
|
}, [e.isOpen]), /* @__PURE__ */ a(
|
|
2645
2670
|
Tt,
|
|
@@ -2653,18 +2678,18 @@ const Ls = async (e, t) => {
|
|
|
2653
2678
|
"aria-label": e.brandImageAlt,
|
|
2654
2679
|
children: /* @__PURE__ */ v(It, { className: "app-about-modal-content", style: { marginTop: "-25px" }, children: [
|
|
2655
2680
|
/* @__PURE__ */ a(De, { component: Le.h2, children: "Web console info" }),
|
|
2656
|
-
/* @__PURE__ */ a(
|
|
2681
|
+
/* @__PURE__ */ a(_e, { isLoading: t === void 0, children: /* @__PURE__ */ v($e, { component: "dl", children: [
|
|
2657
2682
|
/* @__PURE__ */ a(b, { component: "dt", children: "Project" }),
|
|
2658
2683
|
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a("a", { href: t == null ? void 0 : t.url, target: "_blank", children: t == null ? void 0 : t.name }) }),
|
|
2659
2684
|
/* @__PURE__ */ a(b, { component: "dt", children: "Version" }),
|
|
2660
2685
|
/* @__PURE__ */ a(b, { component: "dd", children: t == null ? void 0 : t.version }),
|
|
2661
2686
|
/* @__PURE__ */ a(b, { component: "dt", children: "Built on" }),
|
|
2662
|
-
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(
|
|
2687
|
+
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(Ee, { date: t == null ? void 0 : t.builtOn, format: "locale" }) }),
|
|
2663
2688
|
/* @__PURE__ */ a(b, { component: "dt", children: "Digest" }),
|
|
2664
2689
|
/* @__PURE__ */ a(b, { component: "dd", children: t == null ? void 0 : t.digest })
|
|
2665
2690
|
] }) }),
|
|
2666
2691
|
/* @__PURE__ */ a(De, { style: { marginTop: "40px" }, component: Le.h2, children: e.backendLabel }),
|
|
2667
|
-
/* @__PURE__ */ a(
|
|
2692
|
+
/* @__PURE__ */ a(_e, { isLoading: i === void 0, children: /* @__PURE__ */ v($e, { component: "dl", children: [
|
|
2668
2693
|
/* @__PURE__ */ a(b, { component: "dt", children: "Name" }),
|
|
2669
2694
|
/* @__PURE__ */ a(b, { component: "dd", children: (i == null ? void 0 : i.name) || "" }),
|
|
2670
2695
|
/* @__PURE__ */ a(b, { component: "dt", children: "Description" }),
|
|
@@ -2672,7 +2697,7 @@ const Ls = async (e, t) => {
|
|
|
2672
2697
|
/* @__PURE__ */ a(b, { component: "dt", children: "Version" }),
|
|
2673
2698
|
/* @__PURE__ */ a(b, { component: "dd", children: (i == null ? void 0 : i.version) || "" }),
|
|
2674
2699
|
/* @__PURE__ */ a(b, { component: "dt", children: "Built on" }),
|
|
2675
|
-
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(
|
|
2700
|
+
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(Ee, { date: i == null ? void 0 : i.builtOn, format: "locale" }) })
|
|
2676
2701
|
] }) })
|
|
2677
2702
|
] })
|
|
2678
2703
|
}
|
|
@@ -2706,7 +2731,7 @@ const Ls = async (e, t) => {
|
|
|
2706
2731
|
"aria-label": "please-wait-modal",
|
|
2707
2732
|
style: { marginTop: "-15px" },
|
|
2708
2733
|
actions: [
|
|
2709
|
-
/* @__PURE__ */ a(
|
|
2734
|
+
/* @__PURE__ */ a(le, { variant: "primary", "data-testid": "modal-btn-login", onClick: i, isDisabled: (t == null ? void 0 : t.username) === "" || (t == null ? void 0 : t.password) === "", children: "Login" }, "login")
|
|
2710
2735
|
],
|
|
2711
2736
|
children: /* @__PURE__ */ v(Be, { children: [
|
|
2712
2737
|
/* @__PURE__ */ a(
|
|
@@ -2715,7 +2740,7 @@ const Ls = async (e, t) => {
|
|
|
2715
2740
|
label: "Username",
|
|
2716
2741
|
fieldId: "form-username",
|
|
2717
2742
|
children: /* @__PURE__ */ a(
|
|
2718
|
-
|
|
2743
|
+
ce,
|
|
2719
2744
|
{
|
|
2720
2745
|
isRequired: !0,
|
|
2721
2746
|
type: "text",
|
|
@@ -2735,10 +2760,10 @@ const Ls = async (e, t) => {
|
|
|
2735
2760
|
label: "Password",
|
|
2736
2761
|
fieldId: "form-password",
|
|
2737
2762
|
children: /* @__PURE__ */ a(
|
|
2738
|
-
|
|
2763
|
+
ce,
|
|
2739
2764
|
{
|
|
2740
2765
|
isRequired: !0,
|
|
2741
|
-
type: "
|
|
2766
|
+
type: "password",
|
|
2742
2767
|
id: "form-password",
|
|
2743
2768
|
"data-testid": "basic-auth-login-modal-password",
|
|
2744
2769
|
name: "form-password",
|
|
@@ -2764,7 +2789,7 @@ const Ls = async (e, t) => {
|
|
|
2764
2789
|
"aria-label": "please-wait-modal",
|
|
2765
2790
|
style: { marginTop: "-15px" },
|
|
2766
2791
|
children: [
|
|
2767
|
-
/* @__PURE__ */ a(
|
|
2792
|
+
/* @__PURE__ */ a(te, { size: "md", className: "spinner" }),
|
|
2768
2793
|
/* @__PURE__ */ a("span", { className: "message", style: { fontSize: "15px", color: "#333", marginLeft: "10px" }, children: e.message })
|
|
2769
2794
|
]
|
|
2770
2795
|
}
|
|
@@ -2790,7 +2815,7 @@ const Ls = async (e, t) => {
|
|
|
2790
2815
|
/* AUTHENTICATED */
|
|
2791
2816
|
);
|
|
2792
2817
|
};
|
|
2793
|
-
return
|
|
2818
|
+
return pe(() => {
|
|
2794
2819
|
i.isOidcAuthEnabled() ? i.login("", "").then(() => {
|
|
2795
2820
|
console.info("[ApplicationAuth] Authentication successful."), s(
|
|
2796
2821
|
1
|
|
@@ -2806,14 +2831,14 @@ const Ls = async (e, t) => {
|
|
|
2806
2831
|
/* AUTHENTICATED */
|
|
2807
2832
|
);
|
|
2808
2833
|
}, []), /* @__PURE__ */ v(Re, { children: [
|
|
2809
|
-
/* @__PURE__ */ a(O, { condition: t === 0 && i.isOidcAuthEnabled(), children: /* @__PURE__ */ v(
|
|
2810
|
-
/* @__PURE__ */ a(
|
|
2811
|
-
/* @__PURE__ */ a(
|
|
2834
|
+
/* @__PURE__ */ a(O, { condition: t === 0 && i.isOidcAuthEnabled(), children: /* @__PURE__ */ v(oe, { children: [
|
|
2835
|
+
/* @__PURE__ */ a(ae, { titleText: "Loading", headingLevel: "h4" }),
|
|
2836
|
+
/* @__PURE__ */ a(ve, { children: /* @__PURE__ */ a(te, { size: "xl", "aria-label": "Loading spinner" }) })
|
|
2812
2837
|
] }) }),
|
|
2813
2838
|
/* @__PURE__ */ a(O, { condition: t === 0 && i.isBasicAuthEnabled(), children: /* @__PURE__ */ a(Js, { onLogin: r }) }),
|
|
2814
|
-
/* @__PURE__ */ a(O, { condition: t === 2, children: /* @__PURE__ */ v(
|
|
2815
|
-
/* @__PURE__ */ a(
|
|
2816
|
-
/* @__PURE__ */ a(
|
|
2839
|
+
/* @__PURE__ */ a(O, { condition: t === 2, children: /* @__PURE__ */ v(oe, { children: [
|
|
2840
|
+
/* @__PURE__ */ a(ae, { titleText: "Empty state", headingLevel: "h4", icon: /* @__PURE__ */ a(ze, { icon: Lt }) }),
|
|
2841
|
+
/* @__PURE__ */ a(ve, { children: "Authentication failed." })
|
|
2817
2842
|
] }) }),
|
|
2818
2843
|
/* @__PURE__ */ a(O, { condition: t === 1, children: e.children })
|
|
2819
2844
|
] });
|
|
@@ -2822,7 +2847,7 @@ const Ls = async (e, t) => {
|
|
|
2822
2847
|
return (() => {
|
|
2823
2848
|
let i = !0;
|
|
2824
2849
|
return e.enabled !== void 0 && (i = i && (t.isOidcAuthEnabled() === e.enabled || t.isBasicAuthEnabled() === e.enabled)), i;
|
|
2825
|
-
})() ? /* @__PURE__ */ a(
|
|
2850
|
+
})() ? /* @__PURE__ */ a(j.Fragment, { children: e.children }) : /* @__PURE__ */ a(j.Fragment, {});
|
|
2826
2851
|
}, di = (e) => /* @__PURE__ */ a(Ct, { categoryName: e.categoryName || "Filters", isClosable: !0, onClick: e.onClearAllCriteria, children: e.criteria.map((t, s) => /* @__PURE__ */ v(Pt, { onClick: () => e.onRemoveCriteria(t), children: [
|
|
2827
2852
|
/* @__PURE__ */ a("b", { children: t.filterBy.label }),
|
|
2828
2853
|
/* @__PURE__ */ a("span", { children: ": " }),
|
|
@@ -2834,7 +2859,9 @@ const Ls = async (e, t) => {
|
|
|
2834
2859
|
filterValue: i
|
|
2835
2860
|
}), r("");
|
|
2836
2861
|
};
|
|
2837
|
-
return
|
|
2862
|
+
return pe(() => {
|
|
2863
|
+
s(e.filterTypes[0]);
|
|
2864
|
+
}, [e.filterTypes]), /* @__PURE__ */ a(Be, { onSubmit: n, children: /* @__PURE__ */ v(Rt, { children: [
|
|
2838
2865
|
/* @__PURE__ */ a(
|
|
2839
2866
|
Ms,
|
|
2840
2867
|
{
|
|
@@ -2848,7 +2875,7 @@ const Ls = async (e, t) => {
|
|
|
2848
2875
|
}
|
|
2849
2876
|
),
|
|
2850
2877
|
/* @__PURE__ */ a(
|
|
2851
|
-
|
|
2878
|
+
ce,
|
|
2852
2879
|
{
|
|
2853
2880
|
name: "filterValue",
|
|
2854
2881
|
id: "filterValue",
|
|
@@ -2860,24 +2887,24 @@ const Ls = async (e, t) => {
|
|
|
2860
2887
|
}
|
|
2861
2888
|
),
|
|
2862
2889
|
/* @__PURE__ */ a(
|
|
2863
|
-
|
|
2890
|
+
le,
|
|
2864
2891
|
{
|
|
2865
2892
|
variant: Ut.control,
|
|
2866
2893
|
onClick: n,
|
|
2867
2894
|
"data-testid": "chip-filter-search",
|
|
2868
2895
|
"aria-label": "search button for search input",
|
|
2869
|
-
children: /* @__PURE__ */ a(
|
|
2896
|
+
children: /* @__PURE__ */ a($t, {})
|
|
2870
2897
|
}
|
|
2871
2898
|
)
|
|
2872
2899
|
] }) });
|
|
2873
2900
|
};
|
|
2874
2901
|
function gi() {
|
|
2875
|
-
return /* @__PURE__ */ a(
|
|
2876
|
-
|
|
2902
|
+
return /* @__PURE__ */ a(oe, { children: /* @__PURE__ */ a(
|
|
2903
|
+
ae,
|
|
2877
2904
|
{
|
|
2878
2905
|
titleText: "Loading",
|
|
2879
2906
|
headingLevel: "h4",
|
|
2880
|
-
icon: /* @__PURE__ */ a(ze, { icon:
|
|
2907
|
+
icon: /* @__PURE__ */ a(ze, { icon: te })
|
|
2881
2908
|
}
|
|
2882
2909
|
) });
|
|
2883
2910
|
}
|
|
@@ -2911,7 +2938,7 @@ function Ks({ columns: e, rows: t, getTd: s = () => xe }) {
|
|
|
2911
2938
|
screenreaderText: o === 0 ? "Loading data" : void 0
|
|
2912
2939
|
}
|
|
2913
2940
|
) }, `cell_${o}`);
|
|
2914
|
-
}), r = new Array(t).fill(0).map((n, o) => /* @__PURE__ */ a(
|
|
2941
|
+
}), r = new Array(t).fill(0).map((n, o) => /* @__PURE__ */ a(de, { children: i }, `row_${o}`));
|
|
2915
2942
|
return /* @__PURE__ */ a(Re, { children: r });
|
|
2916
2943
|
}
|
|
2917
2944
|
const _i = ({
|
|
@@ -2927,7 +2954,7 @@ const _i = ({
|
|
|
2927
2954
|
isRowSelected: d,
|
|
2928
2955
|
expectedLength: h = 3,
|
|
2929
2956
|
onRowClick: g,
|
|
2930
|
-
setActionCellOuiaId:
|
|
2957
|
+
setActionCellOuiaId: _,
|
|
2931
2958
|
setRowOuiaId: S,
|
|
2932
2959
|
tableOuiaId: x,
|
|
2933
2960
|
children: k,
|
|
@@ -2939,21 +2966,21 @@ const _i = ({
|
|
|
2939
2966
|
P && cancelAnimationFrame(P), f && (P = requestAnimationFrame(() => {
|
|
2940
2967
|
N(f);
|
|
2941
2968
|
}));
|
|
2942
|
-
}, { ref: R } = Jt({ onResize: F }),
|
|
2943
|
-
(f) =>
|
|
2944
|
-
[s,
|
|
2945
|
-
), U = qe(() => s.map((f,
|
|
2946
|
-
const q =
|
|
2947
|
-
({ children: J, ...K },
|
|
2969
|
+
}, { ref: R } = Jt({ onResize: F }), w = I >= 576, E = Ne(
|
|
2970
|
+
(f) => w && f !== 0 && f !== s.length - 1,
|
|
2971
|
+
[s, w]
|
|
2972
|
+
), U = qe(() => s.map((f, m) => {
|
|
2973
|
+
const q = ne(
|
|
2974
|
+
({ children: J, ...K }, X) => /* @__PURE__ */ a(
|
|
2948
2975
|
dt,
|
|
2949
2976
|
{
|
|
2950
|
-
position:
|
|
2977
|
+
position: m,
|
|
2951
2978
|
tableWidth: I,
|
|
2952
2979
|
columnWidth: t,
|
|
2953
|
-
canHide: E(
|
|
2980
|
+
canHide: E(m),
|
|
2954
2981
|
sort: c ? c(f) : void 0,
|
|
2955
2982
|
...K,
|
|
2956
|
-
ref:
|
|
2983
|
+
ref: X,
|
|
2957
2984
|
children: J
|
|
2958
2985
|
}
|
|
2959
2986
|
)
|
|
@@ -2962,7 +2989,7 @@ const _i = ({
|
|
|
2962
2989
|
Th: q,
|
|
2963
2990
|
key: `header_${f}`,
|
|
2964
2991
|
column: f,
|
|
2965
|
-
colIndex:
|
|
2992
|
+
colIndex: m
|
|
2966
2993
|
});
|
|
2967
2994
|
}), [
|
|
2968
2995
|
E,
|
|
@@ -2973,9 +3000,9 @@ const _i = ({
|
|
|
2973
3000
|
I
|
|
2974
3001
|
]), y = Ne(
|
|
2975
3002
|
(f) => {
|
|
2976
|
-
const
|
|
3003
|
+
const m = ne(
|
|
2977
3004
|
({ children: q, ...J }, K) => /* @__PURE__ */ a(
|
|
2978
|
-
|
|
3005
|
+
Ce,
|
|
2979
3006
|
{
|
|
2980
3007
|
position: f,
|
|
2981
3008
|
tableWidth: I,
|
|
@@ -2987,24 +3014,24 @@ const _i = ({
|
|
|
2987
3014
|
}
|
|
2988
3015
|
)
|
|
2989
3016
|
);
|
|
2990
|
-
return
|
|
3017
|
+
return m.displayName = "ResponsiveTdCurried", m;
|
|
2991
3018
|
},
|
|
2992
3019
|
[E, t, I]
|
|
2993
3020
|
), z = qe(
|
|
2994
|
-
() => s.map((f,
|
|
3021
|
+
() => s.map((f, m) => y(m)),
|
|
2995
3022
|
[s, y]
|
|
2996
3023
|
);
|
|
2997
3024
|
return /* @__PURE__ */ v(
|
|
2998
|
-
|
|
3025
|
+
jt,
|
|
2999
3026
|
{
|
|
3000
3027
|
"aria-label": e,
|
|
3001
3028
|
gridBreakPoint: "",
|
|
3002
3029
|
ref: R,
|
|
3003
|
-
className:
|
|
3030
|
+
className: w ? "" : "pf-m-grid",
|
|
3004
3031
|
ouiaId: x,
|
|
3005
3032
|
variant: A,
|
|
3006
3033
|
children: [
|
|
3007
|
-
/* @__PURE__ */ a(Ft, { children: /* @__PURE__ */ a(
|
|
3034
|
+
/* @__PURE__ */ a(Ft, { children: /* @__PURE__ */ a(de, { children: U }) }),
|
|
3008
3035
|
/* @__PURE__ */ v(Mt, { children: [
|
|
3009
3036
|
i === void 0 && /* @__PURE__ */ a(
|
|
3010
3037
|
Ks,
|
|
@@ -3014,24 +3041,24 @@ const _i = ({
|
|
|
3014
3041
|
getTd: y
|
|
3015
3042
|
}
|
|
3016
3043
|
),
|
|
3017
|
-
i == null ? void 0 : i.map((f,
|
|
3018
|
-
const q = l !== void 0 && l({ row: f, rowIndex:
|
|
3019
|
-
Td: z[
|
|
3020
|
-
key: `row_${
|
|
3021
|
-
column:
|
|
3022
|
-
colIndex:
|
|
3023
|
-
rowIndex:
|
|
3044
|
+
i == null ? void 0 : i.map((f, m) => {
|
|
3045
|
+
const q = l !== void 0 && l({ row: f, rowIndex: m }), J = d !== void 0 && d({ row: f, rowIndex: m }), K = !q && g ? () => g({ row: f, rowIndex: m }) : void 0, X = s.map((Y, se) => n({
|
|
3046
|
+
Td: z[se],
|
|
3047
|
+
key: `row_${m}_cell_${Y}`,
|
|
3048
|
+
column: Y,
|
|
3049
|
+
colIndex: se,
|
|
3050
|
+
rowIndex: m,
|
|
3024
3051
|
row: f
|
|
3025
|
-
})),
|
|
3026
|
-
|
|
3052
|
+
})), fe = !q && o && /* @__PURE__ */ a(
|
|
3053
|
+
Ce,
|
|
3027
3054
|
{
|
|
3028
3055
|
position: s.length,
|
|
3029
3056
|
tableWidth: I,
|
|
3030
3057
|
columnWidth: t,
|
|
3031
3058
|
canHide: !1,
|
|
3032
3059
|
isActionCell: !0,
|
|
3033
|
-
"data-testid":
|
|
3034
|
-
children: o({ rowIndex:
|
|
3060
|
+
"data-testid": _ ? _({ row: f, rowIndex: m }) : `actions-for-row-${m}`,
|
|
3061
|
+
children: o({ rowIndex: m, row: f, ActionsColumn: Wt })
|
|
3035
3062
|
}
|
|
3036
3063
|
);
|
|
3037
3064
|
return /* @__PURE__ */ v(
|
|
@@ -3040,22 +3067,22 @@ const _i = ({
|
|
|
3040
3067
|
isDeleted: q,
|
|
3041
3068
|
isSelected: J,
|
|
3042
3069
|
onClick: K,
|
|
3043
|
-
rowOuiaId: S == null ? void 0 : S({ row: f, rowIndex:
|
|
3070
|
+
rowOuiaId: S == null ? void 0 : S({ row: f, rowIndex: m }),
|
|
3044
3071
|
children: [
|
|
3045
|
-
|
|
3046
|
-
|
|
3072
|
+
X,
|
|
3073
|
+
fe
|
|
3047
3074
|
]
|
|
3048
3075
|
},
|
|
3049
|
-
`row_${
|
|
3076
|
+
`row_${m}`
|
|
3050
3077
|
);
|
|
3051
3078
|
}),
|
|
3052
|
-
(i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ a(
|
|
3079
|
+
(i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ a(de, { children: /* @__PURE__ */ a(xe, { colSpan: s.length, children: k }) })
|
|
3053
3080
|
] })
|
|
3054
3081
|
]
|
|
3055
3082
|
}
|
|
3056
3083
|
);
|
|
3057
3084
|
}, dt = Pe(
|
|
3058
|
-
|
|
3085
|
+
ne((e, t) => {
|
|
3059
3086
|
const {
|
|
3060
3087
|
tableWidth: s,
|
|
3061
3088
|
columnWidth: i,
|
|
@@ -3077,8 +3104,8 @@ const _i = ({
|
|
|
3077
3104
|
})
|
|
3078
3105
|
);
|
|
3079
3106
|
dt.displayName = "ResponsiveTh";
|
|
3080
|
-
const
|
|
3081
|
-
|
|
3107
|
+
const Ce = Pe(
|
|
3108
|
+
ne((e, t) => {
|
|
3082
3109
|
const {
|
|
3083
3110
|
tableWidth: s,
|
|
3084
3111
|
columnWidth: i,
|
|
@@ -3099,10 +3126,10 @@ const Ee = Pe(
|
|
|
3099
3126
|
);
|
|
3100
3127
|
})
|
|
3101
3128
|
);
|
|
3102
|
-
|
|
3129
|
+
Ce.displayName = "ResponsiveTd";
|
|
3103
3130
|
const ht = Pe(
|
|
3104
3131
|
({ isDeleted: e, isSelected: t, onClick: s, children: i, rowOuiaId: r }) => /* @__PURE__ */ a(
|
|
3105
|
-
|
|
3132
|
+
de,
|
|
3106
3133
|
{
|
|
3107
3134
|
onRowClick: (n) => {
|
|
3108
3135
|
(n == null ? void 0 : n.target) instanceof HTMLElement && (["a", "button"].includes(n.target.tagName.toLowerCase()) || s && s());
|
|
@@ -3123,14 +3150,14 @@ export {
|
|
|
3123
3150
|
Kt as AuthConfigContext,
|
|
3124
3151
|
Js as BasicAuthModal,
|
|
3125
3152
|
hi as ChipFilterInput,
|
|
3126
|
-
|
|
3153
|
+
Ee as DateTime,
|
|
3127
3154
|
ht as DeletableRow,
|
|
3128
3155
|
di as FilterChips,
|
|
3129
3156
|
Zs as FromNow,
|
|
3130
3157
|
O as If,
|
|
3131
3158
|
li as IfAuth,
|
|
3132
3159
|
ei as IfNotEmpty,
|
|
3133
|
-
|
|
3160
|
+
_e as IfNotLoading,
|
|
3134
3161
|
ti as ListWithToolbar,
|
|
3135
3162
|
gi as Loading,
|
|
3136
3163
|
si as ObjectDropdown,
|
|
@@ -3139,7 +3166,7 @@ export {
|
|
|
3139
3166
|
oi as PleaseWaitModal,
|
|
3140
3167
|
ai as ProgressModal,
|
|
3141
3168
|
_i as ResponsiveTable,
|
|
3142
|
-
|
|
3169
|
+
Ce as ResponsiveTd,
|
|
3143
3170
|
dt as ResponsiveTh,
|
|
3144
3171
|
Ks as TableSkeleton,
|
|
3145
3172
|
ii as ToggleIcon,
|