@apicurio/common-ui-components 2.0.11 → 2.0.13
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 +341 -310
- 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");
|
|
@@ -2385,9 +2410,13 @@ const Us = (e) => (V = Rs(Cs, e), new Es({
|
|
|
2385
2410
|
} catch (e) {
|
|
2386
2411
|
console.error("[Auth] Error logging in using OIDC: ", e);
|
|
2387
2412
|
}
|
|
2388
|
-
}, As = async () =>
|
|
2389
|
-
|
|
2390
|
-
|
|
2413
|
+
}, As = async () => {
|
|
2414
|
+
const e = await (u == null ? void 0 : u.getUser()), t = e == null ? void 0 : e.id_token;
|
|
2415
|
+
return u == null ? void 0 : u.removeUser().then(() => u == null ? void 0 : u.signoutRedirect({
|
|
2416
|
+
id_token_hint: t,
|
|
2417
|
+
post_logout_redirect_uri: V.logoutUrl || window.location.href
|
|
2418
|
+
}));
|
|
2419
|
+
}, Os = async () => await (u == null ? void 0 : u.getUser()) != null, Ns = async () => {
|
|
2391
2420
|
const e = await (u == null ? void 0 : u.getUser());
|
|
2392
2421
|
return Promise.resolve(e == null ? void 0 : e.access_token);
|
|
2393
2422
|
}, qs = async () => {
|
|
@@ -2397,20 +2426,20 @@ const Us = (e) => (V = Rs(Cs, e), new Es({
|
|
|
2397
2426
|
const e = await (u == null ? void 0 : u.getUser());
|
|
2398
2427
|
return Promise.resolve(e == null ? void 0 : e.profile.preferred_username);
|
|
2399
2428
|
};
|
|
2400
|
-
let
|
|
2429
|
+
let Q, ee;
|
|
2401
2430
|
const Ls = async (e, t) => {
|
|
2402
2431
|
try {
|
|
2403
|
-
console.debug("[Auth] Setting Username and Password for BasicAuth"),
|
|
2432
|
+
console.debug("[Auth] Setting Username and Password for BasicAuth"), Q = e, ee = t;
|
|
2404
2433
|
} catch (s) {
|
|
2405
2434
|
console.error("[Auth] Error logging in using BasicAuth: ", s);
|
|
2406
2435
|
}
|
|
2407
|
-
},
|
|
2408
|
-
console.debug("[Auth] Logout for BasicAuth"),
|
|
2409
|
-
}, Hs = async () =>
|
|
2410
|
-
if (
|
|
2436
|
+
}, $s = async () => {
|
|
2437
|
+
console.debug("[Auth] Logout for BasicAuth"), Q = void 0, ee = void 0, window.location.reload();
|
|
2438
|
+
}, Hs = async () => Q !== void 0 && ee !== void 0, js = async () => Promise.resolve(Q), Fs = () => {
|
|
2439
|
+
if (Q !== void 0 && ee != null)
|
|
2411
2440
|
return {
|
|
2412
|
-
username:
|
|
2413
|
-
password:
|
|
2441
|
+
username: Q,
|
|
2442
|
+
password: ee
|
|
2414
2443
|
};
|
|
2415
2444
|
}, ct = () => {
|
|
2416
2445
|
const e = ut(Kt);
|
|
@@ -2437,9 +2466,9 @@ const Ls = async (e, t) => {
|
|
|
2437
2466
|
getToken: async () => {
|
|
2438
2467
|
},
|
|
2439
2468
|
getUsernameAndPassword: Fs,
|
|
2440
|
-
getUsername:
|
|
2469
|
+
getUsername: js,
|
|
2441
2470
|
login: Ls,
|
|
2442
|
-
logout:
|
|
2471
|
+
logout: $s
|
|
2443
2472
|
} : {
|
|
2444
2473
|
isOidcAuthEnabled: () => !1,
|
|
2445
2474
|
isBasicAuthEnabled: () => !1,
|
|
@@ -2451,37 +2480,37 @@ const Ls = async (e, t) => {
|
|
|
2451
2480
|
login: () => Promise.resolve(),
|
|
2452
2481
|
logout: () => Promise.resolve()
|
|
2453
2482
|
};
|
|
2454
|
-
},
|
|
2483
|
+
}, Ee = (e) => {
|
|
2455
2484
|
const [t, s] = T(""), [i, r] = T(""), n = e.format || "locale";
|
|
2456
2485
|
_t(() => {
|
|
2457
2486
|
n === "fromNow" && o();
|
|
2458
2487
|
}, 5e3);
|
|
2459
2488
|
const o = () => {
|
|
2460
2489
|
let c;
|
|
2461
|
-
if (e.date && typeof e.date == "string" ? c =
|
|
2490
|
+
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
2491
|
const l = {
|
|
2463
2492
|
locale: e.locale
|
|
2464
2493
|
};
|
|
2465
|
-
s(n === "fromNow" ? c.toRelative() || "" : n === "locale" ? c.toLocaleString(
|
|
2494
|
+
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
2495
|
}
|
|
2467
2496
|
};
|
|
2468
|
-
return
|
|
2497
|
+
return pe(() => {
|
|
2469
2498
|
o();
|
|
2470
2499
|
}, [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(
|
|
2500
|
+
}, 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 }) => {
|
|
2501
|
+
const n = () => !e || e.length === 0, o = t || /* @__PURE__ */ v(oe, { variant: ft.xs, children: [
|
|
2502
|
+
/* @__PURE__ */ a(ae, { titleText: s || "None found", headingLevel: "h4" }),
|
|
2503
|
+
/* @__PURE__ */ a(ve, { children: i || "No items found." })
|
|
2475
2504
|
] });
|
|
2476
|
-
return n() ? /* @__PURE__ */ a(
|
|
2477
|
-
},
|
|
2478
|
-
const i = () => typeof e == "boolean" ? e : e(), r = t || /* @__PURE__ */ a(
|
|
2479
|
-
return i() ? /* @__PURE__ */ a(
|
|
2505
|
+
return n() ? /* @__PURE__ */ a(j.Fragment, { children: o }) : /* @__PURE__ */ a(j.Fragment, { children: r });
|
|
2506
|
+
}, _e = ({ isLoading: e, loadingComponent: t, children: s }) => {
|
|
2507
|
+
const i = () => typeof e == "boolean" ? e : e(), r = t || /* @__PURE__ */ a(te, {});
|
|
2508
|
+
return i() ? /* @__PURE__ */ a(j.Fragment, { children: r }) : /* @__PURE__ */ a(j.Fragment, { children: s });
|
|
2480
2509
|
}, ti = ({ toolbar: e, alwaysShowToolbar: t, emptyState: s, filteredEmptyState: i, isLoading: r, isError: n, loadingComponent: o, errorComponent: c, isEmpty: l, isFiltered: d, children: h }) => {
|
|
2481
2510
|
const g = t || !l || d || n;
|
|
2482
|
-
return c || (c = /* @__PURE__ */ a("div", { style: { padding: "15px", backgroundColor: "white" }, children: /* @__PURE__ */ a(
|
|
2511
|
+
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
2512
|
/* @__PURE__ */ a(O, { condition: g, children: e }),
|
|
2484
|
-
/* @__PURE__ */ v(
|
|
2513
|
+
/* @__PURE__ */ v(_e, { isLoading: r, loadingComponent: o, children: [
|
|
2485
2514
|
/* @__PURE__ */ a(O, { condition: !l && !n, children: h }),
|
|
2486
2515
|
/* @__PURE__ */ a(O, { condition: l && d && !n, children: i }),
|
|
2487
2516
|
/* @__PURE__ */ a(O, { condition: l && !d && !n, children: s }),
|
|
@@ -2502,8 +2531,8 @@ const Ls = async (e, t) => {
|
|
|
2502
2531
|
appendTo: e.menuAppendTo
|
|
2503
2532
|
};
|
|
2504
2533
|
let c = /* @__PURE__ */ a(Nt, { title: e.label });
|
|
2505
|
-
return e.isKebab || (c = /* @__PURE__ */ a(
|
|
2506
|
-
|
|
2534
|
+
return e.isKebab || (c = /* @__PURE__ */ a(j.Fragment, { children: e.label })), /* @__PURE__ */ a(
|
|
2535
|
+
mt,
|
|
2507
2536
|
{
|
|
2508
2537
|
isOpen: t,
|
|
2509
2538
|
onSelect: i,
|
|
@@ -2591,7 +2620,7 @@ const Ls = async (e, t) => {
|
|
|
2591
2620
|
}, ri = (e) => {
|
|
2592
2621
|
const [t, s] = T(""), [i, r] = T(""), [n, o] = T(!1), [c, l] = T(), d = (k, A) => {
|
|
2593
2622
|
s(A);
|
|
2594
|
-
}, h = () => t != null && t.trim().length > 0, g = () => c != null && c.trim().length > 0,
|
|
2623
|
+
}, h = () => t != null && t.trim().length > 0, g = () => c != null && c.trim().length > 0, _ = () => {
|
|
2595
2624
|
o(!0), e.onUrlFetch(t).then((k) => {
|
|
2596
2625
|
l(void 0), r(k), o(!1), e.onChange(k, t);
|
|
2597
2626
|
}).catch((k) => {
|
|
@@ -2600,13 +2629,13 @@ const Ls = async (e, t) => {
|
|
|
2600
2629
|
}, S = () => {
|
|
2601
2630
|
s(""), r(""), e.onChange(void 0, void 0);
|
|
2602
2631
|
}, x = /* @__PURE__ */ v("div", { className: "url-upload-loading", style: lt, children: [
|
|
2603
|
-
/* @__PURE__ */ a(
|
|
2632
|
+
/* @__PURE__ */ a(te, { size: "md", className: "spinner", style: { marginRight: "5px" } }),
|
|
2604
2633
|
/* @__PURE__ */ a("span", { className: "spinner-message", children: "Loading URL content" })
|
|
2605
2634
|
] });
|
|
2606
2635
|
return /* @__PURE__ */ v("div", { className: "url-upload", "data-testid": e.testId, children: [
|
|
2607
2636
|
/* @__PURE__ */ v("div", { className: "url-upload-flex", style: { display: "flex" }, children: [
|
|
2608
2637
|
/* @__PURE__ */ a("div", { className: "url-upload-url", style: { flexGrow: 1 }, children: /* @__PURE__ */ a(
|
|
2609
|
-
|
|
2638
|
+
ce,
|
|
2610
2639
|
{
|
|
2611
2640
|
"data-testid": `${e.testId}-input`,
|
|
2612
2641
|
value: t,
|
|
@@ -2617,10 +2646,10 @@ const Ls = async (e, t) => {
|
|
|
2617
2646
|
"aria-label": "url input"
|
|
2618
2647
|
}
|
|
2619
2648
|
) }),
|
|
2620
|
-
/* @__PURE__ */ a("div", { className: "url-fetch-button", children: /* @__PURE__ */ a(
|
|
2621
|
-
/* @__PURE__ */ a("div", { className: "url-clear-button", children: /* @__PURE__ */ a(
|
|
2649
|
+
/* @__PURE__ */ a("div", { className: "url-fetch-button", children: /* @__PURE__ */ a(le, { "data-testid": `${e.testId}-fetch`, variant: "control", isDisabled: !h(), onClick: _, children: "Fetch" }) }),
|
|
2650
|
+
/* @__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
2651
|
] }),
|
|
2623
|
-
/* @__PURE__ */ a("div", { className: "url-upload-preview", children: /* @__PURE__ */ v(
|
|
2652
|
+
/* @__PURE__ */ a("div", { className: "url-upload-preview", children: /* @__PURE__ */ v(_e, { isLoading: n, loadingComponent: x, children: [
|
|
2624
2653
|
/* @__PURE__ */ a(O, { condition: g, children: /* @__PURE__ */ v("div", { className: "url-upload-error", style: Ws, children: [
|
|
2625
2654
|
/* @__PURE__ */ a("div", { children: "Error getting content from URL." }),
|
|
2626
2655
|
/* @__PURE__ */ a("div", { children: c })
|
|
@@ -2639,7 +2668,7 @@ const Ls = async (e, t) => {
|
|
|
2639
2668
|
] });
|
|
2640
2669
|
}, ni = (e) => {
|
|
2641
2670
|
const [t, s] = T(), [i, r] = T();
|
|
2642
|
-
return
|
|
2671
|
+
return pe(() => {
|
|
2643
2672
|
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
2673
|
}, [e.isOpen]), /* @__PURE__ */ a(
|
|
2645
2674
|
Tt,
|
|
@@ -2653,18 +2682,18 @@ const Ls = async (e, t) => {
|
|
|
2653
2682
|
"aria-label": e.brandImageAlt,
|
|
2654
2683
|
children: /* @__PURE__ */ v(It, { className: "app-about-modal-content", style: { marginTop: "-25px" }, children: [
|
|
2655
2684
|
/* @__PURE__ */ a(De, { component: Le.h2, children: "Web console info" }),
|
|
2656
|
-
/* @__PURE__ */ a(
|
|
2685
|
+
/* @__PURE__ */ a(_e, { isLoading: t === void 0, children: /* @__PURE__ */ v($e, { component: "dl", children: [
|
|
2657
2686
|
/* @__PURE__ */ a(b, { component: "dt", children: "Project" }),
|
|
2658
2687
|
/* @__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
2688
|
/* @__PURE__ */ a(b, { component: "dt", children: "Version" }),
|
|
2660
2689
|
/* @__PURE__ */ a(b, { component: "dd", children: t == null ? void 0 : t.version }),
|
|
2661
2690
|
/* @__PURE__ */ a(b, { component: "dt", children: "Built on" }),
|
|
2662
|
-
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(
|
|
2691
|
+
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(Ee, { date: t == null ? void 0 : t.builtOn, format: "locale" }) }),
|
|
2663
2692
|
/* @__PURE__ */ a(b, { component: "dt", children: "Digest" }),
|
|
2664
2693
|
/* @__PURE__ */ a(b, { component: "dd", children: t == null ? void 0 : t.digest })
|
|
2665
2694
|
] }) }),
|
|
2666
2695
|
/* @__PURE__ */ a(De, { style: { marginTop: "40px" }, component: Le.h2, children: e.backendLabel }),
|
|
2667
|
-
/* @__PURE__ */ a(
|
|
2696
|
+
/* @__PURE__ */ a(_e, { isLoading: i === void 0, children: /* @__PURE__ */ v($e, { component: "dl", children: [
|
|
2668
2697
|
/* @__PURE__ */ a(b, { component: "dt", children: "Name" }),
|
|
2669
2698
|
/* @__PURE__ */ a(b, { component: "dd", children: (i == null ? void 0 : i.name) || "" }),
|
|
2670
2699
|
/* @__PURE__ */ a(b, { component: "dt", children: "Description" }),
|
|
@@ -2672,7 +2701,7 @@ const Ls = async (e, t) => {
|
|
|
2672
2701
|
/* @__PURE__ */ a(b, { component: "dt", children: "Version" }),
|
|
2673
2702
|
/* @__PURE__ */ a(b, { component: "dd", children: (i == null ? void 0 : i.version) || "" }),
|
|
2674
2703
|
/* @__PURE__ */ a(b, { component: "dt", children: "Built on" }),
|
|
2675
|
-
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(
|
|
2704
|
+
/* @__PURE__ */ a(b, { component: "dd", children: /* @__PURE__ */ a(Ee, { date: i == null ? void 0 : i.builtOn, format: "locale" }) })
|
|
2676
2705
|
] }) })
|
|
2677
2706
|
] })
|
|
2678
2707
|
}
|
|
@@ -2706,7 +2735,7 @@ const Ls = async (e, t) => {
|
|
|
2706
2735
|
"aria-label": "please-wait-modal",
|
|
2707
2736
|
style: { marginTop: "-15px" },
|
|
2708
2737
|
actions: [
|
|
2709
|
-
/* @__PURE__ */ a(
|
|
2738
|
+
/* @__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
2739
|
],
|
|
2711
2740
|
children: /* @__PURE__ */ v(Be, { children: [
|
|
2712
2741
|
/* @__PURE__ */ a(
|
|
@@ -2715,7 +2744,7 @@ const Ls = async (e, t) => {
|
|
|
2715
2744
|
label: "Username",
|
|
2716
2745
|
fieldId: "form-username",
|
|
2717
2746
|
children: /* @__PURE__ */ a(
|
|
2718
|
-
|
|
2747
|
+
ce,
|
|
2719
2748
|
{
|
|
2720
2749
|
isRequired: !0,
|
|
2721
2750
|
type: "text",
|
|
@@ -2735,7 +2764,7 @@ const Ls = async (e, t) => {
|
|
|
2735
2764
|
label: "Password",
|
|
2736
2765
|
fieldId: "form-password",
|
|
2737
2766
|
children: /* @__PURE__ */ a(
|
|
2738
|
-
|
|
2767
|
+
ce,
|
|
2739
2768
|
{
|
|
2740
2769
|
isRequired: !0,
|
|
2741
2770
|
type: "password",
|
|
@@ -2764,7 +2793,7 @@ const Ls = async (e, t) => {
|
|
|
2764
2793
|
"aria-label": "please-wait-modal",
|
|
2765
2794
|
style: { marginTop: "-15px" },
|
|
2766
2795
|
children: [
|
|
2767
|
-
/* @__PURE__ */ a(
|
|
2796
|
+
/* @__PURE__ */ a(te, { size: "md", className: "spinner" }),
|
|
2768
2797
|
/* @__PURE__ */ a("span", { className: "message", style: { fontSize: "15px", color: "#333", marginLeft: "10px" }, children: e.message })
|
|
2769
2798
|
]
|
|
2770
2799
|
}
|
|
@@ -2790,7 +2819,7 @@ const Ls = async (e, t) => {
|
|
|
2790
2819
|
/* AUTHENTICATED */
|
|
2791
2820
|
);
|
|
2792
2821
|
};
|
|
2793
|
-
return
|
|
2822
|
+
return pe(() => {
|
|
2794
2823
|
i.isOidcAuthEnabled() ? i.login("", "").then(() => {
|
|
2795
2824
|
console.info("[ApplicationAuth] Authentication successful."), s(
|
|
2796
2825
|
1
|
|
@@ -2806,14 +2835,14 @@ const Ls = async (e, t) => {
|
|
|
2806
2835
|
/* AUTHENTICATED */
|
|
2807
2836
|
);
|
|
2808
2837
|
}, []), /* @__PURE__ */ v(Re, { children: [
|
|
2809
|
-
/* @__PURE__ */ a(O, { condition: t === 0 && i.isOidcAuthEnabled(), children: /* @__PURE__ */ v(
|
|
2810
|
-
/* @__PURE__ */ a(
|
|
2811
|
-
/* @__PURE__ */ a(
|
|
2838
|
+
/* @__PURE__ */ a(O, { condition: t === 0 && i.isOidcAuthEnabled(), children: /* @__PURE__ */ v(oe, { children: [
|
|
2839
|
+
/* @__PURE__ */ a(ae, { titleText: "Loading", headingLevel: "h4" }),
|
|
2840
|
+
/* @__PURE__ */ a(ve, { children: /* @__PURE__ */ a(te, { size: "xl", "aria-label": "Loading spinner" }) })
|
|
2812
2841
|
] }) }),
|
|
2813
2842
|
/* @__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(
|
|
2843
|
+
/* @__PURE__ */ a(O, { condition: t === 2, children: /* @__PURE__ */ v(oe, { children: [
|
|
2844
|
+
/* @__PURE__ */ a(ae, { titleText: "Empty state", headingLevel: "h4", icon: /* @__PURE__ */ a(ze, { icon: Lt }) }),
|
|
2845
|
+
/* @__PURE__ */ a(ve, { children: "Authentication failed." })
|
|
2817
2846
|
] }) }),
|
|
2818
2847
|
/* @__PURE__ */ a(O, { condition: t === 1, children: e.children })
|
|
2819
2848
|
] });
|
|
@@ -2822,7 +2851,7 @@ const Ls = async (e, t) => {
|
|
|
2822
2851
|
return (() => {
|
|
2823
2852
|
let i = !0;
|
|
2824
2853
|
return e.enabled !== void 0 && (i = i && (t.isOidcAuthEnabled() === e.enabled || t.isBasicAuthEnabled() === e.enabled)), i;
|
|
2825
|
-
})() ? /* @__PURE__ */ a(
|
|
2854
|
+
})() ? /* @__PURE__ */ a(j.Fragment, { children: e.children }) : /* @__PURE__ */ a(j.Fragment, {});
|
|
2826
2855
|
}, 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
2856
|
/* @__PURE__ */ a("b", { children: t.filterBy.label }),
|
|
2828
2857
|
/* @__PURE__ */ a("span", { children: ": " }),
|
|
@@ -2834,7 +2863,9 @@ const Ls = async (e, t) => {
|
|
|
2834
2863
|
filterValue: i
|
|
2835
2864
|
}), r("");
|
|
2836
2865
|
};
|
|
2837
|
-
return
|
|
2866
|
+
return pe(() => {
|
|
2867
|
+
s(e.filterTypes[0]);
|
|
2868
|
+
}, [e.filterTypes]), /* @__PURE__ */ a(Be, { onSubmit: n, children: /* @__PURE__ */ v(Rt, { children: [
|
|
2838
2869
|
/* @__PURE__ */ a(
|
|
2839
2870
|
Ms,
|
|
2840
2871
|
{
|
|
@@ -2848,7 +2879,7 @@ const Ls = async (e, t) => {
|
|
|
2848
2879
|
}
|
|
2849
2880
|
),
|
|
2850
2881
|
/* @__PURE__ */ a(
|
|
2851
|
-
|
|
2882
|
+
ce,
|
|
2852
2883
|
{
|
|
2853
2884
|
name: "filterValue",
|
|
2854
2885
|
id: "filterValue",
|
|
@@ -2860,24 +2891,24 @@ const Ls = async (e, t) => {
|
|
|
2860
2891
|
}
|
|
2861
2892
|
),
|
|
2862
2893
|
/* @__PURE__ */ a(
|
|
2863
|
-
|
|
2894
|
+
le,
|
|
2864
2895
|
{
|
|
2865
2896
|
variant: Ut.control,
|
|
2866
2897
|
onClick: n,
|
|
2867
2898
|
"data-testid": "chip-filter-search",
|
|
2868
2899
|
"aria-label": "search button for search input",
|
|
2869
|
-
children: /* @__PURE__ */ a(
|
|
2900
|
+
children: /* @__PURE__ */ a($t, {})
|
|
2870
2901
|
}
|
|
2871
2902
|
)
|
|
2872
2903
|
] }) });
|
|
2873
2904
|
};
|
|
2874
2905
|
function gi() {
|
|
2875
|
-
return /* @__PURE__ */ a(
|
|
2876
|
-
|
|
2906
|
+
return /* @__PURE__ */ a(oe, { children: /* @__PURE__ */ a(
|
|
2907
|
+
ae,
|
|
2877
2908
|
{
|
|
2878
2909
|
titleText: "Loading",
|
|
2879
2910
|
headingLevel: "h4",
|
|
2880
|
-
icon: /* @__PURE__ */ a(ze, { icon:
|
|
2911
|
+
icon: /* @__PURE__ */ a(ze, { icon: te })
|
|
2881
2912
|
}
|
|
2882
2913
|
) });
|
|
2883
2914
|
}
|
|
@@ -2911,7 +2942,7 @@ function Ks({ columns: e, rows: t, getTd: s = () => xe }) {
|
|
|
2911
2942
|
screenreaderText: o === 0 ? "Loading data" : void 0
|
|
2912
2943
|
}
|
|
2913
2944
|
) }, `cell_${o}`);
|
|
2914
|
-
}), r = new Array(t).fill(0).map((n, o) => /* @__PURE__ */ a(
|
|
2945
|
+
}), r = new Array(t).fill(0).map((n, o) => /* @__PURE__ */ a(de, { children: i }, `row_${o}`));
|
|
2915
2946
|
return /* @__PURE__ */ a(Re, { children: r });
|
|
2916
2947
|
}
|
|
2917
2948
|
const _i = ({
|
|
@@ -2927,7 +2958,7 @@ const _i = ({
|
|
|
2927
2958
|
isRowSelected: d,
|
|
2928
2959
|
expectedLength: h = 3,
|
|
2929
2960
|
onRowClick: g,
|
|
2930
|
-
setActionCellOuiaId:
|
|
2961
|
+
setActionCellOuiaId: _,
|
|
2931
2962
|
setRowOuiaId: S,
|
|
2932
2963
|
tableOuiaId: x,
|
|
2933
2964
|
children: k,
|
|
@@ -2939,21 +2970,21 @@ const _i = ({
|
|
|
2939
2970
|
P && cancelAnimationFrame(P), f && (P = requestAnimationFrame(() => {
|
|
2940
2971
|
N(f);
|
|
2941
2972
|
}));
|
|
2942
|
-
}, { ref: R } = Jt({ onResize: F }),
|
|
2943
|
-
(f) =>
|
|
2944
|
-
[s,
|
|
2945
|
-
), U = qe(() => s.map((f,
|
|
2946
|
-
const q =
|
|
2947
|
-
({ children: J, ...K },
|
|
2973
|
+
}, { ref: R } = Jt({ onResize: F }), w = I >= 576, E = Ne(
|
|
2974
|
+
(f) => w && f !== 0 && f !== s.length - 1,
|
|
2975
|
+
[s, w]
|
|
2976
|
+
), U = qe(() => s.map((f, m) => {
|
|
2977
|
+
const q = ne(
|
|
2978
|
+
({ children: J, ...K }, X) => /* @__PURE__ */ a(
|
|
2948
2979
|
dt,
|
|
2949
2980
|
{
|
|
2950
|
-
position:
|
|
2981
|
+
position: m,
|
|
2951
2982
|
tableWidth: I,
|
|
2952
2983
|
columnWidth: t,
|
|
2953
|
-
canHide: E(
|
|
2984
|
+
canHide: E(m),
|
|
2954
2985
|
sort: c ? c(f) : void 0,
|
|
2955
2986
|
...K,
|
|
2956
|
-
ref:
|
|
2987
|
+
ref: X,
|
|
2957
2988
|
children: J
|
|
2958
2989
|
}
|
|
2959
2990
|
)
|
|
@@ -2962,7 +2993,7 @@ const _i = ({
|
|
|
2962
2993
|
Th: q,
|
|
2963
2994
|
key: `header_${f}`,
|
|
2964
2995
|
column: f,
|
|
2965
|
-
colIndex:
|
|
2996
|
+
colIndex: m
|
|
2966
2997
|
});
|
|
2967
2998
|
}), [
|
|
2968
2999
|
E,
|
|
@@ -2973,9 +3004,9 @@ const _i = ({
|
|
|
2973
3004
|
I
|
|
2974
3005
|
]), y = Ne(
|
|
2975
3006
|
(f) => {
|
|
2976
|
-
const
|
|
3007
|
+
const m = ne(
|
|
2977
3008
|
({ children: q, ...J }, K) => /* @__PURE__ */ a(
|
|
2978
|
-
|
|
3009
|
+
Ce,
|
|
2979
3010
|
{
|
|
2980
3011
|
position: f,
|
|
2981
3012
|
tableWidth: I,
|
|
@@ -2987,24 +3018,24 @@ const _i = ({
|
|
|
2987
3018
|
}
|
|
2988
3019
|
)
|
|
2989
3020
|
);
|
|
2990
|
-
return
|
|
3021
|
+
return m.displayName = "ResponsiveTdCurried", m;
|
|
2991
3022
|
},
|
|
2992
3023
|
[E, t, I]
|
|
2993
3024
|
), z = qe(
|
|
2994
|
-
() => s.map((f,
|
|
3025
|
+
() => s.map((f, m) => y(m)),
|
|
2995
3026
|
[s, y]
|
|
2996
3027
|
);
|
|
2997
3028
|
return /* @__PURE__ */ v(
|
|
2998
|
-
|
|
3029
|
+
jt,
|
|
2999
3030
|
{
|
|
3000
3031
|
"aria-label": e,
|
|
3001
3032
|
gridBreakPoint: "",
|
|
3002
3033
|
ref: R,
|
|
3003
|
-
className:
|
|
3034
|
+
className: w ? "" : "pf-m-grid",
|
|
3004
3035
|
ouiaId: x,
|
|
3005
3036
|
variant: A,
|
|
3006
3037
|
children: [
|
|
3007
|
-
/* @__PURE__ */ a(Ft, { children: /* @__PURE__ */ a(
|
|
3038
|
+
/* @__PURE__ */ a(Ft, { children: /* @__PURE__ */ a(de, { children: U }) }),
|
|
3008
3039
|
/* @__PURE__ */ v(Mt, { children: [
|
|
3009
3040
|
i === void 0 && /* @__PURE__ */ a(
|
|
3010
3041
|
Ks,
|
|
@@ -3014,24 +3045,24 @@ const _i = ({
|
|
|
3014
3045
|
getTd: y
|
|
3015
3046
|
}
|
|
3016
3047
|
),
|
|
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:
|
|
3048
|
+
i == null ? void 0 : i.map((f, m) => {
|
|
3049
|
+
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({
|
|
3050
|
+
Td: z[se],
|
|
3051
|
+
key: `row_${m}_cell_${Y}`,
|
|
3052
|
+
column: Y,
|
|
3053
|
+
colIndex: se,
|
|
3054
|
+
rowIndex: m,
|
|
3024
3055
|
row: f
|
|
3025
|
-
})),
|
|
3026
|
-
|
|
3056
|
+
})), fe = !q && o && /* @__PURE__ */ a(
|
|
3057
|
+
Ce,
|
|
3027
3058
|
{
|
|
3028
3059
|
position: s.length,
|
|
3029
3060
|
tableWidth: I,
|
|
3030
3061
|
columnWidth: t,
|
|
3031
3062
|
canHide: !1,
|
|
3032
3063
|
isActionCell: !0,
|
|
3033
|
-
"data-testid":
|
|
3034
|
-
children: o({ rowIndex:
|
|
3064
|
+
"data-testid": _ ? _({ row: f, rowIndex: m }) : `actions-for-row-${m}`,
|
|
3065
|
+
children: o({ rowIndex: m, row: f, ActionsColumn: Wt })
|
|
3035
3066
|
}
|
|
3036
3067
|
);
|
|
3037
3068
|
return /* @__PURE__ */ v(
|
|
@@ -3040,22 +3071,22 @@ const _i = ({
|
|
|
3040
3071
|
isDeleted: q,
|
|
3041
3072
|
isSelected: J,
|
|
3042
3073
|
onClick: K,
|
|
3043
|
-
rowOuiaId: S == null ? void 0 : S({ row: f, rowIndex:
|
|
3074
|
+
rowOuiaId: S == null ? void 0 : S({ row: f, rowIndex: m }),
|
|
3044
3075
|
children: [
|
|
3045
|
-
|
|
3046
|
-
|
|
3076
|
+
X,
|
|
3077
|
+
fe
|
|
3047
3078
|
]
|
|
3048
3079
|
},
|
|
3049
|
-
`row_${
|
|
3080
|
+
`row_${m}`
|
|
3050
3081
|
);
|
|
3051
3082
|
}),
|
|
3052
|
-
(i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ a(
|
|
3083
|
+
(i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ a(de, { children: /* @__PURE__ */ a(xe, { colSpan: s.length, children: k }) })
|
|
3053
3084
|
] })
|
|
3054
3085
|
]
|
|
3055
3086
|
}
|
|
3056
3087
|
);
|
|
3057
3088
|
}, dt = Pe(
|
|
3058
|
-
|
|
3089
|
+
ne((e, t) => {
|
|
3059
3090
|
const {
|
|
3060
3091
|
tableWidth: s,
|
|
3061
3092
|
columnWidth: i,
|
|
@@ -3077,8 +3108,8 @@ const _i = ({
|
|
|
3077
3108
|
})
|
|
3078
3109
|
);
|
|
3079
3110
|
dt.displayName = "ResponsiveTh";
|
|
3080
|
-
const
|
|
3081
|
-
|
|
3111
|
+
const Ce = Pe(
|
|
3112
|
+
ne((e, t) => {
|
|
3082
3113
|
const {
|
|
3083
3114
|
tableWidth: s,
|
|
3084
3115
|
columnWidth: i,
|
|
@@ -3099,10 +3130,10 @@ const Ee = Pe(
|
|
|
3099
3130
|
);
|
|
3100
3131
|
})
|
|
3101
3132
|
);
|
|
3102
|
-
|
|
3133
|
+
Ce.displayName = "ResponsiveTd";
|
|
3103
3134
|
const ht = Pe(
|
|
3104
3135
|
({ isDeleted: e, isSelected: t, onClick: s, children: i, rowOuiaId: r }) => /* @__PURE__ */ a(
|
|
3105
|
-
|
|
3136
|
+
de,
|
|
3106
3137
|
{
|
|
3107
3138
|
onRowClick: (n) => {
|
|
3108
3139
|
(n == null ? void 0 : n.target) instanceof HTMLElement && (["a", "button"].includes(n.target.tagName.toLowerCase()) || s && s());
|
|
@@ -3123,14 +3154,14 @@ export {
|
|
|
3123
3154
|
Kt as AuthConfigContext,
|
|
3124
3155
|
Js as BasicAuthModal,
|
|
3125
3156
|
hi as ChipFilterInput,
|
|
3126
|
-
|
|
3157
|
+
Ee as DateTime,
|
|
3127
3158
|
ht as DeletableRow,
|
|
3128
3159
|
di as FilterChips,
|
|
3129
3160
|
Zs as FromNow,
|
|
3130
3161
|
O as If,
|
|
3131
3162
|
li as IfAuth,
|
|
3132
3163
|
ei as IfNotEmpty,
|
|
3133
|
-
|
|
3164
|
+
_e as IfNotLoading,
|
|
3134
3165
|
ti as ListWithToolbar,
|
|
3135
3166
|
gi as Loading,
|
|
3136
3167
|
si as ObjectDropdown,
|
|
@@ -3139,7 +3170,7 @@ export {
|
|
|
3139
3170
|
oi as PleaseWaitModal,
|
|
3140
3171
|
ai as ProgressModal,
|
|
3141
3172
|
_i as ResponsiveTable,
|
|
3142
|
-
|
|
3173
|
+
Ce as ResponsiveTd,
|
|
3143
3174
|
dt as ResponsiveTh,
|
|
3144
3175
|
Ks as TableSkeleton,
|
|
3145
3176
|
ii as ToggleIcon,
|