zudoku 0.3.0-dev.71 → 0.3.0-dev.73
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/app/main.js +6 -2
- package/dist/app/main.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +6 -2
- package/dist/lib/authentication/components/SignIn.js +6 -2
- package/dist/lib/authentication/components/SignIn.js.map +1 -1
- package/dist/lib/authentication/components/SignOut.js +4 -2
- package/dist/lib/authentication/components/SignOut.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +3 -2
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +7 -3
- package/dist/lib/authentication/providers/openid.js +31 -38
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/state.js +1 -1
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/components/DevPortal.js +3 -6
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/components/Header.js +7 -3
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/core/DevPortalContext.js +1 -0
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/lib/{AnchorLink-C_pYhuZi.js → AnchorLink-DwUyvkrL.js} +3 -3
- package/lib/{AnchorLink-C_pYhuZi.js.map → AnchorLink-DwUyvkrL.js.map} +1 -1
- package/lib/AuthenticationPlugin-BuCQtecV.js +55 -0
- package/lib/AuthenticationPlugin-BuCQtecV.js.map +1 -0
- package/lib/{CategoryHeading-D5Q-X6lE.js → CategoryHeading-8saHYD9L.js} +3 -3
- package/lib/{CategoryHeading-D5Q-X6lE.js.map → CategoryHeading-8saHYD9L.js.map} +1 -1
- package/lib/{Combination-Cq0UkOXq.js → Combination-BMJg4xHo.js} +4 -4
- package/lib/{Combination-Cq0UkOXq.js.map → Combination-BMJg4xHo.js.map} +1 -1
- package/lib/{DevPortalProvider-BBhQ8kgI.js → DevPortalProvider-DMrk4yw1.js} +2 -2
- package/lib/{DevPortalProvider-BBhQ8kgI.js.map → DevPortalProvider-DMrk4yw1.js.map} +1 -1
- package/lib/{Input-DdAxw3vC.js → Input-98JuH9ox.js} +5 -5
- package/lib/{Input-DdAxw3vC.js.map → Input-98JuH9ox.js.map} +1 -1
- package/lib/{Markdown-DsCvZnhw.js → Markdown-CSdXDuYx.js} +2914 -3825
- package/lib/Markdown-CSdXDuYx.js.map +1 -0
- package/lib/{MdxPage-B_7x36CA.js → MdxPage-7CszsIct.js} +13 -12
- package/lib/{MdxPage-B_7x36CA.js.map → MdxPage-7CszsIct.js.map} +1 -1
- package/lib/{OperationList-i6FGZUu4.js → OperationList-CzXPfUMy.js} +29 -28
- package/lib/{OperationList-i6FGZUu4.js.map → OperationList-CzXPfUMy.js.map} +1 -1
- package/lib/{Route-Bsrd0acQ.js → Route-CueiECQ0.js} +2 -2
- package/lib/{Route-Bsrd0acQ.js.map → Route-CueiECQ0.js.map} +1 -1
- package/lib/{SlotletProvider-CpNYmq6S.js → SlotletProvider-ibdqvOie.js} +22 -21
- package/lib/{SlotletProvider-CpNYmq6S.js.map → SlotletProvider-ibdqvOie.js.map} +1 -1
- package/lib/{Spinner-BBPlEab_.js → Spinner-D0EmkS4m.js} +4 -4
- package/lib/{Spinner-BBPlEab_.js.map → Spinner-D0EmkS4m.js.map} +1 -1
- package/lib/index-CjHZiWvQ.js +916 -0
- package/lib/index-CjHZiWvQ.js.map +1 -0
- package/lib/{index-DT-cf5tv.js → index-D_ZoO3pi.js} +18 -17
- package/lib/{index-DT-cf5tv.js.map → index-D_ZoO3pi.js.map} +1 -1
- package/lib/{jsx-runtime-BIr0WBt_.js → jsx-runtime-D0NHp7nI.js} +3 -3
- package/lib/{jsx-runtime-BIr0WBt_.js.map → jsx-runtime-D0NHp7nI.js.map} +1 -1
- package/lib/{state-DKdaQzvh.js → state-DsXXkBLH.js} +2 -2
- package/lib/{state-DKdaQzvh.js.map → state-DsXXkBLH.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +26 -20
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +149 -140
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +473 -467
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +17 -16
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-page.js +2 -2
- package/lib/zudoku.plugin-markdown.js +3 -3
- package/lib/zudoku.plugin-openapi.js +3 -3
- package/package.json +1 -1
- package/src/app/main.tsx +6 -8
- package/src/lib/authentication/authentication.ts +2 -2
- package/src/lib/authentication/components/SignIn.tsx +6 -2
- package/src/lib/authentication/components/SignOut.tsx +4 -2
- package/src/lib/authentication/providers/auth0.tsx +3 -2
- package/src/lib/authentication/providers/openid.tsx +43 -41
- package/src/lib/authentication/state.ts +1 -1
- package/src/lib/components/DevPortal.tsx +5 -7
- package/src/lib/components/Header.tsx +11 -3
- package/src/lib/core/DevPortalContext.ts +2 -0
- package/lib/AuthenticationPlugin-RvXALgvS.js +0 -52
- package/lib/AuthenticationPlugin-RvXALgvS.js.map +0 -1
- package/lib/Markdown-DsCvZnhw.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var Re = Object.defineProperty;
|
|
2
2
|
var Pe = (t, e, n) => e in t ? Re(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var
|
|
4
|
-
import { b as xe, j as
|
|
3
|
+
var m = (t, e, n) => Pe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { b as xe, j as E } from "./jsx-runtime-D0NHp7nI.js";
|
|
5
5
|
import { c as Ue, a as Le } from "./_commonjsHelpers-BVfed4GL.js";
|
|
6
|
-
import { A as Ce } from "./AuthenticationPlugin-
|
|
6
|
+
import { A as Ce } from "./AuthenticationPlugin-BuCQtecV.js";
|
|
7
7
|
import { useRef as je, useState as Ie, useEffect as ze } from "react";
|
|
8
|
-
import { u as
|
|
8
|
+
import { u as oe } from "./state-DsXXkBLH.js";
|
|
9
9
|
var he = { exports: {} };
|
|
10
10
|
(function(t) {
|
|
11
11
|
(function(e, n) {
|
|
@@ -34,7 +34,7 @@ var he = { exports: {} };
|
|
|
34
34
|
function f() {
|
|
35
35
|
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function y(l) {
|
|
38
38
|
return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && r ? f : console[l] !== void 0 ? u(console, l) : console.log !== void 0 ? u(console, "log") : e;
|
|
39
39
|
}
|
|
40
40
|
function b() {
|
|
@@ -51,7 +51,7 @@ var he = { exports: {} };
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
function h(l, p, c) {
|
|
54
|
-
return
|
|
54
|
+
return y(l) || _.apply(this, arguments);
|
|
55
55
|
}
|
|
56
56
|
function U(l, p) {
|
|
57
57
|
var c = this, z, $, P, v = "loglevel";
|
|
@@ -70,7 +70,7 @@ var he = { exports: {} };
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function te() {
|
|
74
74
|
var d;
|
|
75
75
|
if (!(typeof window === n || !v)) {
|
|
76
76
|
try {
|
|
@@ -79,16 +79,16 @@ var he = { exports: {} };
|
|
|
79
79
|
}
|
|
80
80
|
if (typeof d === n)
|
|
81
81
|
try {
|
|
82
|
-
var w = window.document.cookie, J = encodeURIComponent(v),
|
|
83
|
-
|
|
84
|
-
w.slice(
|
|
82
|
+
var w = window.document.cookie, J = encodeURIComponent(v), re = w.indexOf(J + "=");
|
|
83
|
+
re !== -1 && (d = /^([^;]+)/.exec(
|
|
84
|
+
w.slice(re + J.length + 1)
|
|
85
85
|
)[1]);
|
|
86
86
|
} catch {
|
|
87
87
|
}
|
|
88
88
|
return c.levels[d] === void 0 && (d = void 0), d;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Ee() {
|
|
92
92
|
if (!(typeof window === n || !v)) {
|
|
93
93
|
try {
|
|
94
94
|
window.localStorage.removeItem(v);
|
|
@@ -118,9 +118,9 @@ var he = { exports: {} };
|
|
|
118
118
|
}, c.setLevel = function(d, w) {
|
|
119
119
|
return P = L(d), w !== !1 && Te(P), b.call(c);
|
|
120
120
|
}, c.setDefaultLevel = function(d) {
|
|
121
|
-
$ = L(d),
|
|
121
|
+
$ = L(d), te() || c.setLevel(d, !1);
|
|
122
122
|
}, c.resetLevel = function() {
|
|
123
|
-
P = null,
|
|
123
|
+
P = null, Ee(), b.call(c);
|
|
124
124
|
}, c.enableAll = function(d) {
|
|
125
125
|
c.setLevel(c.levels.TRACE, d);
|
|
126
126
|
}, c.disableAll = function(d) {
|
|
@@ -132,8 +132,8 @@ var he = { exports: {} };
|
|
|
132
132
|
}, z = L(
|
|
133
133
|
i ? i.getLevel() : "WARN"
|
|
134
134
|
);
|
|
135
|
-
var
|
|
136
|
-
|
|
135
|
+
var ne = te();
|
|
136
|
+
ne != null && (P = L(ne)), b.call(c);
|
|
137
137
|
}
|
|
138
138
|
i = new U(), i.getLogger = function(p) {
|
|
139
139
|
if (typeof p != "symbol" && typeof p != "string" || p === "")
|
|
@@ -153,11 +153,11 @@ var he = { exports: {} };
|
|
|
153
153
|
});
|
|
154
154
|
})(he);
|
|
155
155
|
var Je = he.exports;
|
|
156
|
-
const
|
|
157
|
-
let
|
|
156
|
+
const ie = /* @__PURE__ */ Le(Je);
|
|
157
|
+
let B;
|
|
158
158
|
var O, de;
|
|
159
|
-
(typeof navigator > "u" || !((de = (O = navigator.userAgent) == null ? void 0 : O.startsWith) != null && de.call(O, "Mozilla/5.0 "))) && (
|
|
160
|
-
function
|
|
159
|
+
(typeof navigator > "u" || !((de = (O = navigator.userAgent) == null ? void 0 : O.startsWith) != null && de.call(O, "Mozilla/5.0 "))) && (B = "oauth4webapi/v2.11.1");
|
|
160
|
+
function V(t, e) {
|
|
161
161
|
if (t == null)
|
|
162
162
|
return !1;
|
|
163
163
|
try {
|
|
@@ -166,16 +166,16 @@ function q(t, e) {
|
|
|
166
166
|
return !1;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
const K = Symbol(), Oe = Symbol(),
|
|
170
|
-
function
|
|
169
|
+
const K = Symbol(), Oe = Symbol(), Y = Symbol(), Ne = new TextEncoder(), Ke = new TextDecoder();
|
|
170
|
+
function A(t) {
|
|
171
171
|
return typeof t == "string" ? Ne.encode(t) : Ke.decode(t);
|
|
172
172
|
}
|
|
173
|
-
const
|
|
173
|
+
const se = 32768;
|
|
174
174
|
function We(t) {
|
|
175
175
|
t instanceof ArrayBuffer && (t = new Uint8Array(t));
|
|
176
176
|
const e = [];
|
|
177
|
-
for (let n = 0; n < t.byteLength; n +=
|
|
178
|
-
e.push(String.fromCharCode.apply(null, t.subarray(n, n +
|
|
177
|
+
for (let n = 0; n < t.byteLength; n += se)
|
|
178
|
+
e.push(String.fromCharCode.apply(null, t.subarray(n, n + se)));
|
|
179
179
|
return btoa(e.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
180
180
|
}
|
|
181
181
|
function De(t) {
|
|
@@ -237,7 +237,7 @@ function we(t) {
|
|
|
237
237
|
function Fe(t) {
|
|
238
238
|
return pe(t) && t.type === "public";
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Z(t) {
|
|
241
241
|
try {
|
|
242
242
|
const e = t.headers.get("dpop-nonce");
|
|
243
243
|
e && fe.set(new URL(t.url).origin, e);
|
|
@@ -249,15 +249,15 @@ function C(t) {
|
|
|
249
249
|
return !(t === null || typeof t != "object" || Array.isArray(t));
|
|
250
250
|
}
|
|
251
251
|
function W(t) {
|
|
252
|
-
|
|
252
|
+
V(t, Headers) && (t = Object.fromEntries(t.entries()));
|
|
253
253
|
const e = new Headers(t);
|
|
254
|
-
if (
|
|
254
|
+
if (B && !e.has("user-agent") && e.set("user-agent", B), e.has("authorization"))
|
|
255
255
|
throw new TypeError('"options.headers" must not include the "authorization" header name');
|
|
256
256
|
if (e.has("dpop"))
|
|
257
257
|
throw new TypeError('"options.headers" must not include the "dpop" header name');
|
|
258
258
|
return e;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Q(t) {
|
|
261
261
|
if (typeof t == "function" && (t = t()), !(t instanceof AbortSignal))
|
|
262
262
|
throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
|
|
263
263
|
return t;
|
|
@@ -280,12 +280,12 @@ async function Me(t, e) {
|
|
|
280
280
|
throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
|
|
281
281
|
}
|
|
282
282
|
const r = W(e == null ? void 0 : e.headers);
|
|
283
|
-
return r.set("accept", "application/json"), ((e == null ? void 0 : e[
|
|
283
|
+
return r.set("accept", "application/json"), ((e == null ? void 0 : e[Y]) || fetch)(n.href, {
|
|
284
284
|
headers: Object.fromEntries(r.entries()),
|
|
285
285
|
method: "GET",
|
|
286
286
|
redirect: "manual",
|
|
287
|
-
signal: e != null && e.signal ?
|
|
288
|
-
}).then(
|
|
287
|
+
signal: e != null && e.signal ? Q(e.signal) : null
|
|
288
|
+
}).then(Z);
|
|
289
289
|
}
|
|
290
290
|
function g(t) {
|
|
291
291
|
return typeof t == "string" && t.length !== 0;
|
|
@@ -293,11 +293,11 @@ function g(t) {
|
|
|
293
293
|
async function Be(t, e) {
|
|
294
294
|
if (!(t instanceof URL))
|
|
295
295
|
throw new TypeError('"expectedIssuer" must be an instance of URL');
|
|
296
|
-
if (!
|
|
296
|
+
if (!V(e, Response))
|
|
297
297
|
throw new TypeError('"response" must be an instance of Response');
|
|
298
298
|
if (e.status !== 200)
|
|
299
299
|
throw new a('"response" is not a conform Authorization Server Metadata response');
|
|
300
|
-
|
|
300
|
+
ee(e);
|
|
301
301
|
let n;
|
|
302
302
|
try {
|
|
303
303
|
n = await e.json();
|
|
@@ -324,7 +324,7 @@ function qe() {
|
|
|
324
324
|
async function Ve(t) {
|
|
325
325
|
if (!g(t))
|
|
326
326
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
327
|
-
return T(await crypto.subtle.digest("SHA-256",
|
|
327
|
+
return T(await crypto.subtle.digest("SHA-256", A(t)));
|
|
328
328
|
}
|
|
329
329
|
function Ye(t) {
|
|
330
330
|
if (t instanceof CryptoKey)
|
|
@@ -335,11 +335,11 @@ function Ye(t) {
|
|
|
335
335
|
throw new TypeError('"kid" must be a non-empty string');
|
|
336
336
|
return { key: t.key, kid: t.kid };
|
|
337
337
|
}
|
|
338
|
-
function
|
|
338
|
+
function ae(t) {
|
|
339
339
|
return encodeURIComponent(t).replace(/%20/g, "+");
|
|
340
340
|
}
|
|
341
341
|
function Ze(t, e) {
|
|
342
|
-
const n =
|
|
342
|
+
const n = ae(t), r = ae(e);
|
|
343
343
|
return `Basic ${btoa(`${n}:${r}`)}`;
|
|
344
344
|
}
|
|
345
345
|
function Qe(t) {
|
|
@@ -401,11 +401,11 @@ function tt(t) {
|
|
|
401
401
|
const e = t == null ? void 0 : t[Oe];
|
|
402
402
|
return typeof e == "number" && Number.isFinite(e) && Math.sign(e) !== -1 ? e : 30;
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function X() {
|
|
405
405
|
return Math.floor(Date.now() / 1e3);
|
|
406
406
|
}
|
|
407
407
|
function nt(t, e) {
|
|
408
|
-
const n =
|
|
408
|
+
const n = X() + H(e);
|
|
409
409
|
return {
|
|
410
410
|
jti: D(),
|
|
411
411
|
aud: [t.issuer, t.token_endpoint],
|
|
@@ -436,7 +436,7 @@ function I(t) {
|
|
|
436
436
|
throw new TypeError('"client.client_id" property must be a non-empty string');
|
|
437
437
|
return !0;
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function ce(t) {
|
|
440
440
|
if (!g(t))
|
|
441
441
|
throw new TypeError('"client.client_secret" property must be a non-empty string');
|
|
442
442
|
return t;
|
|
@@ -445,7 +445,7 @@ function F(t, e) {
|
|
|
445
445
|
if (e !== void 0)
|
|
446
446
|
throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${t} client authentication method is used.`);
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function ue(t, e) {
|
|
449
449
|
if (e !== void 0)
|
|
450
450
|
throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
|
|
451
451
|
}
|
|
@@ -453,15 +453,15 @@ async function ot(t, e, n, r, s) {
|
|
|
453
453
|
switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), e.token_endpoint_auth_method) {
|
|
454
454
|
case void 0:
|
|
455
455
|
case "client_secret_basic": {
|
|
456
|
-
F("client_secret_basic", s), r.set("authorization", Ze(e.client_id,
|
|
456
|
+
F("client_secret_basic", s), r.set("authorization", Ze(e.client_id, ce(e.client_secret)));
|
|
457
457
|
break;
|
|
458
458
|
}
|
|
459
459
|
case "client_secret_post": {
|
|
460
|
-
F("client_secret_post", s), n.set("client_id", e.client_id), n.set("client_secret",
|
|
460
|
+
F("client_secret_post", s), n.set("client_id", e.client_id), n.set("client_secret", ce(e.client_secret));
|
|
461
461
|
break;
|
|
462
462
|
}
|
|
463
463
|
case "private_key_jwt": {
|
|
464
|
-
if (
|
|
464
|
+
if (ue("private_key_jwt", e.client_secret), s === void 0)
|
|
465
465
|
throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
|
|
466
466
|
const { key: o, kid: i } = Ye(s);
|
|
467
467
|
if (!we(o))
|
|
@@ -472,7 +472,7 @@ async function ot(t, e, n, r, s) {
|
|
|
472
472
|
case "tls_client_auth":
|
|
473
473
|
case "self_signed_tls_client_auth":
|
|
474
474
|
case "none": {
|
|
475
|
-
|
|
475
|
+
ue(e.token_endpoint_auth_method, e.client_secret), F(e.token_endpoint_auth_method, s), n.set("client_id", e.client_id);
|
|
476
476
|
break;
|
|
477
477
|
}
|
|
478
478
|
default:
|
|
@@ -482,7 +482,7 @@ async function ot(t, e, n, r, s) {
|
|
|
482
482
|
async function me(t, e, n) {
|
|
483
483
|
if (!n.usages.includes("sign"))
|
|
484
484
|
throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
|
|
485
|
-
const r = `${T(
|
|
485
|
+
const r = `${T(A(JSON.stringify(t)))}.${T(A(JSON.stringify(e)))}`, s = T(await crypto.subtle.sign(Se(n), n, A(r)));
|
|
486
486
|
return `${r}.${s}`;
|
|
487
487
|
}
|
|
488
488
|
async function it(t, e, n, r, s, o) {
|
|
@@ -495,17 +495,17 @@ async function it(t, e, n, r, s, o) {
|
|
|
495
495
|
throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
|
|
496
496
|
if (!u.extractable)
|
|
497
497
|
throw new TypeError('"DPoP.publicKey.extractable" must be true');
|
|
498
|
-
const
|
|
498
|
+
const y = X() + s, b = await me({
|
|
499
499
|
alg: ge(i),
|
|
500
500
|
typ: "dpop+jwt",
|
|
501
501
|
jwk: await at(u)
|
|
502
502
|
}, {
|
|
503
|
-
iat:
|
|
503
|
+
iat: y,
|
|
504
504
|
jti: D(),
|
|
505
505
|
htm: r,
|
|
506
506
|
nonce: f,
|
|
507
507
|
htu: `${n.origin}${n.pathname}`,
|
|
508
|
-
ath: o ? T(await crypto.subtle.digest("SHA-256",
|
|
508
|
+
ath: o ? T(await crypto.subtle.digest("SHA-256", A(o))) : void 0
|
|
509
509
|
}, i);
|
|
510
510
|
t.set("dpop", b);
|
|
511
511
|
}
|
|
@@ -525,7 +525,7 @@ function ct(t, e, n) {
|
|
|
525
525
|
function ye(t, e, n) {
|
|
526
526
|
return ct(t[e], e);
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function G(t) {
|
|
529
529
|
const e = t;
|
|
530
530
|
return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
|
|
531
531
|
}
|
|
@@ -534,13 +534,13 @@ async function ut(t, e, n, r, s, o) {
|
|
|
534
534
|
throw new TypeError('"accessToken" must be a non-empty string');
|
|
535
535
|
if (!(n instanceof URL))
|
|
536
536
|
throw new TypeError('"url" must be an instance of URL');
|
|
537
|
-
return r = W(r), (o == null ? void 0 : o.DPoP) === void 0 ? r.set("authorization", `Bearer ${t}`) : (await it(r, o.DPoP, n, "GET", H({ [K]: o == null ? void 0 : o[K] }), t), r.set("authorization", `DPoP ${t}`)), ((o == null ? void 0 : o[
|
|
537
|
+
return r = W(r), (o == null ? void 0 : o.DPoP) === void 0 ? r.set("authorization", `Bearer ${t}`) : (await it(r, o.DPoP, n, "GET", H({ [K]: o == null ? void 0 : o[K] }), t), r.set("authorization", `DPoP ${t}`)), ((o == null ? void 0 : o[Y]) || fetch)(n.href, {
|
|
538
538
|
body: s,
|
|
539
539
|
headers: Object.fromEntries(r.entries()),
|
|
540
540
|
method: e,
|
|
541
541
|
redirect: "manual",
|
|
542
|
-
signal: o != null && o.signal ?
|
|
543
|
-
}).then(
|
|
542
|
+
signal: o != null && o.signal ? Q(o.signal) : null
|
|
543
|
+
}).then(Z);
|
|
544
544
|
}
|
|
545
545
|
async function lt(t, e, n, r) {
|
|
546
546
|
j(t), I(e);
|
|
@@ -551,13 +551,13 @@ async function lt(t, e, n, r) {
|
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
553
|
async function dt(t, e, n, r, s, o, i) {
|
|
554
|
-
return await ot(t, e, s, o, i == null ? void 0 : i.clientPrivateKey), o.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[
|
|
554
|
+
return await ot(t, e, s, o, i == null ? void 0 : i.clientPrivateKey), o.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[Y]) || fetch)(r.href, {
|
|
555
555
|
body: s,
|
|
556
556
|
headers: Object.fromEntries(o.entries()),
|
|
557
557
|
method: n,
|
|
558
558
|
redirect: "manual",
|
|
559
|
-
signal: i != null && i.signal ?
|
|
560
|
-
}).then(
|
|
559
|
+
signal: i != null && i.signal ? Q(i.signal) : null
|
|
560
|
+
}).then(Z);
|
|
561
561
|
}
|
|
562
562
|
async function _e(t, e, n, r, s) {
|
|
563
563
|
const o = ye(t, "token_endpoint");
|
|
@@ -573,7 +573,7 @@ async function ht(t, e, n, r) {
|
|
|
573
573
|
}
|
|
574
574
|
const ft = /* @__PURE__ */ new WeakMap();
|
|
575
575
|
async function be(t, e, n, r = !1, s = !1) {
|
|
576
|
-
if (j(t), I(e), !
|
|
576
|
+
if (j(t), I(e), !V(n, Response))
|
|
577
577
|
throw new TypeError('"response" must be an instance of Response');
|
|
578
578
|
if (n.status !== 200) {
|
|
579
579
|
let i;
|
|
@@ -581,7 +581,7 @@ async function be(t, e, n, r = !1, s = !1) {
|
|
|
581
581
|
return i;
|
|
582
582
|
throw new a('"response" is not a conform Token Endpoint response');
|
|
583
583
|
}
|
|
584
|
-
|
|
584
|
+
ee(n);
|
|
585
585
|
let o;
|
|
586
586
|
try {
|
|
587
587
|
o = await n.json();
|
|
@@ -606,7 +606,7 @@ async function be(t, e, n, r = !1, s = !1) {
|
|
|
606
606
|
if (o.id_token !== void 0 && !g(o.id_token))
|
|
607
607
|
throw new a('"response" body "id_token" property must be a non-empty string');
|
|
608
608
|
if (o.id_token) {
|
|
609
|
-
const { claims: i } = await Tt(o.id_token,
|
|
609
|
+
const { claims: i } = await Tt(o.id_token, Et.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), ke, H(e), tt(e)).then(bt.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(gt.bind(void 0, t.issuer)).then(wt.bind(void 0, e.client_id));
|
|
610
610
|
if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== e.client_id)
|
|
611
611
|
throw new a('unexpected ID Token "azp" (authorized party) claim value');
|
|
612
612
|
if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
|
|
@@ -673,7 +673,7 @@ function bt(t, e) {
|
|
|
673
673
|
}
|
|
674
674
|
async function vt(t, e, n) {
|
|
675
675
|
const r = await be(t, e, n, !0);
|
|
676
|
-
if (
|
|
676
|
+
if (G(r))
|
|
677
677
|
return r;
|
|
678
678
|
if (r.id_token !== void 0) {
|
|
679
679
|
if (typeof r.id_token == "string" && r.id_token.length)
|
|
@@ -682,13 +682,13 @@ async function vt(t, e, n) {
|
|
|
682
682
|
}
|
|
683
683
|
return r;
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function ee(t) {
|
|
686
686
|
if (t.bodyUsed)
|
|
687
687
|
throw new TypeError('"response" body has been used already');
|
|
688
688
|
}
|
|
689
689
|
async function St(t) {
|
|
690
690
|
if (t.status > 399 && t.status < 500) {
|
|
691
|
-
|
|
691
|
+
ee(t);
|
|
692
692
|
try {
|
|
693
693
|
const e = await t.json();
|
|
694
694
|
if (C(e) && typeof e.error == "string" && e.error.length)
|
|
@@ -697,7 +697,7 @@ async function St(t) {
|
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function le(t) {
|
|
701
701
|
if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
|
|
702
702
|
throw new a(`${t.name} modulusLength must be at least 2048 bits`);
|
|
703
703
|
}
|
|
@@ -721,7 +721,7 @@ function Se(t) {
|
|
|
721
721
|
hash: kt(t.algorithm.namedCurve)
|
|
722
722
|
};
|
|
723
723
|
case "RSA-PSS":
|
|
724
|
-
switch (
|
|
724
|
+
switch (le(t.algorithm), t.algorithm.hash.name) {
|
|
725
725
|
case "SHA-256":
|
|
726
726
|
case "SHA-384":
|
|
727
727
|
case "SHA-512":
|
|
@@ -733,7 +733,7 @@ function Se(t) {
|
|
|
733
733
|
throw new S();
|
|
734
734
|
}
|
|
735
735
|
case "RSASSA-PKCS1-v1_5":
|
|
736
|
-
return
|
|
736
|
+
return le(t.algorithm), t.algorithm.name;
|
|
737
737
|
case "Ed448":
|
|
738
738
|
case "Ed25519":
|
|
739
739
|
return t.algorithm.name;
|
|
@@ -747,33 +747,33 @@ async function Tt(t, e, n, r, s) {
|
|
|
747
747
|
throw new S("JWE structure JWTs are not supported");
|
|
748
748
|
if (f !== 3)
|
|
749
749
|
throw new a("Invalid JWT");
|
|
750
|
-
let
|
|
750
|
+
let y;
|
|
751
751
|
try {
|
|
752
|
-
|
|
752
|
+
y = JSON.parse(A(T(o)));
|
|
753
753
|
} catch (R) {
|
|
754
754
|
throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: R });
|
|
755
755
|
}
|
|
756
|
-
if (!C(
|
|
756
|
+
if (!C(y))
|
|
757
757
|
throw new a("JWT Header must be a top level object");
|
|
758
|
-
if (e(
|
|
758
|
+
if (e(y), y.crit !== void 0)
|
|
759
759
|
throw new a('unexpected JWT "crit" header parameter');
|
|
760
760
|
const b = T(u);
|
|
761
761
|
let _;
|
|
762
762
|
if (n !== ke) {
|
|
763
|
-
_ = await n(
|
|
763
|
+
_ = await n(y);
|
|
764
764
|
const R = `${o}.${i}`;
|
|
765
|
-
if (!await crypto.subtle.verify(Se(_), _, b,
|
|
765
|
+
if (!await crypto.subtle.verify(Se(_), _, b, A(R)))
|
|
766
766
|
throw new a("JWT signature verification failed");
|
|
767
767
|
}
|
|
768
768
|
let h;
|
|
769
769
|
try {
|
|
770
|
-
h = JSON.parse(
|
|
770
|
+
h = JSON.parse(A(T(i)));
|
|
771
771
|
} catch (R) {
|
|
772
772
|
throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: R });
|
|
773
773
|
}
|
|
774
774
|
if (!C(h))
|
|
775
775
|
throw new a("JWT Payload must be a top level object");
|
|
776
|
-
const U =
|
|
776
|
+
const U = X() + r;
|
|
777
777
|
if (h.exp !== void 0) {
|
|
778
778
|
if (typeof h.exp != "number")
|
|
779
779
|
throw new a('unexpected JWT "exp" (expiration time) claim type');
|
|
@@ -792,9 +792,9 @@ async function Tt(t, e, n, r, s) {
|
|
|
792
792
|
}
|
|
793
793
|
if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
|
|
794
794
|
throw new a('unexpected JWT "aud" (audience) claim type');
|
|
795
|
-
return { header:
|
|
795
|
+
return { header: y, claims: h, signature: b, key: _ };
|
|
796
796
|
}
|
|
797
|
-
function
|
|
797
|
+
function Et(t, e, n) {
|
|
798
798
|
if (t !== void 0) {
|
|
799
799
|
if (n.alg !== t)
|
|
800
800
|
throw new a('unexpected JWT "alg" header parameter');
|
|
@@ -814,7 +814,7 @@ function k(t, e) {
|
|
|
814
814
|
throw new a(`"${e}" parameter must be provided only once`);
|
|
815
815
|
return n;
|
|
816
816
|
}
|
|
817
|
-
const
|
|
817
|
+
const At = Symbol(), Rt = Symbol();
|
|
818
818
|
function Pt(t, e, n, r) {
|
|
819
819
|
if (j(t), I(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
|
|
820
820
|
throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
|
|
@@ -831,7 +831,7 @@ function Pt(t, e, n, r) {
|
|
|
831
831
|
if (o !== void 0)
|
|
832
832
|
throw new a('unexpected "state" response parameter encountered');
|
|
833
833
|
break;
|
|
834
|
-
case
|
|
834
|
+
case At:
|
|
835
835
|
break;
|
|
836
836
|
default:
|
|
837
837
|
if (!g(r))
|
|
@@ -855,7 +855,7 @@ function Pt(t, e, n, r) {
|
|
|
855
855
|
}
|
|
856
856
|
class x extends Error {
|
|
857
857
|
}
|
|
858
|
-
class
|
|
858
|
+
class q extends x {
|
|
859
859
|
constructor(e, n, r) {
|
|
860
860
|
super(e, r), this.error = n;
|
|
861
861
|
}
|
|
@@ -870,22 +870,22 @@ function xt({
|
|
|
870
870
|
}).catch((o) => {
|
|
871
871
|
r(o);
|
|
872
872
|
}));
|
|
873
|
-
}, []), n ? n instanceof
|
|
874
|
-
/* @__PURE__ */
|
|
875
|
-
/* @__PURE__ */
|
|
873
|
+
}, []), n ? n instanceof q ? /* @__PURE__ */ E.jsxs("div", { children: [
|
|
874
|
+
/* @__PURE__ */ E.jsx("h2", { children: "Error" }),
|
|
875
|
+
/* @__PURE__ */ E.jsxs("pre", { children: [
|
|
876
876
|
n.error.error,
|
|
877
877
|
n.error.error_description,
|
|
878
878
|
n.error.error_uri
|
|
879
879
|
] })
|
|
880
|
-
] }) : /* @__PURE__ */
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
/* @__PURE__ */
|
|
880
|
+
] }) : /* @__PURE__ */ E.jsxs("div", { children: [
|
|
881
|
+
/* @__PURE__ */ E.jsx("h2", { children: "Error" }),
|
|
882
|
+
/* @__PURE__ */ E.jsxs("pre", { children: [
|
|
883
883
|
n.message,
|
|
884
884
|
n.stack
|
|
885
885
|
] })
|
|
886
|
-
] }) : /* @__PURE__ */
|
|
886
|
+
] }) : /* @__PURE__ */ E.jsx("div", { children: "Loading..." });
|
|
887
887
|
}
|
|
888
|
-
const
|
|
888
|
+
const M = "code-verifier";
|
|
889
889
|
class Ut extends Ce {
|
|
890
890
|
constructor(e, n, r) {
|
|
891
891
|
super(), this.callbackUrlPath = e, this.handleCallback = n, this.initialize = r;
|
|
@@ -895,7 +895,7 @@ class Ut extends Ce {
|
|
|
895
895
|
...super.getRoutes(),
|
|
896
896
|
{
|
|
897
897
|
path: this.callbackUrlPath,
|
|
898
|
-
element: /* @__PURE__ */
|
|
898
|
+
element: /* @__PURE__ */ E.jsx(xt, { handleCallback: this.handleCallback })
|
|
899
899
|
}
|
|
900
900
|
];
|
|
901
901
|
}
|
|
@@ -911,21 +911,37 @@ class Lt {
|
|
|
911
911
|
redirectToAfterSignIn: u,
|
|
912
912
|
redirectToAfterSignOut: f
|
|
913
913
|
}) {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
914
|
+
m(this, "client");
|
|
915
|
+
m(this, "issuer");
|
|
916
|
+
m(this, "authorizationEndpoint");
|
|
917
|
+
m(this, "tokenEndpoint");
|
|
918
|
+
m(this, "authorizationServer");
|
|
919
|
+
m(this, "tokens");
|
|
920
|
+
m(this, "callbackUrlPath", "/oauth/callback");
|
|
921
|
+
m(this, "logoutRedirectUrlPath", "/");
|
|
922
|
+
m(this, "redirectToAfterSignUp");
|
|
923
|
+
m(this, "redirectToAfterSignIn");
|
|
924
|
+
m(this, "redirectToAfterSignOut");
|
|
925
|
+
m(this, "audience");
|
|
926
|
+
m(this, "signOut", async () => {
|
|
927
|
+
oe.setState({
|
|
928
|
+
isAuthenticated: !1,
|
|
929
|
+
isPending: !1,
|
|
930
|
+
profile: void 0
|
|
931
|
+
}), localStorage.removeItem("auto-login");
|
|
932
|
+
const e = await this.getAuthServer(), n = new URL(
|
|
933
|
+
window.location.origin + this.redirectToAfterSignOut
|
|
934
|
+
);
|
|
935
|
+
n.pathname = this.logoutRedirectUrlPath;
|
|
936
|
+
let r;
|
|
937
|
+
e.end_session_endpoint ? (r = new URL(e.end_session_endpoint), r.searchParams.set(
|
|
938
|
+
"post_logout_redirect_uri",
|
|
939
|
+
n.toString()
|
|
940
|
+
)) : r = n;
|
|
941
|
+
});
|
|
942
|
+
m(this, "handleCallback", async () => {
|
|
943
|
+
const e = new URL(window.location.href), n = e.searchParams.get("state"), r = sessionStorage.getItem(M);
|
|
944
|
+
if (sessionStorage.removeItem(M), !r)
|
|
929
945
|
throw new x(
|
|
930
946
|
"Code verifier not found. Invalid auth state."
|
|
931
947
|
);
|
|
@@ -935,13 +951,13 @@ class Lt {
|
|
|
935
951
|
e.searchParams,
|
|
936
952
|
n ?? void 0
|
|
937
953
|
);
|
|
938
|
-
if (
|
|
939
|
-
throw
|
|
954
|
+
if (G(o))
|
|
955
|
+
throw ie.error("Error validating OAuth response", o), new q(
|
|
940
956
|
"Error validating OAuth response",
|
|
941
957
|
o
|
|
942
958
|
);
|
|
943
959
|
const i = new URL(e);
|
|
944
|
-
i.pathname = this.redirectToAfterSignIn
|
|
960
|
+
i.pathname = this.redirectToAfterSignIn, i.search = "";
|
|
945
961
|
const u = await yt(
|
|
946
962
|
s,
|
|
947
963
|
this.client,
|
|
@@ -954,10 +970,10 @@ class Lt {
|
|
|
954
970
|
u
|
|
955
971
|
);
|
|
956
972
|
this.setTokensFromResponse(f);
|
|
957
|
-
const
|
|
973
|
+
const y = await this.getAccessToken(), _ = await (await lt(
|
|
958
974
|
s,
|
|
959
975
|
this.client,
|
|
960
|
-
|
|
976
|
+
y
|
|
961
977
|
)).json(), h = {
|
|
962
978
|
sub: _.sub,
|
|
963
979
|
email: _.email,
|
|
@@ -965,11 +981,11 @@ class Lt {
|
|
|
965
981
|
emailVerified: _.email_verified ?? !1,
|
|
966
982
|
pictureUrl: _.picture
|
|
967
983
|
};
|
|
968
|
-
return
|
|
984
|
+
return oe.setState({
|
|
969
985
|
isAuthenticated: !0,
|
|
970
986
|
isPending: !1,
|
|
971
987
|
profile: h
|
|
972
|
-
}), localStorage.
|
|
988
|
+
}), localStorage.setItem("auto-login", "1"), sessionStorage.getItem("redirect-to") ?? "/";
|
|
973
989
|
});
|
|
974
990
|
this.client = {
|
|
975
991
|
client_id: o,
|
|
@@ -999,8 +1015,8 @@ class Lt {
|
|
|
999
1015
|
* @param response
|
|
1000
1016
|
*/
|
|
1001
1017
|
setTokensFromResponse(e) {
|
|
1002
|
-
if (
|
|
1003
|
-
throw
|
|
1018
|
+
if (G(e))
|
|
1019
|
+
throw ie.error("Bad Token Response", e), new q("Bad Token Response", e);
|
|
1004
1020
|
if (!e.expires_in)
|
|
1005
1021
|
throw new x("No expires_in in response");
|
|
1006
1022
|
this.tokens = {
|
|
@@ -1008,32 +1024,38 @@ class Lt {
|
|
|
1008
1024
|
refreshToken: e.refresh_token,
|
|
1009
1025
|
expiresOn: new Date(Date.now() + e.expires_in * 1e3),
|
|
1010
1026
|
tokenType: e.token_type
|
|
1011
|
-
},
|
|
1027
|
+
}, sessionStorage.setItem("openid-token", JSON.stringify(this.tokens));
|
|
1012
1028
|
}
|
|
1013
|
-
async signUp() {
|
|
1014
|
-
return this.authorize(
|
|
1029
|
+
async signUp({ redirectTo: e } = {}) {
|
|
1030
|
+
return this.authorize({
|
|
1031
|
+
redirectTo: e ?? this.redirectToAfterSignUp
|
|
1032
|
+
});
|
|
1015
1033
|
}
|
|
1016
|
-
async signIn() {
|
|
1017
|
-
return this.authorize(
|
|
1034
|
+
async signIn({ redirectTo: e } = {}) {
|
|
1035
|
+
return this.authorize({
|
|
1036
|
+
redirectTo: e ?? this.redirectToAfterSignIn
|
|
1037
|
+
});
|
|
1018
1038
|
}
|
|
1019
|
-
async authorize(
|
|
1039
|
+
async authorize({
|
|
1040
|
+
redirectTo: e
|
|
1041
|
+
}) {
|
|
1020
1042
|
var f;
|
|
1021
1043
|
const n = "S256", r = await this.getAuthServer();
|
|
1022
|
-
if (
|
|
1044
|
+
if (!r.authorization_endpoint)
|
|
1023
1045
|
throw new x("No authorization endpoint");
|
|
1024
1046
|
const s = Ge(), o = await Ve(s);
|
|
1025
|
-
|
|
1047
|
+
sessionStorage.setItem(M, s);
|
|
1026
1048
|
const i = new URL(
|
|
1027
|
-
|
|
1028
|
-
), u = new URL(
|
|
1029
|
-
(e ? window.location.origin + this.redirectToAfterSignUp : window.location.origin + this.redirectToAfterSignIn) ?? window.location.href
|
|
1049
|
+
r.authorization_endpoint
|
|
1030
1050
|
);
|
|
1051
|
+
sessionStorage.setItem("redirect-to", e);
|
|
1052
|
+
const u = new URL(window.location.origin);
|
|
1031
1053
|
if (u.pathname = this.callbackUrlPath, u.search = "", i.searchParams.set("client_id", this.client.client_id), i.searchParams.set("redirect_uri", u.toString()), i.searchParams.set("response_type", "code"), i.searchParams.set("scope", "openid+profile+email"), i.searchParams.set("code_challenge", o), i.searchParams.set(
|
|
1032
1054
|
"code_challenge_method",
|
|
1033
1055
|
n
|
|
1034
1056
|
), this.audience && i.searchParams.set("audience", this.audience), ((f = r.code_challenge_methods_supported) == null ? void 0 : f.includes("S256")) !== !0) {
|
|
1035
|
-
const
|
|
1036
|
-
i.searchParams.set("state",
|
|
1057
|
+
const y = qe();
|
|
1058
|
+
i.searchParams.set("state", y);
|
|
1037
1059
|
}
|
|
1038
1060
|
location.href = i.href;
|
|
1039
1061
|
}
|
|
@@ -1059,26 +1081,13 @@ class Lt {
|
|
|
1059
1081
|
}
|
|
1060
1082
|
return this.tokens.accessToken;
|
|
1061
1083
|
}
|
|
1062
|
-
async signOut() {
|
|
1063
|
-
re.setState({
|
|
1064
|
-
isAuthenticated: !1,
|
|
1065
|
-
isPending: !1,
|
|
1066
|
-
profile: void 0
|
|
1067
|
-
});
|
|
1068
|
-
const e = await this.getAuthServer(), n = new URL(
|
|
1069
|
-
window.location.origin + this.redirectToAfterSignOut
|
|
1070
|
-
);
|
|
1071
|
-
n.pathname = this.logoutRedirectUrlPath;
|
|
1072
|
-
let r;
|
|
1073
|
-
e.end_session_endpoint ? (r = new URL(e.end_session_endpoint), r.searchParams.set(
|
|
1074
|
-
"post_logout_redirect_uri",
|
|
1075
|
-
n.toString()
|
|
1076
|
-
)) : r = n;
|
|
1077
|
-
}
|
|
1078
1084
|
getAuthenticationPlugin() {
|
|
1079
1085
|
return new Ut(
|
|
1080
1086
|
this.callbackUrlPath,
|
|
1081
|
-
() => this.handleCallback()
|
|
1087
|
+
async () => this.handleCallback(),
|
|
1088
|
+
async () => {
|
|
1089
|
+
typeof localStorage < "u" && localStorage.getItem("auto-login") && (localStorage.removeItem("auto-login"), await this.authorize({ redirectTo: window.location.pathname }));
|
|
1090
|
+
}
|
|
1082
1091
|
);
|
|
1083
1092
|
}
|
|
1084
1093
|
}
|