@apicurio/common-ui-components 2.0.3 → 2.0.5
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/auth/AuthConfigContext.d.ts +0 -1
- package/dist/common/ObjectDropdown.d.ts +1 -1
- package/dist/filtering/ChipFilterCriteria.d.ts +6 -0
- package/dist/filtering/ChipFilterInput.d.ts +12 -0
- package/dist/filtering/ChipFilterType.d.ts +5 -0
- package/dist/filtering/FilterChips.d.ts +13 -0
- package/dist/filtering/index.d.ts +4 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +1228 -929
- package/dist/modals/BasicAuthModal.d.ts +1 -1
- package/dist/table/ChipFilter/ChipFilter.d.ts +1 -1
- package/dist/table/ChipFilter/components/FilterSearch.d.ts +1 -1
- package/dist/table/ResponsiveTable.d.ts +5 -5
- package/package.json +24 -24
package/dist/main.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx as a, jsxs as
|
|
3
|
-
import { EmptyState as
|
|
4
|
-
import { EllipsisVIcon as
|
|
5
|
-
import { DateTime as
|
|
6
|
-
import { Tr as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
1
|
+
import H, { createContext as mt, useContext as wt, useState as y, useEffect as Re, memo as Ue, forwardRef as ie, useCallback as je, useMemo as Fe } from "react";
|
|
2
|
+
import { jsx as a, jsxs as m, Fragment as ue } from "react/jsx-runtime";
|
|
3
|
+
import { EmptyState as re, EmptyStateVariant as vt, EmptyStateHeader as ne, EmptyStateBody as ve, Spinner as ee, Alert as St, Dropdown as yt, MenuToggle as _e, DropdownList as bt, Divider as Ve, DropdownItem as kt, Select as xe, SelectOption as Ae, TextInput as oe, Button as ae, TextArea as Tt, AboutModal as It, TextContent as Et, Text as $e, TextVariants as He, TextList as Le, TextListItem as k, Modal as Oe, Form as Ge, FormGroup as Me, Progress as Ct, EmptyStateIcon as Qe, ChipGroup as Pt, Chip as Rt, InputGroup as Xe, ButtonVariant as Ut, Pagination as xt, PaginationVariant as At, Skeleton as Ot, SearchInput as Nt, SelectList as qt, ToolbarItem as Dt, ToolbarToggleGroup as jt, ToolbarGroup as Ft, ToolbarFilter as $t } from "@patternfly/react-core";
|
|
4
|
+
import { EllipsisVIcon as Ht, ChevronDownIcon as Lt, ChevronRightIcon as Mt, ErrorCircleOIcon as Wt, SearchIcon as Jt, FilterIcon as Ye } from "@patternfly/react-icons";
|
|
5
|
+
import { DateTime as fe } from "luxon";
|
|
6
|
+
import { Tr as ce, Td as Ne, Th as Kt, Table as Bt, Thead as zt, Tbody as Vt, ActionsColumn as Gt } from "@patternfly/react-table";
|
|
7
|
+
import Qt from "use-resize-observer";
|
|
8
|
+
const Xt = mt({
|
|
9
9
|
type: "none"
|
|
10
10
|
});
|
|
11
|
-
class
|
|
11
|
+
class Y extends Error {
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
function
|
|
13
|
+
Y.prototype.name = "InvalidTokenError";
|
|
14
|
+
function Yt(e) {
|
|
15
15
|
return decodeURIComponent(atob(e).replace(/(.)/g, (t, s) => {
|
|
16
16
|
let i = s.charCodeAt(0).toString(16).toUpperCase();
|
|
17
17
|
return i.length < 2 && (i = "0" + i), "%" + i;
|
|
18
18
|
}));
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function Zt(e) {
|
|
21
21
|
let t = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
22
22
|
switch (t.length % 4) {
|
|
23
23
|
case 0:
|
|
@@ -32,31 +32,31 @@ function zt(e) {
|
|
|
32
32
|
throw new Error("base64 string is not of the correct length");
|
|
33
33
|
}
|
|
34
34
|
try {
|
|
35
|
-
return
|
|
35
|
+
return Yt(t);
|
|
36
36
|
} catch {
|
|
37
37
|
return atob(t);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function es(e, t) {
|
|
41
41
|
if (typeof e != "string")
|
|
42
|
-
throw new
|
|
42
|
+
throw new Y("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 Y(`Invalid token specified: missing part #${s + 1}`);
|
|
47
47
|
let r;
|
|
48
48
|
try {
|
|
49
|
-
r =
|
|
50
|
-
} catch (
|
|
51
|
-
throw new
|
|
49
|
+
r = Zt(i);
|
|
50
|
+
} catch (o) {
|
|
51
|
+
throw new Y(`Invalid token specified: invalid base64 for part #${s + 1} (${o.message})`);
|
|
52
52
|
}
|
|
53
53
|
try {
|
|
54
54
|
return JSON.parse(r);
|
|
55
|
-
} catch (
|
|
56
|
-
throw new
|
|
55
|
+
} catch (o) {
|
|
56
|
+
throw new Y(`Invalid token specified: invalid json for part #${s + 1} (${o.message})`);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
var
|
|
59
|
+
var ts = {
|
|
60
60
|
debug: () => {
|
|
61
61
|
},
|
|
62
62
|
info: () => {
|
|
@@ -65,39 +65,39 @@ var Bt = {
|
|
|
65
65
|
},
|
|
66
66
|
error: () => {
|
|
67
67
|
}
|
|
68
|
-
},
|
|
68
|
+
}, F, $, le = /* @__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))(le || {});
|
|
69
69
|
((e) => {
|
|
70
70
|
function t() {
|
|
71
|
-
|
|
71
|
+
F = 3, $ = ts;
|
|
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
|
+
F = r;
|
|
78
78
|
}
|
|
79
79
|
e.setLevel = s;
|
|
80
80
|
function i(r) {
|
|
81
|
-
|
|
81
|
+
$ = r;
|
|
82
82
|
}
|
|
83
83
|
e.setLogger = i;
|
|
84
|
-
})(
|
|
85
|
-
var u = class
|
|
84
|
+
})(le || (le = {}));
|
|
85
|
+
var u = 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
|
+
F >= 4 && $.debug(D._format(this._name, this._method), ...t);
|
|
92
92
|
}
|
|
93
93
|
info(...t) {
|
|
94
|
-
|
|
94
|
+
F >= 3 && $.info(D._format(this._name, this._method), ...t);
|
|
95
95
|
}
|
|
96
96
|
warn(...t) {
|
|
97
|
-
|
|
97
|
+
F >= 2 && $.warn(D._format(this._name, this._method), ...t);
|
|
98
98
|
}
|
|
99
99
|
error(...t) {
|
|
100
|
-
|
|
100
|
+
F >= 1 && $.error(D._format(this._name, this._method), ...t);
|
|
101
101
|
}
|
|
102
102
|
/* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
|
|
103
103
|
throw(t) {
|
|
@@ -108,7 +108,7 @@ var u = class O {
|
|
|
108
108
|
return s._method = t, s.debug("begin"), s;
|
|
109
109
|
}
|
|
110
110
|
static createStatic(t, s) {
|
|
111
|
-
const i = new
|
|
111
|
+
const i = new D(`${t}.${s}`);
|
|
112
112
|
return i.debug("begin"), i;
|
|
113
113
|
}
|
|
114
114
|
static _format(t, s) {
|
|
@@ -118,21 +118,41 @@ var u = class O {
|
|
|
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
|
+
F >= 4 && $.debug(D._format(t), ...s);
|
|
122
122
|
}
|
|
123
123
|
static info(t, ...s) {
|
|
124
|
-
|
|
124
|
+
F >= 3 && $.info(D._format(t), ...s);
|
|
125
125
|
}
|
|
126
126
|
static warn(t, ...s) {
|
|
127
|
-
|
|
127
|
+
F >= 2 && $.warn(D._format(t), ...s);
|
|
128
128
|
}
|
|
129
129
|
static error(t, ...s) {
|
|
130
|
-
|
|
130
|
+
F >= 1 && $.error(D._format(t), ...s);
|
|
131
131
|
}
|
|
132
132
|
/* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */
|
|
133
133
|
};
|
|
134
|
-
|
|
135
|
-
var
|
|
134
|
+
le.reset();
|
|
135
|
+
var de = class {
|
|
136
|
+
// IMPORTANT: doesn't validate the token
|
|
137
|
+
static decode(e) {
|
|
138
|
+
try {
|
|
139
|
+
return es(e);
|
|
140
|
+
} catch (t) {
|
|
141
|
+
throw u.error("JwtUtils.decode", t), t;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
static async generateSignedJwt(e, t, s) {
|
|
145
|
+
const i = C.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))), r = C.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))), o = `${i}.${r}`, n = await window.crypto.subtle.sign(
|
|
146
|
+
{
|
|
147
|
+
name: "ECDSA",
|
|
148
|
+
hash: { name: "SHA-256" }
|
|
149
|
+
},
|
|
150
|
+
s,
|
|
151
|
+
new TextEncoder().encode(o)
|
|
152
|
+
), c = C.encodeBase64Url(new Uint8Array(n));
|
|
153
|
+
return `${o}.${c}`;
|
|
154
|
+
}
|
|
155
|
+
}, ss = "10000000-1000-4000-8000-100000000000", Se = (e) => btoa([...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")), Ze = class j {
|
|
136
156
|
static _randomWord() {
|
|
137
157
|
const t = new Uint32Array(1);
|
|
138
158
|
return crypto.getRandomValues(t), t[0];
|
|
@@ -141,16 +161,16 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
141
161
|
* Generates RFC4122 version 4 guid
|
|
142
162
|
*/
|
|
143
163
|
static generateUUIDv4() {
|
|
144
|
-
return
|
|
164
|
+
return ss.replace(
|
|
145
165
|
/[018]/g,
|
|
146
|
-
(s) => (+s ^
|
|
166
|
+
(s) => (+s ^ j._randomWord() & 15 >> +s / 4).toString(16)
|
|
147
167
|
).replace(/-/g, "");
|
|
148
168
|
}
|
|
149
169
|
/**
|
|
150
170
|
* PKCE: Generate a code verifier
|
|
151
171
|
*/
|
|
152
172
|
static generateCodeVerifier() {
|
|
153
|
-
return
|
|
173
|
+
return j.generateUUIDv4() + j.generateUUIDv4() + j.generateUUIDv4();
|
|
154
174
|
}
|
|
155
175
|
/**
|
|
156
176
|
* PKCE: Generate a code challenge
|
|
@@ -160,7 +180,7 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
160
180
|
throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");
|
|
161
181
|
try {
|
|
162
182
|
const i = new TextEncoder().encode(t), r = await crypto.subtle.digest("SHA-256", i);
|
|
163
|
-
return
|
|
183
|
+
return Se(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
164
184
|
} catch (s) {
|
|
165
185
|
throw u.error("CryptoUtils.generateCodeChallenge", s), s;
|
|
166
186
|
}
|
|
@@ -170,11 +190,112 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
170
190
|
*/
|
|
171
191
|
static generateBasicAuth(t, s) {
|
|
172
192
|
const r = new TextEncoder().encode([t, s].join(":"));
|
|
173
|
-
return
|
|
193
|
+
return Se(r);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Generates a hash of a string using a given algorithm
|
|
197
|
+
* @param alg
|
|
198
|
+
* @param message
|
|
199
|
+
*/
|
|
200
|
+
static async hash(t, s) {
|
|
201
|
+
const i = new TextEncoder().encode(s), r = await crypto.subtle.digest(t, i);
|
|
202
|
+
return new Uint8Array(r);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Generates a rfc7638 compliant jwk thumbprint
|
|
206
|
+
* @param jwk
|
|
207
|
+
*/
|
|
208
|
+
static async customCalculateJwkThumbprint(t) {
|
|
209
|
+
let s;
|
|
210
|
+
switch (t.kty) {
|
|
211
|
+
case "RSA":
|
|
212
|
+
s = {
|
|
213
|
+
e: t.e,
|
|
214
|
+
kty: t.kty,
|
|
215
|
+
n: t.n
|
|
216
|
+
};
|
|
217
|
+
break;
|
|
218
|
+
case "EC":
|
|
219
|
+
s = {
|
|
220
|
+
crv: t.crv,
|
|
221
|
+
kty: t.kty,
|
|
222
|
+
x: t.x,
|
|
223
|
+
y: t.y
|
|
224
|
+
};
|
|
225
|
+
break;
|
|
226
|
+
case "OKP":
|
|
227
|
+
s = {
|
|
228
|
+
crv: t.crv,
|
|
229
|
+
kty: t.kty,
|
|
230
|
+
x: t.x
|
|
231
|
+
};
|
|
232
|
+
break;
|
|
233
|
+
case "oct":
|
|
234
|
+
s = {
|
|
235
|
+
crv: t.k,
|
|
236
|
+
kty: t.kty
|
|
237
|
+
};
|
|
238
|
+
break;
|
|
239
|
+
default:
|
|
240
|
+
throw new Error("Unknown jwk type");
|
|
241
|
+
}
|
|
242
|
+
const i = await j.hash("SHA-256", JSON.stringify(s));
|
|
243
|
+
return j.encodeBase64Url(i);
|
|
244
|
+
}
|
|
245
|
+
static async generateDPoPProof({
|
|
246
|
+
url: t,
|
|
247
|
+
accessToken: s,
|
|
248
|
+
httpMethod: i,
|
|
249
|
+
keyPair: r,
|
|
250
|
+
nonce: o
|
|
251
|
+
}) {
|
|
252
|
+
let n, c;
|
|
253
|
+
const l = {
|
|
254
|
+
jti: window.crypto.randomUUID(),
|
|
255
|
+
htm: i ?? "GET",
|
|
256
|
+
htu: t,
|
|
257
|
+
iat: Math.floor(Date.now() / 1e3)
|
|
258
|
+
};
|
|
259
|
+
s && (n = await j.hash("SHA-256", s), c = j.encodeBase64Url(n), l.ath = c), o && (l.nonce = o);
|
|
260
|
+
try {
|
|
261
|
+
const d = await crypto.subtle.exportKey("jwk", r.publicKey), h = {
|
|
262
|
+
alg: "ES256",
|
|
263
|
+
typ: "dpop+jwt",
|
|
264
|
+
jwk: {
|
|
265
|
+
crv: d.crv,
|
|
266
|
+
kty: d.kty,
|
|
267
|
+
x: d.x,
|
|
268
|
+
y: d.y
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
return await de.generateSignedJwt(h, l, r.privateKey);
|
|
272
|
+
} catch (d) {
|
|
273
|
+
throw d instanceof TypeError ? new Error(`Error exporting dpop public key: ${d.message}`) : d;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
static async generateDPoPJkt(t) {
|
|
277
|
+
try {
|
|
278
|
+
const s = await crypto.subtle.exportKey("jwk", t.publicKey);
|
|
279
|
+
return await j.customCalculateJwkThumbprint(s);
|
|
280
|
+
} catch (s) {
|
|
281
|
+
throw s instanceof TypeError ? new Error(`Could not retrieve dpop keys from storage: ${s.message}`) : s;
|
|
282
|
+
}
|
|
174
283
|
}
|
|
175
|
-
|
|
284
|
+
static async generateDPoPKeys() {
|
|
285
|
+
return await window.crypto.subtle.generateKey(
|
|
286
|
+
{
|
|
287
|
+
name: "ECDSA",
|
|
288
|
+
namedCurve: "P-256"
|
|
289
|
+
},
|
|
290
|
+
!1,
|
|
291
|
+
["sign", "verify"]
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
Ze.encodeBase64Url = (e) => Se(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
296
|
+
var C = Ze, W = class {
|
|
176
297
|
constructor(e) {
|
|
177
|
-
this._name = e, this._logger = new u(`Event('${this._name}')`)
|
|
298
|
+
this._name = e, this._callbacks = [], this._logger = new u(`Event('${this._name}')`);
|
|
178
299
|
}
|
|
179
300
|
addHandler(e) {
|
|
180
301
|
return this._callbacks.push(e), () => this.removeHandler(e);
|
|
@@ -188,16 +309,7 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
188
309
|
for (const t of this._callbacks)
|
|
189
310
|
await t(...e);
|
|
190
311
|
}
|
|
191
|
-
},
|
|
192
|
-
// IMPORTANT: doesn't validate the token
|
|
193
|
-
static decode(e) {
|
|
194
|
-
try {
|
|
195
|
-
return Jt(e);
|
|
196
|
-
} catch (t) {
|
|
197
|
-
throw u.error("JwtUtils.decode", t), t;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}, Fe = class {
|
|
312
|
+
}, We = class {
|
|
201
313
|
/**
|
|
202
314
|
* Populates a map of window features with a placement centered in front of
|
|
203
315
|
* the current window. If no explicit width is given, a default value is
|
|
@@ -210,11 +322,11 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
210
322
|
static serialize(e) {
|
|
211
323
|
return Object.entries(e).filter(([, t]) => t != null).map(([t, s]) => `${t}=${typeof s != "boolean" ? s : s ? "yes" : "no"}`).join(",");
|
|
212
324
|
}
|
|
213
|
-
}, M = class
|
|
325
|
+
}, M = class se extends W {
|
|
214
326
|
constructor() {
|
|
215
327
|
super(...arguments), this._logger = new u(`Timer('${this._name}')`), this._timerHandle = null, this._expiration = 0, this._callback = () => {
|
|
216
|
-
const t = this._expiration -
|
|
217
|
-
this._logger.debug("timer completes in", t), this._expiration <=
|
|
328
|
+
const t = this._expiration - se.getEpochTime();
|
|
329
|
+
this._logger.debug("timer completes in", t), this._expiration <= se.getEpochTime() && (this.cancel(), super.raise());
|
|
218
330
|
};
|
|
219
331
|
}
|
|
220
332
|
// get the time
|
|
@@ -224,7 +336,7 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
224
336
|
init(t) {
|
|
225
337
|
const s = this._logger.create("init");
|
|
226
338
|
t = Math.max(Math.floor(t), 1);
|
|
227
|
-
const i =
|
|
339
|
+
const i = se.getEpochTime() + t;
|
|
228
340
|
if (this.expiration === i && this._timerHandle) {
|
|
229
341
|
s.debug("skipping since already initialized for expiration at", this.expiration);
|
|
230
342
|
return;
|
|
@@ -239,25 +351,24 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
239
351
|
cancel() {
|
|
240
352
|
this._logger.create("cancel"), this._timerHandle && (clearInterval(this._timerHandle), this._timerHandle = null);
|
|
241
353
|
}
|
|
242
|
-
},
|
|
354
|
+
}, ye = class {
|
|
243
355
|
static readParams(e, t = "query") {
|
|
244
|
-
if (!e)
|
|
245
|
-
throw new TypeError("Invalid URL");
|
|
356
|
+
if (!e) throw new TypeError("Invalid URL");
|
|
246
357
|
const i = new URL(e, "http://127.0.0.1")[t === "fragment" ? "hash" : "search"];
|
|
247
358
|
return new URLSearchParams(i.slice(1));
|
|
248
359
|
}
|
|
249
|
-
},
|
|
360
|
+
}, be = ";", B = class extends Error {
|
|
250
361
|
constructor(e, t) {
|
|
251
362
|
var s, i, r;
|
|
252
363
|
if (super(e.error_description || e.error || ""), this.form = t, this.name = "ErrorResponse", !e.error)
|
|
253
364
|
throw u.error("ErrorResponse", "No error passed"), new Error("No error passed");
|
|
254
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;
|
|
255
366
|
}
|
|
256
|
-
},
|
|
367
|
+
}, qe = class extends Error {
|
|
257
368
|
constructor(e) {
|
|
258
369
|
super(e), this.name = "ErrorTimeout";
|
|
259
370
|
}
|
|
260
|
-
},
|
|
371
|
+
}, is = class {
|
|
261
372
|
constructor(e) {
|
|
262
373
|
this._logger = new u("AccessTokenEvents"), this._expiringTimer = new M("Access token expiring"), this._expiredTimer = new M("Access token expired"), this._expiringNotificationTimeInSeconds = e.expiringNotificationTimeInSeconds;
|
|
263
374
|
}
|
|
@@ -302,13 +413,13 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
302
413
|
removeAccessTokenExpired(e) {
|
|
303
414
|
this._expiredTimer.removeHandler(e);
|
|
304
415
|
}
|
|
305
|
-
},
|
|
416
|
+
}, rs = class {
|
|
306
417
|
constructor(e, t, s, i, r) {
|
|
307
|
-
this._callback = e, this._client_id = t, this._intervalInSeconds = i, this._stopOnError = r, this._logger = new u("CheckSessionIFrame"), this._timer = null, this._session_state = null, this._message = (
|
|
308
|
-
|
|
418
|
+
this._callback = e, this._client_id = t, this._intervalInSeconds = i, this._stopOnError = r, this._logger = new u("CheckSessionIFrame"), this._timer = null, this._session_state = null, this._message = (n) => {
|
|
419
|
+
n.origin === this._frame_origin && n.source === this._frame.contentWindow && (n.data === "error" ? (this._logger.error("error message from check session op iframe"), this._stopOnError && this.stop()) : n.data === "changed" ? (this._logger.debug("changed message from check session op iframe"), this.stop(), this._callback()) : this._logger.debug(n.data + " message from check session op iframe"));
|
|
309
420
|
};
|
|
310
|
-
const
|
|
311
|
-
this._frame_origin =
|
|
421
|
+
const o = new URL(s);
|
|
422
|
+
this._frame_origin = o.origin, this._frame = window.document.createElement("iframe"), this._frame.style.visibility = "hidden", this._frame.style.position = "fixed", this._frame.style.left = "-1000px", this._frame.style.top = "0", this._frame.width = "0", this._frame.height = "0", this._frame.src = o.href;
|
|
312
423
|
}
|
|
313
424
|
load() {
|
|
314
425
|
return new Promise((e) => {
|
|
@@ -329,7 +440,7 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
329
440
|
stop() {
|
|
330
441
|
this._logger.create("stop"), this._session_state = null, this._timer && (clearInterval(this._timer), this._timer = null);
|
|
331
442
|
}
|
|
332
|
-
},
|
|
443
|
+
}, et = class {
|
|
333
444
|
constructor() {
|
|
334
445
|
this._logger = new u("InMemoryWebStorage"), this._data = {};
|
|
335
446
|
}
|
|
@@ -351,7 +462,11 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
351
462
|
key(e) {
|
|
352
463
|
return Object.getOwnPropertyNames(this._data)[e];
|
|
353
464
|
}
|
|
354
|
-
},
|
|
465
|
+
}, ke = class extends Error {
|
|
466
|
+
constructor(e, t) {
|
|
467
|
+
super(t), this.name = "ErrorDPoPNonce", this.nonce = e;
|
|
468
|
+
}
|
|
469
|
+
}, De = class {
|
|
355
470
|
constructor(e = [], t = null, s = {}) {
|
|
356
471
|
this._jwtHandler = t, this._extraHeaders = s, this._logger = new u("JsonService"), this._contentTypes = [], this._contentTypes.push(...e, "application/json"), t && this._contentTypes.push("application/jwt");
|
|
357
472
|
}
|
|
@@ -359,78 +474,86 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
359
474
|
const { timeoutInSeconds: s, ...i } = t;
|
|
360
475
|
if (!s)
|
|
361
476
|
return await fetch(e, i);
|
|
362
|
-
const r = new AbortController(),
|
|
477
|
+
const r = new AbortController(), o = setTimeout(() => r.abort(), s * 1e3);
|
|
363
478
|
try {
|
|
364
479
|
return await fetch(e, {
|
|
365
480
|
...t,
|
|
366
481
|
signal: r.signal
|
|
367
482
|
});
|
|
368
|
-
} catch (
|
|
369
|
-
throw
|
|
483
|
+
} catch (n) {
|
|
484
|
+
throw n instanceof DOMException && n.name === "AbortError" ? new qe("Network timed out") : n;
|
|
370
485
|
} finally {
|
|
371
|
-
clearTimeout(
|
|
486
|
+
clearTimeout(o);
|
|
372
487
|
}
|
|
373
488
|
}
|
|
374
489
|
async getJson(e, {
|
|
375
490
|
token: t,
|
|
376
|
-
credentials: s
|
|
491
|
+
credentials: s,
|
|
492
|
+
timeoutInSeconds: i
|
|
377
493
|
} = {}) {
|
|
378
|
-
const
|
|
494
|
+
const r = this._logger.create("getJson"), o = {
|
|
379
495
|
Accept: this._contentTypes.join(", ")
|
|
380
496
|
};
|
|
381
|
-
t && (
|
|
497
|
+
t && (r.debug("token passed, setting Authorization header"), o.Authorization = "Bearer " + t), this.appendExtraHeaders(o);
|
|
382
498
|
let n;
|
|
383
499
|
try {
|
|
384
|
-
|
|
385
|
-
} catch (
|
|
386
|
-
throw
|
|
500
|
+
r.debug("url:", e), n = await this.fetchWithTimeout(e, { method: "GET", headers: o, timeoutInSeconds: i, credentials: s });
|
|
501
|
+
} catch (d) {
|
|
502
|
+
throw r.error("Network Error"), d;
|
|
387
503
|
}
|
|
388
|
-
|
|
504
|
+
r.debug("HTTP response received, status", n.status);
|
|
389
505
|
const c = n.headers.get("Content-Type");
|
|
390
|
-
if (c && !this._contentTypes.find((
|
|
506
|
+
if (c && !this._contentTypes.find((d) => c.startsWith(d)) && r.throw(new Error(`Invalid response Content-Type: ${c ?? "undefined"}, from URL: ${e}`)), n.ok && this._jwtHandler && (c != null && c.startsWith("application/jwt")))
|
|
391
507
|
return await this._jwtHandler(await n.text());
|
|
392
|
-
let
|
|
508
|
+
let l;
|
|
393
509
|
try {
|
|
394
|
-
|
|
395
|
-
} catch (
|
|
396
|
-
throw
|
|
510
|
+
l = await n.json();
|
|
511
|
+
} catch (d) {
|
|
512
|
+
throw r.error("Error parsing JSON response", d), n.ok ? d : new Error(`${n.statusText} (${n.status})`);
|
|
397
513
|
}
|
|
398
514
|
if (!n.ok)
|
|
399
|
-
throw
|
|
400
|
-
return
|
|
515
|
+
throw r.error("Error from server:", l), l.error ? new B(l) : new Error(`${n.statusText} (${n.status}): ${JSON.stringify(l)}`);
|
|
516
|
+
return l;
|
|
401
517
|
}
|
|
402
518
|
async postForm(e, {
|
|
403
519
|
body: t,
|
|
404
520
|
basicAuth: s,
|
|
405
521
|
timeoutInSeconds: i,
|
|
406
|
-
initCredentials: r
|
|
522
|
+
initCredentials: r,
|
|
523
|
+
extraHeaders: o
|
|
407
524
|
}) {
|
|
408
525
|
const n = this._logger.create("postForm"), c = {
|
|
409
526
|
Accept: this._contentTypes.join(", "),
|
|
410
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
527
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
528
|
+
...o
|
|
411
529
|
};
|
|
412
530
|
s !== void 0 && (c.Authorization = "Basic " + s), this.appendExtraHeaders(c);
|
|
413
|
-
let
|
|
531
|
+
let l;
|
|
414
532
|
try {
|
|
415
|
-
n.debug("url:", e),
|
|
416
|
-
} catch (
|
|
417
|
-
throw n.error("Network error"),
|
|
533
|
+
n.debug("url:", e), l = await this.fetchWithTimeout(e, { method: "POST", headers: c, body: t, timeoutInSeconds: i, credentials: r });
|
|
534
|
+
} catch (_) {
|
|
535
|
+
throw n.error("Network error"), _;
|
|
418
536
|
}
|
|
419
|
-
n.debug("HTTP response received, status",
|
|
420
|
-
const
|
|
421
|
-
if (
|
|
422
|
-
throw new Error(`Invalid response Content-Type: ${
|
|
423
|
-
const
|
|
424
|
-
let
|
|
425
|
-
if (
|
|
537
|
+
n.debug("HTTP response received, status", l.status);
|
|
538
|
+
const d = l.headers.get("Content-Type");
|
|
539
|
+
if (d && !this._contentTypes.find((_) => d.startsWith(_)))
|
|
540
|
+
throw new Error(`Invalid response Content-Type: ${d ?? "undefined"}, from URL: ${e}`);
|
|
541
|
+
const h = await l.text();
|
|
542
|
+
let g = {};
|
|
543
|
+
if (h)
|
|
426
544
|
try {
|
|
427
|
-
|
|
428
|
-
} catch (
|
|
429
|
-
throw n.error("Error parsing JSON response",
|
|
545
|
+
g = JSON.parse(h);
|
|
546
|
+
} catch (_) {
|
|
547
|
+
throw n.error("Error parsing JSON response", _), l.ok ? _ : new Error(`${l.statusText} (${l.status})`);
|
|
548
|
+
}
|
|
549
|
+
if (!l.ok) {
|
|
550
|
+
if (n.error("Error from server:", g), l.headers.has("dpop-nonce")) {
|
|
551
|
+
const _ = l.headers.get("dpop-nonce");
|
|
552
|
+
throw new ke(_, `${JSON.stringify(g)}`);
|
|
430
553
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
return
|
|
554
|
+
throw g.error ? new B(g, t) : new Error(`${l.statusText} (${l.status}): ${JSON.stringify(g)}`);
|
|
555
|
+
}
|
|
556
|
+
return g;
|
|
434
557
|
}
|
|
435
558
|
appendExtraHeaders(e) {
|
|
436
559
|
const t = this._logger.create("appendExtraHeaders"), s = Object.keys(this._extraHeaders), i = [
|
|
@@ -443,13 +566,13 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
443
566
|
t.warn("Protected header could not be overridden", r, i);
|
|
444
567
|
return;
|
|
445
568
|
}
|
|
446
|
-
const
|
|
447
|
-
|
|
569
|
+
const o = typeof this._extraHeaders[r] == "function" ? this._extraHeaders[r]() : this._extraHeaders[r];
|
|
570
|
+
o && o !== "" && (e[r] = o);
|
|
448
571
|
});
|
|
449
572
|
}
|
|
450
|
-
},
|
|
573
|
+
}, ns = class {
|
|
451
574
|
constructor(e) {
|
|
452
|
-
this._settings = e, this._logger = new u("MetadataService"), this._signingKeys = null, this._metadata = null, this._metadataUrl = this._settings.metadataUrl, this._jsonService = new
|
|
575
|
+
this._settings = e, this._logger = new u("MetadataService"), this._signingKeys = null, this._metadata = null, this._metadataUrl = this._settings.metadataUrl, this._jsonService = new De(
|
|
453
576
|
["application/jwk-set+json"],
|
|
454
577
|
null,
|
|
455
578
|
this._settings.extraHeaders
|
|
@@ -465,7 +588,7 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
465
588
|
if (!this._metadataUrl)
|
|
466
589
|
throw e.throw(new Error("No authority or metadataUrl configured on settings")), null;
|
|
467
590
|
e.debug("getting metadata from", this._metadataUrl);
|
|
468
|
-
const t = await this._jsonService.getJson(this._metadataUrl, { credentials: this._fetchRequestCredentials });
|
|
591
|
+
const t = await this._jsonService.getJson(this._metadataUrl, { credentials: this._fetchRequestCredentials, timeoutInSeconds: this._settings.requestTimeoutInSeconds });
|
|
469
592
|
return e.debug("merging remote JSON with seed metadata"), this._metadata = Object.assign({}, this._settings.metadataSeed, t), this._metadata;
|
|
470
593
|
}
|
|
471
594
|
getIssuer() {
|
|
@@ -509,12 +632,12 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
509
632
|
return e.debug("returning signingKeys from cache"), this._signingKeys;
|
|
510
633
|
const t = await this.getKeysEndpoint(!1);
|
|
511
634
|
e.debug("got jwks_uri", t);
|
|
512
|
-
const s = await this._jsonService.getJson(t);
|
|
635
|
+
const s = await this._jsonService.getJson(t, { timeoutInSeconds: this._settings.requestTimeoutInSeconds });
|
|
513
636
|
if (e.debug("got key set", s), !Array.isArray(s.keys))
|
|
514
637
|
throw e.throw(new Error("Missing keys on keyset")), null;
|
|
515
638
|
return this._signingKeys = s.keys, this._signingKeys;
|
|
516
639
|
}
|
|
517
|
-
},
|
|
640
|
+
}, tt = class {
|
|
518
641
|
constructor({
|
|
519
642
|
prefix: e = "oidc.",
|
|
520
643
|
store: t = localStorage
|
|
@@ -541,7 +664,7 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
541
664
|
}
|
|
542
665
|
return t;
|
|
543
666
|
}
|
|
544
|
-
},
|
|
667
|
+
}, os = "code", as = "openid", cs = "client_secret_post", ls = 60 * 15, Te = class {
|
|
545
668
|
constructor({
|
|
546
669
|
// metadata related
|
|
547
670
|
authority: e,
|
|
@@ -550,56 +673,61 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
550
673
|
signingKeys: i,
|
|
551
674
|
metadataSeed: r,
|
|
552
675
|
// client related
|
|
553
|
-
client_id:
|
|
554
|
-
client_secret:
|
|
555
|
-
response_type:
|
|
556
|
-
scope: l =
|
|
676
|
+
client_id: o,
|
|
677
|
+
client_secret: n,
|
|
678
|
+
response_type: c = os,
|
|
679
|
+
scope: l = as,
|
|
557
680
|
redirect_uri: d,
|
|
558
681
|
post_logout_redirect_uri: h,
|
|
559
|
-
client_authentication: g =
|
|
682
|
+
client_authentication: g = cs,
|
|
560
683
|
// optional protocol
|
|
561
|
-
prompt:
|
|
562
|
-
display:
|
|
563
|
-
max_age:
|
|
564
|
-
ui_locales:
|
|
565
|
-
acr_values:
|
|
566
|
-
resource:
|
|
567
|
-
response_mode:
|
|
684
|
+
prompt: _,
|
|
685
|
+
display: S,
|
|
686
|
+
max_age: x,
|
|
687
|
+
ui_locales: T,
|
|
688
|
+
acr_values: A,
|
|
689
|
+
resource: I,
|
|
690
|
+
response_mode: N,
|
|
568
691
|
// behavior flags
|
|
569
|
-
filterProtocolClaims:
|
|
570
|
-
loadUserInfo:
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
692
|
+
filterProtocolClaims: P = !0,
|
|
693
|
+
loadUserInfo: L = !1,
|
|
694
|
+
requestTimeoutInSeconds: R,
|
|
695
|
+
staleStateAgeInSeconds: w = ls,
|
|
696
|
+
mergeClaimsStrategy: E = { array: "replace" },
|
|
697
|
+
disablePKCE: U = !1,
|
|
574
698
|
// other behavior
|
|
575
|
-
stateStore:
|
|
576
|
-
revokeTokenAdditionalContentTypes:
|
|
577
|
-
fetchRequestCredentials:
|
|
578
|
-
refreshTokenAllowedScope:
|
|
699
|
+
stateStore: b,
|
|
700
|
+
revokeTokenAdditionalContentTypes: z,
|
|
701
|
+
fetchRequestCredentials: f,
|
|
702
|
+
refreshTokenAllowedScope: v,
|
|
579
703
|
// extra
|
|
580
|
-
extraQueryParams:
|
|
581
|
-
extraTokenParams:
|
|
582
|
-
extraHeaders:
|
|
704
|
+
extraQueryParams: q = {},
|
|
705
|
+
extraTokenParams: J = {},
|
|
706
|
+
extraHeaders: K = {},
|
|
707
|
+
dpop: Q,
|
|
708
|
+
omitScopeWhenRequesting: pe = !1
|
|
583
709
|
}) {
|
|
584
|
-
|
|
585
|
-
|
|
710
|
+
var X;
|
|
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 = o, this.client_secret = n, 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 = T, this.acr_values = A, this.resource = I, this.response_mode = N, this.filterProtocolClaims = P ?? !0, this.loadUserInfo = !!L, this.staleStateAgeInSeconds = w, this.mergeClaimsStrategy = E, this.omitScopeWhenRequesting = pe, this.disablePKCE = !!U, this.revokeTokenAdditionalContentTypes = z, this.fetchRequestCredentials = f || "same-origin", this.requestTimeoutInSeconds = R, b)
|
|
712
|
+
this.stateStore = b;
|
|
586
713
|
else {
|
|
587
|
-
const
|
|
588
|
-
this.stateStore = new
|
|
714
|
+
const te = typeof window < "u" ? window.localStorage : new et();
|
|
715
|
+
this.stateStore = new tt({ store: te });
|
|
589
716
|
}
|
|
590
|
-
this.refreshTokenAllowedScope =
|
|
717
|
+
if (this.refreshTokenAllowedScope = v, this.extraQueryParams = q, this.extraTokenParams = J, this.extraHeaders = K, this.dpop = Q, this.dpop && !((X = this.dpop) != null && X.store))
|
|
718
|
+
throw new Error("A DPoPStore is required when dpop is enabled");
|
|
591
719
|
}
|
|
592
|
-
},
|
|
720
|
+
}, ds = class {
|
|
593
721
|
constructor(e, t) {
|
|
594
722
|
this._settings = e, this._metadataService = t, this._logger = new u("UserInfoService"), this._getClaimsFromJwt = async (s) => {
|
|
595
723
|
const i = this._logger.create("_getClaimsFromJwt");
|
|
596
724
|
try {
|
|
597
|
-
const r =
|
|
725
|
+
const r = de.decode(s);
|
|
598
726
|
return i.debug("JWT decoding successful"), r;
|
|
599
727
|
} catch (r) {
|
|
600
728
|
throw i.error("Error parsing JWT response"), r;
|
|
601
729
|
}
|
|
602
|
-
}, this._jsonService = new
|
|
730
|
+
}, this._jsonService = new De(
|
|
603
731
|
void 0,
|
|
604
732
|
this._getClaimsFromJwt,
|
|
605
733
|
this._settings.extraHeaders
|
|
@@ -612,13 +740,14 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
612
740
|
t.debug("got userinfo url", s);
|
|
613
741
|
const i = await this._jsonService.getJson(s, {
|
|
614
742
|
token: e,
|
|
615
|
-
credentials: this._settings.fetchRequestCredentials
|
|
743
|
+
credentials: this._settings.fetchRequestCredentials,
|
|
744
|
+
timeoutInSeconds: this._settings.requestTimeoutInSeconds
|
|
616
745
|
});
|
|
617
746
|
return t.debug("got claims", i), i;
|
|
618
747
|
}
|
|
619
|
-
},
|
|
748
|
+
}, st = class {
|
|
620
749
|
constructor(e, t) {
|
|
621
|
-
this._settings = e, this._metadataService = t, this._logger = new u("TokenClient"), this._jsonService = new
|
|
750
|
+
this._settings = e, this._metadataService = t, this._logger = new u("TokenClient"), this._jsonService = new De(
|
|
622
751
|
this._settings.revokeTokenAdditionalContentTypes,
|
|
623
752
|
null,
|
|
624
753
|
this._settings.extraHeaders
|
|
@@ -634,28 +763,35 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
634
763
|
redirect_uri: t = this._settings.redirect_uri,
|
|
635
764
|
client_id: s = this._settings.client_id,
|
|
636
765
|
client_secret: i = this._settings.client_secret,
|
|
637
|
-
|
|
766
|
+
extraHeaders: r,
|
|
767
|
+
...o
|
|
638
768
|
}) {
|
|
639
769
|
const n = this._logger.create("exchangeCode");
|
|
640
|
-
s || n.throw(new Error("A client_id is required")), t || n.throw(new Error("A redirect_uri is required")),
|
|
770
|
+
s || n.throw(new Error("A client_id is required")), t || n.throw(new Error("A redirect_uri is required")), o.code || n.throw(new Error("A code is required"));
|
|
641
771
|
const c = new URLSearchParams({ grant_type: e, redirect_uri: t });
|
|
642
|
-
for (const [
|
|
643
|
-
|
|
644
|
-
let
|
|
772
|
+
for (const [g, _] of Object.entries(o))
|
|
773
|
+
_ != null && c.set(g, _);
|
|
774
|
+
let l;
|
|
645
775
|
switch (this._settings.client_authentication) {
|
|
646
776
|
case "client_secret_basic":
|
|
647
777
|
if (!i)
|
|
648
778
|
throw n.throw(new Error("A client_secret is required")), null;
|
|
649
|
-
|
|
779
|
+
l = C.generateBasicAuth(s, i);
|
|
650
780
|
break;
|
|
651
781
|
case "client_secret_post":
|
|
652
782
|
c.append("client_id", s), i && c.append("client_secret", i);
|
|
653
783
|
break;
|
|
654
784
|
}
|
|
655
|
-
const
|
|
785
|
+
const d = await this._metadataService.getTokenEndpoint(!1);
|
|
656
786
|
n.debug("got token endpoint");
|
|
657
|
-
const
|
|
658
|
-
|
|
787
|
+
const h = await this._jsonService.postForm(d, {
|
|
788
|
+
body: c,
|
|
789
|
+
basicAuth: l,
|
|
790
|
+
timeoutInSeconds: this._settings.requestTimeoutInSeconds,
|
|
791
|
+
initCredentials: this._settings.fetchRequestCredentials,
|
|
792
|
+
extraHeaders: r
|
|
793
|
+
});
|
|
794
|
+
return n.debug("got response"), h;
|
|
659
795
|
}
|
|
660
796
|
/**
|
|
661
797
|
* Exchange credentials.
|
|
@@ -669,26 +805,27 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
669
805
|
scope: i = this._settings.scope,
|
|
670
806
|
...r
|
|
671
807
|
}) {
|
|
672
|
-
const
|
|
673
|
-
t ||
|
|
674
|
-
const
|
|
808
|
+
const o = this._logger.create("exchangeCredentials");
|
|
809
|
+
t || o.throw(new Error("A client_id is required"));
|
|
810
|
+
const n = new URLSearchParams({ grant_type: e });
|
|
811
|
+
this._settings.omitScopeWhenRequesting || n.set("scope", i);
|
|
675
812
|
for (const [h, g] of Object.entries(r))
|
|
676
|
-
g != null &&
|
|
677
|
-
let
|
|
813
|
+
g != null && n.set(h, g);
|
|
814
|
+
let c;
|
|
678
815
|
switch (this._settings.client_authentication) {
|
|
679
816
|
case "client_secret_basic":
|
|
680
817
|
if (!s)
|
|
681
|
-
throw
|
|
682
|
-
|
|
818
|
+
throw o.throw(new Error("A client_secret is required")), null;
|
|
819
|
+
c = C.generateBasicAuth(t, s);
|
|
683
820
|
break;
|
|
684
821
|
case "client_secret_post":
|
|
685
|
-
|
|
822
|
+
n.append("client_id", t), s && n.append("client_secret", s);
|
|
686
823
|
break;
|
|
687
824
|
}
|
|
688
825
|
const l = await this._metadataService.getTokenEndpoint(!1);
|
|
689
|
-
|
|
690
|
-
const d = await this._jsonService.postForm(l, { body:
|
|
691
|
-
return
|
|
826
|
+
o.debug("got token endpoint");
|
|
827
|
+
const d = await this._jsonService.postForm(l, { body: n, basicAuth: c, timeoutInSeconds: this._settings.requestTimeoutInSeconds, initCredentials: this._settings.fetchRequestCredentials });
|
|
828
|
+
return o.debug("got response"), d;
|
|
692
829
|
}
|
|
693
830
|
/**
|
|
694
831
|
* Exchange a refresh token.
|
|
@@ -700,28 +837,29 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
700
837
|
client_id: t = this._settings.client_id,
|
|
701
838
|
client_secret: s = this._settings.client_secret,
|
|
702
839
|
timeoutInSeconds: i,
|
|
703
|
-
|
|
840
|
+
extraHeaders: r,
|
|
841
|
+
...o
|
|
704
842
|
}) {
|
|
705
843
|
const n = this._logger.create("exchangeRefreshToken");
|
|
706
|
-
t || n.throw(new Error("A client_id is required")),
|
|
844
|
+
t || n.throw(new Error("A client_id is required")), o.refresh_token || n.throw(new Error("A refresh_token is required"));
|
|
707
845
|
const c = new URLSearchParams({ grant_type: e });
|
|
708
|
-
for (const [
|
|
709
|
-
Array.isArray(
|
|
710
|
-
let
|
|
846
|
+
for (const [g, _] of Object.entries(o))
|
|
847
|
+
Array.isArray(_) ? _.forEach((S) => c.append(g, S)) : _ != null && c.set(g, _);
|
|
848
|
+
let l;
|
|
711
849
|
switch (this._settings.client_authentication) {
|
|
712
850
|
case "client_secret_basic":
|
|
713
851
|
if (!s)
|
|
714
852
|
throw n.throw(new Error("A client_secret is required")), null;
|
|
715
|
-
|
|
853
|
+
l = C.generateBasicAuth(t, s);
|
|
716
854
|
break;
|
|
717
855
|
case "client_secret_post":
|
|
718
856
|
c.append("client_id", t), s && c.append("client_secret", s);
|
|
719
857
|
break;
|
|
720
858
|
}
|
|
721
|
-
const
|
|
859
|
+
const d = await this._metadataService.getTokenEndpoint(!1);
|
|
722
860
|
n.debug("got token endpoint");
|
|
723
|
-
const
|
|
724
|
-
return n.debug("got response"),
|
|
861
|
+
const h = await this._jsonService.postForm(d, { body: c, basicAuth: l, timeoutInSeconds: i, initCredentials: this._settings.fetchRequestCredentials, extraHeaders: r });
|
|
862
|
+
return n.debug("got response"), h;
|
|
725
863
|
}
|
|
726
864
|
/**
|
|
727
865
|
* Revoke an access or refresh token.
|
|
@@ -735,17 +873,17 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
735
873
|
const i = await this._metadataService.getRevocationEndpoint(!1);
|
|
736
874
|
s.debug(`got revocation endpoint, revoking ${(t = e.token_type_hint) != null ? t : "default token type"}`);
|
|
737
875
|
const r = new URLSearchParams();
|
|
738
|
-
for (const [
|
|
739
|
-
|
|
740
|
-
r.set("client_id", this._settings.client_id), this._settings.client_secret && r.set("client_secret", this._settings.client_secret), await this._jsonService.postForm(i, { body: r }), s.debug("got response");
|
|
876
|
+
for (const [o, n] of Object.entries(e))
|
|
877
|
+
n != null && r.set(o, n);
|
|
878
|
+
r.set("client_id", this._settings.client_id), this._settings.client_secret && r.set("client_secret", this._settings.client_secret), await this._jsonService.postForm(i, { body: r, timeoutInSeconds: this._settings.requestTimeoutInSeconds }), s.debug("got response");
|
|
741
879
|
}
|
|
742
|
-
},
|
|
880
|
+
}, hs = class {
|
|
743
881
|
constructor(e, t, s) {
|
|
744
|
-
this._settings = e, this._metadataService = t, this._claimsService = s, this._logger = new u("ResponseValidator"), this._userInfoService = new
|
|
882
|
+
this._settings = e, this._metadataService = t, this._claimsService = s, this._logger = new u("ResponseValidator"), this._userInfoService = new ds(this._settings, this._metadataService), this._tokenClient = new st(this._settings, this._metadataService);
|
|
745
883
|
}
|
|
746
|
-
async validateSigninResponse(e, t) {
|
|
747
|
-
const
|
|
748
|
-
this._processSigninState(e, t),
|
|
884
|
+
async validateSigninResponse(e, t, s) {
|
|
885
|
+
const i = this._logger.create("validateSigninResponse");
|
|
886
|
+
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");
|
|
749
887
|
}
|
|
750
888
|
async validateCredentialsResponse(e, t) {
|
|
751
889
|
const s = this._logger.create("validateCredentialsResponse");
|
|
@@ -755,19 +893,19 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
755
893
|
var s, i;
|
|
756
894
|
const r = this._logger.create("validateRefreshResponse");
|
|
757
895
|
e.userState = t.data, (s = e.session_state) != null || (e.session_state = t.session_state), (i = e.scope) != null || (e.scope = t.scope), e.isOpenId && e.id_token && (this._validateIdTokenAttributes(e, t.id_token), r.debug("ID Token validated")), e.id_token || (e.id_token = t.id_token, e.profile = t.profile);
|
|
758
|
-
const
|
|
759
|
-
await this._processClaims(e, !1,
|
|
896
|
+
const o = e.isOpenId && !!e.id_token;
|
|
897
|
+
await this._processClaims(e, !1, o), r.debug("claims processed");
|
|
760
898
|
}
|
|
761
899
|
validateSignoutResponse(e, t) {
|
|
762
900
|
const s = this._logger.create("validateSignoutResponse");
|
|
763
901
|
if (t.id !== e.state && s.throw(new Error("State does not match")), s.debug("state validated"), e.userState = t.data, e.error)
|
|
764
|
-
throw s.warn("Response was error", e.error), new
|
|
902
|
+
throw s.warn("Response was error", e.error), new B(e);
|
|
765
903
|
}
|
|
766
904
|
_processSigninState(e, t) {
|
|
767
905
|
var s;
|
|
768
906
|
const i = this._logger.create("_processSigninState");
|
|
769
907
|
if (t.id !== e.state && i.throw(new Error("State does not match")), t.client_id || i.throw(new Error("No client_id on state")), t.authority || i.throw(new Error("No authority on state")), this._settings.authority !== t.authority && i.throw(new Error("authority mismatch on settings vs. signin state")), this._settings.client_id && this._settings.client_id !== t.client_id && i.throw(new Error("client_id mismatch on settings vs. signin state")), i.debug("state validated"), e.userState = t.data, e.url_state = t.url_state, (s = e.scope) != null || (e.scope = t.scope), e.error)
|
|
770
|
-
throw i.warn("Response was error", e.error), new
|
|
908
|
+
throw i.warn("Response was error", e.error), new B(e);
|
|
771
909
|
t.code_verifier && !e.code && i.throw(new Error("Expected code in response"));
|
|
772
910
|
}
|
|
773
911
|
async _processClaims(e, t = !1, s = !0) {
|
|
@@ -780,36 +918,37 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
780
918
|
const r = await this._userInfoService.getClaims(e.access_token);
|
|
781
919
|
i.debug("user info claims received from user info endpoint"), s && r.sub !== e.profile.sub && i.throw(new Error("subject from UserInfo response does not match subject in ID Token")), e.profile = this._claimsService.mergeClaims(e.profile, this._claimsService.filterProtocolClaims(r)), i.debug("user info claims received, updated profile:", e.profile);
|
|
782
920
|
}
|
|
783
|
-
async _processCode(e, t) {
|
|
784
|
-
const
|
|
921
|
+
async _processCode(e, t, s) {
|
|
922
|
+
const i = this._logger.create("_processCode");
|
|
785
923
|
if (e.code) {
|
|
786
|
-
|
|
787
|
-
const
|
|
924
|
+
i.debug("Validating code");
|
|
925
|
+
const r = await this._tokenClient.exchangeCode({
|
|
788
926
|
client_id: t.client_id,
|
|
789
927
|
client_secret: t.client_secret,
|
|
790
928
|
code: e.code,
|
|
791
929
|
redirect_uri: t.redirect_uri,
|
|
792
930
|
code_verifier: t.code_verifier,
|
|
931
|
+
extraHeaders: s,
|
|
793
932
|
...t.extraTokenParams
|
|
794
933
|
});
|
|
795
|
-
Object.assign(e,
|
|
934
|
+
Object.assign(e, r);
|
|
796
935
|
} else
|
|
797
|
-
|
|
936
|
+
i.debug("No code to process");
|
|
798
937
|
}
|
|
799
938
|
_validateIdTokenAttributes(e, t) {
|
|
800
939
|
var s;
|
|
801
940
|
const i = this._logger.create("_validateIdTokenAttributes");
|
|
802
941
|
i.debug("decoding ID Token JWT");
|
|
803
|
-
const r =
|
|
942
|
+
const r = de.decode((s = e.id_token) != null ? s : "");
|
|
804
943
|
if (r.sub || i.throw(new Error("ID Token is missing a subject claim")), t) {
|
|
805
|
-
const
|
|
806
|
-
r.sub !==
|
|
944
|
+
const o = de.decode(t);
|
|
945
|
+
r.sub !== o.sub && i.throw(new Error("sub in id_token does not match current sub")), r.auth_time && r.auth_time !== o.auth_time && i.throw(new Error("auth_time in id_token does not match original auth_time")), r.azp && r.azp !== o.azp && i.throw(new Error("azp in id_token does not match original azp")), !r.azp && o.azp && i.throw(new Error("azp not in id_token, but present in original id_token"));
|
|
807
946
|
}
|
|
808
947
|
e.profile = r;
|
|
809
948
|
}
|
|
810
|
-
},
|
|
949
|
+
}, he = class Ie {
|
|
811
950
|
constructor(t) {
|
|
812
|
-
this.id = t.id ||
|
|
951
|
+
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;
|
|
813
952
|
}
|
|
814
953
|
toStorageString() {
|
|
815
954
|
return new u("State").create("toStorageString"), JSON.stringify({
|
|
@@ -821,33 +960,33 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
821
960
|
});
|
|
822
961
|
}
|
|
823
962
|
static fromStorageString(t) {
|
|
824
|
-
return u.createStatic("State", "fromStorageString"), Promise.resolve(new
|
|
963
|
+
return u.createStatic("State", "fromStorageString"), Promise.resolve(new Ie(JSON.parse(t)));
|
|
825
964
|
}
|
|
826
965
|
static async clearStaleState(t, s) {
|
|
827
|
-
const i = u.createStatic("State", "clearStaleState"), r = M.getEpochTime() - s,
|
|
828
|
-
i.debug("got keys",
|
|
829
|
-
for (let
|
|
830
|
-
const
|
|
966
|
+
const i = u.createStatic("State", "clearStaleState"), r = M.getEpochTime() - s, o = await t.getAllKeys();
|
|
967
|
+
i.debug("got keys", o);
|
|
968
|
+
for (let n = 0; n < o.length; n++) {
|
|
969
|
+
const c = o[n], l = await t.get(c);
|
|
831
970
|
let d = !1;
|
|
832
971
|
if (l)
|
|
833
972
|
try {
|
|
834
|
-
const h = await
|
|
835
|
-
i.debug("got item from key:",
|
|
973
|
+
const h = await Ie.fromStorageString(l);
|
|
974
|
+
i.debug("got item from key:", c, h.created), h.created <= r && (d = !0);
|
|
836
975
|
} catch (h) {
|
|
837
|
-
i.error("Error parsing state for key:",
|
|
976
|
+
i.error("Error parsing state for key:", c, h), d = !0;
|
|
838
977
|
}
|
|
839
978
|
else
|
|
840
|
-
i.debug("no item in storage for key:",
|
|
841
|
-
d && (i.debug("removed item for key:",
|
|
979
|
+
i.debug("no item in storage for key:", c), d = !0;
|
|
980
|
+
d && (i.debug("removed item for key:", c), t.remove(c));
|
|
842
981
|
}
|
|
843
982
|
}
|
|
844
|
-
},
|
|
983
|
+
}, it = class Ee extends he {
|
|
845
984
|
constructor(t) {
|
|
846
985
|
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;
|
|
847
986
|
}
|
|
848
987
|
static async create(t) {
|
|
849
|
-
const s = t.code_verifier === !0 ?
|
|
850
|
-
return new
|
|
988
|
+
const s = t.code_verifier === !0 ? C.generateCodeVerifier() : t.code_verifier || void 0, i = s ? await C.generateCodeChallenge(s) : void 0;
|
|
989
|
+
return new Ee({
|
|
851
990
|
...t,
|
|
852
991
|
code_verifier: s,
|
|
853
992
|
code_challenge: i
|
|
@@ -874,9 +1013,9 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
874
1013
|
static fromStorageString(t) {
|
|
875
1014
|
u.createStatic("SigninState", "fromStorageString");
|
|
876
1015
|
const s = JSON.parse(t);
|
|
877
|
-
return
|
|
1016
|
+
return Ee.create(s);
|
|
878
1017
|
}
|
|
879
|
-
},
|
|
1018
|
+
}, rt = class nt {
|
|
880
1019
|
constructor(t) {
|
|
881
1020
|
this.url = t.url, this.state = t.state;
|
|
882
1021
|
}
|
|
@@ -886,21 +1025,23 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
886
1025
|
authority: s,
|
|
887
1026
|
client_id: i,
|
|
888
1027
|
redirect_uri: r,
|
|
889
|
-
response_type:
|
|
890
|
-
scope:
|
|
1028
|
+
response_type: o,
|
|
1029
|
+
scope: n,
|
|
891
1030
|
// optional
|
|
892
|
-
state_data:
|
|
1031
|
+
state_data: c,
|
|
893
1032
|
response_mode: l,
|
|
894
1033
|
request_type: d,
|
|
895
1034
|
client_secret: h,
|
|
896
1035
|
nonce: g,
|
|
897
|
-
url_state:
|
|
898
|
-
resource:
|
|
899
|
-
skipUserInfo:
|
|
900
|
-
extraQueryParams:
|
|
901
|
-
extraTokenParams:
|
|
902
|
-
disablePKCE:
|
|
903
|
-
|
|
1036
|
+
url_state: _,
|
|
1037
|
+
resource: S,
|
|
1038
|
+
skipUserInfo: x,
|
|
1039
|
+
extraQueryParams: T,
|
|
1040
|
+
extraTokenParams: A,
|
|
1041
|
+
disablePKCE: I,
|
|
1042
|
+
dpopJkt: N,
|
|
1043
|
+
omitScopeWhenRequesting: P,
|
|
1044
|
+
...L
|
|
904
1045
|
}) {
|
|
905
1046
|
if (!t)
|
|
906
1047
|
throw this._logger.error("create: No url passed"), new Error("url");
|
|
@@ -908,43 +1049,43 @@ var Vt = "10000000-1000-4000-8000-100000000000", Me = (e) => btoa([...new Uint8A
|
|
|
908
1049
|
throw this._logger.error("create: No client_id passed"), new Error("client_id");
|
|
909
1050
|
if (!r)
|
|
910
1051
|
throw this._logger.error("create: No redirect_uri passed"), new Error("redirect_uri");
|
|
911
|
-
if (!
|
|
1052
|
+
if (!o)
|
|
912
1053
|
throw this._logger.error("create: No response_type passed"), new Error("response_type");
|
|
913
|
-
if (!
|
|
1054
|
+
if (!n)
|
|
914
1055
|
throw this._logger.error("create: No scope passed"), new Error("scope");
|
|
915
1056
|
if (!s)
|
|
916
1057
|
throw this._logger.error("create: No authority passed"), new Error("authority");
|
|
917
|
-
const
|
|
918
|
-
data:
|
|
1058
|
+
const R = await it.create({
|
|
1059
|
+
data: c,
|
|
919
1060
|
request_type: d,
|
|
920
|
-
url_state:
|
|
921
|
-
code_verifier: !
|
|
1061
|
+
url_state: _,
|
|
1062
|
+
code_verifier: !I,
|
|
922
1063
|
client_id: i,
|
|
923
1064
|
authority: s,
|
|
924
1065
|
redirect_uri: r,
|
|
925
1066
|
response_mode: l,
|
|
926
1067
|
client_secret: h,
|
|
927
|
-
scope:
|
|
928
|
-
extraTokenParams:
|
|
929
|
-
skipUserInfo:
|
|
1068
|
+
scope: n,
|
|
1069
|
+
extraTokenParams: A,
|
|
1070
|
+
skipUserInfo: x
|
|
930
1071
|
}), w = new URL(t);
|
|
931
|
-
w.searchParams.append("client_id", i), w.searchParams.append("redirect_uri", r), w.searchParams.append("response_type",
|
|
932
|
-
let
|
|
933
|
-
|
|
934
|
-
for (const [
|
|
935
|
-
|
|
936
|
-
return new
|
|
1072
|
+
w.searchParams.append("client_id", i), w.searchParams.append("redirect_uri", r), w.searchParams.append("response_type", o), P || w.searchParams.append("scope", n), g && w.searchParams.append("nonce", g), N && w.searchParams.append("dpop_jkt", N);
|
|
1073
|
+
let E = R.id;
|
|
1074
|
+
_ && (E = `${E}${be}${_}`), 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((b) => w.searchParams.append("resource", b));
|
|
1075
|
+
for (const [U, b] of Object.entries({ response_mode: l, ...L, ...T }))
|
|
1076
|
+
b != null && w.searchParams.append(U, b.toString());
|
|
1077
|
+
return new nt({
|
|
937
1078
|
url: w.href,
|
|
938
|
-
state:
|
|
1079
|
+
state: R
|
|
939
1080
|
});
|
|
940
1081
|
}
|
|
941
1082
|
};
|
|
942
|
-
|
|
943
|
-
var
|
|
1083
|
+
rt._logger = new u("SigninRequest");
|
|
1084
|
+
var gs = rt, us = "openid", me = class {
|
|
944
1085
|
constructor(e) {
|
|
945
1086
|
if (this.access_token = "", this.token_type = "", this.profile = {}, this.state = e.get("state"), this.session_state = e.get("session_state"), this.state) {
|
|
946
|
-
const t = decodeURIComponent(this.state).split(
|
|
947
|
-
this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(
|
|
1087
|
+
const t = decodeURIComponent(this.state).split(be);
|
|
1088
|
+
this.state = t[0], t.length > 1 && (this.url_state = t.slice(1).join(be));
|
|
948
1089
|
}
|
|
949
1090
|
this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri"), this.code = e.get("code");
|
|
950
1091
|
}
|
|
@@ -957,31 +1098,31 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
957
1098
|
}
|
|
958
1099
|
get isOpenId() {
|
|
959
1100
|
var e;
|
|
960
|
-
return ((e = this.scope) == null ? void 0 : e.split(" ").includes(
|
|
1101
|
+
return ((e = this.scope) == null ? void 0 : e.split(" ").includes(us)) || !!this.id_token;
|
|
961
1102
|
}
|
|
962
|
-
},
|
|
1103
|
+
}, _s = class {
|
|
963
1104
|
constructor({
|
|
964
1105
|
url: e,
|
|
965
1106
|
state_data: t,
|
|
966
1107
|
id_token_hint: s,
|
|
967
1108
|
post_logout_redirect_uri: i,
|
|
968
1109
|
extraQueryParams: r,
|
|
969
|
-
request_type:
|
|
970
|
-
client_id:
|
|
1110
|
+
request_type: o,
|
|
1111
|
+
client_id: n
|
|
971
1112
|
}) {
|
|
972
1113
|
if (this._logger = new u("SignoutRequest"), !e)
|
|
973
1114
|
throw this._logger.error("ctor: No url passed"), new Error("url");
|
|
974
|
-
const
|
|
975
|
-
s &&
|
|
1115
|
+
const c = new URL(e);
|
|
1116
|
+
s && c.searchParams.append("id_token_hint", s), n && c.searchParams.append("client_id", n), i && (c.searchParams.append("post_logout_redirect_uri", i), t && (this.state = new he({ data: t, request_type: o }), c.searchParams.append("state", this.state.id)));
|
|
976
1117
|
for (const [l, d] of Object.entries({ ...r }))
|
|
977
|
-
d != null &&
|
|
978
|
-
this.url =
|
|
1118
|
+
d != null && c.searchParams.append(l, d.toString());
|
|
1119
|
+
this.url = c.href;
|
|
979
1120
|
}
|
|
980
|
-
},
|
|
1121
|
+
}, ps = class {
|
|
981
1122
|
constructor(e) {
|
|
982
1123
|
this.state = e.get("state"), this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri");
|
|
983
1124
|
}
|
|
984
|
-
},
|
|
1125
|
+
}, fs = [
|
|
985
1126
|
"nbf",
|
|
986
1127
|
"jti",
|
|
987
1128
|
"auth_time",
|
|
@@ -991,7 +1132,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
991
1132
|
"azp",
|
|
992
1133
|
"at_hash"
|
|
993
1134
|
// https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken
|
|
994
|
-
],
|
|
1135
|
+
], ms = ["sub", "iss", "aud", "exp", "iat"], ws = class {
|
|
995
1136
|
constructor(e) {
|
|
996
1137
|
this._settings = e, this._logger = new u("ClaimsService");
|
|
997
1138
|
}
|
|
@@ -999,9 +1140,9 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
999
1140
|
const t = { ...e };
|
|
1000
1141
|
if (this._settings.filterProtocolClaims) {
|
|
1001
1142
|
let s;
|
|
1002
|
-
Array.isArray(this._settings.filterProtocolClaims) ? s = this._settings.filterProtocolClaims : s =
|
|
1143
|
+
Array.isArray(this._settings.filterProtocolClaims) ? s = this._settings.filterProtocolClaims : s = fs;
|
|
1003
1144
|
for (const i of s)
|
|
1004
|
-
|
|
1145
|
+
ms.includes(i) || delete t[i];
|
|
1005
1146
|
}
|
|
1006
1147
|
return t;
|
|
1007
1148
|
}
|
|
@@ -1013,18 +1154,21 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1013
1154
|
if (this._settings.mergeClaimsStrategy.array == "replace")
|
|
1014
1155
|
s[i] = r;
|
|
1015
1156
|
else {
|
|
1016
|
-
const
|
|
1017
|
-
for (const
|
|
1018
|
-
|
|
1019
|
-
s[i] =
|
|
1157
|
+
const o = Array.isArray(s[i]) ? s[i] : [s[i]];
|
|
1158
|
+
for (const n of Array.isArray(r) ? r : [r])
|
|
1159
|
+
o.includes(n) || o.push(n);
|
|
1160
|
+
s[i] = o;
|
|
1020
1161
|
}
|
|
1021
|
-
else
|
|
1022
|
-
typeof s[i] == "object" && typeof r == "object" ? s[i] = this.mergeClaims(s[i], r) : s[i] = r;
|
|
1162
|
+
else typeof s[i] == "object" && typeof r == "object" ? s[i] = this.mergeClaims(s[i], r) : s[i] = r;
|
|
1023
1163
|
return s;
|
|
1024
1164
|
}
|
|
1025
|
-
},
|
|
1165
|
+
}, ot = class {
|
|
1166
|
+
constructor(e, t) {
|
|
1167
|
+
this.keys = e, this.nonce = t;
|
|
1168
|
+
}
|
|
1169
|
+
}, vs = class {
|
|
1026
1170
|
constructor(e, t) {
|
|
1027
|
-
this._logger = new u("OidcClient"), this.settings = e instanceof
|
|
1171
|
+
this._logger = new u("OidcClient"), this.settings = e instanceof Te ? e : new Te(e), this.metadataService = t ?? new ns(this.settings), this._claimsService = new ws(this.settings), this._validator = new hs(this.settings, this.metadataService, this._claimsService), this._tokenClient = new st(this.settings, this.metadataService);
|
|
1028
1172
|
}
|
|
1029
1173
|
async createSigninRequest({
|
|
1030
1174
|
state: e,
|
|
@@ -1032,30 +1176,32 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1032
1176
|
request_uri: s,
|
|
1033
1177
|
request_type: i,
|
|
1034
1178
|
id_token_hint: r,
|
|
1035
|
-
login_hint:
|
|
1036
|
-
skipUserInfo:
|
|
1037
|
-
nonce:
|
|
1179
|
+
login_hint: o,
|
|
1180
|
+
skipUserInfo: n,
|
|
1181
|
+
nonce: c,
|
|
1038
1182
|
url_state: l,
|
|
1039
1183
|
response_type: d = this.settings.response_type,
|
|
1040
1184
|
scope: h = this.settings.scope,
|
|
1041
1185
|
redirect_uri: g = this.settings.redirect_uri,
|
|
1042
|
-
prompt:
|
|
1043
|
-
display:
|
|
1044
|
-
max_age:
|
|
1045
|
-
ui_locales:
|
|
1046
|
-
acr_values:
|
|
1047
|
-
resource:
|
|
1048
|
-
response_mode:
|
|
1049
|
-
extraQueryParams:
|
|
1050
|
-
extraTokenParams:
|
|
1186
|
+
prompt: _ = this.settings.prompt,
|
|
1187
|
+
display: S = this.settings.display,
|
|
1188
|
+
max_age: x = this.settings.max_age,
|
|
1189
|
+
ui_locales: T = this.settings.ui_locales,
|
|
1190
|
+
acr_values: A = this.settings.acr_values,
|
|
1191
|
+
resource: I = this.settings.resource,
|
|
1192
|
+
response_mode: N = this.settings.response_mode,
|
|
1193
|
+
extraQueryParams: P = this.settings.extraQueryParams,
|
|
1194
|
+
extraTokenParams: L = this.settings.extraTokenParams,
|
|
1195
|
+
dpopJkt: R,
|
|
1196
|
+
omitScopeWhenRequesting: w = this.settings.omitScopeWhenRequesting
|
|
1051
1197
|
}) {
|
|
1052
|
-
const
|
|
1198
|
+
const E = this._logger.create("createSigninRequest");
|
|
1053
1199
|
if (d !== "code")
|
|
1054
1200
|
throw new Error("Only the Authorization Code flow (with PKCE) is supported");
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
const
|
|
1058
|
-
url:
|
|
1201
|
+
const U = await this.metadataService.getAuthorizationEndpoint();
|
|
1202
|
+
E.debug("Received authorization endpoint", U);
|
|
1203
|
+
const b = await gs.create({
|
|
1204
|
+
url: U,
|
|
1059
1205
|
authority: this.settings.authority,
|
|
1060
1206
|
client_id: this.settings.client_id,
|
|
1061
1207
|
redirect_uri: g,
|
|
@@ -1063,41 +1209,65 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1063
1209
|
scope: h,
|
|
1064
1210
|
state_data: e,
|
|
1065
1211
|
url_state: l,
|
|
1066
|
-
prompt:
|
|
1067
|
-
display:
|
|
1068
|
-
max_age:
|
|
1069
|
-
ui_locales:
|
|
1212
|
+
prompt: _,
|
|
1213
|
+
display: S,
|
|
1214
|
+
max_age: x,
|
|
1215
|
+
ui_locales: T,
|
|
1070
1216
|
id_token_hint: r,
|
|
1071
|
-
login_hint:
|
|
1072
|
-
acr_values:
|
|
1073
|
-
|
|
1217
|
+
login_hint: o,
|
|
1218
|
+
acr_values: A,
|
|
1219
|
+
dpopJkt: R,
|
|
1220
|
+
resource: I,
|
|
1074
1221
|
request: t,
|
|
1075
1222
|
request_uri: s,
|
|
1076
|
-
extraQueryParams:
|
|
1077
|
-
extraTokenParams:
|
|
1223
|
+
extraQueryParams: P,
|
|
1224
|
+
extraTokenParams: L,
|
|
1078
1225
|
request_type: i,
|
|
1079
|
-
response_mode:
|
|
1226
|
+
response_mode: N,
|
|
1080
1227
|
client_secret: this.settings.client_secret,
|
|
1081
|
-
skipUserInfo:
|
|
1082
|
-
nonce:
|
|
1083
|
-
disablePKCE: this.settings.disablePKCE
|
|
1228
|
+
skipUserInfo: n,
|
|
1229
|
+
nonce: c,
|
|
1230
|
+
disablePKCE: this.settings.disablePKCE,
|
|
1231
|
+
omitScopeWhenRequesting: w
|
|
1084
1232
|
});
|
|
1085
1233
|
await this.clearStaleState();
|
|
1086
|
-
const
|
|
1087
|
-
return await this.settings.stateStore.set(
|
|
1234
|
+
const z = b.state;
|
|
1235
|
+
return await this.settings.stateStore.set(z.id, z.toStorageString()), b;
|
|
1088
1236
|
}
|
|
1089
1237
|
async readSigninResponseState(e, t = !1) {
|
|
1090
|
-
const s = this._logger.create("readSigninResponseState"), i = new
|
|
1238
|
+
const s = this._logger.create("readSigninResponseState"), i = new me(ye.readParams(e, this.settings.response_mode));
|
|
1091
1239
|
if (!i.state)
|
|
1092
1240
|
throw s.throw(new Error("No state in response")), null;
|
|
1093
1241
|
const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
|
|
1094
1242
|
if (!r)
|
|
1095
1243
|
throw s.throw(new Error("No matching state found in storage")), null;
|
|
1096
|
-
return { state: await
|
|
1244
|
+
return { state: await it.fromStorageString(r), response: i };
|
|
1097
1245
|
}
|
|
1098
|
-
async processSigninResponse(e) {
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1246
|
+
async processSigninResponse(e, t) {
|
|
1247
|
+
const s = this._logger.create("processSigninResponse"), { state: i, response: r } = await this.readSigninResponseState(e, !0);
|
|
1248
|
+
if (s.debug("received state from storage; validating response"), this.settings.dpop && this.settings.dpop.store) {
|
|
1249
|
+
const o = await this.getDpopProof(this.settings.dpop.store);
|
|
1250
|
+
t = { ...t, DPoP: o };
|
|
1251
|
+
}
|
|
1252
|
+
try {
|
|
1253
|
+
await this._validator.validateSigninResponse(r, i, t);
|
|
1254
|
+
} catch (o) {
|
|
1255
|
+
if (o instanceof ke && this.settings.dpop) {
|
|
1256
|
+
const n = await this.getDpopProof(this.settings.dpop.store, o.nonce);
|
|
1257
|
+
t.DPoP = n, await this._validator.validateSigninResponse(r, i, t);
|
|
1258
|
+
} else
|
|
1259
|
+
throw o;
|
|
1260
|
+
}
|
|
1261
|
+
return r;
|
|
1262
|
+
}
|
|
1263
|
+
async getDpopProof(e, t) {
|
|
1264
|
+
let s, i;
|
|
1265
|
+
return (await e.getAllKeys()).includes(this.settings.client_id) ? (i = await e.get(this.settings.client_id), i.nonce !== t && t && (i.nonce = t, await e.set(this.settings.client_id, i))) : (s = await C.generateDPoPKeys(), i = new ot(s, t), await e.set(this.settings.client_id, i)), await C.generateDPoPProof({
|
|
1266
|
+
url: await this.metadataService.getTokenEndpoint(!1),
|
|
1267
|
+
httpMethod: "POST",
|
|
1268
|
+
keyPair: i.keys,
|
|
1269
|
+
nonce: i.nonce
|
|
1270
|
+
});
|
|
1101
1271
|
}
|
|
1102
1272
|
async processResourceOwnerPasswordCredentials({
|
|
1103
1273
|
username: e,
|
|
@@ -1105,40 +1275,64 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1105
1275
|
skipUserInfo: s = !1,
|
|
1106
1276
|
extraTokenParams: i = {}
|
|
1107
1277
|
}) {
|
|
1108
|
-
const r = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...i }),
|
|
1109
|
-
return Object.assign(
|
|
1278
|
+
const r = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...i }), o = new me(new URLSearchParams());
|
|
1279
|
+
return Object.assign(o, r), await this._validator.validateCredentialsResponse(o, s), o;
|
|
1110
1280
|
}
|
|
1111
1281
|
async useRefreshToken({
|
|
1112
1282
|
state: e,
|
|
1113
1283
|
redirect_uri: t,
|
|
1114
1284
|
resource: s,
|
|
1115
1285
|
timeoutInSeconds: i,
|
|
1116
|
-
|
|
1286
|
+
extraHeaders: r,
|
|
1287
|
+
extraTokenParams: o
|
|
1117
1288
|
}) {
|
|
1118
1289
|
var n;
|
|
1119
1290
|
const c = this._logger.create("useRefreshToken");
|
|
1120
|
-
let
|
|
1291
|
+
let l;
|
|
1121
1292
|
if (this.settings.refreshTokenAllowedScope === void 0)
|
|
1122
|
-
|
|
1293
|
+
l = e.scope;
|
|
1123
1294
|
else {
|
|
1124
|
-
const
|
|
1125
|
-
|
|
1295
|
+
const g = this.settings.refreshTokenAllowedScope.split(" ");
|
|
1296
|
+
l = (((n = e.scope) == null ? void 0 : n.split(" ")) || []).filter((S) => g.includes(S)).join(" ");
|
|
1126
1297
|
}
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1298
|
+
if (this.settings.dpop && this.settings.dpop.store) {
|
|
1299
|
+
const g = await this.getDpopProof(this.settings.dpop.store);
|
|
1300
|
+
r = { ...r, DPoP: g };
|
|
1301
|
+
}
|
|
1302
|
+
let d;
|
|
1303
|
+
try {
|
|
1304
|
+
d = await this._tokenClient.exchangeRefreshToken({
|
|
1305
|
+
refresh_token: e.refresh_token,
|
|
1306
|
+
// provide the (possible filtered) scope list
|
|
1307
|
+
scope: l,
|
|
1308
|
+
redirect_uri: t,
|
|
1309
|
+
resource: s,
|
|
1310
|
+
timeoutInSeconds: i,
|
|
1311
|
+
extraHeaders: r,
|
|
1312
|
+
...o
|
|
1313
|
+
});
|
|
1314
|
+
} catch (g) {
|
|
1315
|
+
if (g instanceof ke && this.settings.dpop)
|
|
1316
|
+
r.DPoP = await this.getDpopProof(this.settings.dpop.store, g.nonce), d = await this._tokenClient.exchangeRefreshToken({
|
|
1317
|
+
refresh_token: e.refresh_token,
|
|
1318
|
+
// provide the (possible filtered) scope list
|
|
1319
|
+
scope: l,
|
|
1320
|
+
redirect_uri: t,
|
|
1321
|
+
resource: s,
|
|
1322
|
+
timeoutInSeconds: i,
|
|
1323
|
+
extraHeaders: r,
|
|
1324
|
+
...o
|
|
1325
|
+
});
|
|
1326
|
+
else
|
|
1327
|
+
throw g;
|
|
1328
|
+
}
|
|
1329
|
+
const h = new me(new URLSearchParams());
|
|
1330
|
+
return Object.assign(h, d), c.debug("validating response", h), await this._validator.validateRefreshResponse(h, {
|
|
1137
1331
|
...e,
|
|
1138
1332
|
// override the scope in the state handed over to the validator
|
|
1139
1333
|
// so it can set the granted scope to the requested scope in case none is included in the response
|
|
1140
|
-
scope:
|
|
1141
|
-
}),
|
|
1334
|
+
scope: l
|
|
1335
|
+
}), h;
|
|
1142
1336
|
}
|
|
1143
1337
|
async createSignoutRequest({
|
|
1144
1338
|
state: e,
|
|
@@ -1146,43 +1340,43 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1146
1340
|
client_id: s,
|
|
1147
1341
|
request_type: i,
|
|
1148
1342
|
post_logout_redirect_uri: r = this.settings.post_logout_redirect_uri,
|
|
1149
|
-
extraQueryParams:
|
|
1343
|
+
extraQueryParams: o = this.settings.extraQueryParams
|
|
1150
1344
|
} = {}) {
|
|
1151
|
-
const
|
|
1152
|
-
if (!
|
|
1153
|
-
throw
|
|
1154
|
-
|
|
1155
|
-
const l = new
|
|
1156
|
-
url:
|
|
1345
|
+
const n = this._logger.create("createSignoutRequest"), c = await this.metadataService.getEndSessionEndpoint();
|
|
1346
|
+
if (!c)
|
|
1347
|
+
throw n.throw(new Error("No end session endpoint")), null;
|
|
1348
|
+
n.debug("Received end session endpoint", c), !s && r && !t && (s = this.settings.client_id);
|
|
1349
|
+
const l = new _s({
|
|
1350
|
+
url: c,
|
|
1157
1351
|
id_token_hint: t,
|
|
1158
1352
|
client_id: s,
|
|
1159
1353
|
post_logout_redirect_uri: r,
|
|
1160
1354
|
state_data: e,
|
|
1161
|
-
extraQueryParams:
|
|
1355
|
+
extraQueryParams: o,
|
|
1162
1356
|
request_type: i
|
|
1163
1357
|
});
|
|
1164
1358
|
await this.clearStaleState();
|
|
1165
1359
|
const d = l.state;
|
|
1166
|
-
return d && (
|
|
1360
|
+
return d && (n.debug("Signout request has state to persist"), await this.settings.stateStore.set(d.id, d.toStorageString())), l;
|
|
1167
1361
|
}
|
|
1168
1362
|
async readSignoutResponseState(e, t = !1) {
|
|
1169
|
-
const s = this._logger.create("readSignoutResponseState"), i = new
|
|
1363
|
+
const s = this._logger.create("readSignoutResponseState"), i = new ps(ye.readParams(e, this.settings.response_mode));
|
|
1170
1364
|
if (!i.state) {
|
|
1171
1365
|
if (s.debug("No state in response"), i.error)
|
|
1172
|
-
throw s.warn("Response was error:", i.error), new
|
|
1366
|
+
throw s.warn("Response was error:", i.error), new B(i);
|
|
1173
1367
|
return { state: void 0, response: i };
|
|
1174
1368
|
}
|
|
1175
1369
|
const r = await this.settings.stateStore[t ? "remove" : "get"](i.state);
|
|
1176
1370
|
if (!r)
|
|
1177
1371
|
throw s.throw(new Error("No matching state found in storage")), null;
|
|
1178
|
-
return { state: await
|
|
1372
|
+
return { state: await he.fromStorageString(r), response: i };
|
|
1179
1373
|
}
|
|
1180
1374
|
async processSignoutResponse(e) {
|
|
1181
1375
|
const t = this._logger.create("processSignoutResponse"), { state: s, response: i } = await this.readSignoutResponseState(e, !0);
|
|
1182
1376
|
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;
|
|
1183
1377
|
}
|
|
1184
1378
|
clearStaleState() {
|
|
1185
|
-
return this._logger.create("clearStaleState"),
|
|
1379
|
+
return this._logger.create("clearStaleState"), he.clearStaleState(this.settings.stateStore, this.settings.staleStateAgeInSeconds);
|
|
1186
1380
|
}
|
|
1187
1381
|
async revokeToken(e, t) {
|
|
1188
1382
|
return this._logger.create("revokeToken"), await this._tokenClient.revoke({
|
|
@@ -1190,7 +1384,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1190
1384
|
token_type_hint: t
|
|
1191
1385
|
});
|
|
1192
1386
|
}
|
|
1193
|
-
},
|
|
1387
|
+
}, Ss = class {
|
|
1194
1388
|
constructor(e) {
|
|
1195
1389
|
this._userManager = e, this._logger = new u("SessionMonitor"), this._start = async (t) => {
|
|
1196
1390
|
const s = t.session_state;
|
|
@@ -1205,7 +1399,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1205
1399
|
const r = await this._userManager.metadataService.getCheckSessionIframe();
|
|
1206
1400
|
if (r) {
|
|
1207
1401
|
i.debug("initializing check session iframe");
|
|
1208
|
-
const
|
|
1402
|
+
const o = this._userManager.settings.client_id, n = this._userManager.settings.checkSessionIntervalInSeconds, c = this._userManager.settings.stopCheckSessionOnError, l = new rs(this._callback, o, r, n, c);
|
|
1209
1403
|
await l.load(), this._checkSessionIFrame = l, l.start(s);
|
|
1210
1404
|
} else
|
|
1211
1405
|
i.warn("no check session iframe found in the metadata");
|
|
@@ -1264,7 +1458,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1264
1458
|
}
|
|
1265
1459
|
}
|
|
1266
1460
|
}
|
|
1267
|
-
},
|
|
1461
|
+
}, we = class at {
|
|
1268
1462
|
constructor(t) {
|
|
1269
1463
|
var s;
|
|
1270
1464
|
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;
|
|
@@ -1301,34 +1495,34 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1301
1495
|
});
|
|
1302
1496
|
}
|
|
1303
1497
|
static fromStorageString(t) {
|
|
1304
|
-
return u.createStatic("User", "fromStorageString"), new
|
|
1498
|
+
return u.createStatic("User", "fromStorageString"), new at(JSON.parse(t));
|
|
1305
1499
|
}
|
|
1306
|
-
},
|
|
1500
|
+
}, Je = "oidc-client", ct = class {
|
|
1307
1501
|
constructor() {
|
|
1308
|
-
this._abort = new
|
|
1502
|
+
this._abort = new W("Window navigation aborted"), this._disposeHandlers = /* @__PURE__ */ new Set(), this._window = null;
|
|
1309
1503
|
}
|
|
1310
1504
|
async navigate(e) {
|
|
1311
1505
|
const t = this._logger.create("navigate");
|
|
1312
1506
|
if (!this._window)
|
|
1313
1507
|
throw new Error("Attempted to navigate on a disposed window");
|
|
1314
1508
|
t.debug("setting URL in window"), this._window.location.replace(e.url);
|
|
1315
|
-
const { url: s, keepOpen: i } = await new Promise((r,
|
|
1316
|
-
const
|
|
1509
|
+
const { url: s, keepOpen: i } = await new Promise((r, o) => {
|
|
1510
|
+
const n = (c) => {
|
|
1317
1511
|
var l;
|
|
1318
|
-
const d =
|
|
1319
|
-
if (!(
|
|
1512
|
+
const d = c.data, h = (l = e.scriptOrigin) != null ? l : window.location.origin;
|
|
1513
|
+
if (!(c.origin !== h || (d == null ? void 0 : d.source) !== Je)) {
|
|
1320
1514
|
try {
|
|
1321
|
-
const g =
|
|
1322
|
-
if (g || t.warn("no state found in response url"),
|
|
1515
|
+
const g = ye.readParams(d.url, e.response_mode).get("state");
|
|
1516
|
+
if (g || t.warn("no state found in response url"), c.source !== this._window && g !== e.state)
|
|
1323
1517
|
return;
|
|
1324
1518
|
} catch {
|
|
1325
|
-
this._dispose(),
|
|
1519
|
+
this._dispose(), o(new Error("Invalid response from window"));
|
|
1326
1520
|
}
|
|
1327
1521
|
r(d);
|
|
1328
1522
|
}
|
|
1329
1523
|
};
|
|
1330
|
-
window.addEventListener("message",
|
|
1331
|
-
this._dispose(),
|
|
1524
|
+
window.addEventListener("message", n, !1), this._disposeHandlers.add(() => window.removeEventListener("message", n, !1)), this._disposeHandlers.add(this._abort.addHandler((c) => {
|
|
1525
|
+
this._dispose(), o(c);
|
|
1332
1526
|
}));
|
|
1333
1527
|
});
|
|
1334
1528
|
return t.debug("got response from window"), this._dispose(), i || this.close(), { url: s };
|
|
@@ -1341,55 +1535,56 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1341
1535
|
}
|
|
1342
1536
|
static _notifyParent(e, t, s = !1, i = window.location.origin) {
|
|
1343
1537
|
e.postMessage({
|
|
1344
|
-
source:
|
|
1538
|
+
source: Je,
|
|
1345
1539
|
url: t,
|
|
1346
1540
|
keepOpen: s
|
|
1347
1541
|
}, i);
|
|
1348
1542
|
}
|
|
1349
|
-
},
|
|
1543
|
+
}, lt = {
|
|
1350
1544
|
location: !1,
|
|
1351
1545
|
toolbar: !1,
|
|
1352
1546
|
height: 640,
|
|
1353
1547
|
closePopupWindowAfterInSeconds: -1
|
|
1354
|
-
},
|
|
1548
|
+
}, dt = "_blank", ys = 60, bs = 2, ht = 10, ks = class extends Te {
|
|
1355
1549
|
constructor(e) {
|
|
1356
1550
|
const {
|
|
1357
1551
|
popup_redirect_uri: t = e.redirect_uri,
|
|
1358
1552
|
popup_post_logout_redirect_uri: s = e.post_logout_redirect_uri,
|
|
1359
|
-
popupWindowFeatures: i =
|
|
1360
|
-
popupWindowTarget: r =
|
|
1361
|
-
redirectMethod:
|
|
1362
|
-
redirectTarget:
|
|
1363
|
-
iframeNotifyParentOrigin:
|
|
1553
|
+
popupWindowFeatures: i = lt,
|
|
1554
|
+
popupWindowTarget: r = dt,
|
|
1555
|
+
redirectMethod: o = "assign",
|
|
1556
|
+
redirectTarget: n = "self",
|
|
1557
|
+
iframeNotifyParentOrigin: c = e.iframeNotifyParentOrigin,
|
|
1364
1558
|
iframeScriptOrigin: l = e.iframeScriptOrigin,
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1559
|
+
requestTimeoutInSeconds: d,
|
|
1560
|
+
silent_redirect_uri: h = e.redirect_uri,
|
|
1561
|
+
silentRequestTimeoutInSeconds: g,
|
|
1562
|
+
automaticSilentRenew: _ = !0,
|
|
1563
|
+
validateSubOnSilentRenew: S = !0,
|
|
1564
|
+
includeIdTokenInSilentRenew: x = !1,
|
|
1565
|
+
monitorSession: T = !1,
|
|
1566
|
+
monitorAnonymousSession: A = !1,
|
|
1567
|
+
checkSessionIntervalInSeconds: I = bs,
|
|
1568
|
+
query_status_response_type: N = "code",
|
|
1569
|
+
stopCheckSessionOnError: P = !0,
|
|
1570
|
+
revokeTokenTypes: L = ["access_token", "refresh_token"],
|
|
1571
|
+
revokeTokensOnSignout: R = !1,
|
|
1572
|
+
includeIdTokenInSilentSignout: w = !1,
|
|
1573
|
+
accessTokenExpiringNotificationTimeInSeconds: E = ys,
|
|
1574
|
+
userStore: U
|
|
1380
1575
|
} = e;
|
|
1381
|
-
if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = s, this.popupWindowFeatures = i, this.popupWindowTarget = r, this.redirectMethod =
|
|
1382
|
-
this.userStore =
|
|
1576
|
+
if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = s, this.popupWindowFeatures = i, this.popupWindowTarget = r, this.redirectMethod = o, this.redirectTarget = n, this.iframeNotifyParentOrigin = c, this.iframeScriptOrigin = l, this.silent_redirect_uri = h, this.silentRequestTimeoutInSeconds = g || d || ht, this.automaticSilentRenew = _, this.validateSubOnSilentRenew = S, this.includeIdTokenInSilentRenew = x, this.monitorSession = T, this.monitorAnonymousSession = A, this.checkSessionIntervalInSeconds = I, this.stopCheckSessionOnError = P, this.query_status_response_type = N, this.revokeTokenTypes = L, this.revokeTokensOnSignout = R, this.includeIdTokenInSilentSignout = w, this.accessTokenExpiringNotificationTimeInSeconds = E, U)
|
|
1577
|
+
this.userStore = U;
|
|
1383
1578
|
else {
|
|
1384
|
-
const
|
|
1385
|
-
this.userStore = new
|
|
1579
|
+
const b = typeof window < "u" ? window.sessionStorage : new et();
|
|
1580
|
+
this.userStore = new tt({ store: b });
|
|
1386
1581
|
}
|
|
1387
1582
|
}
|
|
1388
|
-
},
|
|
1583
|
+
}, Ke = class gt extends ct {
|
|
1389
1584
|
constructor({
|
|
1390
|
-
silentRequestTimeoutInSeconds: t =
|
|
1585
|
+
silentRequestTimeoutInSeconds: t = ht
|
|
1391
1586
|
}) {
|
|
1392
|
-
super(), this._logger = new u("IFrameWindow"), this._timeoutInSeconds = t, this._frame =
|
|
1587
|
+
super(), this._logger = new u("IFrameWindow"), this._timeoutInSeconds = t, this._frame = gt.createHiddenIframe(), this._window = this._frame.contentWindow;
|
|
1393
1588
|
}
|
|
1394
1589
|
static createHiddenIframe() {
|
|
1395
1590
|
const t = window.document.createElement("iframe");
|
|
@@ -1397,7 +1592,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1397
1592
|
}
|
|
1398
1593
|
async navigate(t) {
|
|
1399
1594
|
this._logger.debug("navigate: Using timeout of:", this._timeoutInSeconds);
|
|
1400
|
-
const s = setTimeout(() => void this._abort.raise(new
|
|
1595
|
+
const s = setTimeout(() => void this._abort.raise(new qe("IFrame timed out without a response")), this._timeoutInSeconds * 1e3);
|
|
1401
1596
|
return this._disposeHandlers.add(() => clearTimeout(s)), await super.navigate(t);
|
|
1402
1597
|
}
|
|
1403
1598
|
close() {
|
|
@@ -1411,39 +1606,43 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1411
1606
|
static notifyParent(t, s) {
|
|
1412
1607
|
return super._notifyParent(window.parent, t, !1, s);
|
|
1413
1608
|
}
|
|
1414
|
-
},
|
|
1609
|
+
}, Ts = class {
|
|
1415
1610
|
constructor(e) {
|
|
1416
1611
|
this._settings = e, this._logger = new u("IFrameNavigator");
|
|
1417
1612
|
}
|
|
1418
1613
|
async prepare({
|
|
1419
1614
|
silentRequestTimeoutInSeconds: e = this._settings.silentRequestTimeoutInSeconds
|
|
1420
1615
|
}) {
|
|
1421
|
-
return new
|
|
1616
|
+
return new Ke({ silentRequestTimeoutInSeconds: e });
|
|
1422
1617
|
}
|
|
1423
1618
|
async callback(e) {
|
|
1424
|
-
this._logger.create("callback"),
|
|
1619
|
+
this._logger.create("callback"), Ke.notifyParent(e, this._settings.iframeNotifyParentOrigin);
|
|
1425
1620
|
}
|
|
1426
|
-
},
|
|
1621
|
+
}, Is = 500, Es = 1e3, Be = class extends ct {
|
|
1427
1622
|
constructor({
|
|
1428
|
-
popupWindowTarget: e =
|
|
1429
|
-
popupWindowFeatures: t = {}
|
|
1623
|
+
popupWindowTarget: e = dt,
|
|
1624
|
+
popupWindowFeatures: t = {},
|
|
1625
|
+
popupSignal: s
|
|
1430
1626
|
}) {
|
|
1431
1627
|
super(), this._logger = new u("PopupWindow");
|
|
1432
|
-
const
|
|
1433
|
-
this._window = window.open(void 0, e,
|
|
1628
|
+
const i = We.center({ ...lt, ...t });
|
|
1629
|
+
this._window = window.open(void 0, e, We.serialize(i)), s && s.addEventListener("abort", () => {
|
|
1630
|
+
var r;
|
|
1631
|
+
this._abort.raise(new Error((r = s.reason) != null ? r : "Popup aborted"));
|
|
1632
|
+
}), t.closePopupWindowAfterInSeconds && t.closePopupWindowAfterInSeconds > 0 && setTimeout(() => {
|
|
1434
1633
|
if (!this._window || typeof this._window.closed != "boolean" || this._window.closed) {
|
|
1435
1634
|
this._abort.raise(new Error("Popup blocked by user"));
|
|
1436
1635
|
return;
|
|
1437
1636
|
}
|
|
1438
1637
|
this.close();
|
|
1439
|
-
}, t.closePopupWindowAfterInSeconds *
|
|
1638
|
+
}, t.closePopupWindowAfterInSeconds * Es);
|
|
1440
1639
|
}
|
|
1441
1640
|
async navigate(e) {
|
|
1442
1641
|
var t;
|
|
1443
1642
|
(t = this._window) == null || t.focus();
|
|
1444
1643
|
const s = setInterval(() => {
|
|
1445
1644
|
(!this._window || this._window.closed) && this._abort.raise(new Error("Popup closed by user"));
|
|
1446
|
-
},
|
|
1645
|
+
}, Is);
|
|
1447
1646
|
return this._disposeHandlers.add(() => clearInterval(s)), await super.navigate(e);
|
|
1448
1647
|
}
|
|
1449
1648
|
close() {
|
|
@@ -1454,20 +1653,21 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1454
1653
|
throw new Error("No window.opener. Can't complete notification.");
|
|
1455
1654
|
return super._notifyParent(window.opener, e, t);
|
|
1456
1655
|
}
|
|
1457
|
-
},
|
|
1656
|
+
}, Cs = class {
|
|
1458
1657
|
constructor(e) {
|
|
1459
1658
|
this._settings = e, this._logger = new u("PopupNavigator");
|
|
1460
1659
|
}
|
|
1461
1660
|
async prepare({
|
|
1462
1661
|
popupWindowFeatures: e = this._settings.popupWindowFeatures,
|
|
1463
|
-
popupWindowTarget: t = this._settings.popupWindowTarget
|
|
1662
|
+
popupWindowTarget: t = this._settings.popupWindowTarget,
|
|
1663
|
+
popupSignal: s
|
|
1464
1664
|
}) {
|
|
1465
|
-
return new
|
|
1665
|
+
return new Be({ popupWindowFeatures: e, popupWindowTarget: t, popupSignal: s });
|
|
1466
1666
|
}
|
|
1467
1667
|
async callback(e, { keepOpen: t = !1 }) {
|
|
1468
|
-
this._logger.create("callback"),
|
|
1668
|
+
this._logger.create("callback"), Be.notifyOpener(e, t);
|
|
1469
1669
|
}
|
|
1470
|
-
},
|
|
1670
|
+
}, Ps = class {
|
|
1471
1671
|
constructor(e) {
|
|
1472
1672
|
this._settings = e, this._logger = new u("RedirectNavigator");
|
|
1473
1673
|
}
|
|
@@ -1480,25 +1680,25 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1480
1680
|
let i = window.self;
|
|
1481
1681
|
t === "top" && (i = (s = window.top) != null ? s : window.self);
|
|
1482
1682
|
const r = i.location[e].bind(i.location);
|
|
1483
|
-
let
|
|
1683
|
+
let o;
|
|
1484
1684
|
return {
|
|
1485
|
-
navigate: async (
|
|
1685
|
+
navigate: async (n) => {
|
|
1486
1686
|
this._logger.create("navigate");
|
|
1487
|
-
const
|
|
1488
|
-
|
|
1687
|
+
const c = new Promise((l, d) => {
|
|
1688
|
+
o = d;
|
|
1489
1689
|
});
|
|
1490
|
-
return r(
|
|
1690
|
+
return r(n.url), await c;
|
|
1491
1691
|
},
|
|
1492
1692
|
close: () => {
|
|
1493
|
-
this._logger.create("close"),
|
|
1693
|
+
this._logger.create("close"), o == null || o(new Error("Redirect aborted")), i.stop();
|
|
1494
1694
|
}
|
|
1495
1695
|
};
|
|
1496
1696
|
}
|
|
1497
1697
|
async callback() {
|
|
1498
1698
|
}
|
|
1499
|
-
},
|
|
1699
|
+
}, Rs = class extends is {
|
|
1500
1700
|
constructor(e) {
|
|
1501
|
-
super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new u("UserManagerEvents"), this._userLoaded = new
|
|
1701
|
+
super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new u("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");
|
|
1502
1702
|
}
|
|
1503
1703
|
async load(e, t = !0) {
|
|
1504
1704
|
super.load(e), t && await this._userLoaded.raise(e);
|
|
@@ -1605,14 +1805,14 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1605
1805
|
async _raiseUserSessionChanged() {
|
|
1606
1806
|
await this._userSessionChanged.raise();
|
|
1607
1807
|
}
|
|
1608
|
-
},
|
|
1808
|
+
}, Us = class {
|
|
1609
1809
|
constructor(e) {
|
|
1610
1810
|
this._userManager = e, this._logger = new u("SilentRenewService"), this._isStarted = !1, this._retryTimer = new M("Retry Silent Renew"), this._tokenExpiring = async () => {
|
|
1611
1811
|
const t = this._logger.create("_tokenExpiring");
|
|
1612
1812
|
try {
|
|
1613
1813
|
await this._userManager.signinSilent(), t.debug("silent token renewal successful");
|
|
1614
1814
|
} catch (s) {
|
|
1615
|
-
if (s instanceof
|
|
1815
|
+
if (s instanceof qe) {
|
|
1616
1816
|
t.warn("ErrorTimeout from signinSilent:", s, "retry in 5s"), this._retryTimer.init(5);
|
|
1617
1817
|
return;
|
|
1618
1818
|
}
|
|
@@ -1634,13 +1834,13 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1634
1834
|
stop() {
|
|
1635
1835
|
this._isStarted && (this._retryTimer.cancel(), this._retryTimer.removeHandler(this._tokenExpiring), this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring), this._isStarted = !1);
|
|
1636
1836
|
}
|
|
1637
|
-
},
|
|
1837
|
+
}, xs = class {
|
|
1638
1838
|
constructor(e) {
|
|
1639
1839
|
this.refresh_token = e.refresh_token, this.id_token = e.id_token, this.session_state = e.session_state, this.scope = e.scope, this.profile = e.profile, this.data = e.state;
|
|
1640
1840
|
}
|
|
1641
|
-
},
|
|
1841
|
+
}, As = class {
|
|
1642
1842
|
constructor(e, t, s, i) {
|
|
1643
|
-
this._logger = new u("UserManager"), this.settings = new
|
|
1843
|
+
this._logger = new u("UserManager"), this.settings = new ks(e), this._client = new vs(e), this._redirectNavigator = t ?? new Ps(this.settings), this._popupNavigator = s ?? new Cs(this.settings), this._iframeNavigator = i ?? new Ts(this.settings), this._events = new Rs(this.settings), this._silentRenewService = new Us(this), this.settings.automaticSilentRenew && this.startSilentRenew(), this._sessionMonitor = null, this.settings.monitorSession && (this._sessionMonitor = new Ss(this));
|
|
1644
1844
|
}
|
|
1645
1845
|
/**
|
|
1646
1846
|
* Get object used to register for events raised by the `UserManager`.
|
|
@@ -1680,19 +1880,24 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1680
1880
|
* @throws `Error` In cases of wrong authentication.
|
|
1681
1881
|
*/
|
|
1682
1882
|
async signinRedirect(e = {}) {
|
|
1883
|
+
var t;
|
|
1683
1884
|
this._logger.create("signinRedirect");
|
|
1684
1885
|
const {
|
|
1685
|
-
redirectMethod:
|
|
1686
|
-
...
|
|
1687
|
-
} = e
|
|
1886
|
+
redirectMethod: s,
|
|
1887
|
+
...i
|
|
1888
|
+
} = e;
|
|
1889
|
+
let r;
|
|
1890
|
+
(t = this.settings.dpop) != null && t.bind_authorization_code && (r = await this.generateDPoPJkt(this.settings.dpop));
|
|
1891
|
+
const o = await this._redirectNavigator.prepare({ redirectMethod: s });
|
|
1688
1892
|
await this._signinStart({
|
|
1689
1893
|
request_type: "si:r",
|
|
1690
|
-
|
|
1691
|
-
|
|
1894
|
+
dpopJkt: r,
|
|
1895
|
+
...i
|
|
1896
|
+
}, o);
|
|
1692
1897
|
}
|
|
1693
1898
|
/**
|
|
1694
1899
|
* Process the response (callback) from the authorization endpoint.
|
|
1695
|
-
* It is
|
|
1900
|
+
* It is recommended to use {@link UserManager.signinCallback} instead.
|
|
1696
1901
|
*
|
|
1697
1902
|
* @returns A promise containing the authenticated `User`.
|
|
1698
1903
|
*
|
|
@@ -1713,10 +1918,15 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1713
1918
|
password: t,
|
|
1714
1919
|
skipUserInfo: s = !1
|
|
1715
1920
|
}) {
|
|
1716
|
-
const i = this._logger.create("signinResourceOwnerCredential"), r = await this._client.processResourceOwnerPasswordCredentials({
|
|
1921
|
+
const i = this._logger.create("signinResourceOwnerCredential"), r = await this._client.processResourceOwnerPasswordCredentials({
|
|
1922
|
+
username: e,
|
|
1923
|
+
password: t,
|
|
1924
|
+
skipUserInfo: s,
|
|
1925
|
+
extraTokenParams: this.settings.extraTokenParams
|
|
1926
|
+
});
|
|
1717
1927
|
i.debug("got signin response");
|
|
1718
|
-
const
|
|
1719
|
-
return
|
|
1928
|
+
const o = await this._buildUser(r);
|
|
1929
|
+
return o.profile && o.profile.sub ? i.info("success, signed in subject", o.profile.sub) : i.info("no subject"), o;
|
|
1720
1930
|
}
|
|
1721
1931
|
/**
|
|
1722
1932
|
* Trigger a request (via a popup window) to the authorization endpoint.
|
|
@@ -1725,23 +1935,29 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1725
1935
|
* @throws `Error` In cases of wrong authentication.
|
|
1726
1936
|
*/
|
|
1727
1937
|
async signinPopup(e = {}) {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1938
|
+
var t;
|
|
1939
|
+
const s = this._logger.create("signinPopup");
|
|
1940
|
+
let i;
|
|
1941
|
+
(t = this.settings.dpop) != null && t.bind_authorization_code && (i = await this.generateDPoPJkt(this.settings.dpop));
|
|
1942
|
+
const {
|
|
1943
|
+
popupWindowFeatures: r,
|
|
1944
|
+
popupWindowTarget: o,
|
|
1945
|
+
popupSignal: n,
|
|
1946
|
+
...c
|
|
1947
|
+
} = e, l = this.settings.popup_redirect_uri;
|
|
1948
|
+
l || s.throw(new Error("No popup_redirect_uri configured"));
|
|
1949
|
+
const d = await this._popupNavigator.prepare({ popupWindowFeatures: r, popupWindowTarget: o, popupSignal: n }), h = await this._signin({
|
|
1735
1950
|
request_type: "si:p",
|
|
1736
|
-
redirect_uri:
|
|
1951
|
+
redirect_uri: l,
|
|
1737
1952
|
display: "popup",
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1953
|
+
dpopJkt: i,
|
|
1954
|
+
...c
|
|
1955
|
+
}, d);
|
|
1956
|
+
return h && (h.profile && h.profile.sub ? s.info("success, signed in subject", h.profile.sub) : s.info("no subject")), h;
|
|
1741
1957
|
}
|
|
1742
1958
|
/**
|
|
1743
1959
|
* Notify the opening window of response (callback) from the authorization endpoint.
|
|
1744
|
-
* It is
|
|
1960
|
+
* It is recommended to use {@link UserManager.signinCallback} instead.
|
|
1745
1961
|
*
|
|
1746
1962
|
* @returns A promise
|
|
1747
1963
|
*
|
|
@@ -1757,47 +1973,50 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1757
1973
|
* @returns A promise that contains the authenticated `User`.
|
|
1758
1974
|
*/
|
|
1759
1975
|
async signinSilent(e = {}) {
|
|
1760
|
-
var t;
|
|
1761
|
-
const
|
|
1762
|
-
silentRequestTimeoutInSeconds:
|
|
1763
|
-
...
|
|
1976
|
+
var t, s;
|
|
1977
|
+
const i = this._logger.create("signinSilent"), {
|
|
1978
|
+
silentRequestTimeoutInSeconds: r,
|
|
1979
|
+
...o
|
|
1764
1980
|
} = e;
|
|
1765
1981
|
let n = await this._loadUser();
|
|
1766
1982
|
if (n != null && n.refresh_token) {
|
|
1767
|
-
|
|
1768
|
-
const
|
|
1983
|
+
i.debug("using refresh token");
|
|
1984
|
+
const g = new xs(n);
|
|
1769
1985
|
return await this._useRefreshToken({
|
|
1770
|
-
state:
|
|
1771
|
-
redirect_uri:
|
|
1772
|
-
resource:
|
|
1773
|
-
extraTokenParams:
|
|
1774
|
-
timeoutInSeconds:
|
|
1986
|
+
state: g,
|
|
1987
|
+
redirect_uri: o.redirect_uri,
|
|
1988
|
+
resource: o.resource,
|
|
1989
|
+
extraTokenParams: o.extraTokenParams,
|
|
1990
|
+
timeoutInSeconds: r
|
|
1775
1991
|
});
|
|
1776
1992
|
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1993
|
+
let c;
|
|
1994
|
+
(t = this.settings.dpop) != null && t.bind_authorization_code && (c = await this.generateDPoPJkt(this.settings.dpop));
|
|
1995
|
+
const l = this.settings.silent_redirect_uri;
|
|
1996
|
+
l || i.throw(new Error("No silent_redirect_uri configured"));
|
|
1997
|
+
let d;
|
|
1998
|
+
n && this.settings.validateSubOnSilentRenew && (i.debug("subject prior to silent renew:", n.profile.sub), d = n.profile.sub);
|
|
1999
|
+
const h = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: r });
|
|
1782
2000
|
return n = await this._signin({
|
|
1783
2001
|
request_type: "si:s",
|
|
1784
|
-
redirect_uri:
|
|
2002
|
+
redirect_uri: l,
|
|
1785
2003
|
prompt: "none",
|
|
1786
2004
|
id_token_hint: this.settings.includeIdTokenInSilentRenew ? n == null ? void 0 : n.id_token : void 0,
|
|
1787
|
-
|
|
1788
|
-
|
|
2005
|
+
dpopJkt: c,
|
|
2006
|
+
...o
|
|
2007
|
+
}, h, d), n && ((s = n.profile) != null && s.sub ? i.info("success, signed in subject", n.profile.sub) : i.info("no subject")), n;
|
|
1789
2008
|
}
|
|
1790
2009
|
async _useRefreshToken(e) {
|
|
1791
2010
|
const t = await this._client.useRefreshToken({
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
}), s = new
|
|
2011
|
+
timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds,
|
|
2012
|
+
...e
|
|
2013
|
+
}), s = new we({ ...e.state, ...t });
|
|
1795
2014
|
return await this.storeUser(s), await this._events.load(s), s;
|
|
1796
2015
|
}
|
|
1797
2016
|
/**
|
|
1798
2017
|
*
|
|
1799
2018
|
* Notify the parent window of response (callback) from the authorization endpoint.
|
|
1800
|
-
* It is
|
|
2019
|
+
* It is recommended to use {@link UserManager.signinCallback} instead.
|
|
1801
2020
|
*
|
|
1802
2021
|
* @returns A promise
|
|
1803
2022
|
*
|
|
@@ -1814,7 +2033,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1814
2033
|
* - {@link UserManager.signinPopupCallback}
|
|
1815
2034
|
* - {@link UserManager.signinSilentCallback}
|
|
1816
2035
|
*
|
|
1817
|
-
* @throws `Error` If request_type is unknown or
|
|
2036
|
+
* @throws `Error` If request_type is unknown or signin cannot be processed.
|
|
1818
2037
|
*/
|
|
1819
2038
|
async signinCallback(e = window.location.href) {
|
|
1820
2039
|
const { state: t } = await this._client.readSigninResponseState(e);
|
|
@@ -1822,9 +2041,11 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1822
2041
|
case "si:r":
|
|
1823
2042
|
return await this.signinRedirectCallback(e);
|
|
1824
2043
|
case "si:p":
|
|
1825
|
-
|
|
2044
|
+
await this.signinPopupCallback(e);
|
|
2045
|
+
break;
|
|
1826
2046
|
case "si:s":
|
|
1827
|
-
|
|
2047
|
+
await this.signinSilentCallback(e);
|
|
2048
|
+
break;
|
|
1828
2049
|
default:
|
|
1829
2050
|
throw new Error("invalid response_type in state");
|
|
1830
2051
|
}
|
|
@@ -1836,15 +2057,14 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1836
2057
|
* - {@link UserManager.signoutPopupCallback}
|
|
1837
2058
|
* - {@link UserManager.signoutSilentCallback}
|
|
1838
2059
|
*
|
|
1839
|
-
* @throws `Error` If request_type is unknown or signout
|
|
2060
|
+
* @throws `Error` If request_type is unknown or signout cannot be processed.
|
|
1840
2061
|
*/
|
|
1841
2062
|
async signoutCallback(e = window.location.href, t = !1) {
|
|
1842
2063
|
const { state: s } = await this._client.readSignoutResponseState(e);
|
|
1843
2064
|
if (s)
|
|
1844
2065
|
switch (s.request_type) {
|
|
1845
2066
|
case "so:r":
|
|
1846
|
-
await this.signoutRedirectCallback(e);
|
|
1847
|
-
break;
|
|
2067
|
+
return await this.signoutRedirectCallback(e);
|
|
1848
2068
|
case "so:p":
|
|
1849
2069
|
await this.signoutPopupCallback(e, t);
|
|
1850
2070
|
break;
|
|
@@ -1866,25 +2086,25 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1866
2086
|
...i
|
|
1867
2087
|
} = e, r = this.settings.silent_redirect_uri;
|
|
1868
2088
|
r || t.throw(new Error("No silent_redirect_uri configured"));
|
|
1869
|
-
const
|
|
2089
|
+
const o = await this._loadUser(), n = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: s }), c = await this._signinStart({
|
|
1870
2090
|
request_type: "si:s",
|
|
1871
2091
|
// this acts like a signin silent
|
|
1872
2092
|
redirect_uri: r,
|
|
1873
2093
|
prompt: "none",
|
|
1874
|
-
id_token_hint: this.settings.includeIdTokenInSilentRenew ?
|
|
2094
|
+
id_token_hint: this.settings.includeIdTokenInSilentRenew ? o == null ? void 0 : o.id_token : void 0,
|
|
1875
2095
|
response_type: this.settings.query_status_response_type,
|
|
1876
2096
|
scope: "openid",
|
|
1877
2097
|
skipUserInfo: !0,
|
|
1878
2098
|
...i
|
|
1879
|
-
},
|
|
2099
|
+
}, n);
|
|
1880
2100
|
try {
|
|
1881
|
-
const l = await this._client.processSigninResponse(
|
|
1882
|
-
return t.debug("got signin response"),
|
|
1883
|
-
session_state:
|
|
1884
|
-
sub:
|
|
2101
|
+
const l = {}, d = await this._client.processSigninResponse(c.url, l);
|
|
2102
|
+
return t.debug("got signin response"), d.session_state && d.profile.sub ? (t.info("success for subject", d.profile.sub), {
|
|
2103
|
+
session_state: d.session_state,
|
|
2104
|
+
sub: d.profile.sub
|
|
1885
2105
|
}) : (t.info("success, user not authenticated"), null);
|
|
1886
2106
|
} catch (l) {
|
|
1887
|
-
if (this.settings.monitorAnonymousSession && l instanceof
|
|
2107
|
+
if (this.settings.monitorAnonymousSession && l instanceof B)
|
|
1888
2108
|
switch (l.error) {
|
|
1889
2109
|
case "login_required":
|
|
1890
2110
|
case "consent_required":
|
|
@@ -1917,14 +2137,14 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1917
2137
|
}
|
|
1918
2138
|
}
|
|
1919
2139
|
async _signinEnd(e, t) {
|
|
1920
|
-
const s = this._logger.create("_signinEnd"), i = await this._client.processSigninResponse(e);
|
|
1921
|
-
return s.debug("got signin response"), await this._buildUser(
|
|
2140
|
+
const s = this._logger.create("_signinEnd"), i = {}, r = await this._client.processSigninResponse(e, i);
|
|
2141
|
+
return s.debug("got signin response"), await this._buildUser(r, t);
|
|
1922
2142
|
}
|
|
1923
2143
|
async _buildUser(e, t) {
|
|
1924
|
-
const s = this._logger.create("_buildUser"), i = new
|
|
2144
|
+
const s = this._logger.create("_buildUser"), i = new we(e);
|
|
1925
2145
|
if (t) {
|
|
1926
2146
|
if (t !== i.profile.sub)
|
|
1927
|
-
throw s.debug("current user does not match user returned from signin. sub from signin:", i.profile.sub), new
|
|
2147
|
+
throw s.debug("current user does not match user returned from signin. sub from signin:", i.profile.sub), new B({ ...e, error: "login_required" });
|
|
1928
2148
|
s.debug("current user matches user returned from signin");
|
|
1929
2149
|
}
|
|
1930
2150
|
return await this.storeUser(i), s.debug("user stored"), await this._events.load(i), i;
|
|
@@ -1947,7 +2167,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1947
2167
|
}
|
|
1948
2168
|
/**
|
|
1949
2169
|
* Process response (callback) from the end session endpoint.
|
|
1950
|
-
* It is
|
|
2170
|
+
* It is recommended to use {@link UserManager.signoutCallback} instead.
|
|
1951
2171
|
*
|
|
1952
2172
|
* @returns A promise containing signout response
|
|
1953
2173
|
*
|
|
@@ -1958,7 +2178,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1958
2178
|
return t.info("success"), s;
|
|
1959
2179
|
}
|
|
1960
2180
|
/**
|
|
1961
|
-
* Trigger a redirect of a popup window
|
|
2181
|
+
* Trigger a redirect of a popup window to the end session endpoint.
|
|
1962
2182
|
*
|
|
1963
2183
|
* @returns A promise
|
|
1964
2184
|
*/
|
|
@@ -1966,8 +2186,9 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1966
2186
|
const t = this._logger.create("signoutPopup"), {
|
|
1967
2187
|
popupWindowFeatures: s,
|
|
1968
2188
|
popupWindowTarget: i,
|
|
1969
|
-
|
|
1970
|
-
|
|
2189
|
+
popupSignal: r,
|
|
2190
|
+
...o
|
|
2191
|
+
} = e, n = this.settings.popup_post_logout_redirect_uri, c = await this._popupNavigator.prepare({ popupWindowFeatures: s, popupWindowTarget: i, popupSignal: r });
|
|
1971
2192
|
await this._signout({
|
|
1972
2193
|
request_type: "so:p",
|
|
1973
2194
|
post_logout_redirect_uri: n,
|
|
@@ -1977,12 +2198,12 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
1977
2198
|
// plan to return back to the client after signout
|
|
1978
2199
|
// and so we can close the popup after signout
|
|
1979
2200
|
state: n == null ? void 0 : {},
|
|
1980
|
-
...
|
|
2201
|
+
...o
|
|
1981
2202
|
}, c), t.info("success");
|
|
1982
2203
|
}
|
|
1983
2204
|
/**
|
|
1984
2205
|
* Process response (callback) from the end session endpoint from a popup window.
|
|
1985
|
-
* It is
|
|
2206
|
+
* It is recommended to use {@link UserManager.signoutCallback} instead.
|
|
1986
2207
|
*
|
|
1987
2208
|
* @returns A promise
|
|
1988
2209
|
*
|
|
@@ -2002,12 +2223,12 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
2002
2223
|
try {
|
|
2003
2224
|
const r = await this._loadUser();
|
|
2004
2225
|
i.debug("loaded current user from storage"), this.settings.revokeTokensOnSignout && await this._revokeInternal(r);
|
|
2005
|
-
const
|
|
2006
|
-
|
|
2007
|
-
const
|
|
2226
|
+
const o = e.id_token_hint || r && r.id_token;
|
|
2227
|
+
o && (i.debug("setting id_token_hint in signout request"), e.id_token_hint = o), await this.removeUser(), i.debug("user removed, creating signout request");
|
|
2228
|
+
const n = await this._client.createSignoutRequest(e);
|
|
2008
2229
|
return i.debug("got signout request"), await t.navigate({
|
|
2009
|
-
url:
|
|
2010
|
-
state: (s =
|
|
2230
|
+
url: n.url,
|
|
2231
|
+
state: (s = n.state) == null ? void 0 : s.id,
|
|
2011
2232
|
scriptOrigin: this.settings.iframeScriptOrigin
|
|
2012
2233
|
});
|
|
2013
2234
|
} catch (r) {
|
|
@@ -2028,17 +2249,17 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
2028
2249
|
const s = this._logger.create("signoutSilent"), {
|
|
2029
2250
|
silentRequestTimeoutInSeconds: i,
|
|
2030
2251
|
...r
|
|
2031
|
-
} = e,
|
|
2252
|
+
} = e, o = this.settings.includeIdTokenInSilentSignout ? (t = await this._loadUser()) == null ? void 0 : t.id_token : void 0, n = this.settings.popup_post_logout_redirect_uri, c = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds: i });
|
|
2032
2253
|
await this._signout({
|
|
2033
2254
|
request_type: "so:s",
|
|
2034
|
-
post_logout_redirect_uri:
|
|
2035
|
-
id_token_hint:
|
|
2255
|
+
post_logout_redirect_uri: n,
|
|
2256
|
+
id_token_hint: o,
|
|
2036
2257
|
...r
|
|
2037
|
-
},
|
|
2258
|
+
}, c), s.info("success");
|
|
2038
2259
|
}
|
|
2039
2260
|
/**
|
|
2040
2261
|
* Notify the parent window of response (callback) from the end session endpoint.
|
|
2041
|
-
* It is
|
|
2262
|
+
* It is recommended to use {@link UserManager.signoutCallback} instead.
|
|
2042
2263
|
*
|
|
2043
2264
|
* @returns A promise
|
|
2044
2265
|
*
|
|
@@ -2054,8 +2275,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
2054
2275
|
}
|
|
2055
2276
|
async _revokeInternal(e, t = this.settings.revokeTokenTypes) {
|
|
2056
2277
|
const s = this._logger.create("_revokeInternal");
|
|
2057
|
-
if (!e)
|
|
2058
|
-
return;
|
|
2278
|
+
if (!e) return;
|
|
2059
2279
|
const i = t.filter((r) => typeof e[r] == "string");
|
|
2060
2280
|
if (!i.length) {
|
|
2061
2281
|
s.debug("no need to revoke due to no token(s)");
|
|
@@ -2086,7 +2306,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
2086
2306
|
}
|
|
2087
2307
|
async _loadUser() {
|
|
2088
2308
|
const e = this._logger.create("_loadUser"), t = await this.settings.userStore.get(this._userStoreKey);
|
|
2089
|
-
return t ? (e.debug("user storageString loaded"),
|
|
2309
|
+
return t ? (e.debug("user storageString loaded"), we.fromStorageString(t)) : (e.debug("no user storageString"), null);
|
|
2090
2310
|
}
|
|
2091
2311
|
async storeUser(e) {
|
|
2092
2312
|
const t = this._logger.create("storeUser");
|
|
@@ -2095,7 +2315,7 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
2095
2315
|
const s = e.toStorageString();
|
|
2096
2316
|
await this.settings.userStore.set(this._userStoreKey, s);
|
|
2097
2317
|
} else
|
|
2098
|
-
this._logger.debug("removing user"), await this.settings.userStore.remove(this._userStoreKey);
|
|
2318
|
+
this._logger.debug("removing user"), await this.settings.userStore.remove(this._userStoreKey), this.settings.dpop && await this.settings.dpop.store.remove(this.settings.client_id);
|
|
2099
2319
|
}
|
|
2100
2320
|
/**
|
|
2101
2321
|
* Removes stale state entries in storage for incomplete authorize requests.
|
|
@@ -2103,83 +2323,113 @@ var rs = Ye, ns = "openid", de = class {
|
|
|
2103
2323
|
async clearStaleState() {
|
|
2104
2324
|
await this._client.clearStaleState();
|
|
2105
2325
|
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Dynamically generates a DPoP proof for a given user, URL and optional Http method.
|
|
2328
|
+
* This method is useful when you need to make a request to a resource server
|
|
2329
|
+
* with fetch or similar, and you need to include a DPoP proof in a DPoP header.
|
|
2330
|
+
* @param url - The URL to generate the DPoP proof for
|
|
2331
|
+
* @param user - The user to generate the DPoP proof for
|
|
2332
|
+
* @param httpMethod - Optional, defaults to "GET"
|
|
2333
|
+
* @param nonce - Optional nonce provided by the resource server
|
|
2334
|
+
*
|
|
2335
|
+
* @returns A promise containing the DPoP proof or undefined if DPoP is not enabled/no user is found.
|
|
2336
|
+
*/
|
|
2337
|
+
async dpopProof(e, t, s, i) {
|
|
2338
|
+
var r, o;
|
|
2339
|
+
const n = await ((o = (r = this.settings.dpop) == null ? void 0 : r.store) == null ? void 0 : o.get(this.settings.client_id));
|
|
2340
|
+
if (n)
|
|
2341
|
+
return await C.generateDPoPProof({
|
|
2342
|
+
url: e,
|
|
2343
|
+
accessToken: t == null ? void 0 : t.access_token,
|
|
2344
|
+
httpMethod: s,
|
|
2345
|
+
keyPair: n.keys,
|
|
2346
|
+
nonce: i
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
async generateDPoPJkt(e) {
|
|
2350
|
+
let t = await e.store.get(this.settings.client_id);
|
|
2351
|
+
if (!t) {
|
|
2352
|
+
const s = await C.generateDPoPKeys();
|
|
2353
|
+
t = new ot(s), await e.store.set(this.settings.client_id, t);
|
|
2354
|
+
}
|
|
2355
|
+
return await C.generateDPoPJkt(t.keys);
|
|
2356
|
+
}
|
|
2106
2357
|
};
|
|
2107
|
-
const
|
|
2108
|
-
function
|
|
2358
|
+
const Os = ["url", "clientId", "redirectUri", "scope", "logoutUrl"], Ns = "openid profile email";
|
|
2359
|
+
function qs(e, t) {
|
|
2109
2360
|
const s = {};
|
|
2110
2361
|
return e.forEach((i) => {
|
|
2111
2362
|
t[i] !== void 0 && (s[i] = t[i]);
|
|
2112
2363
|
}), s;
|
|
2113
2364
|
}
|
|
2114
|
-
let
|
|
2115
|
-
const
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
loadUserInfo: !0
|
|
2127
|
-
});
|
|
2128
|
-
}, xs = async () => {
|
|
2365
|
+
let p, V;
|
|
2366
|
+
const Ds = (e) => (V = qs(Os, e), new As({
|
|
2367
|
+
authority: V.url,
|
|
2368
|
+
client_id: V.clientId,
|
|
2369
|
+
redirect_uri: V.redirectUri,
|
|
2370
|
+
response_type: "code",
|
|
2371
|
+
scope: V.scope || Ns,
|
|
2372
|
+
filterProtocolClaims: !0,
|
|
2373
|
+
includeIdTokenInSilentRenew: !0,
|
|
2374
|
+
includeIdTokenInSilentSignout: !0,
|
|
2375
|
+
loadUserInfo: !0
|
|
2376
|
+
})), js = async () => {
|
|
2129
2377
|
try {
|
|
2130
2378
|
console.debug("[Auth] Logging in using OIDC");
|
|
2131
|
-
const e = new URL(window.location.href), t = await (
|
|
2132
|
-
e.searchParams.get("state") || t ? await (
|
|
2133
|
-
|
|
2379
|
+
const e = new URL(window.location.href), t = await (p == null ? void 0 : p.getUser());
|
|
2380
|
+
e.searchParams.get("state") || t ? await (p == null ? void 0 : p.signinRedirectCallback()) : await (p == null ? void 0 : p.signinRedirect().then(() => {
|
|
2381
|
+
p == null || p.startSilentRenew(), p == null || p.signinRedirectCallback();
|
|
2134
2382
|
}).catch((s) => {
|
|
2135
2383
|
console.log(s);
|
|
2136
2384
|
}));
|
|
2137
2385
|
} catch (e) {
|
|
2138
2386
|
console.error("[Auth] Error logging in using OIDC: ", e);
|
|
2139
2387
|
}
|
|
2140
|
-
},
|
|
2141
|
-
|
|
2388
|
+
}, Fs = async () => p == null ? void 0 : p.removeUser().then(() => p == null ? void 0 : p.signoutRedirect({
|
|
2389
|
+
post_logout_redirect_uri: V.logoutUrl || window.location.href
|
|
2390
|
+
})), $s = async () => await (p == null ? void 0 : p.getUser()) != null, Hs = async () => {
|
|
2391
|
+
const e = await (p == null ? void 0 : p.getUser());
|
|
2142
2392
|
return Promise.resolve(e == null ? void 0 : e.id_token);
|
|
2143
|
-
},
|
|
2144
|
-
const e = await (
|
|
2393
|
+
}, Ls = async () => {
|
|
2394
|
+
const e = await (p == null ? void 0 : p.getUser());
|
|
2145
2395
|
return Promise.resolve(e == null ? void 0 : e.profile.preferred_username);
|
|
2146
2396
|
};
|
|
2147
|
-
let
|
|
2148
|
-
const
|
|
2397
|
+
let G, Z;
|
|
2398
|
+
const Ms = async (e, t) => {
|
|
2149
2399
|
try {
|
|
2150
|
-
console.debug("[Auth] Setting Username and Password for BasicAuth"),
|
|
2400
|
+
console.debug("[Auth] Setting Username and Password for BasicAuth"), G = e, Z = t;
|
|
2151
2401
|
} catch (s) {
|
|
2152
2402
|
console.error("[Auth] Error logging in using BasicAuth: ", s);
|
|
2153
2403
|
}
|
|
2154
|
-
},
|
|
2155
|
-
console.debug("[Auth] Logout for BasicAuth"),
|
|
2156
|
-
},
|
|
2157
|
-
if (
|
|
2404
|
+
}, Ws = async () => {
|
|
2405
|
+
console.debug("[Auth] Logout for BasicAuth"), G = void 0, Z = void 0, window.location.reload();
|
|
2406
|
+
}, Js = async () => G !== void 0 && Z !== void 0, Ks = async () => Promise.resolve(G), Bs = () => {
|
|
2407
|
+
if (G !== void 0 && Z != null)
|
|
2158
2408
|
return {
|
|
2159
|
-
username:
|
|
2160
|
-
password:
|
|
2409
|
+
username: G,
|
|
2410
|
+
password: Z
|
|
2161
2411
|
};
|
|
2162
|
-
},
|
|
2163
|
-
const e =
|
|
2164
|
-
return e.type === "oidc" ? (
|
|
2412
|
+
}, ut = () => {
|
|
2413
|
+
const e = wt(Xt);
|
|
2414
|
+
return e.type === "oidc" ? (p === void 0 && (console.debug("[Auth] Creating OIDC UserManager with options: ", e.options), p = Ds(e.options)), {
|
|
2165
2415
|
isOidcAuthEnabled: () => !0,
|
|
2166
2416
|
isBasicAuthEnabled: () => !1,
|
|
2167
|
-
isAuthenticated:
|
|
2168
|
-
getToken:
|
|
2417
|
+
isAuthenticated: $s,
|
|
2418
|
+
getToken: Hs,
|
|
2169
2419
|
getUsernameAndPassword: () => {
|
|
2170
2420
|
},
|
|
2171
|
-
getUsername:
|
|
2172
|
-
login:
|
|
2173
|
-
logout:
|
|
2421
|
+
getUsername: Ls,
|
|
2422
|
+
login: js,
|
|
2423
|
+
logout: Fs
|
|
2174
2424
|
}) : e.type === "basic" ? {
|
|
2175
2425
|
isOidcAuthEnabled: () => !1,
|
|
2176
2426
|
isBasicAuthEnabled: () => !0,
|
|
2177
|
-
isAuthenticated:
|
|
2427
|
+
isAuthenticated: Js,
|
|
2178
2428
|
getToken: () => Promise.resolve(void 0),
|
|
2179
|
-
getUsernameAndPassword:
|
|
2180
|
-
getUsername:
|
|
2181
|
-
login:
|
|
2182
|
-
logout:
|
|
2429
|
+
getUsernameAndPassword: Bs,
|
|
2430
|
+
getUsername: Ks,
|
|
2431
|
+
login: Ms,
|
|
2432
|
+
logout: Ws
|
|
2183
2433
|
} : {
|
|
2184
2434
|
isOidcAuthEnabled: () => !1,
|
|
2185
2435
|
isBasicAuthEnabled: () => !1,
|
|
@@ -2191,95 +2441,95 @@ const Ns = async (e, t) => {
|
|
|
2191
2441
|
login: () => Promise.resolve(),
|
|
2192
2442
|
logout: () => Promise.resolve()
|
|
2193
2443
|
};
|
|
2194
|
-
},
|
|
2195
|
-
const [t, s] =
|
|
2196
|
-
return
|
|
2444
|
+
}, Ce = (e) => {
|
|
2445
|
+
const [t, s] = y(null), i = e.format || "locale";
|
|
2446
|
+
return Re(() => {
|
|
2197
2447
|
let r;
|
|
2198
|
-
if (e.date && typeof e.date == "string" ? r =
|
|
2199
|
-
const
|
|
2448
|
+
if (e.date && typeof e.date == "string" ? r = fe.fromISO(e.date) : e.date && typeof e.date == "object" && (r = fe.fromJSDate(e.date)), r) {
|
|
2449
|
+
const o = {
|
|
2200
2450
|
locale: e.locale
|
|
2201
2451
|
};
|
|
2202
|
-
s(i === "fromNow" ? r.toRelative() : i === "locale" ? r.toLocaleString(
|
|
2452
|
+
s(i === "fromNow" ? r.toRelative() : i === "locale" ? r.toLocaleString(fe.DATETIME_FULL, o) : r.toFormat(i, o));
|
|
2203
2453
|
} else
|
|
2204
2454
|
s(null);
|
|
2205
2455
|
}, [e.date]), /* @__PURE__ */ a("span", { children: t || "" });
|
|
2206
|
-
},
|
|
2207
|
-
const
|
|
2208
|
-
/* @__PURE__ */ a(
|
|
2209
|
-
/* @__PURE__ */ a(
|
|
2456
|
+
}, oi = (e) => /* @__PURE__ */ a(Ce, { date: e.date, format: "fromNow" }), O = ({ condition: e, children: t }) => (typeof e == "boolean" ? e : e()) ? /* @__PURE__ */ a(H.Fragment, { children: t }) : /* @__PURE__ */ a(H.Fragment, {}), ai = ({ collection: e, emptyState: t, emptyStateTitle: s, emptyStateMessage: i, children: r }) => {
|
|
2457
|
+
const o = () => !e || e.length === 0, n = t || /* @__PURE__ */ m(re, { variant: vt.xs, children: [
|
|
2458
|
+
/* @__PURE__ */ a(ne, { titleText: s || "None found", headingLevel: "h4" }),
|
|
2459
|
+
/* @__PURE__ */ a(ve, { children: i || "No items found." })
|
|
2210
2460
|
] });
|
|
2211
|
-
return
|
|
2212
|
-
},
|
|
2213
|
-
const i = () => typeof e == "boolean" ? e : e(), r = t || /* @__PURE__ */ a(
|
|
2214
|
-
return i() ? /* @__PURE__ */ a(
|
|
2215
|
-
},
|
|
2216
|
-
const g = t || !l || d ||
|
|
2217
|
-
return
|
|
2218
|
-
/* @__PURE__ */ a(
|
|
2219
|
-
/* @__PURE__ */
|
|
2220
|
-
/* @__PURE__ */ a(
|
|
2221
|
-
/* @__PURE__ */ a(
|
|
2222
|
-
/* @__PURE__ */ a(
|
|
2223
|
-
/* @__PURE__ */ a(
|
|
2461
|
+
return o() ? /* @__PURE__ */ a(H.Fragment, { children: n }) : /* @__PURE__ */ a(H.Fragment, { children: r });
|
|
2462
|
+
}, ge = ({ isLoading: e, loadingComponent: t, children: s }) => {
|
|
2463
|
+
const i = () => typeof e == "boolean" ? e : e(), r = t || /* @__PURE__ */ a(ee, {});
|
|
2464
|
+
return i() ? /* @__PURE__ */ a(H.Fragment, { children: r }) : /* @__PURE__ */ a(H.Fragment, { children: s });
|
|
2465
|
+
}, ci = ({ toolbar: e, alwaysShowToolbar: t, emptyState: s, filteredEmptyState: i, isLoading: r, isError: o, loadingComponent: n, errorComponent: c, isEmpty: l, isFiltered: d, children: h }) => {
|
|
2466
|
+
const g = t || !l || d || o;
|
|
2467
|
+
return c || (c = /* @__PURE__ */ a("div", { style: { padding: "15px", backgroundColor: "white" }, children: /* @__PURE__ */ a(St, { 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__ */ m(H.Fragment, { children: [
|
|
2468
|
+
/* @__PURE__ */ a(O, { condition: g, children: e }),
|
|
2469
|
+
/* @__PURE__ */ m(ge, { isLoading: r, loadingComponent: n, children: [
|
|
2470
|
+
/* @__PURE__ */ a(O, { condition: !l && !o, children: h }),
|
|
2471
|
+
/* @__PURE__ */ a(O, { condition: l && d && !o, children: i }),
|
|
2472
|
+
/* @__PURE__ */ a(O, { condition: l && !d && !o, children: s }),
|
|
2473
|
+
/* @__PURE__ */ a(O, { condition: o, children: c })
|
|
2224
2474
|
] })
|
|
2225
2475
|
] });
|
|
2226
|
-
},
|
|
2227
|
-
const [t, s] =
|
|
2476
|
+
}, li = (e) => {
|
|
2477
|
+
const [t, s] = y(!1), i = (l, d) => {
|
|
2228
2478
|
s(!1);
|
|
2229
2479
|
const h = d;
|
|
2230
2480
|
h !== void 0 && h >= 0 ? e.onSelect(e.items[h]) : e.onSelect(void 0);
|
|
2231
2481
|
}, r = () => {
|
|
2232
2482
|
s(!t);
|
|
2233
|
-
},
|
|
2483
|
+
}, o = (l) => {
|
|
2234
2484
|
let d;
|
|
2235
2485
|
return e.itemToTestId !== void 0 && (d = e.itemToTestId(l)), d;
|
|
2236
|
-
},
|
|
2486
|
+
}, n = e.popperProps || {
|
|
2237
2487
|
appendTo: e.menuAppendTo
|
|
2238
2488
|
};
|
|
2239
|
-
let
|
|
2240
|
-
return e.isKebab || (
|
|
2241
|
-
|
|
2489
|
+
let c = /* @__PURE__ */ a(Ht, { title: e.label });
|
|
2490
|
+
return e.isKebab || (c = /* @__PURE__ */ a(H.Fragment, { children: e.label })), /* @__PURE__ */ a(
|
|
2491
|
+
yt,
|
|
2242
2492
|
{
|
|
2243
2493
|
isOpen: t,
|
|
2244
2494
|
onSelect: i,
|
|
2245
2495
|
onOpenChange: (l) => s(l),
|
|
2246
2496
|
toggle: (l) => /* @__PURE__ */ a(
|
|
2247
|
-
|
|
2497
|
+
_e,
|
|
2248
2498
|
{
|
|
2249
2499
|
"data-testid": e.testId,
|
|
2250
2500
|
ref: l,
|
|
2251
2501
|
onClick: r,
|
|
2252
2502
|
isExpanded: t,
|
|
2253
2503
|
variant: e.isKebab ? "plain" : "default",
|
|
2254
|
-
children:
|
|
2504
|
+
children: c
|
|
2255
2505
|
}
|
|
2256
2506
|
),
|
|
2257
2507
|
ouiaId: "ObjectDropdown",
|
|
2258
|
-
popperProps:
|
|
2508
|
+
popperProps: n,
|
|
2259
2509
|
shouldFocusToggleOnSelect: !0,
|
|
2260
|
-
children: /* @__PURE__ */ a(
|
|
2261
|
-
|
|
2510
|
+
children: /* @__PURE__ */ a(bt, { children: e.items.map((l, d) => e.itemIsVisible !== void 0 && !e.itemIsVisible(l) ? /* @__PURE__ */ a(ue, {}) : e.itemIsDivider && e.itemIsDivider(l) ? /* @__PURE__ */ a(Ve, { component: "li" }, `divider-${d}`) : /* @__PURE__ */ a(
|
|
2511
|
+
kt,
|
|
2262
2512
|
{
|
|
2263
2513
|
value: d,
|
|
2264
2514
|
isDisabled: e.itemIsDisabled === void 0 ? !1 : e.itemIsDisabled(l),
|
|
2265
|
-
component: (h) => /* @__PURE__ */ a("button", { ...h, "data-testid":
|
|
2515
|
+
component: (h) => /* @__PURE__ */ a("button", { ...h, "data-testid": o(l) }),
|
|
2266
2516
|
children: e.itemToString(l)
|
|
2267
2517
|
},
|
|
2268
2518
|
`action-${d}`
|
|
2269
2519
|
)) })
|
|
2270
2520
|
}
|
|
2271
2521
|
);
|
|
2272
|
-
},
|
|
2522
|
+
}, zs = (e) => {
|
|
2273
2523
|
var l;
|
|
2274
|
-
const [t, s] =
|
|
2524
|
+
const [t, s] = y(!1), i = (d, h) => {
|
|
2275
2525
|
s(!1), e.onSelect(e.items[h]);
|
|
2276
2526
|
}, r = () => {
|
|
2277
2527
|
s(!t);
|
|
2278
|
-
},
|
|
2528
|
+
}, o = (d) => {
|
|
2279
2529
|
let h;
|
|
2280
2530
|
return e.itemToTestId !== void 0 && (h = e.itemToTestId(d)), h;
|
|
2281
|
-
},
|
|
2282
|
-
|
|
2531
|
+
}, n = (d) => /* @__PURE__ */ a(
|
|
2532
|
+
_e,
|
|
2283
2533
|
{
|
|
2284
2534
|
ref: d,
|
|
2285
2535
|
className: e.toggleClassname || "menu-toggle",
|
|
@@ -2288,23 +2538,23 @@ const Ns = async (e, t) => {
|
|
|
2288
2538
|
isExpanded: t,
|
|
2289
2539
|
children: e.value ? e.itemToString(e.value) : e.noSelectionLabel
|
|
2290
2540
|
}
|
|
2291
|
-
),
|
|
2541
|
+
), c = {
|
|
2292
2542
|
appendTo: e.appendTo === "document" ? () => document.body : "inline"
|
|
2293
2543
|
};
|
|
2294
2544
|
return /* @__PURE__ */ a(
|
|
2295
|
-
|
|
2545
|
+
xe,
|
|
2296
2546
|
{
|
|
2297
|
-
toggle:
|
|
2547
|
+
toggle: n,
|
|
2298
2548
|
id: e.toggleId,
|
|
2299
2549
|
onSelect: i,
|
|
2300
2550
|
onOpenChange: s,
|
|
2301
2551
|
isOpen: t,
|
|
2302
|
-
popperProps:
|
|
2303
|
-
children: (l = e.items) == null ? void 0 : l.map((d, h) => e.itemIsDivider && e.itemIsDivider(d) ? /* @__PURE__ */ a(
|
|
2304
|
-
|
|
2552
|
+
popperProps: c,
|
|
2553
|
+
children: (l = e.items) == null ? void 0 : l.map((d, h) => e.itemIsDivider && e.itemIsDivider(d) ? /* @__PURE__ */ a(Ve, {}, h) : /* @__PURE__ */ a(
|
|
2554
|
+
Ae,
|
|
2305
2555
|
{
|
|
2306
2556
|
isSelected: d === e.value,
|
|
2307
|
-
component: (g) => /* @__PURE__ */ a("button", { ...g, "data-testid":
|
|
2557
|
+
component: (g) => /* @__PURE__ */ a("button", { ...g, "data-testid": o(d) }),
|
|
2308
2558
|
value: h,
|
|
2309
2559
|
children: e.itemToString(d)
|
|
2310
2560
|
},
|
|
@@ -2312,36 +2562,36 @@ const Ns = async (e, t) => {
|
|
|
2312
2562
|
))
|
|
2313
2563
|
}
|
|
2314
2564
|
);
|
|
2315
|
-
},
|
|
2565
|
+
}, di = ({ expanded: e, onClick: t }) => e ? /* @__PURE__ */ a(Lt, { onClick: t, style: { cursor: "pointer" } }) : /* @__PURE__ */ a(Mt, { onClick: t, style: { cursor: "pointer" } }), _t = {
|
|
2316
2566
|
padding: "5px",
|
|
2317
2567
|
minHeight: "128px",
|
|
2318
2568
|
borderRight: 0,
|
|
2319
2569
|
borderLeft: 0,
|
|
2320
2570
|
borderBottom: "1px solid #666",
|
|
2321
2571
|
backgroundColor: "rgb(240, 240, 240)"
|
|
2322
|
-
},
|
|
2323
|
-
...
|
|
2572
|
+
}, Vs = {
|
|
2573
|
+
..._t,
|
|
2324
2574
|
color: "red",
|
|
2325
2575
|
overflow: "auto"
|
|
2326
|
-
},
|
|
2327
|
-
const [t, s] =
|
|
2328
|
-
s(
|
|
2329
|
-
}, h = () => t != null && t.trim().length > 0, g = () =>
|
|
2330
|
-
|
|
2331
|
-
l(void 0), r(
|
|
2332
|
-
}).catch((
|
|
2333
|
-
l(
|
|
2576
|
+
}, hi = (e) => {
|
|
2577
|
+
const [t, s] = y(""), [i, r] = y(""), [o, n] = y(!1), [c, l] = y(), d = (T, A) => {
|
|
2578
|
+
s(A);
|
|
2579
|
+
}, h = () => t != null && t.trim().length > 0, g = () => c != null && c.trim().length > 0, _ = () => {
|
|
2580
|
+
n(!0), e.onUrlFetch(t).then((T) => {
|
|
2581
|
+
l(void 0), r(T), n(!1), e.onChange(T, t);
|
|
2582
|
+
}).catch((T) => {
|
|
2583
|
+
l(T.message), n(!1);
|
|
2334
2584
|
});
|
|
2335
|
-
},
|
|
2585
|
+
}, S = () => {
|
|
2336
2586
|
s(""), r(""), e.onChange(void 0, void 0);
|
|
2337
|
-
},
|
|
2338
|
-
/* @__PURE__ */ a(
|
|
2587
|
+
}, x = /* @__PURE__ */ m("div", { className: "url-upload-loading", style: _t, children: [
|
|
2588
|
+
/* @__PURE__ */ a(ee, { size: "md", className: "spinner", style: { marginRight: "5px" } }),
|
|
2339
2589
|
/* @__PURE__ */ a("span", { className: "spinner-message", children: "Loading URL content" })
|
|
2340
2590
|
] });
|
|
2341
|
-
return /* @__PURE__ */
|
|
2342
|
-
/* @__PURE__ */
|
|
2591
|
+
return /* @__PURE__ */ m("div", { className: "url-upload", "data-testid": e.testId, children: [
|
|
2592
|
+
/* @__PURE__ */ m("div", { className: "url-upload-flex", style: { display: "flex" }, children: [
|
|
2343
2593
|
/* @__PURE__ */ a("div", { className: "url-upload-url", style: { flexGrow: 1 }, children: /* @__PURE__ */ a(
|
|
2344
|
-
|
|
2594
|
+
oe,
|
|
2345
2595
|
{
|
|
2346
2596
|
"data-testid": `${e.testId}-input`,
|
|
2347
2597
|
value: t,
|
|
@@ -2352,16 +2602,16 @@ const Ns = async (e, t) => {
|
|
|
2352
2602
|
"aria-label": "url input"
|
|
2353
2603
|
}
|
|
2354
2604
|
) }),
|
|
2355
|
-
/* @__PURE__ */ a("div", { className: "url-fetch-button", children: /* @__PURE__ */ a(
|
|
2356
|
-
/* @__PURE__ */ a("div", { className: "url-clear-button", children: /* @__PURE__ */ a(
|
|
2605
|
+
/* @__PURE__ */ a("div", { className: "url-fetch-button", children: /* @__PURE__ */ a(ae, { "data-testid": `${e.testId}-fetch`, variant: "control", isDisabled: !h(), onClick: _, children: "Fetch" }) }),
|
|
2606
|
+
/* @__PURE__ */ a("div", { className: "url-clear-button", children: /* @__PURE__ */ a(ae, { "data-testid": `${e.testId}-clear`, variant: "control", isDisabled: !h(), onClick: S, children: "Clear" }) })
|
|
2357
2607
|
] }),
|
|
2358
|
-
/* @__PURE__ */ a("div", { className: "url-upload-preview", children: /* @__PURE__ */
|
|
2359
|
-
/* @__PURE__ */ a(
|
|
2608
|
+
/* @__PURE__ */ a("div", { className: "url-upload-preview", children: /* @__PURE__ */ m(ge, { isLoading: o, loadingComponent: x, children: [
|
|
2609
|
+
/* @__PURE__ */ a(O, { condition: g, children: /* @__PURE__ */ m("div", { className: "url-upload-error", style: Vs, children: [
|
|
2360
2610
|
/* @__PURE__ */ a("div", { children: "Error getting content from URL." }),
|
|
2361
|
-
/* @__PURE__ */ a("div", { children:
|
|
2611
|
+
/* @__PURE__ */ a("div", { children: c })
|
|
2362
2612
|
] }) }),
|
|
2363
|
-
/* @__PURE__ */ a(
|
|
2364
|
-
|
|
2613
|
+
/* @__PURE__ */ a(O, { condition: !g(), children: /* @__PURE__ */ a(
|
|
2614
|
+
Tt,
|
|
2365
2615
|
{
|
|
2366
2616
|
"data-testid": `${e.testId}-preview`,
|
|
2367
2617
|
"aria-label": "url-content",
|
|
@@ -2372,25 +2622,65 @@ const Ns = async (e, t) => {
|
|
|
2372
2622
|
) })
|
|
2373
2623
|
] }) })
|
|
2374
2624
|
] });
|
|
2375
|
-
},
|
|
2376
|
-
const [t, s] =
|
|
2625
|
+
}, gi = (e) => {
|
|
2626
|
+
const [t, s] = y(), [i, r] = y();
|
|
2627
|
+
return Re(() => {
|
|
2628
|
+
e.isOpen && (typeof e.frontendInfo == "function" ? e.frontendInfo().then(s) : s(e.frontendInfo), typeof e.backendInfo == "function" ? e.backendInfo().then(r) : r(e.backendInfo));
|
|
2629
|
+
}, [e.isOpen]), /* @__PURE__ */ a(
|
|
2630
|
+
It,
|
|
2631
|
+
{
|
|
2632
|
+
className: "app-about-modal",
|
|
2633
|
+
isOpen: e.isOpen,
|
|
2634
|
+
onClose: e.onClose,
|
|
2635
|
+
trademark: "© 2024 Red Hat",
|
|
2636
|
+
brandImageSrc: e.brandImageSrc,
|
|
2637
|
+
brandImageAlt: e.brandImageAlt,
|
|
2638
|
+
"aria-label": e.brandImageAlt,
|
|
2639
|
+
children: /* @__PURE__ */ m(Et, { className: "app-about-modal-content", style: { marginTop: "-25px" }, children: [
|
|
2640
|
+
/* @__PURE__ */ a($e, { component: He.h2, children: "Web console info" }),
|
|
2641
|
+
/* @__PURE__ */ a(ge, { isLoading: t === void 0, children: /* @__PURE__ */ m(Le, { component: "dl", children: [
|
|
2642
|
+
/* @__PURE__ */ a(k, { component: "dt", children: "Project" }),
|
|
2643
|
+
/* @__PURE__ */ a(k, { component: "dd", children: /* @__PURE__ */ a("a", { href: t == null ? void 0 : t.url, target: "_blank", children: t == null ? void 0 : t.name }) }),
|
|
2644
|
+
/* @__PURE__ */ a(k, { component: "dt", children: "Version" }),
|
|
2645
|
+
/* @__PURE__ */ a(k, { component: "dd", children: t == null ? void 0 : t.version }),
|
|
2646
|
+
/* @__PURE__ */ a(k, { component: "dt", children: "Built on" }),
|
|
2647
|
+
/* @__PURE__ */ a(k, { component: "dd", children: /* @__PURE__ */ a(Ce, { date: t == null ? void 0 : t.builtOn, format: "locale" }) }),
|
|
2648
|
+
/* @__PURE__ */ a(k, { component: "dt", children: "Digest" }),
|
|
2649
|
+
/* @__PURE__ */ a(k, { component: "dd", children: t == null ? void 0 : t.digest })
|
|
2650
|
+
] }) }),
|
|
2651
|
+
/* @__PURE__ */ a($e, { style: { marginTop: "40px" }, component: He.h2, children: e.backendLabel }),
|
|
2652
|
+
/* @__PURE__ */ a(ge, { isLoading: i === void 0, children: /* @__PURE__ */ m(Le, { component: "dl", children: [
|
|
2653
|
+
/* @__PURE__ */ a(k, { component: "dt", children: "Name" }),
|
|
2654
|
+
/* @__PURE__ */ a(k, { component: "dd", children: (i == null ? void 0 : i.name) || "" }),
|
|
2655
|
+
/* @__PURE__ */ a(k, { component: "dt", children: "Description" }),
|
|
2656
|
+
/* @__PURE__ */ a(k, { component: "dd", children: (i == null ? void 0 : i.description) || "" }),
|
|
2657
|
+
/* @__PURE__ */ a(k, { component: "dt", children: "Version" }),
|
|
2658
|
+
/* @__PURE__ */ a(k, { component: "dd", children: (i == null ? void 0 : i.version) || "" }),
|
|
2659
|
+
/* @__PURE__ */ a(k, { component: "dt", children: "Built on" }),
|
|
2660
|
+
/* @__PURE__ */ a(k, { component: "dd", children: /* @__PURE__ */ a(Ce, { date: i == null ? void 0 : i.builtOn, format: "locale" }) })
|
|
2661
|
+
] }) })
|
|
2662
|
+
] })
|
|
2663
|
+
}
|
|
2664
|
+
);
|
|
2665
|
+
}, Gs = (e) => {
|
|
2666
|
+
const [t, s] = y({
|
|
2377
2667
|
username: "",
|
|
2378
2668
|
password: ""
|
|
2379
2669
|
}), i = () => {
|
|
2380
2670
|
e.onLogin(t);
|
|
2381
|
-
}, r = (
|
|
2671
|
+
}, r = (n, c) => {
|
|
2382
2672
|
s({
|
|
2383
2673
|
...t,
|
|
2384
|
-
username:
|
|
2674
|
+
username: c
|
|
2385
2675
|
});
|
|
2386
|
-
},
|
|
2676
|
+
}, o = (n, c) => {
|
|
2387
2677
|
s({
|
|
2388
2678
|
...t,
|
|
2389
|
-
password:
|
|
2679
|
+
password: c
|
|
2390
2680
|
});
|
|
2391
2681
|
};
|
|
2392
2682
|
return /* @__PURE__ */ a(
|
|
2393
|
-
|
|
2683
|
+
Oe,
|
|
2394
2684
|
{
|
|
2395
2685
|
title: "Login",
|
|
2396
2686
|
variant: "small",
|
|
@@ -2401,16 +2691,16 @@ const Ns = async (e, t) => {
|
|
|
2401
2691
|
"aria-label": "please-wait-modal",
|
|
2402
2692
|
style: { marginTop: "-15px" },
|
|
2403
2693
|
actions: [
|
|
2404
|
-
/* @__PURE__ */ a(
|
|
2694
|
+
/* @__PURE__ */ a(ae, { 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")
|
|
2405
2695
|
],
|
|
2406
|
-
children: /* @__PURE__ */
|
|
2696
|
+
children: /* @__PURE__ */ m(Ge, { children: [
|
|
2407
2697
|
/* @__PURE__ */ a(
|
|
2408
|
-
|
|
2698
|
+
Me,
|
|
2409
2699
|
{
|
|
2410
2700
|
label: "Username",
|
|
2411
2701
|
fieldId: "form-username",
|
|
2412
2702
|
children: /* @__PURE__ */ a(
|
|
2413
|
-
|
|
2703
|
+
oe,
|
|
2414
2704
|
{
|
|
2415
2705
|
isRequired: !0,
|
|
2416
2706
|
type: "text",
|
|
@@ -2425,12 +2715,12 @@ const Ns = async (e, t) => {
|
|
|
2425
2715
|
}
|
|
2426
2716
|
),
|
|
2427
2717
|
/* @__PURE__ */ a(
|
|
2428
|
-
|
|
2718
|
+
Me,
|
|
2429
2719
|
{
|
|
2430
2720
|
label: "Password",
|
|
2431
2721
|
fieldId: "form-password",
|
|
2432
2722
|
children: /* @__PURE__ */ a(
|
|
2433
|
-
|
|
2723
|
+
oe,
|
|
2434
2724
|
{
|
|
2435
2725
|
isRequired: !0,
|
|
2436
2726
|
type: "text",
|
|
@@ -2439,7 +2729,7 @@ const Ns = async (e, t) => {
|
|
|
2439
2729
|
name: "form-password",
|
|
2440
2730
|
value: t == null ? void 0 : t.password,
|
|
2441
2731
|
placeholder: "Password",
|
|
2442
|
-
onChange:
|
|
2732
|
+
onChange: o
|
|
2443
2733
|
}
|
|
2444
2734
|
)
|
|
2445
2735
|
}
|
|
@@ -2447,24 +2737,52 @@ const Ns = async (e, t) => {
|
|
|
2447
2737
|
] })
|
|
2448
2738
|
}
|
|
2449
2739
|
);
|
|
2450
|
-
},
|
|
2451
|
-
|
|
2740
|
+
}, ui = (e) => /* @__PURE__ */ m(
|
|
2741
|
+
Oe,
|
|
2742
|
+
{
|
|
2743
|
+
title: "Please Wait",
|
|
2744
|
+
variant: "small",
|
|
2745
|
+
isOpen: e.isOpen,
|
|
2746
|
+
header: /* @__PURE__ */ a("a", { href: "#" }),
|
|
2747
|
+
showClose: !1,
|
|
2748
|
+
className: "please-wait pf-m-redhat-font",
|
|
2749
|
+
"aria-label": "please-wait-modal",
|
|
2750
|
+
style: { marginTop: "-15px" },
|
|
2751
|
+
children: [
|
|
2752
|
+
/* @__PURE__ */ a(ee, { size: "md", className: "spinner" }),
|
|
2753
|
+
/* @__PURE__ */ a("span", { className: "message", style: { fontSize: "15px", color: "#333", marginLeft: "10px" }, children: e.message })
|
|
2754
|
+
]
|
|
2755
|
+
}
|
|
2756
|
+
), _i = (e) => /* @__PURE__ */ a(
|
|
2757
|
+
Oe,
|
|
2758
|
+
{
|
|
2759
|
+
title: e.title,
|
|
2760
|
+
variant: "small",
|
|
2761
|
+
isOpen: e.isOpen,
|
|
2762
|
+
showClose: e.isCloseable,
|
|
2763
|
+
onClose: e.onClose,
|
|
2764
|
+
className: "progress pf-m-redhat-font",
|
|
2765
|
+
"aria-label": "progress-modal",
|
|
2766
|
+
children: /* @__PURE__ */ a(Ct, { title: e.message, value: e.progress })
|
|
2767
|
+
}
|
|
2768
|
+
), pi = (e) => {
|
|
2769
|
+
const [t, s] = y(
|
|
2452
2770
|
0
|
|
2453
2771
|
/* AUTHENTICATING */
|
|
2454
|
-
), i =
|
|
2455
|
-
console.info("[ApplicationAuth] Using username and password."), i.login(
|
|
2772
|
+
), i = ut(), r = (o) => {
|
|
2773
|
+
console.info("[ApplicationAuth] Using username and password."), i.login(o.username, o.password), s(
|
|
2456
2774
|
1
|
|
2457
2775
|
/* AUTHENTICATED */
|
|
2458
2776
|
);
|
|
2459
2777
|
};
|
|
2460
|
-
return
|
|
2778
|
+
return Re(() => {
|
|
2461
2779
|
i.isOidcAuthEnabled() ? i.login("", "").then(() => {
|
|
2462
2780
|
console.info("[ApplicationAuth] Authentication successful."), s(
|
|
2463
2781
|
1
|
|
2464
2782
|
/* AUTHENTICATED */
|
|
2465
2783
|
);
|
|
2466
|
-
}).catch((
|
|
2467
|
-
console.error("[ApplicationAuth] Authentication failed: ",
|
|
2784
|
+
}).catch((o) => {
|
|
2785
|
+
console.error("[ApplicationAuth] Authentication failed: ", o), s(
|
|
2468
2786
|
2
|
|
2469
2787
|
/* AUTHENTICATION_FAILED */
|
|
2470
2788
|
);
|
|
@@ -2472,403 +2790,382 @@ const Ns = async (e, t) => {
|
|
|
2472
2790
|
1
|
|
2473
2791
|
/* AUTHENTICATED */
|
|
2474
2792
|
);
|
|
2475
|
-
}, []), /* @__PURE__ */
|
|
2476
|
-
/* @__PURE__ */ a(
|
|
2477
|
-
/* @__PURE__ */ a(
|
|
2478
|
-
/* @__PURE__ */ a(
|
|
2793
|
+
}, []), /* @__PURE__ */ m(ue, { children: [
|
|
2794
|
+
/* @__PURE__ */ a(O, { condition: t === 0 && i.isOidcAuthEnabled(), children: /* @__PURE__ */ m(re, { children: [
|
|
2795
|
+
/* @__PURE__ */ a(ne, { titleText: "Loading", headingLevel: "h4" }),
|
|
2796
|
+
/* @__PURE__ */ a(ve, { children: /* @__PURE__ */ a(ee, { size: "xl", "aria-label": "Loading spinner" }) })
|
|
2479
2797
|
] }) }),
|
|
2480
|
-
/* @__PURE__ */ a(
|
|
2481
|
-
/* @__PURE__ */ a(
|
|
2482
|
-
/* @__PURE__ */ a(
|
|
2483
|
-
/* @__PURE__ */ a(
|
|
2798
|
+
/* @__PURE__ */ a(O, { condition: t === 0 && i.isBasicAuthEnabled(), children: /* @__PURE__ */ a(Gs, { onLogin: r }) }),
|
|
2799
|
+
/* @__PURE__ */ a(O, { condition: t === 2, children: /* @__PURE__ */ m(re, { children: [
|
|
2800
|
+
/* @__PURE__ */ a(ne, { titleText: "Empty state", headingLevel: "h4", icon: /* @__PURE__ */ a(Qe, { icon: Wt }) }),
|
|
2801
|
+
/* @__PURE__ */ a(ve, { children: "Authentication failed." })
|
|
2484
2802
|
] }) }),
|
|
2485
|
-
/* @__PURE__ */ a(
|
|
2803
|
+
/* @__PURE__ */ a(O, { condition: t === 1, children: e.children })
|
|
2486
2804
|
] });
|
|
2487
|
-
},
|
|
2488
|
-
const t =
|
|
2805
|
+
}, fi = (e) => {
|
|
2806
|
+
const t = ut();
|
|
2489
2807
|
return (() => {
|
|
2490
2808
|
let i = !0;
|
|
2491
2809
|
return e.enabled !== void 0 && (i = i && (t.isOidcAuthEnabled() === e.enabled || t.isBasicAuthEnabled() === e.enabled)), i;
|
|
2492
|
-
})() ? /* @__PURE__ */ a(
|
|
2493
|
-
},
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
{
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
children: [
|
|
2545
|
-
/* @__PURE__ */ a(Q, { size: "md", className: "spinner" }),
|
|
2546
|
-
/* @__PURE__ */ a("span", { className: "message", style: { fontSize: "15px", color: "#333", marginLeft: "10px" }, children: e.message })
|
|
2547
|
-
]
|
|
2548
|
-
}
|
|
2549
|
-
), ci = (e) => /* @__PURE__ */ a(
|
|
2550
|
-
Ce,
|
|
2551
|
-
{
|
|
2552
|
-
title: e.title,
|
|
2553
|
-
variant: "small",
|
|
2554
|
-
isOpen: e.isOpen,
|
|
2555
|
-
showClose: e.isCloseable,
|
|
2556
|
-
onClose: e.onClose,
|
|
2557
|
-
className: "progress pf-m-redhat-font",
|
|
2558
|
-
"aria-label": "progress-modal",
|
|
2559
|
-
children: /* @__PURE__ */ a(yt, { title: e.message, value: e.progress })
|
|
2560
|
-
}
|
|
2561
|
-
);
|
|
2562
|
-
function li() {
|
|
2563
|
-
return /* @__PURE__ */ a(ee, { children: /* @__PURE__ */ a(
|
|
2564
|
-
te,
|
|
2810
|
+
})() ? /* @__PURE__ */ a(H.Fragment, { children: e.children }) : /* @__PURE__ */ a(H.Fragment, {});
|
|
2811
|
+
}, mi = (e) => /* @__PURE__ */ a(Pt, { categoryName: e.categoryName || "Filters", isClosable: !0, onClick: e.onClearAllCriteria, children: e.criteria.map((t, s) => /* @__PURE__ */ m(Rt, { onClick: () => e.onRemoveCriteria(t), children: [
|
|
2812
|
+
/* @__PURE__ */ a("b", { children: t.filterBy.label }),
|
|
2813
|
+
/* @__PURE__ */ a("span", { children: ": " }),
|
|
2814
|
+
/* @__PURE__ */ a("span", { children: t.filterValue })
|
|
2815
|
+
] }, s)) }), wi = (e) => {
|
|
2816
|
+
const [t, s] = y(e.filterTypes[0]), [i, r] = y(""), o = (n) => {
|
|
2817
|
+
n && n.preventDefault(), e.onAddCriteria({
|
|
2818
|
+
filterBy: t,
|
|
2819
|
+
filterValue: i
|
|
2820
|
+
}), r("");
|
|
2821
|
+
};
|
|
2822
|
+
return /* @__PURE__ */ a(Ge, { onSubmit: o, children: /* @__PURE__ */ m(Xe, { children: [
|
|
2823
|
+
/* @__PURE__ */ a(
|
|
2824
|
+
zs,
|
|
2825
|
+
{
|
|
2826
|
+
value: t,
|
|
2827
|
+
items: e.filterTypes,
|
|
2828
|
+
testId: "chip-filter-select",
|
|
2829
|
+
toggleClassname: "chip-filter-toggle",
|
|
2830
|
+
onSelect: s,
|
|
2831
|
+
itemToTestId: (n) => n.testId,
|
|
2832
|
+
itemToString: (n) => n.label
|
|
2833
|
+
}
|
|
2834
|
+
),
|
|
2835
|
+
/* @__PURE__ */ a(
|
|
2836
|
+
oe,
|
|
2837
|
+
{
|
|
2838
|
+
name: "filterValue",
|
|
2839
|
+
id: "filterValue",
|
|
2840
|
+
type: "search",
|
|
2841
|
+
value: i,
|
|
2842
|
+
onChange: (n, c) => r(c),
|
|
2843
|
+
"data-testid": "chip-filter-value",
|
|
2844
|
+
"aria-label": "search input"
|
|
2845
|
+
}
|
|
2846
|
+
),
|
|
2847
|
+
/* @__PURE__ */ a(
|
|
2848
|
+
ae,
|
|
2849
|
+
{
|
|
2850
|
+
variant: Ut.control,
|
|
2851
|
+
onClick: o,
|
|
2852
|
+
"data-testid": "chip-filter-search",
|
|
2853
|
+
"aria-label": "search button for search input",
|
|
2854
|
+
children: /* @__PURE__ */ a(Jt, {})
|
|
2855
|
+
}
|
|
2856
|
+
)
|
|
2857
|
+
] }) });
|
|
2858
|
+
};
|
|
2859
|
+
function vi() {
|
|
2860
|
+
return /* @__PURE__ */ a(re, { children: /* @__PURE__ */ a(
|
|
2861
|
+
ne,
|
|
2565
2862
|
{
|
|
2566
2863
|
titleText: "Loading",
|
|
2567
2864
|
headingLevel: "h4",
|
|
2568
|
-
icon: /* @__PURE__ */ a(
|
|
2865
|
+
icon: /* @__PURE__ */ a(Qe, { icon: ee })
|
|
2569
2866
|
}
|
|
2570
2867
|
) });
|
|
2571
2868
|
}
|
|
2572
|
-
function
|
|
2869
|
+
function Si({
|
|
2573
2870
|
itemCount: e,
|
|
2574
2871
|
page: t,
|
|
2575
2872
|
perPage: s,
|
|
2576
2873
|
isCompact: i = !1,
|
|
2577
2874
|
onChange: r,
|
|
2578
|
-
variant:
|
|
2875
|
+
variant: o = At.top
|
|
2579
2876
|
}) {
|
|
2580
2877
|
return /* @__PURE__ */ a(
|
|
2581
|
-
|
|
2878
|
+
xt,
|
|
2582
2879
|
{
|
|
2583
2880
|
itemCount: e,
|
|
2584
2881
|
page: t,
|
|
2585
2882
|
perPage: s,
|
|
2586
|
-
onSetPage: (
|
|
2587
|
-
onPerPageSelect: (
|
|
2588
|
-
variant:
|
|
2883
|
+
onSetPage: (n, c) => r(c, s),
|
|
2884
|
+
onPerPageSelect: (n, c) => r(1, c),
|
|
2885
|
+
variant: o,
|
|
2589
2886
|
isCompact: i
|
|
2590
2887
|
}
|
|
2591
2888
|
);
|
|
2592
2889
|
}
|
|
2593
|
-
function
|
|
2594
|
-
const i = new Array(e).fill(0).map((
|
|
2595
|
-
const
|
|
2596
|
-
return /* @__PURE__ */ a(
|
|
2597
|
-
|
|
2890
|
+
function Qs({ columns: e, rows: t, getTd: s = () => Ne }) {
|
|
2891
|
+
const i = new Array(e).fill(0).map((o, n) => {
|
|
2892
|
+
const c = s(n);
|
|
2893
|
+
return /* @__PURE__ */ a(c, { children: /* @__PURE__ */ a(
|
|
2894
|
+
Ot,
|
|
2598
2895
|
{
|
|
2599
|
-
screenreaderText:
|
|
2896
|
+
screenreaderText: n === 0 ? "Loading data" : void 0
|
|
2600
2897
|
}
|
|
2601
|
-
) }, `cell_${
|
|
2602
|
-
}), r = new Array(t).fill(0).map((
|
|
2603
|
-
return /* @__PURE__ */ a(
|
|
2898
|
+
) }, `cell_${n}`);
|
|
2899
|
+
}), r = new Array(t).fill(0).map((o, n) => /* @__PURE__ */ a(ce, { children: i }, `row_${n}`));
|
|
2900
|
+
return /* @__PURE__ */ a(ue, { children: r });
|
|
2604
2901
|
}
|
|
2605
|
-
const
|
|
2902
|
+
const yi = ({
|
|
2606
2903
|
ariaLabel: e,
|
|
2607
2904
|
minimumColumnWidth: t = 250,
|
|
2608
2905
|
columns: s,
|
|
2609
2906
|
data: i,
|
|
2610
2907
|
renderHeader: r,
|
|
2611
|
-
renderCell:
|
|
2612
|
-
renderActions:
|
|
2613
|
-
isColumnSortable:
|
|
2908
|
+
renderCell: o,
|
|
2909
|
+
renderActions: n,
|
|
2910
|
+
isColumnSortable: c,
|
|
2614
2911
|
isRowDeleted: l,
|
|
2615
2912
|
isRowSelected: d,
|
|
2616
2913
|
expectedLength: h = 3,
|
|
2617
2914
|
onRowClick: g,
|
|
2618
|
-
setActionCellOuiaId:
|
|
2619
|
-
setRowOuiaId:
|
|
2620
|
-
tableOuiaId:
|
|
2621
|
-
children:
|
|
2622
|
-
variant:
|
|
2915
|
+
setActionCellOuiaId: _,
|
|
2916
|
+
setRowOuiaId: S,
|
|
2917
|
+
tableOuiaId: x,
|
|
2918
|
+
children: T,
|
|
2919
|
+
variant: A
|
|
2623
2920
|
}) => {
|
|
2624
|
-
const [
|
|
2625
|
-
let
|
|
2626
|
-
const
|
|
2627
|
-
|
|
2628
|
-
|
|
2921
|
+
const [I, N] = y(1e3);
|
|
2922
|
+
let P;
|
|
2923
|
+
const L = ({ width: f }) => {
|
|
2924
|
+
P && cancelAnimationFrame(P), f && (P = requestAnimationFrame(() => {
|
|
2925
|
+
N(f);
|
|
2629
2926
|
}));
|
|
2630
|
-
}, { ref:
|
|
2631
|
-
(
|
|
2632
|
-
[s,
|
|
2633
|
-
),
|
|
2634
|
-
const
|
|
2635
|
-
({ children:
|
|
2636
|
-
|
|
2927
|
+
}, { ref: R } = Qt({ onResize: L }), w = I >= 576, E = je(
|
|
2928
|
+
(f) => w && f !== 0 && f !== s.length - 1,
|
|
2929
|
+
[s, w]
|
|
2930
|
+
), U = Fe(() => s.map((f, v) => {
|
|
2931
|
+
const q = ie(
|
|
2932
|
+
({ children: J, ...K }, Q) => /* @__PURE__ */ a(
|
|
2933
|
+
pt,
|
|
2637
2934
|
{
|
|
2638
|
-
position:
|
|
2639
|
-
tableWidth:
|
|
2935
|
+
position: v,
|
|
2936
|
+
tableWidth: I,
|
|
2640
2937
|
columnWidth: t,
|
|
2641
|
-
canHide:
|
|
2642
|
-
sort:
|
|
2643
|
-
|
|
2644
|
-
ref:
|
|
2645
|
-
children:
|
|
2938
|
+
canHide: E(v),
|
|
2939
|
+
sort: c ? c(f) : void 0,
|
|
2940
|
+
...K,
|
|
2941
|
+
ref: Q,
|
|
2942
|
+
children: J
|
|
2646
2943
|
}
|
|
2647
2944
|
)
|
|
2648
2945
|
);
|
|
2649
|
-
return
|
|
2650
|
-
Th:
|
|
2651
|
-
key: `header_${
|
|
2652
|
-
column:
|
|
2653
|
-
colIndex:
|
|
2946
|
+
return q.displayName = "ResponsiveThCurried", r({
|
|
2947
|
+
Th: q,
|
|
2948
|
+
key: `header_${f}`,
|
|
2949
|
+
column: f,
|
|
2950
|
+
colIndex: v
|
|
2654
2951
|
});
|
|
2655
2952
|
}), [
|
|
2656
|
-
|
|
2953
|
+
E,
|
|
2657
2954
|
s,
|
|
2658
|
-
|
|
2955
|
+
c,
|
|
2659
2956
|
t,
|
|
2660
2957
|
r,
|
|
2661
|
-
|
|
2662
|
-
]),
|
|
2663
|
-
(
|
|
2664
|
-
const
|
|
2665
|
-
({ children:
|
|
2666
|
-
|
|
2958
|
+
I
|
|
2959
|
+
]), b = je(
|
|
2960
|
+
(f) => {
|
|
2961
|
+
const v = ie(
|
|
2962
|
+
({ children: q, ...J }, K) => /* @__PURE__ */ a(
|
|
2963
|
+
Pe,
|
|
2667
2964
|
{
|
|
2668
|
-
position:
|
|
2669
|
-
tableWidth:
|
|
2965
|
+
position: f,
|
|
2966
|
+
tableWidth: I,
|
|
2670
2967
|
columnWidth: t,
|
|
2671
|
-
canHide:
|
|
2672
|
-
...
|
|
2673
|
-
ref:
|
|
2674
|
-
children:
|
|
2968
|
+
canHide: E(f),
|
|
2969
|
+
...J,
|
|
2970
|
+
ref: K,
|
|
2971
|
+
children: q
|
|
2675
2972
|
}
|
|
2676
2973
|
)
|
|
2677
2974
|
);
|
|
2678
|
-
return
|
|
2975
|
+
return v.displayName = "ResponsiveTdCurried", v;
|
|
2679
2976
|
},
|
|
2680
|
-
[
|
|
2681
|
-
),
|
|
2682
|
-
() => s.map((
|
|
2683
|
-
[s,
|
|
2977
|
+
[E, t, I]
|
|
2978
|
+
), z = Fe(
|
|
2979
|
+
() => s.map((f, v) => b(v)),
|
|
2980
|
+
[s, b]
|
|
2684
2981
|
);
|
|
2685
|
-
return /* @__PURE__ */
|
|
2686
|
-
|
|
2982
|
+
return /* @__PURE__ */ m(
|
|
2983
|
+
Bt,
|
|
2687
2984
|
{
|
|
2688
2985
|
"aria-label": e,
|
|
2689
2986
|
gridBreakPoint: "",
|
|
2690
|
-
ref:
|
|
2691
|
-
className:
|
|
2692
|
-
ouiaId:
|
|
2693
|
-
variant:
|
|
2987
|
+
ref: R,
|
|
2988
|
+
className: w ? "" : "pf-m-grid",
|
|
2989
|
+
ouiaId: x,
|
|
2990
|
+
variant: A,
|
|
2694
2991
|
children: [
|
|
2695
|
-
/* @__PURE__ */ a(
|
|
2696
|
-
/* @__PURE__ */
|
|
2992
|
+
/* @__PURE__ */ a(zt, { children: /* @__PURE__ */ a(ce, { children: U }) }),
|
|
2993
|
+
/* @__PURE__ */ m(Vt, { children: [
|
|
2697
2994
|
i === void 0 && /* @__PURE__ */ a(
|
|
2698
|
-
|
|
2995
|
+
Qs,
|
|
2699
2996
|
{
|
|
2700
2997
|
columns: s.length,
|
|
2701
2998
|
rows: h,
|
|
2702
|
-
getTd:
|
|
2999
|
+
getTd: b
|
|
2703
3000
|
}
|
|
2704
3001
|
),
|
|
2705
|
-
i == null ? void 0 : i.map((
|
|
2706
|
-
const
|
|
2707
|
-
Td:
|
|
2708
|
-
key: `row_${
|
|
2709
|
-
column:
|
|
2710
|
-
colIndex:
|
|
2711
|
-
rowIndex:
|
|
2712
|
-
row:
|
|
2713
|
-
})),
|
|
2714
|
-
|
|
3002
|
+
i == null ? void 0 : i.map((f, v) => {
|
|
3003
|
+
const q = l !== void 0 && l({ row: f, rowIndex: v }), J = d !== void 0 && d({ row: f, rowIndex: v }), K = !q && g ? () => g({ row: f, rowIndex: v }) : void 0, Q = s.map((X, te) => o({
|
|
3004
|
+
Td: z[te],
|
|
3005
|
+
key: `row_${v}_cell_${X}`,
|
|
3006
|
+
column: X,
|
|
3007
|
+
colIndex: te,
|
|
3008
|
+
rowIndex: v,
|
|
3009
|
+
row: f
|
|
3010
|
+
})), pe = !q && n && /* @__PURE__ */ a(
|
|
3011
|
+
Pe,
|
|
2715
3012
|
{
|
|
2716
3013
|
position: s.length,
|
|
2717
|
-
tableWidth:
|
|
3014
|
+
tableWidth: I,
|
|
2718
3015
|
columnWidth: t,
|
|
2719
3016
|
canHide: !1,
|
|
2720
3017
|
isActionCell: !0,
|
|
2721
|
-
"data-testid":
|
|
2722
|
-
children:
|
|
3018
|
+
"data-testid": _ ? _({ row: f, rowIndex: v }) : `actions-for-row-${v}`,
|
|
3019
|
+
children: n({ rowIndex: v, row: f, ActionsColumn: Gt })
|
|
2723
3020
|
}
|
|
2724
3021
|
);
|
|
2725
|
-
return /* @__PURE__ */
|
|
2726
|
-
|
|
3022
|
+
return /* @__PURE__ */ m(
|
|
3023
|
+
ft,
|
|
2727
3024
|
{
|
|
2728
|
-
isDeleted:
|
|
2729
|
-
isSelected:
|
|
2730
|
-
onClick:
|
|
2731
|
-
rowOuiaId:
|
|
3025
|
+
isDeleted: q,
|
|
3026
|
+
isSelected: J,
|
|
3027
|
+
onClick: K,
|
|
3028
|
+
rowOuiaId: S == null ? void 0 : S({ row: f, rowIndex: v }),
|
|
2732
3029
|
children: [
|
|
2733
|
-
|
|
2734
|
-
|
|
3030
|
+
Q,
|
|
3031
|
+
pe
|
|
2735
3032
|
]
|
|
2736
3033
|
},
|
|
2737
|
-
`row_${
|
|
3034
|
+
`row_${v}`
|
|
2738
3035
|
);
|
|
2739
3036
|
}),
|
|
2740
|
-
(i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ a(
|
|
3037
|
+
(i == null ? void 0 : i.length) === 0 && /* @__PURE__ */ a(ce, { children: /* @__PURE__ */ a(Ne, { colSpan: s.length, children: T }) })
|
|
2741
3038
|
] })
|
|
2742
3039
|
]
|
|
2743
3040
|
}
|
|
2744
3041
|
);
|
|
2745
|
-
},
|
|
2746
|
-
|
|
3042
|
+
}, pt = Ue(
|
|
3043
|
+
ie((e, t) => {
|
|
2747
3044
|
const {
|
|
2748
3045
|
tableWidth: s,
|
|
2749
3046
|
columnWidth: i,
|
|
2750
3047
|
position: r,
|
|
2751
|
-
canHide:
|
|
2752
|
-
className:
|
|
2753
|
-
children:
|
|
3048
|
+
canHide: o,
|
|
3049
|
+
className: n = "",
|
|
3050
|
+
children: c,
|
|
2754
3051
|
...l
|
|
2755
|
-
} = e, d =
|
|
3052
|
+
} = e, d = o && s < i * (r + 1) ? "pf-m-hidden" : "pf-m-visible";
|
|
2756
3053
|
return /* @__PURE__ */ a(
|
|
2757
|
-
|
|
3054
|
+
Kt,
|
|
2758
3055
|
{
|
|
2759
3056
|
ref: t,
|
|
2760
|
-
className: `${d} ${
|
|
3057
|
+
className: `${d} ${n}`,
|
|
2761
3058
|
...l,
|
|
2762
|
-
children:
|
|
3059
|
+
children: c
|
|
2763
3060
|
}
|
|
2764
3061
|
);
|
|
2765
3062
|
})
|
|
2766
3063
|
);
|
|
2767
|
-
|
|
2768
|
-
const
|
|
2769
|
-
|
|
3064
|
+
pt.displayName = "ResponsiveTh";
|
|
3065
|
+
const Pe = Ue(
|
|
3066
|
+
ie((e, t) => {
|
|
2770
3067
|
const {
|
|
2771
3068
|
tableWidth: s,
|
|
2772
3069
|
columnWidth: i,
|
|
2773
3070
|
position: r,
|
|
2774
|
-
canHide:
|
|
2775
|
-
className:
|
|
2776
|
-
children:
|
|
3071
|
+
canHide: o,
|
|
3072
|
+
className: n = "",
|
|
3073
|
+
children: c,
|
|
2777
3074
|
...l
|
|
2778
|
-
} = e, d =
|
|
3075
|
+
} = e, d = o && s < i * (r + 1) ? "pf-m-hidden" : "pf-m-visible";
|
|
2779
3076
|
return /* @__PURE__ */ a(
|
|
2780
|
-
|
|
3077
|
+
Ne,
|
|
2781
3078
|
{
|
|
2782
3079
|
ref: t,
|
|
2783
|
-
className: `${d} ${
|
|
3080
|
+
className: `${d} ${n}`,
|
|
2784
3081
|
...l,
|
|
2785
|
-
children:
|
|
3082
|
+
children: c
|
|
2786
3083
|
}
|
|
2787
3084
|
);
|
|
2788
3085
|
})
|
|
2789
3086
|
);
|
|
2790
|
-
|
|
2791
|
-
const
|
|
3087
|
+
Pe.displayName = "ResponsiveTd";
|
|
3088
|
+
const ft = Ue(
|
|
2792
3089
|
({ isDeleted: e, isSelected: t, onClick: s, children: i, rowOuiaId: r }) => /* @__PURE__ */ a(
|
|
2793
|
-
|
|
3090
|
+
ce,
|
|
2794
3091
|
{
|
|
2795
|
-
onRowClick: (
|
|
2796
|
-
(
|
|
3092
|
+
onRowClick: (o) => {
|
|
3093
|
+
(o == null ? void 0 : o.target) instanceof HTMLElement && (["a", "button"].includes(o.target.tagName.toLowerCase()) || s && s());
|
|
2797
3094
|
},
|
|
2798
3095
|
ouiaId: r,
|
|
2799
3096
|
isRowSelected: t,
|
|
2800
3097
|
className: e ? "mas--ResponsiveTable__Tr--deleted" : void 0,
|
|
2801
|
-
"data-testid": [t && "row-selected", e && "row-deleted"].filter((
|
|
3098
|
+
"data-testid": [t && "row-selected", e && "row-deleted"].filter((o) => !!o).join(" "),
|
|
2802
3099
|
role: "row",
|
|
2803
3100
|
children: i
|
|
2804
3101
|
}
|
|
2805
3102
|
)
|
|
2806
3103
|
);
|
|
2807
|
-
|
|
2808
|
-
const
|
|
2809
|
-
const s = (i, r,
|
|
3104
|
+
ft.displayName = "DeletableRow";
|
|
3105
|
+
const Xs = ({ label: e, onSearch: t }) => {
|
|
3106
|
+
const s = (i, r, o) => {
|
|
2810
3107
|
t(r);
|
|
2811
3108
|
};
|
|
2812
3109
|
return /* @__PURE__ */ a(
|
|
2813
|
-
|
|
3110
|
+
Nt,
|
|
2814
3111
|
{
|
|
2815
3112
|
placeholder: `Filter by ${e}`,
|
|
2816
3113
|
onSearch: s
|
|
2817
3114
|
}
|
|
2818
3115
|
);
|
|
2819
3116
|
};
|
|
2820
|
-
function
|
|
3117
|
+
function ze({
|
|
2821
3118
|
options: e,
|
|
2822
3119
|
value: t,
|
|
2823
3120
|
onChange: s,
|
|
2824
3121
|
ouiaId: i
|
|
2825
3122
|
}) {
|
|
2826
|
-
const [r,
|
|
3123
|
+
const [r, o] = y(!1);
|
|
2827
3124
|
return /* @__PURE__ */ a(
|
|
2828
|
-
|
|
3125
|
+
xe,
|
|
2829
3126
|
{
|
|
2830
|
-
toggle: (
|
|
2831
|
-
|
|
3127
|
+
toggle: (c) => /* @__PURE__ */ a(
|
|
3128
|
+
_e,
|
|
2832
3129
|
{
|
|
2833
|
-
ref:
|
|
2834
|
-
onClick: () =>
|
|
3130
|
+
ref: c,
|
|
3131
|
+
onClick: () => o((l) => !l),
|
|
2835
3132
|
isExpanded: r,
|
|
2836
3133
|
variant: "plain",
|
|
2837
|
-
children: /* @__PURE__ */ a(
|
|
3134
|
+
children: /* @__PURE__ */ a(Ye, {})
|
|
2838
3135
|
}
|
|
2839
3136
|
),
|
|
2840
3137
|
"aria-label": "table:select_filter",
|
|
2841
3138
|
selected: t,
|
|
2842
3139
|
isOpen: r,
|
|
2843
|
-
onSelect: (
|
|
2844
|
-
s(l),
|
|
3140
|
+
onSelect: (c, l) => {
|
|
3141
|
+
s(l), o(!1);
|
|
2845
3142
|
},
|
|
2846
3143
|
ouiaId: i,
|
|
2847
|
-
children: /* @__PURE__ */ a(
|
|
3144
|
+
children: /* @__PURE__ */ a(qt, { children: e.map((c, l) => /* @__PURE__ */ a(Ae, { value: c, children: c }, l)) })
|
|
2848
3145
|
}
|
|
2849
3146
|
);
|
|
2850
3147
|
}
|
|
2851
|
-
function
|
|
3148
|
+
function Ys({
|
|
2852
3149
|
label: e,
|
|
2853
3150
|
chips: t,
|
|
2854
3151
|
options: s,
|
|
2855
3152
|
onToggle: i
|
|
2856
3153
|
}) {
|
|
2857
|
-
const [r,
|
|
3154
|
+
const [r, o] = y(!1);
|
|
2858
3155
|
return /* @__PURE__ */ a(
|
|
2859
|
-
|
|
3156
|
+
xe,
|
|
2860
3157
|
{
|
|
2861
3158
|
"aria-label": e,
|
|
2862
|
-
onSelect: (
|
|
2863
|
-
i(
|
|
3159
|
+
onSelect: (n, c) => {
|
|
3160
|
+
i(c);
|
|
2864
3161
|
},
|
|
2865
3162
|
selected: t,
|
|
2866
3163
|
isOpen: r,
|
|
2867
|
-
toggle: (
|
|
2868
|
-
|
|
3164
|
+
toggle: (n) => /* @__PURE__ */ a(
|
|
3165
|
+
_e,
|
|
2869
3166
|
{
|
|
2870
|
-
ref:
|
|
2871
|
-
onClick: () =>
|
|
3167
|
+
ref: n,
|
|
3168
|
+
onClick: () => o((c) => !c),
|
|
2872
3169
|
isExpanded: r,
|
|
2873
3170
|
style: {
|
|
2874
3171
|
width: "200px"
|
|
@@ -2876,45 +3173,45 @@ function Ws({
|
|
|
2876
3173
|
children: `Filter by ${e}`
|
|
2877
3174
|
}
|
|
2878
3175
|
),
|
|
2879
|
-
children: Object.entries(s).map(([
|
|
3176
|
+
children: Object.entries(s).map(([n, c]) => /* @__PURE__ */ a(Ae, { value: n, hasCheckbox: !0, children: c }, n))
|
|
2880
3177
|
}
|
|
2881
3178
|
);
|
|
2882
3179
|
}
|
|
2883
|
-
function
|
|
2884
|
-
const s = Object.keys(e), [i, r] =
|
|
2885
|
-
switch (
|
|
3180
|
+
function bi({ filters: e, breakpoint: t = "md" }) {
|
|
3181
|
+
const s = Object.keys(e), [i, r] = y(s[0]), o = (n, c) => {
|
|
3182
|
+
switch (c.type) {
|
|
2886
3183
|
case "search":
|
|
2887
3184
|
return /* @__PURE__ */ a(
|
|
2888
|
-
|
|
3185
|
+
Xs,
|
|
2889
3186
|
{
|
|
2890
|
-
onSearch:
|
|
2891
|
-
label:
|
|
2892
|
-
validate:
|
|
2893
|
-
errorMessage:
|
|
3187
|
+
onSearch: c.onSearch,
|
|
3188
|
+
label: n,
|
|
3189
|
+
validate: c.validate,
|
|
3190
|
+
errorMessage: c.errorMessage
|
|
2894
3191
|
}
|
|
2895
3192
|
);
|
|
2896
3193
|
case "checkbox":
|
|
2897
3194
|
return /* @__PURE__ */ a(
|
|
2898
|
-
|
|
3195
|
+
Ys,
|
|
2899
3196
|
{
|
|
2900
|
-
chips:
|
|
2901
|
-
options:
|
|
2902
|
-
onToggle:
|
|
2903
|
-
label:
|
|
3197
|
+
chips: c.chips,
|
|
3198
|
+
options: c.options,
|
|
3199
|
+
onToggle: c.onToggle,
|
|
3200
|
+
label: n
|
|
2904
3201
|
}
|
|
2905
3202
|
);
|
|
2906
3203
|
}
|
|
2907
3204
|
};
|
|
2908
|
-
return /* @__PURE__ */
|
|
3205
|
+
return /* @__PURE__ */ m(ue, { children: [
|
|
2909
3206
|
/* @__PURE__ */ a(
|
|
2910
|
-
|
|
3207
|
+
Dt,
|
|
2911
3208
|
{
|
|
2912
3209
|
variant: "search-filter",
|
|
2913
3210
|
visibility: { default: "hidden", [t]: "visible" },
|
|
2914
3211
|
"data-testid": "large-viewport-toolbar",
|
|
2915
|
-
children: /* @__PURE__ */
|
|
3212
|
+
children: /* @__PURE__ */ m(Xe, { children: [
|
|
2916
3213
|
s.length > 1 && /* @__PURE__ */ a(
|
|
2917
|
-
|
|
3214
|
+
ze,
|
|
2918
3215
|
{
|
|
2919
3216
|
options: s,
|
|
2920
3217
|
value: i,
|
|
@@ -2922,19 +3219,19 @@ function gi({ filters: e, breakpoint: t = "md" }) {
|
|
|
2922
3219
|
ouiaId: "chip-filter-selector-large-viewport"
|
|
2923
3220
|
}
|
|
2924
3221
|
),
|
|
2925
|
-
|
|
3222
|
+
o(i, e[i])
|
|
2926
3223
|
] })
|
|
2927
3224
|
}
|
|
2928
3225
|
),
|
|
2929
3226
|
/* @__PURE__ */ a(
|
|
2930
|
-
|
|
3227
|
+
jt,
|
|
2931
3228
|
{
|
|
2932
|
-
toggleIcon: /* @__PURE__ */ a(
|
|
3229
|
+
toggleIcon: /* @__PURE__ */ a(Ye, {}),
|
|
2933
3230
|
breakpoint: t,
|
|
2934
3231
|
visibility: { default: "visible", [t]: "hidden" },
|
|
2935
|
-
children: /* @__PURE__ */
|
|
3232
|
+
children: /* @__PURE__ */ m(Ft, { variant: "filter-group", children: [
|
|
2936
3233
|
s.length > 1 && /* @__PURE__ */ a(
|
|
2937
|
-
|
|
3234
|
+
ze,
|
|
2938
3235
|
{
|
|
2939
3236
|
options: s,
|
|
2940
3237
|
value: i,
|
|
@@ -2942,15 +3239,15 @@ function gi({ filters: e, breakpoint: t = "md" }) {
|
|
|
2942
3239
|
ouiaId: "chip-filter-selector-small-viewport"
|
|
2943
3240
|
}
|
|
2944
3241
|
),
|
|
2945
|
-
Object.entries(e).map(([
|
|
2946
|
-
|
|
3242
|
+
Object.entries(e).map(([n, c], l) => /* @__PURE__ */ a(
|
|
3243
|
+
$t,
|
|
2947
3244
|
{
|
|
2948
|
-
chips:
|
|
2949
|
-
deleteChip: (d, h) =>
|
|
2950
|
-
deleteChipGroup:
|
|
2951
|
-
categoryName:
|
|
2952
|
-
showToolbarItem:
|
|
2953
|
-
children:
|
|
3245
|
+
chips: c.type === "checkbox" ? c.chips.map((d) => ({ key: d, node: c.options[d] })) : c.chips,
|
|
3246
|
+
deleteChip: (d, h) => c.onRemoveChip(typeof h == "string" ? h : h.key),
|
|
3247
|
+
deleteChipGroup: c.onRemoveGroup,
|
|
3248
|
+
categoryName: n,
|
|
3249
|
+
showToolbarItem: n === i,
|
|
3250
|
+
children: n === i && o(n, c)
|
|
2954
3251
|
},
|
|
2955
3252
|
l
|
|
2956
3253
|
))
|
|
@@ -2960,33 +3257,35 @@ function gi({ filters: e, breakpoint: t = "md" }) {
|
|
|
2960
3257
|
] });
|
|
2961
3258
|
}
|
|
2962
3259
|
export {
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
Xs as
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
3260
|
+
gi as AppAboutModal,
|
|
3261
|
+
pi as ApplicationAuth,
|
|
3262
|
+
Xt as AuthConfigContext,
|
|
3263
|
+
Gs as BasicAuthModal,
|
|
3264
|
+
bi as ChipFilter,
|
|
3265
|
+
wi as ChipFilterInput,
|
|
3266
|
+
Ce as DateTime,
|
|
3267
|
+
ft as DeletableRow,
|
|
3268
|
+
Ys as FilterCheckbox,
|
|
3269
|
+
mi as FilterChips,
|
|
3270
|
+
Xs as FilterSearch,
|
|
3271
|
+
ze as FilterSelector,
|
|
3272
|
+
oi as FromNow,
|
|
3273
|
+
O as If,
|
|
3274
|
+
fi as IfAuth,
|
|
3275
|
+
ai as IfNotEmpty,
|
|
3276
|
+
ge as IfNotLoading,
|
|
3277
|
+
ci as ListWithToolbar,
|
|
3278
|
+
vi as Loading,
|
|
3279
|
+
li as ObjectDropdown,
|
|
3280
|
+
zs as ObjectSelect,
|
|
3281
|
+
Si as Pagination,
|
|
3282
|
+
ui as PleaseWaitModal,
|
|
3283
|
+
_i as ProgressModal,
|
|
3284
|
+
yi as ResponsiveTable,
|
|
3285
|
+
Pe as ResponsiveTd,
|
|
3286
|
+
pt as ResponsiveTh,
|
|
3287
|
+
Qs as TableSkeleton,
|
|
3288
|
+
di as ToggleIcon,
|
|
3289
|
+
hi as UrlUpload,
|
|
3290
|
+
ut as useAuth
|
|
2992
3291
|
};
|