zudoku 0.3.0-dev.74 → 0.3.0-dev.76
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/lib/authentication/components/SignUp.js +1 -1
- package/dist/lib/authentication/components/SignUp.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +4 -4
- package/dist/lib/authentication/providers/openid.js +12 -11
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/components/DevPortal.js +18 -2
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +4 -1
- package/dist/lib/core/DevPortalContext.js +4 -7
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +4 -2
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +1 -1
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
- package/lib/{AnchorLink-DwUyvkrL.js → AnchorLink-BZcpTwOs.js} +3 -3
- package/lib/{AnchorLink-DwUyvkrL.js.map → AnchorLink-BZcpTwOs.js.map} +1 -1
- package/lib/{AuthenticationPlugin-BuCQtecV.js → AuthenticationPlugin-CngUn5DP.js} +9 -9
- package/lib/AuthenticationPlugin-CngUn5DP.js.map +1 -0
- package/lib/{CategoryHeading-8saHYD9L.js → CategoryHeading-D0V23fMT.js} +3 -3
- package/lib/{CategoryHeading-8saHYD9L.js.map → CategoryHeading-D0V23fMT.js.map} +1 -1
- package/lib/{Combination-BMJg4xHo.js → Combination-CgxP9BB4.js} +4 -4
- package/lib/{Combination-BMJg4xHo.js.map → Combination-CgxP9BB4.js.map} +1 -1
- package/lib/{DevPortalProvider-DMrk4yw1.js → DevPortalProvider-BTFqdAEL.js} +2 -2
- package/lib/{DevPortalProvider-DMrk4yw1.js.map → DevPortalProvider-BTFqdAEL.js.map} +1 -1
- package/lib/{Input-98JuH9ox.js → Input-BcZoDid4.js} +5 -5
- package/lib/{Input-98JuH9ox.js.map → Input-BcZoDid4.js.map} +1 -1
- package/lib/{Markdown-CSdXDuYx.js → Markdown-IsabnbGN.js} +3 -3
- package/lib/{Markdown-CSdXDuYx.js.map → Markdown-IsabnbGN.js.map} +1 -1
- package/lib/{MdxPage-7CszsIct.js → MdxPage-B1B2Inj5.js} +7 -7
- package/lib/{MdxPage-7CszsIct.js.map → MdxPage-B1B2Inj5.js.map} +1 -1
- package/lib/{OperationList-DbFAs7j0.js → OperationList-B2nsuf1v.js} +10 -10
- package/lib/{OperationList-DbFAs7j0.js.map → OperationList-B2nsuf1v.js.map} +1 -1
- package/lib/{Route-CueiECQ0.js → Route-D0Ub80Oa.js} +2 -2
- package/lib/{Route-CueiECQ0.js.map → Route-D0Ub80Oa.js.map} +1 -1
- package/lib/{SlotletProvider-ibdqvOie.js → SlotletProvider-CJXWb2gw.js} +7 -7
- package/lib/{SlotletProvider-ibdqvOie.js.map → SlotletProvider-CJXWb2gw.js.map} +1 -1
- package/lib/{Spinner-D0EmkS4m.js → Spinner-BhtSoFka.js} +4 -4
- package/lib/{Spinner-D0EmkS4m.js.map → Spinner-BhtSoFka.js.map} +1 -1
- package/lib/{index-C5qcuxqm.js → index-BC2Ob2BR.js} +7 -7
- package/lib/{index-C5qcuxqm.js.map → index-BC2Ob2BR.js.map} +1 -1
- package/lib/{index-CjHZiWvQ.js → index-Dt-pU7Vu.js} +2 -2
- package/lib/{index-CjHZiWvQ.js.map → index-Dt-pU7Vu.js.map} +1 -1
- package/lib/{jsx-runtime-D0NHp7nI.js → jsx-runtime-CJBdjYYx.js} +3 -3
- package/lib/{jsx-runtime-D0NHp7nI.js.map → jsx-runtime-CJBdjYYx.js.map} +1 -1
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +261 -287
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +501 -493
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +19 -18
- 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/lib/authentication/components/SignUp.tsx +1 -1
- package/src/lib/authentication/providers/openid.tsx +13 -15
- package/src/lib/components/DevPortal.tsx +19 -1
- package/src/lib/core/DevPortalContext.ts +9 -6
- package/src/lib/core/plugins.ts +5 -2
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +2 -0
- package/dist/lib/authentication/Callback.d.ts +0 -3
- package/dist/lib/authentication/Callback.js +0 -34
- package/dist/lib/authentication/Callback.js.map +0 -1
- package/lib/AuthenticationPlugin-BuCQtecV.js.map +0 -1
- package/src/lib/authentication/Callback.tsx +0 -60
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (t, e, n) =>
|
|
4
|
-
import {
|
|
5
|
-
import { c as Ue, a as
|
|
6
|
-
import { A as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
var he = { exports: {} };
|
|
1
|
+
var Ee = Object.defineProperty;
|
|
2
|
+
var Re = (t, e, n) => e in t ? Ee(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var m = (t, e, n) => Re(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { j as Pe } from "./jsx-runtime-CJBdjYYx.js";
|
|
5
|
+
import { c as Ue, a as xe } from "./_commonjsHelpers-BVfed4GL.js";
|
|
6
|
+
import { A as Le } from "./AuthenticationPlugin-CngUn5DP.js";
|
|
7
|
+
import { u as ne } from "./state-DsXXkBLH.js";
|
|
8
|
+
var de = { exports: {} };
|
|
10
9
|
(function(t) {
|
|
11
10
|
(function(e, n) {
|
|
12
11
|
t.exports ? t.exports = n() : e.log = n();
|
|
@@ -53,8 +52,8 @@ var he = { exports: {} };
|
|
|
53
52
|
function h(l, p, c) {
|
|
54
53
|
return y(l) || _.apply(this, arguments);
|
|
55
54
|
}
|
|
56
|
-
function
|
|
57
|
-
var c = this,
|
|
55
|
+
function P(l, p) {
|
|
56
|
+
var c = this, I, H, R, v = "loglevel";
|
|
58
57
|
typeof l == "string" ? v += ":" + l : typeof l == "symbol" && (v = void 0);
|
|
59
58
|
function Te(d) {
|
|
60
59
|
var w = (s[d] || "silent").toUpperCase();
|
|
@@ -70,7 +69,7 @@ var he = { exports: {} };
|
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
|
-
function
|
|
72
|
+
function X() {
|
|
74
73
|
var d;
|
|
75
74
|
if (!(typeof window === n || !v)) {
|
|
76
75
|
try {
|
|
@@ -79,16 +78,16 @@ var he = { exports: {} };
|
|
|
79
78
|
}
|
|
80
79
|
if (typeof d === n)
|
|
81
80
|
try {
|
|
82
|
-
var w = window.document.cookie,
|
|
83
|
-
|
|
84
|
-
w.slice(
|
|
81
|
+
var w = window.document.cookie, j = encodeURIComponent(v), te = w.indexOf(j + "=");
|
|
82
|
+
te !== -1 && (d = /^([^;]+)/.exec(
|
|
83
|
+
w.slice(te + j.length + 1)
|
|
85
84
|
)[1]);
|
|
86
85
|
} catch {
|
|
87
86
|
}
|
|
88
87
|
return c.levels[d] === void 0 && (d = void 0), d;
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
function
|
|
90
|
+
function ke() {
|
|
92
91
|
if (!(typeof window === n || !v)) {
|
|
93
92
|
try {
|
|
94
93
|
window.localStorage.removeItem(v);
|
|
@@ -100,7 +99,7 @@ var he = { exports: {} };
|
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
}
|
|
103
|
-
function
|
|
102
|
+
function U(d) {
|
|
104
103
|
var w = d;
|
|
105
104
|
if (typeof w == "string" && c.levels[w.toUpperCase()] !== void 0 && (w = c.levels[w.toUpperCase()]), typeof w == "number" && w >= 0 && w <= c.levels.SILENT)
|
|
106
105
|
return w;
|
|
@@ -114,50 +113,50 @@ var he = { exports: {} };
|
|
|
114
113
|
ERROR: 4,
|
|
115
114
|
SILENT: 5
|
|
116
115
|
}, c.methodFactory = p || h, c.getLevel = function() {
|
|
117
|
-
return
|
|
116
|
+
return R ?? H ?? I;
|
|
118
117
|
}, c.setLevel = function(d, w) {
|
|
119
|
-
return
|
|
118
|
+
return R = U(d), w !== !1 && Te(R), b.call(c);
|
|
120
119
|
}, c.setDefaultLevel = function(d) {
|
|
121
|
-
|
|
120
|
+
H = U(d), X() || c.setLevel(d, !1);
|
|
122
121
|
}, c.resetLevel = function() {
|
|
123
|
-
|
|
122
|
+
R = null, ke(), b.call(c);
|
|
124
123
|
}, c.enableAll = function(d) {
|
|
125
124
|
c.setLevel(c.levels.TRACE, d);
|
|
126
125
|
}, c.disableAll = function(d) {
|
|
127
126
|
c.setLevel(c.levels.SILENT, d);
|
|
128
127
|
}, c.rebuild = function() {
|
|
129
|
-
if (i !== c && (
|
|
128
|
+
if (i !== c && (I = U(i.getLevel())), b.call(c), i === c)
|
|
130
129
|
for (var d in o)
|
|
131
130
|
o[d].rebuild();
|
|
132
|
-
},
|
|
131
|
+
}, I = U(
|
|
133
132
|
i ? i.getLevel() : "WARN"
|
|
134
133
|
);
|
|
135
|
-
var
|
|
136
|
-
|
|
134
|
+
var ee = X();
|
|
135
|
+
ee != null && (R = U(ee)), b.call(c);
|
|
137
136
|
}
|
|
138
|
-
i = new
|
|
137
|
+
i = new P(), i.getLogger = function(p) {
|
|
139
138
|
if (typeof p != "symbol" && typeof p != "string" || p === "")
|
|
140
139
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
141
140
|
var c = o[p];
|
|
142
|
-
return c || (c = o[p] = new
|
|
141
|
+
return c || (c = o[p] = new P(
|
|
143
142
|
p,
|
|
144
143
|
i.methodFactory
|
|
145
144
|
)), c;
|
|
146
145
|
};
|
|
147
|
-
var
|
|
146
|
+
var E = typeof window !== n ? window.log : void 0;
|
|
148
147
|
return i.noConflict = function() {
|
|
149
|
-
return typeof window !== n && window.log === i && (window.log =
|
|
148
|
+
return typeof window !== n && window.log === i && (window.log = E), i;
|
|
150
149
|
}, i.getLoggers = function() {
|
|
151
150
|
return o;
|
|
152
151
|
}, i.default = i, i;
|
|
153
152
|
});
|
|
154
|
-
})(
|
|
155
|
-
var
|
|
156
|
-
const
|
|
157
|
-
let
|
|
158
|
-
var
|
|
159
|
-
(typeof navigator > "u" || !((
|
|
160
|
-
function
|
|
153
|
+
})(de);
|
|
154
|
+
var Ce = de.exports;
|
|
155
|
+
const re = /* @__PURE__ */ xe(Ce);
|
|
156
|
+
let M;
|
|
157
|
+
var z, le;
|
|
158
|
+
(typeof navigator > "u" || !((le = (z = navigator.userAgent) == null ? void 0 : z.startsWith) != null && le.call(z, "Mozilla/5.0 "))) && (M = "oauth4webapi/v2.11.1");
|
|
159
|
+
function G(t, e) {
|
|
161
160
|
if (t == null)
|
|
162
161
|
return !1;
|
|
163
162
|
try {
|
|
@@ -166,19 +165,19 @@ function V(t, e) {
|
|
|
166
165
|
return !1;
|
|
167
166
|
}
|
|
168
167
|
}
|
|
169
|
-
const
|
|
168
|
+
const N = Symbol(), Ie = Symbol(), q = Symbol(), je = new TextEncoder(), ze = new TextDecoder();
|
|
170
169
|
function A(t) {
|
|
171
|
-
return typeof t == "string" ?
|
|
170
|
+
return typeof t == "string" ? je.encode(t) : ze.decode(t);
|
|
172
171
|
}
|
|
173
|
-
const
|
|
174
|
-
function
|
|
172
|
+
const oe = 32768;
|
|
173
|
+
function Je(t) {
|
|
175
174
|
t instanceof ArrayBuffer && (t = new Uint8Array(t));
|
|
176
175
|
const e = [];
|
|
177
|
-
for (let n = 0; n < t.byteLength; n +=
|
|
178
|
-
e.push(String.fromCharCode.apply(null, t.subarray(n, n +
|
|
176
|
+
for (let n = 0; n < t.byteLength; n += oe)
|
|
177
|
+
e.push(String.fromCharCode.apply(null, t.subarray(n, n + oe)));
|
|
179
178
|
return btoa(e.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
180
179
|
}
|
|
181
|
-
function
|
|
180
|
+
function Oe(t) {
|
|
182
181
|
try {
|
|
183
182
|
const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(e.length);
|
|
184
183
|
for (let r = 0; r < e.length; r++)
|
|
@@ -188,10 +187,10 @@ function De(t) {
|
|
|
188
187
|
throw new a("The input to be decoded is not correctly encoded.", { cause: e });
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
|
-
function
|
|
192
|
-
return typeof t == "string" ?
|
|
190
|
+
function k(t) {
|
|
191
|
+
return typeof t == "string" ? Oe(t) : Je(t);
|
|
193
192
|
}
|
|
194
|
-
class
|
|
193
|
+
class Ne {
|
|
195
194
|
constructor(e) {
|
|
196
195
|
this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = e;
|
|
197
196
|
}
|
|
@@ -221,48 +220,48 @@ class S extends Error {
|
|
|
221
220
|
super(e ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
|
|
222
221
|
}
|
|
223
222
|
}
|
|
224
|
-
class
|
|
223
|
+
class Ke extends Error {
|
|
225
224
|
constructor(e, n) {
|
|
226
225
|
var r;
|
|
227
226
|
super(e, n), this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
|
|
228
227
|
}
|
|
229
228
|
}
|
|
230
|
-
const a =
|
|
231
|
-
function
|
|
229
|
+
const a = Ke, he = new Ne(100);
|
|
230
|
+
function fe(t) {
|
|
232
231
|
return t instanceof CryptoKey;
|
|
233
232
|
}
|
|
234
|
-
function
|
|
235
|
-
return
|
|
233
|
+
function pe(t) {
|
|
234
|
+
return fe(t) && t.type === "private";
|
|
236
235
|
}
|
|
237
|
-
function
|
|
238
|
-
return
|
|
236
|
+
function We(t) {
|
|
237
|
+
return fe(t) && t.type === "public";
|
|
239
238
|
}
|
|
240
|
-
function
|
|
239
|
+
function V(t) {
|
|
241
240
|
try {
|
|
242
241
|
const e = t.headers.get("dpop-nonce");
|
|
243
|
-
e &&
|
|
242
|
+
e && he.set(new URL(t.url).origin, e);
|
|
244
243
|
} catch {
|
|
245
244
|
}
|
|
246
245
|
return t;
|
|
247
246
|
}
|
|
248
|
-
function
|
|
247
|
+
function x(t) {
|
|
249
248
|
return !(t === null || typeof t != "object" || Array.isArray(t));
|
|
250
249
|
}
|
|
251
|
-
function
|
|
252
|
-
|
|
250
|
+
function K(t) {
|
|
251
|
+
G(t, Headers) && (t = Object.fromEntries(t.entries()));
|
|
253
252
|
const e = new Headers(t);
|
|
254
|
-
if (
|
|
253
|
+
if (M && !e.has("user-agent") && e.set("user-agent", M), e.has("authorization"))
|
|
255
254
|
throw new TypeError('"options.headers" must not include the "authorization" header name');
|
|
256
255
|
if (e.has("dpop"))
|
|
257
256
|
throw new TypeError('"options.headers" must not include the "dpop" header name');
|
|
258
257
|
return e;
|
|
259
258
|
}
|
|
260
|
-
function
|
|
259
|
+
function Y(t) {
|
|
261
260
|
if (typeof t == "function" && (t = t()), !(t instanceof AbortSignal))
|
|
262
261
|
throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
|
|
263
262
|
return t;
|
|
264
263
|
}
|
|
265
|
-
async function
|
|
264
|
+
async function De(t, e) {
|
|
266
265
|
if (!(t instanceof URL))
|
|
267
266
|
throw new TypeError('"issuerIdentifier" must be an instance of URL');
|
|
268
267
|
if (t.protocol !== "https:" && t.protocol !== "http:")
|
|
@@ -279,32 +278,32 @@ async function Me(t, e) {
|
|
|
279
278
|
default:
|
|
280
279
|
throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
|
|
281
280
|
}
|
|
282
|
-
const r =
|
|
283
|
-
return r.set("accept", "application/json"), ((e == null ? void 0 : e[
|
|
281
|
+
const r = K(e == null ? void 0 : e.headers);
|
|
282
|
+
return r.set("accept", "application/json"), ((e == null ? void 0 : e[q]) || fetch)(n.href, {
|
|
284
283
|
headers: Object.fromEntries(r.entries()),
|
|
285
284
|
method: "GET",
|
|
286
285
|
redirect: "manual",
|
|
287
|
-
signal: e != null && e.signal ?
|
|
288
|
-
}).then(
|
|
286
|
+
signal: e != null && e.signal ? Y(e.signal) : null
|
|
287
|
+
}).then(V);
|
|
289
288
|
}
|
|
290
289
|
function g(t) {
|
|
291
290
|
return typeof t == "string" && t.length !== 0;
|
|
292
291
|
}
|
|
293
|
-
async function
|
|
292
|
+
async function He(t, e) {
|
|
294
293
|
if (!(t instanceof URL))
|
|
295
294
|
throw new TypeError('"expectedIssuer" must be an instance of URL');
|
|
296
|
-
if (!
|
|
295
|
+
if (!G(e, Response))
|
|
297
296
|
throw new TypeError('"response" must be an instance of Response');
|
|
298
297
|
if (e.status !== 200)
|
|
299
298
|
throw new a('"response" is not a conform Authorization Server Metadata response');
|
|
300
|
-
|
|
299
|
+
Q(e);
|
|
301
300
|
let n;
|
|
302
301
|
try {
|
|
303
302
|
n = await e.json();
|
|
304
303
|
} catch (r) {
|
|
305
304
|
throw new a('failed to parse "response" body as JSON', { cause: r });
|
|
306
305
|
}
|
|
307
|
-
if (!
|
|
306
|
+
if (!x(n))
|
|
308
307
|
throw new a('"response" body must be a top level object');
|
|
309
308
|
if (!g(n.issuer))
|
|
310
309
|
throw new a('"response" body "issuer" property must be a non-empty string');
|
|
@@ -312,21 +311,21 @@ async function Be(t, e) {
|
|
|
312
311
|
throw new a('"response" body "issuer" does not match "expectedIssuer"');
|
|
313
312
|
return n;
|
|
314
313
|
}
|
|
315
|
-
function
|
|
316
|
-
return
|
|
314
|
+
function W() {
|
|
315
|
+
return k(crypto.getRandomValues(new Uint8Array(32)));
|
|
317
316
|
}
|
|
318
|
-
function
|
|
319
|
-
return
|
|
317
|
+
function $e() {
|
|
318
|
+
return W();
|
|
320
319
|
}
|
|
321
|
-
function
|
|
322
|
-
return
|
|
320
|
+
function Fe() {
|
|
321
|
+
return W();
|
|
323
322
|
}
|
|
324
|
-
async function
|
|
323
|
+
async function Me(t) {
|
|
325
324
|
if (!g(t))
|
|
326
325
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
327
|
-
return
|
|
326
|
+
return k(await crypto.subtle.digest("SHA-256", A(t)));
|
|
328
327
|
}
|
|
329
|
-
function
|
|
328
|
+
function Be(t) {
|
|
330
329
|
if (t instanceof CryptoKey)
|
|
331
330
|
return { key: t };
|
|
332
331
|
if (!((t == null ? void 0 : t.key) instanceof CryptoKey))
|
|
@@ -335,14 +334,14 @@ function Ye(t) {
|
|
|
335
334
|
throw new TypeError('"kid" must be a non-empty string');
|
|
336
335
|
return { key: t.key, kid: t.kid };
|
|
337
336
|
}
|
|
338
|
-
function
|
|
337
|
+
function ie(t) {
|
|
339
338
|
return encodeURIComponent(t).replace(/%20/g, "+");
|
|
340
339
|
}
|
|
341
|
-
function
|
|
342
|
-
const n =
|
|
340
|
+
function Ge(t, e) {
|
|
341
|
+
const n = ie(t), r = ie(e);
|
|
343
342
|
return `Basic ${btoa(`${n}:${r}`)}`;
|
|
344
343
|
}
|
|
345
|
-
function
|
|
344
|
+
function qe(t) {
|
|
346
345
|
switch (t.algorithm.hash.name) {
|
|
347
346
|
case "SHA-256":
|
|
348
347
|
return "PS256";
|
|
@@ -354,7 +353,7 @@ function Qe(t) {
|
|
|
354
353
|
throw new S("unsupported RsaHashedKeyAlgorithm hash name");
|
|
355
354
|
}
|
|
356
355
|
}
|
|
357
|
-
function
|
|
356
|
+
function Ve(t) {
|
|
358
357
|
switch (t.algorithm.hash.name) {
|
|
359
358
|
case "SHA-256":
|
|
360
359
|
return "RS256";
|
|
@@ -366,7 +365,7 @@ function Xe(t) {
|
|
|
366
365
|
throw new S("unsupported RsaHashedKeyAlgorithm hash name");
|
|
367
366
|
}
|
|
368
367
|
}
|
|
369
|
-
function
|
|
368
|
+
function Ye(t) {
|
|
370
369
|
switch (t.algorithm.namedCurve) {
|
|
371
370
|
case "P-256":
|
|
372
371
|
return "ES256";
|
|
@@ -378,14 +377,14 @@ function et(t) {
|
|
|
378
377
|
throw new S("unsupported EcKeyAlgorithm namedCurve");
|
|
379
378
|
}
|
|
380
379
|
}
|
|
381
|
-
function
|
|
380
|
+
function we(t) {
|
|
382
381
|
switch (t.algorithm.name) {
|
|
383
382
|
case "RSA-PSS":
|
|
384
|
-
return
|
|
383
|
+
return qe(t);
|
|
385
384
|
case "RSASSA-PKCS1-v1_5":
|
|
386
|
-
return
|
|
385
|
+
return Ve(t);
|
|
387
386
|
case "ECDSA":
|
|
388
|
-
return
|
|
387
|
+
return Ye(t);
|
|
389
388
|
case "Ed25519":
|
|
390
389
|
case "Ed448":
|
|
391
390
|
return "EdDSA";
|
|
@@ -393,21 +392,21 @@ function ge(t) {
|
|
|
393
392
|
throw new S("unsupported CryptoKey algorithm name");
|
|
394
393
|
}
|
|
395
394
|
}
|
|
396
|
-
function
|
|
397
|
-
const e = t == null ? void 0 : t[
|
|
395
|
+
function D(t) {
|
|
396
|
+
const e = t == null ? void 0 : t[N];
|
|
398
397
|
return typeof e == "number" && Number.isFinite(e) ? e : 0;
|
|
399
398
|
}
|
|
400
|
-
function
|
|
401
|
-
const e = t == null ? void 0 : t[
|
|
399
|
+
function Ze(t) {
|
|
400
|
+
const e = t == null ? void 0 : t[Ie];
|
|
402
401
|
return typeof e == "number" && Number.isFinite(e) && Math.sign(e) !== -1 ? e : 30;
|
|
403
402
|
}
|
|
404
|
-
function
|
|
403
|
+
function Z() {
|
|
405
404
|
return Math.floor(Date.now() / 1e3);
|
|
406
405
|
}
|
|
407
|
-
function
|
|
408
|
-
const n =
|
|
406
|
+
function Qe(t, e) {
|
|
407
|
+
const n = Z() + D(e);
|
|
409
408
|
return {
|
|
410
|
-
jti:
|
|
409
|
+
jti: W(),
|
|
411
410
|
aud: [t.issuer, t.token_endpoint],
|
|
412
411
|
exp: n + 60,
|
|
413
412
|
iat: n,
|
|
@@ -416,179 +415,179 @@ function nt(t, e) {
|
|
|
416
415
|
sub: e.client_id
|
|
417
416
|
};
|
|
418
417
|
}
|
|
419
|
-
async function
|
|
420
|
-
return
|
|
421
|
-
alg:
|
|
418
|
+
async function Xe(t, e, n, r) {
|
|
419
|
+
return ge({
|
|
420
|
+
alg: we(n),
|
|
422
421
|
kid: r
|
|
423
|
-
},
|
|
422
|
+
}, Qe(t, e), n);
|
|
424
423
|
}
|
|
425
|
-
function
|
|
424
|
+
function L(t) {
|
|
426
425
|
if (typeof t != "object" || t === null)
|
|
427
426
|
throw new TypeError('"as" must be an object');
|
|
428
427
|
if (!g(t.issuer))
|
|
429
428
|
throw new TypeError('"as.issuer" property must be a non-empty string');
|
|
430
429
|
return !0;
|
|
431
430
|
}
|
|
432
|
-
function
|
|
431
|
+
function C(t) {
|
|
433
432
|
if (typeof t != "object" || t === null)
|
|
434
433
|
throw new TypeError('"client" must be an object');
|
|
435
434
|
if (!g(t.client_id))
|
|
436
435
|
throw new TypeError('"client.client_id" property must be a non-empty string');
|
|
437
436
|
return !0;
|
|
438
437
|
}
|
|
439
|
-
function
|
|
438
|
+
function se(t) {
|
|
440
439
|
if (!g(t))
|
|
441
440
|
throw new TypeError('"client.client_secret" property must be a non-empty string');
|
|
442
441
|
return t;
|
|
443
442
|
}
|
|
444
|
-
function
|
|
443
|
+
function $(t, e) {
|
|
445
444
|
if (e !== void 0)
|
|
446
445
|
throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${t} client authentication method is used.`);
|
|
447
446
|
}
|
|
448
|
-
function
|
|
447
|
+
function ae(t, e) {
|
|
449
448
|
if (e !== void 0)
|
|
450
449
|
throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
|
|
451
450
|
}
|
|
452
|
-
async function
|
|
451
|
+
async function et(t, e, n, r, s) {
|
|
453
452
|
switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), e.token_endpoint_auth_method) {
|
|
454
453
|
case void 0:
|
|
455
454
|
case "client_secret_basic": {
|
|
456
|
-
|
|
455
|
+
$("client_secret_basic", s), r.set("authorization", Ge(e.client_id, se(e.client_secret)));
|
|
457
456
|
break;
|
|
458
457
|
}
|
|
459
458
|
case "client_secret_post": {
|
|
460
|
-
|
|
459
|
+
$("client_secret_post", s), n.set("client_id", e.client_id), n.set("client_secret", se(e.client_secret));
|
|
461
460
|
break;
|
|
462
461
|
}
|
|
463
462
|
case "private_key_jwt": {
|
|
464
|
-
if (
|
|
463
|
+
if (ae("private_key_jwt", e.client_secret), s === void 0)
|
|
465
464
|
throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
|
|
466
|
-
const { key: o, kid: i } =
|
|
467
|
-
if (!
|
|
465
|
+
const { key: o, kid: i } = Be(s);
|
|
466
|
+
if (!pe(o))
|
|
468
467
|
throw new TypeError('"options.clientPrivateKey.key" must be a private CryptoKey');
|
|
469
|
-
n.set("client_id", e.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await
|
|
468
|
+
n.set("client_id", e.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await Xe(t, e, o, i));
|
|
470
469
|
break;
|
|
471
470
|
}
|
|
472
471
|
case "tls_client_auth":
|
|
473
472
|
case "self_signed_tls_client_auth":
|
|
474
473
|
case "none": {
|
|
475
|
-
|
|
474
|
+
ae(e.token_endpoint_auth_method, e.client_secret), $(e.token_endpoint_auth_method, s), n.set("client_id", e.client_id);
|
|
476
475
|
break;
|
|
477
476
|
}
|
|
478
477
|
default:
|
|
479
478
|
throw new S("unsupported client token_endpoint_auth_method");
|
|
480
479
|
}
|
|
481
480
|
}
|
|
482
|
-
async function
|
|
481
|
+
async function ge(t, e, n) {
|
|
483
482
|
if (!n.usages.includes("sign"))
|
|
484
483
|
throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
|
|
485
|
-
const r = `${
|
|
484
|
+
const r = `${k(A(JSON.stringify(t)))}.${k(A(JSON.stringify(e)))}`, s = k(await crypto.subtle.sign(ve(n), n, A(r)));
|
|
486
485
|
return `${r}.${s}`;
|
|
487
486
|
}
|
|
488
|
-
async function
|
|
489
|
-
const { privateKey: i, publicKey: u, nonce: f =
|
|
490
|
-
if (!
|
|
487
|
+
async function tt(t, e, n, r, s, o) {
|
|
488
|
+
const { privateKey: i, publicKey: u, nonce: f = he.get(n.origin) } = e;
|
|
489
|
+
if (!pe(i))
|
|
491
490
|
throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
|
|
492
|
-
if (!
|
|
491
|
+
if (!We(u))
|
|
493
492
|
throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
|
|
494
493
|
if (f !== void 0 && !g(f))
|
|
495
494
|
throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
|
|
496
495
|
if (!u.extractable)
|
|
497
496
|
throw new TypeError('"DPoP.publicKey.extractable" must be true');
|
|
498
|
-
const y =
|
|
499
|
-
alg:
|
|
497
|
+
const y = Z() + s, b = await ge({
|
|
498
|
+
alg: we(i),
|
|
500
499
|
typ: "dpop+jwt",
|
|
501
|
-
jwk: await
|
|
500
|
+
jwk: await rt(u)
|
|
502
501
|
}, {
|
|
503
502
|
iat: y,
|
|
504
|
-
jti:
|
|
503
|
+
jti: W(),
|
|
505
504
|
htm: r,
|
|
506
505
|
nonce: f,
|
|
507
506
|
htu: `${n.origin}${n.pathname}`,
|
|
508
|
-
ath: o ?
|
|
507
|
+
ath: o ? k(await crypto.subtle.digest("SHA-256", A(o))) : void 0
|
|
509
508
|
}, i);
|
|
510
509
|
t.set("dpop", b);
|
|
511
510
|
}
|
|
512
|
-
let
|
|
513
|
-
async function
|
|
511
|
+
let J;
|
|
512
|
+
async function nt(t) {
|
|
514
513
|
const { kty: e, e: n, n: r, x: s, y: o, crv: i } = await crypto.subtle.exportKey("jwk", t), u = { kty: e, e: n, n: r, x: s, y: o, crv: i };
|
|
515
|
-
return
|
|
514
|
+
return J.set(t, u), u;
|
|
516
515
|
}
|
|
517
|
-
async function
|
|
518
|
-
return
|
|
516
|
+
async function rt(t) {
|
|
517
|
+
return J || (J = /* @__PURE__ */ new WeakMap()), J.get(t) || nt(t);
|
|
519
518
|
}
|
|
520
|
-
function
|
|
519
|
+
function ot(t, e, n) {
|
|
521
520
|
if (typeof t != "string")
|
|
522
521
|
throw new TypeError(`"as.${e}" must be a string`);
|
|
523
522
|
return new URL(t);
|
|
524
523
|
}
|
|
525
|
-
function
|
|
526
|
-
return
|
|
524
|
+
function me(t, e, n) {
|
|
525
|
+
return ot(t[e], e);
|
|
527
526
|
}
|
|
528
|
-
function
|
|
527
|
+
function B(t) {
|
|
529
528
|
const e = t;
|
|
530
529
|
return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
|
|
531
530
|
}
|
|
532
|
-
async function
|
|
531
|
+
async function it(t, e, n, r, s, o) {
|
|
533
532
|
if (!g(t))
|
|
534
533
|
throw new TypeError('"accessToken" must be a non-empty string');
|
|
535
534
|
if (!(n instanceof URL))
|
|
536
535
|
throw new TypeError('"url" must be an instance of URL');
|
|
537
|
-
return r =
|
|
536
|
+
return r = K(r), (o == null ? void 0 : o.DPoP) === void 0 ? r.set("authorization", `Bearer ${t}`) : (await tt(r, o.DPoP, n, "GET", D({ [N]: o == null ? void 0 : o[N] }), t), r.set("authorization", `DPoP ${t}`)), ((o == null ? void 0 : o[q]) || fetch)(n.href, {
|
|
538
537
|
body: s,
|
|
539
538
|
headers: Object.fromEntries(r.entries()),
|
|
540
539
|
method: e,
|
|
541
540
|
redirect: "manual",
|
|
542
|
-
signal: o != null && o.signal ?
|
|
543
|
-
}).then(
|
|
541
|
+
signal: o != null && o.signal ? Y(o.signal) : null
|
|
542
|
+
}).then(V);
|
|
544
543
|
}
|
|
545
|
-
async function
|
|
546
|
-
|
|
547
|
-
const s =
|
|
548
|
-
return e.userinfo_signed_response_alg ? o.set("accept", "application/jwt") : (o.set("accept", "application/json"), o.append("accept", "application/jwt")),
|
|
544
|
+
async function st(t, e, n, r) {
|
|
545
|
+
L(t), C(e);
|
|
546
|
+
const s = me(t, "userinfo_endpoint"), o = K(r == null ? void 0 : r.headers);
|
|
547
|
+
return e.userinfo_signed_response_alg ? o.set("accept", "application/jwt") : (o.set("accept", "application/json"), o.append("accept", "application/jwt")), it(n, "GET", s, o, null, {
|
|
549
548
|
...r,
|
|
550
|
-
[
|
|
549
|
+
[N]: D(e)
|
|
551
550
|
});
|
|
552
551
|
}
|
|
553
|
-
async function
|
|
554
|
-
return await
|
|
552
|
+
async function at(t, e, n, r, s, o, i) {
|
|
553
|
+
return await et(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[q]) || fetch)(r.href, {
|
|
555
554
|
body: s,
|
|
556
555
|
headers: Object.fromEntries(o.entries()),
|
|
557
556
|
method: n,
|
|
558
557
|
redirect: "manual",
|
|
559
|
-
signal: i != null && i.signal ?
|
|
560
|
-
}).then(
|
|
558
|
+
signal: i != null && i.signal ? Y(i.signal) : null
|
|
559
|
+
}).then(V);
|
|
561
560
|
}
|
|
562
|
-
async function
|
|
563
|
-
const o =
|
|
561
|
+
async function ye(t, e, n, r, s) {
|
|
562
|
+
const o = me(t, "token_endpoint");
|
|
564
563
|
r.set("grant_type", n);
|
|
565
|
-
const i =
|
|
566
|
-
return i.set("accept", "application/json"),
|
|
564
|
+
const i = K(s == null ? void 0 : s.headers);
|
|
565
|
+
return i.set("accept", "application/json"), at(t, e, "POST", o, r, i, s);
|
|
567
566
|
}
|
|
568
|
-
async function
|
|
569
|
-
if (
|
|
567
|
+
async function ct(t, e, n, r) {
|
|
568
|
+
if (L(t), C(e), !g(n))
|
|
570
569
|
throw new TypeError('"refreshToken" must be a non-empty string');
|
|
571
570
|
const s = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
|
|
572
|
-
return s.set("refresh_token", n),
|
|
571
|
+
return s.set("refresh_token", n), ye(t, e, "refresh_token", s, r);
|
|
573
572
|
}
|
|
574
|
-
const
|
|
575
|
-
async function
|
|
576
|
-
if (
|
|
573
|
+
const ut = /* @__PURE__ */ new WeakMap();
|
|
574
|
+
async function _e(t, e, n, r = !1, s = !1) {
|
|
575
|
+
if (L(t), C(e), !G(n, Response))
|
|
577
576
|
throw new TypeError('"response" must be an instance of Response');
|
|
578
577
|
if (n.status !== 200) {
|
|
579
578
|
let i;
|
|
580
|
-
if (i = await
|
|
579
|
+
if (i = await yt(n))
|
|
581
580
|
return i;
|
|
582
581
|
throw new a('"response" is not a conform Token Endpoint response');
|
|
583
582
|
}
|
|
584
|
-
|
|
583
|
+
Q(n);
|
|
585
584
|
let o;
|
|
586
585
|
try {
|
|
587
586
|
o = await n.json();
|
|
588
587
|
} catch (i) {
|
|
589
588
|
throw new a('failed to parse "response" body as JSON', { cause: i });
|
|
590
589
|
}
|
|
591
|
-
if (!
|
|
590
|
+
if (!x(o))
|
|
592
591
|
throw new a('"response" body must be a top level object');
|
|
593
592
|
if (!g(o.access_token))
|
|
594
593
|
throw new a('"response" body "access_token" property must be a non-empty string');
|
|
@@ -606,20 +605,20 @@ async function be(t, e, n, r = !1, s = !1) {
|
|
|
606
605
|
if (o.id_token !== void 0 && !g(o.id_token))
|
|
607
606
|
throw new a('"response" body "id_token" property must be a non-empty string');
|
|
608
607
|
if (o.id_token) {
|
|
609
|
-
const { claims: i } = await
|
|
608
|
+
const { claims: i } = await bt(o.id_token, vt.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Se, D(e), Ze(e)).then(gt.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(ht.bind(void 0, t.issuer)).then(dt.bind(void 0, e.client_id));
|
|
610
609
|
if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== e.client_id)
|
|
611
610
|
throw new a('unexpected ID Token "azp" (authorized party) claim value');
|
|
612
611
|
if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
|
|
613
612
|
throw new a('ID Token "auth_time" (authentication time) must be a positive number');
|
|
614
|
-
|
|
613
|
+
ut.set(o, i);
|
|
615
614
|
}
|
|
616
615
|
}
|
|
617
616
|
return o;
|
|
618
617
|
}
|
|
619
|
-
async function
|
|
620
|
-
return
|
|
618
|
+
async function lt(t, e, n) {
|
|
619
|
+
return _e(t, e, n);
|
|
621
620
|
}
|
|
622
|
-
function
|
|
621
|
+
function dt(t, e) {
|
|
623
622
|
if (Array.isArray(e.claims.aud)) {
|
|
624
623
|
if (!e.claims.aud.includes(t))
|
|
625
624
|
throw new a('unexpected JWT "aud" (audience) claim value');
|
|
@@ -627,29 +626,29 @@ function wt(t, e) {
|
|
|
627
626
|
throw new a('unexpected JWT "aud" (audience) claim value');
|
|
628
627
|
return e;
|
|
629
628
|
}
|
|
630
|
-
function
|
|
629
|
+
function ht(t, e) {
|
|
631
630
|
if (e.claims.iss !== t)
|
|
632
631
|
throw new a('unexpected JWT "iss" (issuer) claim value');
|
|
633
632
|
return e;
|
|
634
633
|
}
|
|
635
|
-
const
|
|
636
|
-
function
|
|
637
|
-
return
|
|
634
|
+
const be = /* @__PURE__ */ new WeakSet();
|
|
635
|
+
function ft(t) {
|
|
636
|
+
return be.add(t), t;
|
|
638
637
|
}
|
|
639
|
-
async function
|
|
640
|
-
if (
|
|
638
|
+
async function pt(t, e, n, r, s, o) {
|
|
639
|
+
if (L(t), C(e), !be.has(n))
|
|
641
640
|
throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
|
|
642
641
|
if (!g(r))
|
|
643
642
|
throw new TypeError('"redirectUri" must be a non-empty string');
|
|
644
643
|
if (!g(s))
|
|
645
644
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
646
|
-
const i =
|
|
645
|
+
const i = T(n, "code");
|
|
647
646
|
if (!i)
|
|
648
647
|
throw new a('no authorization code in "callbackParameters"');
|
|
649
648
|
const u = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
|
|
650
|
-
return u.set("redirect_uri", r), u.set("code_verifier", s), u.set("code", i),
|
|
649
|
+
return u.set("redirect_uri", r), u.set("code_verifier", s), u.set("code", i), ye(t, e, "authorization_code", u, o);
|
|
651
650
|
}
|
|
652
|
-
const
|
|
651
|
+
const wt = {
|
|
653
652
|
aud: "audience",
|
|
654
653
|
c_hash: "code hash",
|
|
655
654
|
client_id: "client id",
|
|
@@ -665,15 +664,15 @@ const _t = {
|
|
|
665
664
|
htu: "http uri",
|
|
666
665
|
cnf: "confirmation"
|
|
667
666
|
};
|
|
668
|
-
function
|
|
667
|
+
function gt(t, e) {
|
|
669
668
|
for (const n of t)
|
|
670
669
|
if (e.claims[n] === void 0)
|
|
671
|
-
throw new a(`JWT "${n}" (${
|
|
670
|
+
throw new a(`JWT "${n}" (${wt[n]}) claim missing`);
|
|
672
671
|
return e;
|
|
673
672
|
}
|
|
674
|
-
async function
|
|
675
|
-
const r = await
|
|
676
|
-
if (
|
|
673
|
+
async function mt(t, e, n) {
|
|
674
|
+
const r = await _e(t, e, n, !0);
|
|
675
|
+
if (B(r))
|
|
677
676
|
return r;
|
|
678
677
|
if (r.id_token !== void 0) {
|
|
679
678
|
if (typeof r.id_token == "string" && r.id_token.length)
|
|
@@ -682,26 +681,26 @@ async function vt(t, e, n) {
|
|
|
682
681
|
}
|
|
683
682
|
return r;
|
|
684
683
|
}
|
|
685
|
-
function
|
|
684
|
+
function Q(t) {
|
|
686
685
|
if (t.bodyUsed)
|
|
687
686
|
throw new TypeError('"response" body has been used already');
|
|
688
687
|
}
|
|
689
|
-
async function
|
|
688
|
+
async function yt(t) {
|
|
690
689
|
if (t.status > 399 && t.status < 500) {
|
|
691
|
-
|
|
690
|
+
Q(t);
|
|
692
691
|
try {
|
|
693
692
|
const e = await t.json();
|
|
694
|
-
if (
|
|
693
|
+
if (x(e) && typeof e.error == "string" && e.error.length)
|
|
695
694
|
return e.error_description !== void 0 && typeof e.error_description != "string" && delete e.error_description, e.error_uri !== void 0 && typeof e.error_uri != "string" && delete e.error_uri, e.algs !== void 0 && typeof e.algs != "string" && delete e.algs, e.scope !== void 0 && typeof e.scope != "string" && delete e.scope, e;
|
|
696
695
|
} catch {
|
|
697
696
|
}
|
|
698
697
|
}
|
|
699
698
|
}
|
|
700
|
-
function
|
|
699
|
+
function ce(t) {
|
|
701
700
|
if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
|
|
702
701
|
throw new a(`${t.name} modulusLength must be at least 2048 bits`);
|
|
703
702
|
}
|
|
704
|
-
function
|
|
703
|
+
function _t(t) {
|
|
705
704
|
switch (t) {
|
|
706
705
|
case "P-256":
|
|
707
706
|
return "SHA-256";
|
|
@@ -713,15 +712,15 @@ function kt(t) {
|
|
|
713
712
|
throw new S();
|
|
714
713
|
}
|
|
715
714
|
}
|
|
716
|
-
function
|
|
715
|
+
function ve(t) {
|
|
717
716
|
switch (t.algorithm.name) {
|
|
718
717
|
case "ECDSA":
|
|
719
718
|
return {
|
|
720
719
|
name: t.algorithm.name,
|
|
721
|
-
hash:
|
|
720
|
+
hash: _t(t.algorithm.namedCurve)
|
|
722
721
|
};
|
|
723
722
|
case "RSA-PSS":
|
|
724
|
-
switch (
|
|
723
|
+
switch (ce(t.algorithm), t.algorithm.hash.name) {
|
|
725
724
|
case "SHA-256":
|
|
726
725
|
case "SHA-384":
|
|
727
726
|
case "SHA-512":
|
|
@@ -733,15 +732,15 @@ function Se(t) {
|
|
|
733
732
|
throw new S();
|
|
734
733
|
}
|
|
735
734
|
case "RSASSA-PKCS1-v1_5":
|
|
736
|
-
return
|
|
735
|
+
return ce(t.algorithm), t.algorithm.name;
|
|
737
736
|
case "Ed448":
|
|
738
737
|
case "Ed25519":
|
|
739
738
|
return t.algorithm.name;
|
|
740
739
|
}
|
|
741
740
|
throw new S();
|
|
742
741
|
}
|
|
743
|
-
const
|
|
744
|
-
async function
|
|
742
|
+
const Se = Symbol();
|
|
743
|
+
async function bt(t, e, n, r, s) {
|
|
745
744
|
const { 0: o, 1: i, 2: u, length: f } = t.split(".");
|
|
746
745
|
if (f === 5)
|
|
747
746
|
throw new S("JWE structure JWTs are not supported");
|
|
@@ -749,35 +748,35 @@ async function Tt(t, e, n, r, s) {
|
|
|
749
748
|
throw new a("Invalid JWT");
|
|
750
749
|
let y;
|
|
751
750
|
try {
|
|
752
|
-
y = JSON.parse(A(
|
|
753
|
-
} catch (
|
|
754
|
-
throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause:
|
|
751
|
+
y = JSON.parse(A(k(o)));
|
|
752
|
+
} catch (E) {
|
|
753
|
+
throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: E });
|
|
755
754
|
}
|
|
756
|
-
if (!
|
|
755
|
+
if (!x(y))
|
|
757
756
|
throw new a("JWT Header must be a top level object");
|
|
758
757
|
if (e(y), y.crit !== void 0)
|
|
759
758
|
throw new a('unexpected JWT "crit" header parameter');
|
|
760
|
-
const b =
|
|
759
|
+
const b = k(u);
|
|
761
760
|
let _;
|
|
762
|
-
if (n !==
|
|
761
|
+
if (n !== Se) {
|
|
763
762
|
_ = await n(y);
|
|
764
|
-
const
|
|
765
|
-
if (!await crypto.subtle.verify(
|
|
763
|
+
const E = `${o}.${i}`;
|
|
764
|
+
if (!await crypto.subtle.verify(ve(_), _, b, A(E)))
|
|
766
765
|
throw new a("JWT signature verification failed");
|
|
767
766
|
}
|
|
768
767
|
let h;
|
|
769
768
|
try {
|
|
770
|
-
h = JSON.parse(A(
|
|
771
|
-
} catch (
|
|
772
|
-
throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause:
|
|
769
|
+
h = JSON.parse(A(k(i)));
|
|
770
|
+
} catch (E) {
|
|
771
|
+
throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: E });
|
|
773
772
|
}
|
|
774
|
-
if (!
|
|
773
|
+
if (!x(h))
|
|
775
774
|
throw new a("JWT Payload must be a top level object");
|
|
776
|
-
const
|
|
775
|
+
const P = Z() + r;
|
|
777
776
|
if (h.exp !== void 0) {
|
|
778
777
|
if (typeof h.exp != "number")
|
|
779
778
|
throw new a('unexpected JWT "exp" (expiration time) claim type');
|
|
780
|
-
if (h.exp <=
|
|
779
|
+
if (h.exp <= P - s)
|
|
781
780
|
throw new a('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
|
|
782
781
|
}
|
|
783
782
|
if (h.iat !== void 0 && typeof h.iat != "number")
|
|
@@ -787,14 +786,14 @@ async function Tt(t, e, n, r, s) {
|
|
|
787
786
|
if (h.nbf !== void 0) {
|
|
788
787
|
if (typeof h.nbf != "number")
|
|
789
788
|
throw new a('unexpected JWT "nbf" (not before) claim type');
|
|
790
|
-
if (h.nbf >
|
|
789
|
+
if (h.nbf > P + s)
|
|
791
790
|
throw new a('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
|
|
792
791
|
}
|
|
793
792
|
if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
|
|
794
793
|
throw new a('unexpected JWT "aud" (audience) claim type');
|
|
795
794
|
return { header: y, claims: h, signature: b, key: _ };
|
|
796
795
|
}
|
|
797
|
-
function
|
|
796
|
+
function vt(t, e, n) {
|
|
798
797
|
if (t !== void 0) {
|
|
799
798
|
if (n.alg !== t)
|
|
800
799
|
throw new a('unexpected JWT "alg" header parameter');
|
|
@@ -808,30 +807,30 @@ function Et(t, e, n) {
|
|
|
808
807
|
if (n.alg !== "RS256")
|
|
809
808
|
throw new a('unexpected JWT "alg" header parameter');
|
|
810
809
|
}
|
|
811
|
-
function
|
|
810
|
+
function T(t, e) {
|
|
812
811
|
const { 0: n, length: r } = t.getAll(e);
|
|
813
812
|
if (r > 1)
|
|
814
813
|
throw new a(`"${e}" parameter must be provided only once`);
|
|
815
814
|
return n;
|
|
816
815
|
}
|
|
817
|
-
const
|
|
818
|
-
function
|
|
819
|
-
if (
|
|
816
|
+
const St = Symbol(), Tt = Symbol();
|
|
817
|
+
function kt(t, e, n, r) {
|
|
818
|
+
if (L(t), C(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
|
|
820
819
|
throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
|
|
821
|
-
if (
|
|
820
|
+
if (T(n, "response"))
|
|
822
821
|
throw new a('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
|
|
823
|
-
const s =
|
|
822
|
+
const s = T(n, "iss"), o = T(n, "state");
|
|
824
823
|
if (!s && t.authorization_response_iss_parameter_supported)
|
|
825
824
|
throw new a('response parameter "iss" (issuer) missing');
|
|
826
825
|
if (s && s !== t.issuer)
|
|
827
826
|
throw new a('unexpected "iss" (issuer) response parameter value');
|
|
828
827
|
switch (r) {
|
|
829
828
|
case void 0:
|
|
830
|
-
case
|
|
829
|
+
case Tt:
|
|
831
830
|
if (o !== void 0)
|
|
832
831
|
throw new a('unexpected "state" response parameter encountered');
|
|
833
832
|
break;
|
|
834
|
-
case
|
|
833
|
+
case St:
|
|
835
834
|
break;
|
|
836
835
|
default:
|
|
837
836
|
if (!g(r))
|
|
@@ -841,66 +840,41 @@ function Pt(t, e, n, r) {
|
|
|
841
840
|
if (o !== r)
|
|
842
841
|
throw new a('unexpected "state" response parameter value');
|
|
843
842
|
}
|
|
844
|
-
const i =
|
|
843
|
+
const i = T(n, "error");
|
|
845
844
|
if (i)
|
|
846
845
|
return {
|
|
847
846
|
error: i,
|
|
848
|
-
error_description:
|
|
849
|
-
error_uri:
|
|
847
|
+
error_description: T(n, "error_description"),
|
|
848
|
+
error_uri: T(n, "error_uri")
|
|
850
849
|
};
|
|
851
|
-
const u =
|
|
850
|
+
const u = T(n, "id_token"), f = T(n, "token");
|
|
852
851
|
if (u !== void 0 || f !== void 0)
|
|
853
852
|
throw new S("implicit and hybrid flows are not supported");
|
|
854
|
-
return
|
|
853
|
+
return ft(new URLSearchParams(n));
|
|
855
854
|
}
|
|
856
|
-
class
|
|
855
|
+
class O extends Error {
|
|
857
856
|
}
|
|
858
|
-
class
|
|
857
|
+
class ue extends O {
|
|
859
858
|
constructor(e, n, r) {
|
|
860
859
|
super(e, r), this.error = n;
|
|
861
860
|
}
|
|
862
861
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
return ze(() => {
|
|
868
|
-
e.current || (e.current = !0, t().then((o) => {
|
|
869
|
-
s(o);
|
|
870
|
-
}).catch((o) => {
|
|
871
|
-
r(o);
|
|
872
|
-
}));
|
|
873
|
-
}, []), n ? n instanceof q ? /* @__PURE__ */ E.jsxs("div", { children: [
|
|
874
|
-
/* @__PURE__ */ E.jsx("h2", { children: "Error" }),
|
|
875
|
-
/* @__PURE__ */ E.jsxs("pre", { children: [
|
|
876
|
-
n.error.error,
|
|
877
|
-
n.error.error_description,
|
|
878
|
-
n.error.error_uri
|
|
879
|
-
] })
|
|
880
|
-
] }) : /* @__PURE__ */ E.jsxs("div", { children: [
|
|
881
|
-
/* @__PURE__ */ E.jsx("h2", { children: "Error" }),
|
|
882
|
-
/* @__PURE__ */ E.jsxs("pre", { children: [
|
|
883
|
-
n.message,
|
|
884
|
-
n.stack
|
|
885
|
-
] })
|
|
886
|
-
] }) : /* @__PURE__ */ E.jsx("div", { children: "Loading..." });
|
|
887
|
-
}
|
|
888
|
-
const M = "code-verifier";
|
|
889
|
-
class Ut extends Ce {
|
|
890
|
-
constructor(e, n, r) {
|
|
891
|
-
super(), this.callbackUrlPath = e, this.handleCallback = n, this.initialize = r;
|
|
862
|
+
const F = "code-verifier";
|
|
863
|
+
class At extends Le {
|
|
864
|
+
constructor(e, n) {
|
|
865
|
+
super(), this.callbackUrlPath = e, this.initialize = n;
|
|
892
866
|
}
|
|
893
867
|
getRoutes() {
|
|
894
868
|
return [
|
|
895
869
|
...super.getRoutes(),
|
|
896
870
|
{
|
|
897
871
|
path: this.callbackUrlPath,
|
|
898
|
-
element: /* @__PURE__ */
|
|
872
|
+
element: /* @__PURE__ */ Pe.jsx("div", {})
|
|
899
873
|
}
|
|
900
874
|
];
|
|
901
875
|
}
|
|
902
876
|
}
|
|
903
|
-
class
|
|
877
|
+
class Et {
|
|
904
878
|
constructor({
|
|
905
879
|
issuer: e,
|
|
906
880
|
audience: n,
|
|
@@ -924,7 +898,7 @@ class Lt {
|
|
|
924
898
|
m(this, "redirectToAfterSignOut");
|
|
925
899
|
m(this, "audience");
|
|
926
900
|
m(this, "signOut", async () => {
|
|
927
|
-
|
|
901
|
+
ne.setState({
|
|
928
902
|
isAuthenticated: !1,
|
|
929
903
|
isPending: !1,
|
|
930
904
|
profile: void 0
|
|
@@ -940,37 +914,35 @@ class Lt {
|
|
|
940
914
|
)) : r = n;
|
|
941
915
|
});
|
|
942
916
|
m(this, "handleCallback", async () => {
|
|
943
|
-
const e = new URL(window.location.href), n = e.searchParams.get("state"), r = sessionStorage.getItem(
|
|
944
|
-
if (sessionStorage.removeItem(
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
);
|
|
948
|
-
const s = await this.getAuthServer(), o = Pt(
|
|
917
|
+
const e = new URL(window.location.href), n = e.searchParams.get("state"), r = sessionStorage.getItem(F);
|
|
918
|
+
if (sessionStorage.removeItem(F), !r)
|
|
919
|
+
return;
|
|
920
|
+
const s = await this.getAuthServer(), o = kt(
|
|
949
921
|
s,
|
|
950
922
|
this.client,
|
|
951
923
|
e.searchParams,
|
|
952
924
|
n ?? void 0
|
|
953
925
|
);
|
|
954
|
-
if (
|
|
955
|
-
throw
|
|
926
|
+
if (B(o))
|
|
927
|
+
throw re.error("Error validating OAuth response", o), new ue(
|
|
956
928
|
"Error validating OAuth response",
|
|
957
929
|
o
|
|
958
930
|
);
|
|
959
931
|
const i = new URL(e);
|
|
960
932
|
i.pathname = this.redirectToAfterSignIn, i.search = "";
|
|
961
|
-
const u = await
|
|
933
|
+
const u = await pt(
|
|
962
934
|
s,
|
|
963
935
|
this.client,
|
|
964
936
|
o,
|
|
965
937
|
i.toString(),
|
|
966
938
|
r
|
|
967
|
-
), f = await
|
|
939
|
+
), f = await mt(
|
|
968
940
|
s,
|
|
969
941
|
this.client,
|
|
970
942
|
u
|
|
971
943
|
);
|
|
972
944
|
this.setTokensFromResponse(f);
|
|
973
|
-
const y = await this.getAccessToken(), _ = await (await
|
|
945
|
+
const y = await this.getAccessToken(), _ = await (await st(
|
|
974
946
|
s,
|
|
975
947
|
this.client,
|
|
976
948
|
y
|
|
@@ -981,7 +953,7 @@ class Lt {
|
|
|
981
953
|
emailVerified: _.email_verified ?? !1,
|
|
982
954
|
pictureUrl: _.picture
|
|
983
955
|
};
|
|
984
|
-
return
|
|
956
|
+
return ne.setState({
|
|
985
957
|
isAuthenticated: !0,
|
|
986
958
|
isPending: !1,
|
|
987
959
|
profile: h
|
|
@@ -1002,8 +974,8 @@ class Lt {
|
|
|
1002
974
|
code_challenge_methods_supported: []
|
|
1003
975
|
};
|
|
1004
976
|
else {
|
|
1005
|
-
const e = new URL(this.issuer), n = await
|
|
1006
|
-
this.authorizationServer = await
|
|
977
|
+
const e = new URL(this.issuer), n = await De(e);
|
|
978
|
+
this.authorizationServer = await He(
|
|
1007
979
|
e,
|
|
1008
980
|
n
|
|
1009
981
|
);
|
|
@@ -1015,10 +987,10 @@ class Lt {
|
|
|
1015
987
|
* @param response
|
|
1016
988
|
*/
|
|
1017
989
|
setTokensFromResponse(e) {
|
|
1018
|
-
if (
|
|
1019
|
-
throw
|
|
990
|
+
if (B(e))
|
|
991
|
+
throw re.error("Bad Token Response", e), new ue("Bad Token Response", e);
|
|
1020
992
|
if (!e.expires_in)
|
|
1021
|
-
throw new
|
|
993
|
+
throw new O("No expires_in in response");
|
|
1022
994
|
this.tokens = {
|
|
1023
995
|
accessToken: e.access_token,
|
|
1024
996
|
refreshToken: e.refresh_token,
|
|
@@ -1042,9 +1014,9 @@ class Lt {
|
|
|
1042
1014
|
var f;
|
|
1043
1015
|
const n = "S256", r = await this.getAuthServer();
|
|
1044
1016
|
if (!r.authorization_endpoint)
|
|
1045
|
-
throw new
|
|
1046
|
-
const s =
|
|
1047
|
-
sessionStorage.setItem(
|
|
1017
|
+
throw new O("No authorization endpoint");
|
|
1018
|
+
const s = $e(), o = await Me(s);
|
|
1019
|
+
sessionStorage.setItem(F, s);
|
|
1048
1020
|
const i = new URL(
|
|
1049
1021
|
r.authorization_endpoint
|
|
1050
1022
|
);
|
|
@@ -1054,7 +1026,7 @@ class Lt {
|
|
|
1054
1026
|
"code_challenge_method",
|
|
1055
1027
|
n
|
|
1056
1028
|
), this.audience && i.searchParams.set("audience", this.audience), ((f = r.code_challenge_methods_supported) == null ? void 0 : f.includes("S256")) !== !0) {
|
|
1057
|
-
const y =
|
|
1029
|
+
const y = Fe();
|
|
1058
1030
|
i.searchParams.set("state", y);
|
|
1059
1031
|
}
|
|
1060
1032
|
location.href = i.href;
|
|
@@ -1062,17 +1034,15 @@ class Lt {
|
|
|
1062
1034
|
async getAccessToken() {
|
|
1063
1035
|
const e = await this.getAuthServer();
|
|
1064
1036
|
if (!this.tokens)
|
|
1065
|
-
throw new
|
|
1037
|
+
throw new O("User is not authenticated");
|
|
1066
1038
|
if (this.tokens.expiresOn < /* @__PURE__ */ new Date()) {
|
|
1067
1039
|
if (!this.tokens.refreshToken)
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
);
|
|
1071
|
-
const n = await ht(
|
|
1040
|
+
return await this.signIn(), "";
|
|
1041
|
+
const n = await ct(
|
|
1072
1042
|
e,
|
|
1073
1043
|
this.client,
|
|
1074
1044
|
this.tokens.refreshToken
|
|
1075
|
-
), r = await
|
|
1045
|
+
), r = await lt(
|
|
1076
1046
|
e,
|
|
1077
1047
|
this.client,
|
|
1078
1048
|
n
|
|
@@ -1082,18 +1052,22 @@ class Lt {
|
|
|
1082
1052
|
return this.tokens.accessToken;
|
|
1083
1053
|
}
|
|
1084
1054
|
getAuthenticationPlugin() {
|
|
1085
|
-
return new
|
|
1055
|
+
return new At(
|
|
1086
1056
|
this.callbackUrlPath,
|
|
1087
|
-
async () =>
|
|
1088
|
-
|
|
1089
|
-
|
|
1057
|
+
async (e, n) => {
|
|
1058
|
+
if (typeof localStorage < "u" && localStorage.getItem("auto-login"))
|
|
1059
|
+
localStorage.removeItem("auto-login"), await this.authorize({ redirectTo: window.location.pathname });
|
|
1060
|
+
else if (window.location.pathname === "/oauth/callback") {
|
|
1061
|
+
const r = await this.handleCallback();
|
|
1062
|
+
r && n.navigate(r);
|
|
1063
|
+
}
|
|
1090
1064
|
}
|
|
1091
1065
|
);
|
|
1092
1066
|
}
|
|
1093
1067
|
}
|
|
1094
|
-
const
|
|
1068
|
+
const Ct = (t) => new Et(t);
|
|
1095
1069
|
export {
|
|
1096
|
-
|
|
1097
|
-
|
|
1070
|
+
Et as OpenIDAuthenticationProvider,
|
|
1071
|
+
Ct as default
|
|
1098
1072
|
};
|
|
1099
1073
|
//# sourceMappingURL=zudoku.auth-openid.js.map
|