zudoku 0.35.4 → 0.35.6
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/providers/openid.js +11 -7
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/components/AnchorLink.js +3 -2
- package/dist/lib/components/AnchorLink.js.map +1 -1
- package/dist/lib/components/navigation/SidebarItem.js +3 -2
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
- package/dist/lib/oas/graphql/index.d.ts +4 -3
- package/dist/lib/oas/graphql/index.js +9 -13
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +2 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/ParamInfos.js +1 -1
- package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +5 -3
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.d.ts +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +2 -1
- package/dist/lib/plugins/openapi/graphql/graphql.js +3 -1
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +5 -2
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/lib/{Markdown-hBN9vkm5.js → Markdown-C0eXdzGn.js} +306 -306
- package/lib/{Markdown-hBN9vkm5.js.map → Markdown-C0eXdzGn.js.map} +1 -1
- package/lib/{MdxPage-UCWwxhzC.js → MdxPage-BKkG1cm1.js} +2 -2
- package/lib/{MdxPage-UCWwxhzC.js.map → MdxPage-BKkG1cm1.js.map} +1 -1
- package/lib/{OasProvider-BbSqUQka.js → OasProvider-CwhKwrwl.js} +2 -2
- package/lib/{OasProvider-BbSqUQka.js.map → OasProvider-CwhKwrwl.js.map} +1 -1
- package/lib/{OperationList-CENzwqY8.js → OperationList-DGYoFitT.js} +360 -362
- package/lib/OperationList-DGYoFitT.js.map +1 -0
- package/lib/{SlotletProvider-D-XPr1Wg.js → SlotletProvider-BJC58V32.js} +2 -2
- package/lib/{SlotletProvider-D-XPr1Wg.js.map → SlotletProvider-BJC58V32.js.map} +1 -1
- package/lib/{createServer-BEFAOb-x.js → createServer-CbL1Uh2Q.js} +4108 -4066
- package/lib/createServer-CbL1Uh2Q.js.map +1 -0
- package/lib/{index-BVhQWA89.js → index-Dm1QJHVl.js} +121 -117
- package/lib/index-Dm1QJHVl.js.map +1 -0
- package/lib/zudoku.auth-openid.js +282 -281
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +2 -2
- package/lib/zudoku.plugin-api-catalog.js +1 -1
- package/lib/zudoku.plugin-api-keys.js +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/package.json +5 -5
- package/src/app/main.css +4 -0
- package/src/lib/authentication/providers/openid.tsx +12 -9
- package/src/lib/components/AnchorLink.tsx +4 -2
- package/src/lib/components/navigation/SidebarItem.tsx +3 -2
- package/src/lib/oas/graphql/index.ts +27 -27
- package/src/lib/plugins/openapi/OperationList.tsx +2 -1
- package/src/lib/plugins/openapi/ParamInfos.tsx +1 -1
- package/src/lib/plugins/openapi/ParameterListItem.tsx +20 -14
- package/src/lib/plugins/openapi/graphql/gql.ts +3 -3
- package/src/lib/plugins/openapi/graphql/graphql.ts +8 -4
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +10 -6
- package/lib/OperationList-CENzwqY8.js.map +0 -1
- package/lib/createServer-BEFAOb-x.js.map +0 -1
- package/lib/index-BVhQWA89.js.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var _ = (t, e, n) =>
|
|
4
|
-
import { j as
|
|
5
|
-
import { g as
|
|
6
|
-
import { C as
|
|
7
|
-
import { j as
|
|
1
|
+
var Le = Object.defineProperty;
|
|
2
|
+
var xe = (t, e, n) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var _ = (t, e, n) => xe(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { j as B } from "./jsx-runtime-CYK1ROHF.js";
|
|
5
|
+
import { g as Ce } from "./_commonjsHelpers-BkfeUUK-.js";
|
|
6
|
+
import { C as Ie } from "./ClientOnly-E7hGysn1.js";
|
|
7
|
+
import { j as ie } from "./joinUrl-10po2Jdj.js";
|
|
8
8
|
import { A as je } from "./AuthenticationPlugin-4ip08maU.js";
|
|
9
|
-
import { b as
|
|
10
|
-
import { N as
|
|
11
|
-
import { Z as
|
|
12
|
-
var D = { exports: {} },
|
|
13
|
-
function
|
|
14
|
-
return
|
|
9
|
+
import { b as Je, u as x } from "./hook-CfCFKZ-2.js";
|
|
10
|
+
import { N as Oe } from "./chunk-HA7DTUK3-ZGg2W6yV.js";
|
|
11
|
+
import { Z as ze } from "./invariant-Caa8-XvF.js";
|
|
12
|
+
var D = { exports: {} }, De = D.exports, ae;
|
|
13
|
+
function Ne() {
|
|
14
|
+
return ae || (ae = 1, function(t) {
|
|
15
15
|
(function(e, n) {
|
|
16
16
|
t.exports ? t.exports = n() : e.log = n();
|
|
17
|
-
})(
|
|
17
|
+
})(De, function() {
|
|
18
18
|
var e = function() {
|
|
19
19
|
}, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), a = [
|
|
20
20
|
"trace",
|
|
@@ -23,8 +23,8 @@ function De() {
|
|
|
23
23
|
"warn",
|
|
24
24
|
"error"
|
|
25
25
|
], r = {}, i = null;
|
|
26
|
-
function c(l,
|
|
27
|
-
var u = l[
|
|
26
|
+
function c(l, g) {
|
|
27
|
+
var u = l[g];
|
|
28
28
|
if (typeof u.bind == "function")
|
|
29
29
|
return u.bind(l);
|
|
30
30
|
try {
|
|
@@ -42,39 +42,39 @@ function De() {
|
|
|
42
42
|
return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && o ? p : console[l] !== void 0 ? c(console, l) : console.log !== void 0 ? c(console, "log") : e;
|
|
43
43
|
}
|
|
44
44
|
function f() {
|
|
45
|
-
for (var l = this.getLevel(),
|
|
46
|
-
var u = a[
|
|
47
|
-
this[u] =
|
|
45
|
+
for (var l = this.getLevel(), g = 0; g < a.length; g++) {
|
|
46
|
+
var u = a[g];
|
|
47
|
+
this[u] = g < l ? e : this.methodFactory(u, l, this.name);
|
|
48
48
|
}
|
|
49
49
|
if (this.log = this.debug, typeof console === n && l < this.levels.SILENT)
|
|
50
50
|
return "No console available for logging";
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function v(l) {
|
|
53
53
|
return function() {
|
|
54
54
|
typeof console !== n && (f.call(this), this[l].apply(this, arguments));
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
return w(l) ||
|
|
57
|
+
function b(l, g, u) {
|
|
58
|
+
return w(l) || v.apply(this, arguments);
|
|
59
59
|
}
|
|
60
|
-
function h(l,
|
|
61
|
-
var u = this, J, $,
|
|
60
|
+
function h(l, g) {
|
|
61
|
+
var u = this, J, $, U, S = "loglevel";
|
|
62
62
|
typeof l == "string" ? S += ":" + l : typeof l == "symbol" && (S = void 0);
|
|
63
|
-
function
|
|
64
|
-
var
|
|
63
|
+
function Re(d) {
|
|
64
|
+
var y = (a[d] || "silent").toUpperCase();
|
|
65
65
|
if (!(typeof window === n || !S)) {
|
|
66
66
|
try {
|
|
67
|
-
window.localStorage[S] =
|
|
67
|
+
window.localStorage[S] = y;
|
|
68
68
|
return;
|
|
69
69
|
} catch {
|
|
70
70
|
}
|
|
71
71
|
try {
|
|
72
|
-
window.document.cookie = encodeURIComponent(S) + "=" +
|
|
72
|
+
window.document.cookie = encodeURIComponent(S) + "=" + y + ";";
|
|
73
73
|
} catch {
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ne() {
|
|
78
78
|
var d;
|
|
79
79
|
if (!(typeof window === n || !S)) {
|
|
80
80
|
try {
|
|
@@ -83,16 +83,16 @@ function De() {
|
|
|
83
83
|
}
|
|
84
84
|
if (typeof d === n)
|
|
85
85
|
try {
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
var y = window.document.cookie, O = encodeURIComponent(S), oe = y.indexOf(O + "=");
|
|
87
|
+
oe !== -1 && (d = /^([^;]+)/.exec(
|
|
88
|
+
y.slice(oe + O.length + 1)
|
|
89
89
|
)[1]);
|
|
90
90
|
} catch {
|
|
91
91
|
}
|
|
92
92
|
return u.levels[d] === void 0 && (d = void 0), d;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function Pe() {
|
|
96
96
|
if (!(typeof window === n || !S)) {
|
|
97
97
|
try {
|
|
98
98
|
window.localStorage.removeItem(S);
|
|
@@ -104,10 +104,10 @@ function De() {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
var
|
|
109
|
-
if (typeof
|
|
110
|
-
return
|
|
107
|
+
function L(d) {
|
|
108
|
+
var y = d;
|
|
109
|
+
if (typeof y == "string" && u.levels[y.toUpperCase()] !== void 0 && (y = u.levels[y.toUpperCase()]), typeof y == "number" && y >= 0 && y <= u.levels.SILENT)
|
|
110
|
+
return y;
|
|
111
111
|
throw new TypeError("log.setLevel() called with invalid level: " + d);
|
|
112
112
|
}
|
|
113
113
|
u.name = l, u.levels = {
|
|
@@ -117,52 +117,52 @@ function De() {
|
|
|
117
117
|
WARN: 3,
|
|
118
118
|
ERROR: 4,
|
|
119
119
|
SILENT: 5
|
|
120
|
-
}, u.methodFactory =
|
|
121
|
-
return
|
|
122
|
-
}, u.setLevel = function(d,
|
|
123
|
-
return
|
|
120
|
+
}, u.methodFactory = g || b, u.getLevel = function() {
|
|
121
|
+
return U ?? $ ?? J;
|
|
122
|
+
}, u.setLevel = function(d, y) {
|
|
123
|
+
return U = L(d), y !== !1 && Re(U), f.call(u);
|
|
124
124
|
}, u.setDefaultLevel = function(d) {
|
|
125
|
-
$ =
|
|
125
|
+
$ = L(d), ne() || u.setLevel(d, !1);
|
|
126
126
|
}, u.resetLevel = function() {
|
|
127
|
-
|
|
127
|
+
U = null, Pe(), f.call(u);
|
|
128
128
|
}, u.enableAll = function(d) {
|
|
129
129
|
u.setLevel(u.levels.TRACE, d);
|
|
130
130
|
}, u.disableAll = function(d) {
|
|
131
131
|
u.setLevel(u.levels.SILENT, d);
|
|
132
132
|
}, u.rebuild = function() {
|
|
133
|
-
if (i !== u && (J =
|
|
133
|
+
if (i !== u && (J = L(i.getLevel())), f.call(u), i === u)
|
|
134
134
|
for (var d in r)
|
|
135
135
|
r[d].rebuild();
|
|
136
|
-
}, J =
|
|
136
|
+
}, J = L(
|
|
137
137
|
i ? i.getLevel() : "WARN"
|
|
138
138
|
);
|
|
139
|
-
var
|
|
140
|
-
|
|
139
|
+
var re = ne();
|
|
140
|
+
re != null && (U = L(re)), f.call(u);
|
|
141
141
|
}
|
|
142
|
-
i = new h(), i.getLogger = function(
|
|
143
|
-
if (typeof
|
|
142
|
+
i = new h(), i.getLogger = function(g) {
|
|
143
|
+
if (typeof g != "symbol" && typeof g != "string" || g === "")
|
|
144
144
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
145
|
-
var u = r[
|
|
146
|
-
return u || (u = r[
|
|
147
|
-
|
|
145
|
+
var u = r[g];
|
|
146
|
+
return u || (u = r[g] = new h(
|
|
147
|
+
g,
|
|
148
148
|
i.methodFactory
|
|
149
149
|
)), u;
|
|
150
150
|
};
|
|
151
|
-
var
|
|
151
|
+
var P = typeof window !== n ? window.log : void 0;
|
|
152
152
|
return i.noConflict = function() {
|
|
153
|
-
return typeof window !== n && window.log === i && (window.log =
|
|
153
|
+
return typeof window !== n && window.log === i && (window.log = P), i;
|
|
154
154
|
}, i.getLoggers = function() {
|
|
155
155
|
return r;
|
|
156
156
|
}, i.default = i, i;
|
|
157
157
|
});
|
|
158
158
|
}(D)), D.exports;
|
|
159
159
|
}
|
|
160
|
-
var
|
|
161
|
-
const
|
|
162
|
-
let
|
|
163
|
-
var z,
|
|
164
|
-
(typeof navigator > "u" || !((
|
|
165
|
-
function
|
|
160
|
+
var We = Ne();
|
|
161
|
+
const se = /* @__PURE__ */ Ce(We);
|
|
162
|
+
let V;
|
|
163
|
+
var z, we;
|
|
164
|
+
(typeof navigator > "u" || !((we = (z = navigator.userAgent) == null ? void 0 : z.startsWith) != null && we.call(z, "Mozilla/5.0 "))) && (V = "oauth4webapi/v2.17.0");
|
|
165
|
+
function Y(t, e) {
|
|
166
166
|
if (t == null)
|
|
167
167
|
return !1;
|
|
168
168
|
try {
|
|
@@ -171,19 +171,19 @@ function G(t, e) {
|
|
|
171
171
|
return !1;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
const W = Symbol(),
|
|
174
|
+
const W = Symbol(), Ke = Symbol(), Z = Symbol(), He = Symbol(), $e = Symbol(), Fe = Symbol(), Me = new TextEncoder(), qe = new TextDecoder();
|
|
175
175
|
function E(t) {
|
|
176
|
-
return typeof t == "string" ?
|
|
176
|
+
return typeof t == "string" ? Me.encode(t) : qe.decode(t);
|
|
177
177
|
}
|
|
178
|
-
const
|
|
179
|
-
function
|
|
178
|
+
const ce = 32768;
|
|
179
|
+
function Be(t) {
|
|
180
180
|
t instanceof ArrayBuffer && (t = new Uint8Array(t));
|
|
181
181
|
const e = [];
|
|
182
|
-
for (let n = 0; n < t.byteLength; n +=
|
|
183
|
-
e.push(String.fromCharCode.apply(null, t.subarray(n, n +
|
|
182
|
+
for (let n = 0; n < t.byteLength; n += ce)
|
|
183
|
+
e.push(String.fromCharCode.apply(null, t.subarray(n, n + ce)));
|
|
184
184
|
return btoa(e.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Ve(t) {
|
|
187
187
|
try {
|
|
188
188
|
const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(e.length);
|
|
189
189
|
for (let o = 0; o < e.length; o++)
|
|
@@ -194,9 +194,9 @@ function Be(t) {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
function k(t) {
|
|
197
|
-
return typeof t == "string" ?
|
|
197
|
+
return typeof t == "string" ? Ve(t) : Be(t);
|
|
198
198
|
}
|
|
199
|
-
class
|
|
199
|
+
class Ge {
|
|
200
200
|
constructor(e) {
|
|
201
201
|
this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = e;
|
|
202
202
|
}
|
|
@@ -226,48 +226,48 @@ class T extends Error {
|
|
|
226
226
|
super(e ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
class
|
|
229
|
+
class Ye extends Error {
|
|
230
230
|
constructor(e, n) {
|
|
231
231
|
var o;
|
|
232
232
|
super(e, n), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
const s =
|
|
236
|
-
function
|
|
235
|
+
const s = Ye, me = new Ge(100);
|
|
236
|
+
function ge(t) {
|
|
237
237
|
return t instanceof CryptoKey;
|
|
238
238
|
}
|
|
239
239
|
function Ze(t) {
|
|
240
|
-
return
|
|
240
|
+
return ge(t) && t.type === "private";
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
return
|
|
242
|
+
function Qe(t) {
|
|
243
|
+
return ge(t) && t.type === "public";
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function Q(t) {
|
|
246
246
|
try {
|
|
247
247
|
const e = t.headers.get("dpop-nonce");
|
|
248
|
-
e &&
|
|
248
|
+
e && me.set(new URL(t.url).origin, e);
|
|
249
249
|
} catch {
|
|
250
250
|
}
|
|
251
251
|
return t;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function C(t) {
|
|
254
254
|
return !(t === null || typeof t != "object" || Array.isArray(t));
|
|
255
255
|
}
|
|
256
256
|
function K(t) {
|
|
257
|
-
|
|
257
|
+
Y(t, Headers) && (t = Object.fromEntries(t.entries()));
|
|
258
258
|
const e = new Headers(t);
|
|
259
|
-
if (
|
|
259
|
+
if (V && !e.has("user-agent") && e.set("user-agent", V), e.has("authorization"))
|
|
260
260
|
throw new TypeError('"options.headers" must not include the "authorization" header name');
|
|
261
261
|
if (e.has("dpop"))
|
|
262
262
|
throw new TypeError('"options.headers" must not include the "dpop" header name');
|
|
263
263
|
return e;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function Xe(t) {
|
|
266
266
|
if (typeof t == "function" && (t = t()), !(t instanceof AbortSignal))
|
|
267
267
|
throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
|
|
268
268
|
return t;
|
|
269
269
|
}
|
|
270
|
-
async function
|
|
270
|
+
async function et(t, e) {
|
|
271
271
|
if (!(t instanceof URL))
|
|
272
272
|
throw new TypeError('"issuerIdentifier" must be an instance of URL');
|
|
273
273
|
if (t.protocol !== "https:" && t.protocol !== "http:")
|
|
@@ -290,26 +290,26 @@ async function Xe(t, e) {
|
|
|
290
290
|
method: "GET",
|
|
291
291
|
redirect: "manual",
|
|
292
292
|
signal: null
|
|
293
|
-
}).then(
|
|
293
|
+
}).then(Q);
|
|
294
294
|
}
|
|
295
295
|
function m(t) {
|
|
296
296
|
return typeof t == "string" && t.length !== 0;
|
|
297
297
|
}
|
|
298
|
-
async function
|
|
298
|
+
async function tt(t, e) {
|
|
299
299
|
if (!(t instanceof URL))
|
|
300
300
|
throw new TypeError('"expectedIssuer" must be an instance of URL');
|
|
301
|
-
if (!
|
|
301
|
+
if (!Y(e, Response))
|
|
302
302
|
throw new TypeError('"response" must be an instance of Response');
|
|
303
303
|
if (e.status !== 200)
|
|
304
304
|
throw new s('"response" is not a conform Authorization Server Metadata response');
|
|
305
|
-
|
|
305
|
+
te(e);
|
|
306
306
|
let n;
|
|
307
307
|
try {
|
|
308
308
|
n = await e.json();
|
|
309
309
|
} catch (o) {
|
|
310
310
|
throw new s('failed to parse "response" body as JSON', { cause: o });
|
|
311
311
|
}
|
|
312
|
-
if (!
|
|
312
|
+
if (!C(n))
|
|
313
313
|
throw new s('"response" body must be a top level object');
|
|
314
314
|
if (!m(n.issuer))
|
|
315
315
|
throw new s('"response" body "issuer" property must be a non-empty string');
|
|
@@ -317,28 +317,28 @@ async function et(t, e) {
|
|
|
317
317
|
throw new s('"response" body "issuer" does not match "expectedIssuer"');
|
|
318
318
|
return n;
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function X() {
|
|
321
321
|
return k(crypto.getRandomValues(new Uint8Array(32)));
|
|
322
322
|
}
|
|
323
|
-
function tt() {
|
|
324
|
-
return Q();
|
|
325
|
-
}
|
|
326
323
|
function nt() {
|
|
327
|
-
return
|
|
324
|
+
return X();
|
|
325
|
+
}
|
|
326
|
+
function rt() {
|
|
327
|
+
return X();
|
|
328
328
|
}
|
|
329
|
-
async function
|
|
329
|
+
async function ot(t) {
|
|
330
330
|
if (!m(t))
|
|
331
331
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
332
332
|
return k(await crypto.subtle.digest("SHA-256", E(t)));
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function ue(t) {
|
|
335
335
|
return encodeURIComponent(t).replace(/%20/g, "+");
|
|
336
336
|
}
|
|
337
|
-
function
|
|
338
|
-
const n =
|
|
337
|
+
function it(t, e) {
|
|
338
|
+
const n = ue(t), o = ue(e);
|
|
339
339
|
return `Basic ${btoa(`${n}:${o}`)}`;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function at(t) {
|
|
342
342
|
switch (t.algorithm.hash.name) {
|
|
343
343
|
case "SHA-256":
|
|
344
344
|
return "PS256";
|
|
@@ -350,7 +350,7 @@ function it(t) {
|
|
|
350
350
|
throw new T("unsupported RsaHashedKeyAlgorithm hash name");
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function st(t) {
|
|
354
354
|
switch (t.algorithm.hash.name) {
|
|
355
355
|
case "SHA-256":
|
|
356
356
|
return "RS256";
|
|
@@ -362,7 +362,7 @@ function at(t) {
|
|
|
362
362
|
throw new T("unsupported RsaHashedKeyAlgorithm hash name");
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function ct(t) {
|
|
366
366
|
switch (t.algorithm.namedCurve) {
|
|
367
367
|
case "P-256":
|
|
368
368
|
return "ES256";
|
|
@@ -374,14 +374,14 @@ function st(t) {
|
|
|
374
374
|
throw new T("unsupported EcKeyAlgorithm namedCurve");
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function ut(t) {
|
|
378
378
|
switch (t.algorithm.name) {
|
|
379
379
|
case "RSA-PSS":
|
|
380
|
-
return it(t);
|
|
381
|
-
case "RSASSA-PKCS1-v1_5":
|
|
382
380
|
return at(t);
|
|
383
|
-
case "
|
|
381
|
+
case "RSASSA-PKCS1-v1_5":
|
|
384
382
|
return st(t);
|
|
383
|
+
case "ECDSA":
|
|
384
|
+
return ct(t);
|
|
385
385
|
case "Ed25519":
|
|
386
386
|
case "Ed448":
|
|
387
387
|
return "EdDSA";
|
|
@@ -393,14 +393,14 @@ function H(t) {
|
|
|
393
393
|
const e = t == null ? void 0 : t[W];
|
|
394
394
|
return typeof e == "number" && Number.isFinite(e) ? e : 0;
|
|
395
395
|
}
|
|
396
|
-
function
|
|
397
|
-
const e = t == null ? void 0 : t[
|
|
396
|
+
function ye(t) {
|
|
397
|
+
const e = t == null ? void 0 : t[Ke];
|
|
398
398
|
return typeof e == "number" && Number.isFinite(e) && Math.sign(e) !== -1 ? e : 30;
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function ee() {
|
|
401
401
|
return Math.floor(Date.now() / 1e3);
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function I(t) {
|
|
404
404
|
if (typeof t != "object" || t === null)
|
|
405
405
|
throw new TypeError('"as" must be an object');
|
|
406
406
|
if (!m(t.issuer))
|
|
@@ -414,160 +414,160 @@ function j(t) {
|
|
|
414
414
|
throw new TypeError('"client.client_id" property must be a non-empty string');
|
|
415
415
|
return !0;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function le(t) {
|
|
418
418
|
if (!m(t))
|
|
419
419
|
throw new TypeError('"client.client_secret" property must be a non-empty string');
|
|
420
420
|
return t;
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function de(t, e) {
|
|
423
423
|
if (e !== void 0)
|
|
424
424
|
throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
|
|
425
425
|
}
|
|
426
|
-
async function
|
|
426
|
+
async function lt(t, e, n, o, a) {
|
|
427
427
|
switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), e.token_endpoint_auth_method) {
|
|
428
428
|
case void 0:
|
|
429
429
|
case "client_secret_basic": {
|
|
430
|
-
o.set("authorization",
|
|
430
|
+
o.set("authorization", it(e.client_id, le(e.client_secret)));
|
|
431
431
|
break;
|
|
432
432
|
}
|
|
433
433
|
case "client_secret_post": {
|
|
434
|
-
n.set("client_id", e.client_id), n.set("client_secret",
|
|
434
|
+
n.set("client_id", e.client_id), n.set("client_secret", le(e.client_secret));
|
|
435
435
|
break;
|
|
436
436
|
}
|
|
437
437
|
case "private_key_jwt":
|
|
438
|
-
throw
|
|
438
|
+
throw de("private_key_jwt", e.client_secret), new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
|
|
439
439
|
case "tls_client_auth":
|
|
440
440
|
case "self_signed_tls_client_auth":
|
|
441
441
|
case "none": {
|
|
442
|
-
|
|
442
|
+
de(e.token_endpoint_auth_method, e.client_secret), e.token_endpoint_auth_method, n.set("client_id", e.client_id);
|
|
443
443
|
break;
|
|
444
444
|
}
|
|
445
445
|
default:
|
|
446
446
|
throw new T("unsupported client token_endpoint_auth_method");
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
async function
|
|
449
|
+
async function dt(t, e, n) {
|
|
450
450
|
if (!n.usages.includes("sign"))
|
|
451
451
|
throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
|
|
452
|
-
const o = `${k(E(JSON.stringify(t)))}.${k(E(JSON.stringify(e)))}`, a = k(await crypto.subtle.sign(
|
|
452
|
+
const o = `${k(E(JSON.stringify(t)))}.${k(E(JSON.stringify(e)))}`, a = k(await crypto.subtle.sign(ke(n), n, E(o)));
|
|
453
453
|
return `${o}.${a}`;
|
|
454
454
|
}
|
|
455
|
-
async function
|
|
456
|
-
var
|
|
457
|
-
const { privateKey: i, publicKey: c, nonce: p =
|
|
455
|
+
async function ht(t, e, n, o, a, r) {
|
|
456
|
+
var b;
|
|
457
|
+
const { privateKey: i, publicKey: c, nonce: p = me.get(n.origin) } = e;
|
|
458
458
|
if (!Ze(i))
|
|
459
459
|
throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
|
|
460
|
-
if (!
|
|
460
|
+
if (!Qe(c))
|
|
461
461
|
throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
|
|
462
462
|
if (p !== void 0 && !m(p))
|
|
463
463
|
throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
|
|
464
464
|
if (!c.extractable)
|
|
465
465
|
throw new TypeError('"DPoP.publicKey.extractable" must be true');
|
|
466
|
-
const w =
|
|
467
|
-
alg:
|
|
466
|
+
const w = ee() + a, f = {
|
|
467
|
+
alg: ut(i),
|
|
468
468
|
typ: "dpop+jwt",
|
|
469
|
-
jwk: await
|
|
470
|
-
},
|
|
469
|
+
jwk: await pt(c)
|
|
470
|
+
}, v = {
|
|
471
471
|
iat: w,
|
|
472
|
-
jti:
|
|
472
|
+
jti: X(),
|
|
473
473
|
htm: o,
|
|
474
474
|
nonce: p,
|
|
475
475
|
htu: `${n.origin}${n.pathname}`,
|
|
476
476
|
ath: r ? k(await crypto.subtle.digest("SHA-256", E(r))) : void 0
|
|
477
477
|
};
|
|
478
|
-
(
|
|
478
|
+
(b = e[He]) == null || b.call(e, f, v), t.set("dpop", await dt(f, v, i));
|
|
479
479
|
}
|
|
480
480
|
let N;
|
|
481
|
-
async function
|
|
481
|
+
async function ft(t) {
|
|
482
482
|
const { kty: e, e: n, n: o, x: a, y: r, crv: i } = await crypto.subtle.exportKey("jwk", t), c = { kty: e, e: n, n: o, x: a, y: r, crv: i };
|
|
483
483
|
return N.set(t, c), c;
|
|
484
484
|
}
|
|
485
|
-
async function
|
|
486
|
-
return N || (N = /* @__PURE__ */ new WeakMap()), N.get(t) ||
|
|
485
|
+
async function pt(t) {
|
|
486
|
+
return N || (N = /* @__PURE__ */ new WeakMap()), N.get(t) || ft(t);
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function he(t, e, n) {
|
|
489
489
|
if (typeof t != "string")
|
|
490
490
|
throw n ? new TypeError(`"as.mtls_endpoint_aliases.${e}" must be a string`) : new TypeError(`"as.${e}" must be a string`);
|
|
491
491
|
return new URL(t);
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
return n && t.mtls_endpoint_aliases && e in t.mtls_endpoint_aliases ?
|
|
493
|
+
function be(t, e, n = !1) {
|
|
494
|
+
return n && t.mtls_endpoint_aliases && e in t.mtls_endpoint_aliases ? he(t.mtls_endpoint_aliases[e], e, n) : he(t[e], e, n);
|
|
495
495
|
}
|
|
496
|
-
function
|
|
497
|
-
return !!(t.use_mtls_endpoint_aliases || e != null && e[
|
|
496
|
+
function _e(t, e) {
|
|
497
|
+
return !!(t.use_mtls_endpoint_aliases || e != null && e[Fe]);
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function G(t) {
|
|
500
500
|
const e = t;
|
|
501
501
|
return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
|
|
502
502
|
}
|
|
503
|
-
async function
|
|
503
|
+
async function wt(t, e, n, o, a, r) {
|
|
504
504
|
if (!m(t))
|
|
505
505
|
throw new TypeError('"accessToken" must be a non-empty string');
|
|
506
506
|
if (!(n instanceof URL))
|
|
507
507
|
throw new TypeError('"url" must be an instance of URL');
|
|
508
|
-
return o = K(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await
|
|
508
|
+
return o = K(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await ht(o, r.DPoP, n, e.toUpperCase(), H({ [W]: r == null ? void 0 : r[W] }), t), o.set("authorization", `DPoP ${t}`)), ((r == null ? void 0 : r[Z]) || fetch)(n.href, {
|
|
509
509
|
body: a,
|
|
510
510
|
headers: Object.fromEntries(o.entries()),
|
|
511
511
|
method: e,
|
|
512
512
|
redirect: "manual",
|
|
513
|
-
signal: r != null && r.signal ?
|
|
514
|
-
}).then(
|
|
513
|
+
signal: r != null && r.signal ? Xe(r.signal) : null
|
|
514
|
+
}).then(Q);
|
|
515
515
|
}
|
|
516
|
-
async function
|
|
517
|
-
|
|
518
|
-
const a =
|
|
519
|
-
return e.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")),
|
|
516
|
+
async function mt(t, e, n, o) {
|
|
517
|
+
I(t), j(e);
|
|
518
|
+
const a = be(t, "userinfo_endpoint", _e(e, o)), r = K(o == null ? void 0 : o.headers);
|
|
519
|
+
return e.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), wt(n, "GET", a, r, null, {
|
|
520
520
|
...o,
|
|
521
521
|
[W]: H(e)
|
|
522
522
|
});
|
|
523
523
|
}
|
|
524
|
-
async function
|
|
525
|
-
return await
|
|
524
|
+
async function gt(t, e, n, o, a, r, i) {
|
|
525
|
+
return await lt(t, e, a, r), r.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[Z]) || fetch)(o.href, {
|
|
526
526
|
body: a,
|
|
527
527
|
headers: Object.fromEntries(r.entries()),
|
|
528
528
|
method: n,
|
|
529
529
|
redirect: "manual",
|
|
530
530
|
signal: null
|
|
531
|
-
}).then(
|
|
531
|
+
}).then(Q);
|
|
532
532
|
}
|
|
533
|
-
async function
|
|
534
|
-
const r =
|
|
533
|
+
async function ve(t, e, n, o, a) {
|
|
534
|
+
const r = be(t, "token_endpoint", _e(e, a));
|
|
535
535
|
o.set("grant_type", n);
|
|
536
536
|
const i = K(a == null ? void 0 : a.headers);
|
|
537
|
-
return i.set("accept", "application/json"),
|
|
537
|
+
return i.set("accept", "application/json"), gt(t, e, "POST", r, o, i, a);
|
|
538
538
|
}
|
|
539
|
-
async function
|
|
540
|
-
if (
|
|
539
|
+
async function yt(t, e, n, o) {
|
|
540
|
+
if (I(t), j(e), !m(n))
|
|
541
541
|
throw new TypeError('"refreshToken" must be a non-empty string');
|
|
542
542
|
const a = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
|
|
543
|
-
return a.set("refresh_token", n),
|
|
543
|
+
return a.set("refresh_token", n), ve(t, e, "refresh_token", a, o);
|
|
544
544
|
}
|
|
545
|
-
const
|
|
546
|
-
function
|
|
545
|
+
const Se = /* @__PURE__ */ new WeakMap();
|
|
546
|
+
function bt(t) {
|
|
547
547
|
if (!t.id_token)
|
|
548
548
|
return;
|
|
549
|
-
const e =
|
|
549
|
+
const e = Se.get(t);
|
|
550
550
|
if (!e)
|
|
551
551
|
throw new TypeError('"ref" was already garbage collected or did not resolve from the proper sources');
|
|
552
552
|
return e[0];
|
|
553
553
|
}
|
|
554
|
-
async function
|
|
555
|
-
if (
|
|
554
|
+
async function Te(t, e, n, o = !1, a = !1) {
|
|
555
|
+
if (I(t), j(e), !Y(n, Response))
|
|
556
556
|
throw new TypeError('"response" must be an instance of Response');
|
|
557
557
|
if (n.status !== 200) {
|
|
558
558
|
let i;
|
|
559
|
-
if (i = await
|
|
559
|
+
if (i = await Ut(n))
|
|
560
560
|
return i;
|
|
561
561
|
throw new s('"response" is not a conform Token Endpoint response');
|
|
562
562
|
}
|
|
563
|
-
|
|
563
|
+
te(n);
|
|
564
564
|
let r;
|
|
565
565
|
try {
|
|
566
566
|
r = await n.json();
|
|
567
567
|
} catch (i) {
|
|
568
568
|
throw new s('failed to parse "response" body as JSON', { cause: i });
|
|
569
569
|
}
|
|
570
|
-
if (!
|
|
570
|
+
if (!C(r))
|
|
571
571
|
throw new s('"response" body must be a top level object');
|
|
572
572
|
if (!m(r.access_token))
|
|
573
573
|
throw new s('"response" body "access_token" property must be a non-empty string');
|
|
@@ -585,7 +585,7 @@ async function Se(t, e, n, o = !1, a = !1) {
|
|
|
585
585
|
if (r.id_token !== void 0 && !m(r.id_token))
|
|
586
586
|
throw new s('"response" body "id_token" property must be a non-empty string');
|
|
587
587
|
if (r.id_token) {
|
|
588
|
-
const { claims: i, jwt: c } = await
|
|
588
|
+
const { claims: i, jwt: c } = await Ct(r.id_token, It.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ee, H(e), ye(e), e[$e]).then(Et.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(St.bind(void 0, t.issuer)).then(vt.bind(void 0, e.client_id));
|
|
589
589
|
if (Array.isArray(i.aud) && i.aud.length !== 1) {
|
|
590
590
|
if (i.azp === void 0)
|
|
591
591
|
throw new s('ID Token "aud" (audience) claim includes additional untrusted audiences');
|
|
@@ -594,15 +594,15 @@ async function Se(t, e, n, o = !1, a = !1) {
|
|
|
594
594
|
}
|
|
595
595
|
if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
|
|
596
596
|
throw new s('ID Token "auth_time" (authentication time) must be a positive number');
|
|
597
|
-
|
|
597
|
+
Se.set(r, [i, c]);
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
600
|
return r;
|
|
601
601
|
}
|
|
602
|
-
async function
|
|
603
|
-
return
|
|
602
|
+
async function _t(t, e, n) {
|
|
603
|
+
return Te(t, e, n);
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function vt(t, e) {
|
|
606
606
|
if (Array.isArray(e.claims.aud)) {
|
|
607
607
|
if (!e.claims.aud.includes(t))
|
|
608
608
|
throw new s('unexpected JWT "aud" (audience) claim value');
|
|
@@ -610,17 +610,17 @@ function _t(t, e) {
|
|
|
610
610
|
throw new s('unexpected JWT "aud" (audience) claim value');
|
|
611
611
|
return e;
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function St(t, e) {
|
|
614
614
|
if (e.claims.iss !== t)
|
|
615
615
|
throw new s('unexpected JWT "iss" (issuer) claim value');
|
|
616
616
|
return e;
|
|
617
617
|
}
|
|
618
|
-
const
|
|
619
|
-
function
|
|
620
|
-
return
|
|
618
|
+
const Ae = /* @__PURE__ */ new WeakSet();
|
|
619
|
+
function Tt(t) {
|
|
620
|
+
return Ae.add(t), t;
|
|
621
621
|
}
|
|
622
|
-
async function
|
|
623
|
-
if (
|
|
622
|
+
async function At(t, e, n, o, a, r) {
|
|
623
|
+
if (I(t), j(e), !Ae.has(n))
|
|
624
624
|
throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
|
|
625
625
|
if (!m(o))
|
|
626
626
|
throw new TypeError('"redirectUri" must be a non-empty string');
|
|
@@ -630,9 +630,9 @@ async function Tt(t, e, n, o, a, r) {
|
|
|
630
630
|
if (!i)
|
|
631
631
|
throw new s('no authorization code in "callbackParameters"');
|
|
632
632
|
const c = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
|
|
633
|
-
return c.set("redirect_uri", o), c.set("code_verifier", a), c.set("code", i),
|
|
633
|
+
return c.set("redirect_uri", o), c.set("code_verifier", a), c.set("code", i), ve(t, e, "authorization_code", c, r);
|
|
634
634
|
}
|
|
635
|
-
const
|
|
635
|
+
const kt = {
|
|
636
636
|
aud: "audience",
|
|
637
637
|
c_hash: "code hash",
|
|
638
638
|
client_id: "client id",
|
|
@@ -648,33 +648,33 @@ const At = {
|
|
|
648
648
|
htu: "http uri",
|
|
649
649
|
cnf: "confirmation"
|
|
650
650
|
};
|
|
651
|
-
function
|
|
651
|
+
function Et(t, e) {
|
|
652
652
|
for (const n of t)
|
|
653
653
|
if (e.claims[n] === void 0)
|
|
654
|
-
throw new s(`JWT "${n}" (${
|
|
654
|
+
throw new s(`JWT "${n}" (${kt[n]}) claim missing`);
|
|
655
655
|
return e;
|
|
656
656
|
}
|
|
657
|
-
const
|
|
658
|
-
async function
|
|
659
|
-
const r = await
|
|
660
|
-
if (
|
|
657
|
+
const Rt = Symbol(), F = Symbol();
|
|
658
|
+
async function Pt(t, e, n, o, a) {
|
|
659
|
+
const r = await Te(t, e, n);
|
|
660
|
+
if (G(r))
|
|
661
661
|
return r;
|
|
662
662
|
if (!m(r.id_token))
|
|
663
663
|
throw new s('"response" body "id_token" property must be a non-empty string');
|
|
664
664
|
a ?? (a = e.default_max_age ?? F);
|
|
665
|
-
const i =
|
|
665
|
+
const i = bt(r);
|
|
666
666
|
if ((e.require_auth_time || a !== F) && i.auth_time === void 0)
|
|
667
667
|
throw new s('ID Token "auth_time" (authentication time) claim missing');
|
|
668
668
|
if (a !== F) {
|
|
669
669
|
if (typeof a != "number" || a < 0)
|
|
670
670
|
throw new TypeError('"maxAge" must be a non-negative number');
|
|
671
|
-
const c =
|
|
671
|
+
const c = ee() + H(e), p = ye(e);
|
|
672
672
|
if (i.auth_time + a < c - p)
|
|
673
673
|
throw new s("too much time has elapsed since the last End-User authentication");
|
|
674
674
|
}
|
|
675
675
|
switch (o) {
|
|
676
676
|
case void 0:
|
|
677
|
-
case
|
|
677
|
+
case Rt:
|
|
678
678
|
if (i.nonce !== void 0)
|
|
679
679
|
throw new s('unexpected ID Token "nonce" claim value');
|
|
680
680
|
break;
|
|
@@ -688,26 +688,26 @@ async function Rt(t, e, n, o, a) {
|
|
|
688
688
|
}
|
|
689
689
|
return r;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function te(t) {
|
|
692
692
|
if (t.bodyUsed)
|
|
693
693
|
throw new TypeError('"response" body has been used already');
|
|
694
694
|
}
|
|
695
|
-
async function
|
|
695
|
+
async function Ut(t) {
|
|
696
696
|
if (t.status > 399 && t.status < 500) {
|
|
697
|
-
|
|
697
|
+
te(t);
|
|
698
698
|
try {
|
|
699
699
|
const e = await t.json();
|
|
700
|
-
if (
|
|
700
|
+
if (C(e) && typeof e.error == "string" && e.error.length)
|
|
701
701
|
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;
|
|
702
702
|
} catch {
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function fe(t) {
|
|
707
707
|
if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
|
|
708
708
|
throw new s(`${t.name} modulusLength must be at least 2048 bits`);
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function Lt(t) {
|
|
711
711
|
switch (t) {
|
|
712
712
|
case "P-256":
|
|
713
713
|
return "SHA-256";
|
|
@@ -719,15 +719,15 @@ function Ut(t) {
|
|
|
719
719
|
throw new T();
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
function
|
|
722
|
+
function ke(t) {
|
|
723
723
|
switch (t.algorithm.name) {
|
|
724
724
|
case "ECDSA":
|
|
725
725
|
return {
|
|
726
726
|
name: t.algorithm.name,
|
|
727
|
-
hash:
|
|
727
|
+
hash: Lt(t.algorithm.namedCurve)
|
|
728
728
|
};
|
|
729
729
|
case "RSA-PSS":
|
|
730
|
-
switch (
|
|
730
|
+
switch (fe(t.algorithm), t.algorithm.hash.name) {
|
|
731
731
|
case "SHA-256":
|
|
732
732
|
case "SHA-384":
|
|
733
733
|
case "SHA-512":
|
|
@@ -739,20 +739,20 @@ function Ae(t) {
|
|
|
739
739
|
throw new T();
|
|
740
740
|
}
|
|
741
741
|
case "RSASSA-PKCS1-v1_5":
|
|
742
|
-
return
|
|
742
|
+
return fe(t.algorithm), t.algorithm.name;
|
|
743
743
|
case "Ed448":
|
|
744
744
|
case "Ed25519":
|
|
745
745
|
return t.algorithm.name;
|
|
746
746
|
}
|
|
747
747
|
throw new T();
|
|
748
748
|
}
|
|
749
|
-
const
|
|
750
|
-
async function
|
|
749
|
+
const Ee = Symbol();
|
|
750
|
+
async function xt(t, e, n, o) {
|
|
751
751
|
const a = `${t}.${e}`;
|
|
752
|
-
if (!await crypto.subtle.verify(
|
|
752
|
+
if (!await crypto.subtle.verify(ke(n), n, o, E(a)))
|
|
753
753
|
throw new s("JWT signature verification failed");
|
|
754
754
|
}
|
|
755
|
-
async function
|
|
755
|
+
async function Ct(t, e, n, o, a, r) {
|
|
756
756
|
let { 0: i, 1: c, 2: p, length: w } = t.split(".");
|
|
757
757
|
if (w === 5)
|
|
758
758
|
if (r !== void 0)
|
|
@@ -767,26 +767,26 @@ async function xt(t, e, n, o, a, r) {
|
|
|
767
767
|
} catch (l) {
|
|
768
768
|
throw new s("failed to parse JWT Header body as base64url encoded JSON", { cause: l });
|
|
769
769
|
}
|
|
770
|
-
if (!
|
|
770
|
+
if (!C(f))
|
|
771
771
|
throw new s("JWT Header must be a top level object");
|
|
772
772
|
if (e(f), f.crit !== void 0)
|
|
773
773
|
throw new s('unexpected JWT "crit" header parameter');
|
|
774
|
-
const
|
|
775
|
-
let
|
|
776
|
-
n !==
|
|
774
|
+
const v = k(p);
|
|
775
|
+
let b;
|
|
776
|
+
n !== Ee && (b = await n(f), await xt(i, c, b, v));
|
|
777
777
|
let h;
|
|
778
778
|
try {
|
|
779
779
|
h = JSON.parse(E(k(c)));
|
|
780
780
|
} catch (l) {
|
|
781
781
|
throw new s("failed to parse JWT Payload body as base64url encoded JSON", { cause: l });
|
|
782
782
|
}
|
|
783
|
-
if (!
|
|
783
|
+
if (!C(h))
|
|
784
784
|
throw new s("JWT Payload must be a top level object");
|
|
785
|
-
const
|
|
785
|
+
const P = ee() + o;
|
|
786
786
|
if (h.exp !== void 0) {
|
|
787
787
|
if (typeof h.exp != "number")
|
|
788
788
|
throw new s('unexpected JWT "exp" (expiration time) claim type');
|
|
789
|
-
if (h.exp <=
|
|
789
|
+
if (h.exp <= P - a)
|
|
790
790
|
throw new s('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
|
|
791
791
|
}
|
|
792
792
|
if (h.iat !== void 0 && typeof h.iat != "number")
|
|
@@ -796,14 +796,14 @@ async function xt(t, e, n, o, a, r) {
|
|
|
796
796
|
if (h.nbf !== void 0) {
|
|
797
797
|
if (typeof h.nbf != "number")
|
|
798
798
|
throw new s('unexpected JWT "nbf" (not before) claim type');
|
|
799
|
-
if (h.nbf >
|
|
799
|
+
if (h.nbf > P + a)
|
|
800
800
|
throw new s('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
|
|
801
801
|
}
|
|
802
802
|
if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
|
|
803
803
|
throw new s('unexpected JWT "aud" (audience) claim type');
|
|
804
|
-
return { header: f, claims: h, signature:
|
|
804
|
+
return { header: f, claims: h, signature: v, key: b, jwt: t };
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function It(t, e, n) {
|
|
807
807
|
if (t !== void 0) {
|
|
808
808
|
if (n.alg !== t)
|
|
809
809
|
throw new s('unexpected JWT "alg" header parameter');
|
|
@@ -823,9 +823,9 @@ function A(t, e) {
|
|
|
823
823
|
throw new s(`"${e}" parameter must be provided only once`);
|
|
824
824
|
return n;
|
|
825
825
|
}
|
|
826
|
-
const jt = Symbol(),
|
|
827
|
-
function
|
|
828
|
-
if (
|
|
826
|
+
const jt = Symbol(), Jt = Symbol();
|
|
827
|
+
function Ot(t, e, n, o) {
|
|
828
|
+
if (I(t), j(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
|
|
829
829
|
throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
|
|
830
830
|
if (A(n, "response"))
|
|
831
831
|
throw new s('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
|
|
@@ -836,7 +836,7 @@ function Jt(t, e, n, o) {
|
|
|
836
836
|
throw new s('unexpected "iss" (issuer) response parameter value');
|
|
837
837
|
switch (o) {
|
|
838
838
|
case void 0:
|
|
839
|
-
case
|
|
839
|
+
case Jt:
|
|
840
840
|
if (r !== void 0)
|
|
841
841
|
throw new s('unexpected "state" response parameter encountered');
|
|
842
842
|
break;
|
|
@@ -860,19 +860,19 @@ function Jt(t, e, n, o) {
|
|
|
860
860
|
const c = A(n, "id_token"), p = A(n, "token");
|
|
861
861
|
if (c !== void 0 || p !== void 0)
|
|
862
862
|
throw new T("implicit and hybrid flows are not supported");
|
|
863
|
-
return
|
|
863
|
+
return Tt(new URLSearchParams(n));
|
|
864
864
|
}
|
|
865
|
-
function
|
|
865
|
+
function zt({
|
|
866
866
|
handleCallback: t
|
|
867
867
|
}) {
|
|
868
|
-
const e =
|
|
868
|
+
const e = Je({
|
|
869
869
|
retry: !1,
|
|
870
870
|
queryKey: ["oauth-callback"],
|
|
871
871
|
queryFn: async () => {
|
|
872
872
|
try {
|
|
873
873
|
return await t();
|
|
874
874
|
} catch (n) {
|
|
875
|
-
throw new
|
|
875
|
+
throw new ze("Could not validate user", {
|
|
876
876
|
cause: n,
|
|
877
877
|
title: "Authentication Error",
|
|
878
878
|
developerHint: "Check the configuration of your authorization provider and ensure all settings such as the callback URL are configured correctly."
|
|
@@ -880,17 +880,17 @@ function Ot({
|
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
882
|
});
|
|
883
|
-
return /* @__PURE__ */
|
|
883
|
+
return /* @__PURE__ */ B.jsx(Oe, { to: e.data });
|
|
884
884
|
}
|
|
885
|
-
class
|
|
885
|
+
class R extends Error {
|
|
886
886
|
}
|
|
887
|
-
class
|
|
887
|
+
class pe extends R {
|
|
888
888
|
constructor(e, n, o) {
|
|
889
889
|
super(e, o), this.error = n;
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
|
-
const M = "code-verifier";
|
|
893
|
-
class
|
|
892
|
+
const M = "code-verifier", q = "oauth-state";
|
|
893
|
+
class Dt extends je {
|
|
894
894
|
constructor(e, n) {
|
|
895
895
|
super(), this.callbackUrlPath = e, this.handleCallback = n;
|
|
896
896
|
}
|
|
@@ -899,12 +899,12 @@ class zt extends je {
|
|
|
899
899
|
...super.getRoutes(),
|
|
900
900
|
{
|
|
901
901
|
path: this.callbackUrlPath,
|
|
902
|
-
element: /* @__PURE__ */
|
|
902
|
+
element: /* @__PURE__ */ B.jsx(Ie, { children: /* @__PURE__ */ B.jsx(zt, { handleCallback: this.handleCallback }) })
|
|
903
903
|
}
|
|
904
904
|
];
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
|
-
class
|
|
907
|
+
class Nt {
|
|
908
908
|
constructor({
|
|
909
909
|
issuer: e,
|
|
910
910
|
audience: n,
|
|
@@ -927,7 +927,7 @@ class Dt {
|
|
|
927
927
|
_(this, "audience");
|
|
928
928
|
_(this, "scopes");
|
|
929
929
|
_(this, "signOut", async () => {
|
|
930
|
-
|
|
930
|
+
x.setState({
|
|
931
931
|
isAuthenticated: !1,
|
|
932
932
|
isPending: !1,
|
|
933
933
|
profile: void 0,
|
|
@@ -944,64 +944,67 @@ class Dt {
|
|
|
944
944
|
)) : o = n;
|
|
945
945
|
});
|
|
946
946
|
_(this, "handleCallback", async () => {
|
|
947
|
-
const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(
|
|
948
|
-
if (sessionStorage.removeItem(
|
|
949
|
-
throw new
|
|
950
|
-
const a =
|
|
951
|
-
|
|
947
|
+
const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(q);
|
|
948
|
+
if (sessionStorage.removeItem(q), n !== o)
|
|
949
|
+
throw new R("Invalid state parameter");
|
|
950
|
+
const a = sessionStorage.getItem(M);
|
|
951
|
+
if (sessionStorage.removeItem(M), !a)
|
|
952
|
+
throw new R("No code verifier found in state.");
|
|
953
|
+
const r = await this.getAuthServer(), i = Ot(
|
|
954
|
+
r,
|
|
952
955
|
this.client,
|
|
953
956
|
e.searchParams,
|
|
954
957
|
n ?? void 0
|
|
955
958
|
);
|
|
956
|
-
if (
|
|
957
|
-
throw
|
|
959
|
+
if (G(i))
|
|
960
|
+
throw se.error("Error validating OAuth response", i), new pe(
|
|
958
961
|
"Error validating OAuth response",
|
|
959
|
-
|
|
962
|
+
i
|
|
960
963
|
);
|
|
961
|
-
const
|
|
962
|
-
|
|
963
|
-
const
|
|
964
|
-
|
|
964
|
+
const c = new URL(e);
|
|
965
|
+
c.pathname = this.callbackUrlPath, c.search = "";
|
|
966
|
+
const p = await At(
|
|
967
|
+
r,
|
|
965
968
|
this.client,
|
|
969
|
+
i,
|
|
970
|
+
c.toString(),
|
|
971
|
+
a
|
|
972
|
+
), w = await Pt(
|
|
966
973
|
r,
|
|
967
|
-
i.toString(),
|
|
968
|
-
o
|
|
969
|
-
), p = await Rt(
|
|
970
|
-
a,
|
|
971
974
|
this.client,
|
|
972
|
-
|
|
975
|
+
p
|
|
973
976
|
);
|
|
974
|
-
this.setTokensFromResponse(
|
|
975
|
-
const
|
|
976
|
-
|
|
977
|
+
this.setTokensFromResponse(w);
|
|
978
|
+
const f = await this.getAccessToken(), b = await (await mt(
|
|
979
|
+
r,
|
|
977
980
|
this.client,
|
|
978
|
-
|
|
979
|
-
)).json(),
|
|
980
|
-
sub:
|
|
981
|
-
email:
|
|
982
|
-
name:
|
|
983
|
-
emailVerified:
|
|
984
|
-
pictureUrl:
|
|
981
|
+
f
|
|
982
|
+
)).json(), h = {
|
|
983
|
+
sub: b.sub,
|
|
984
|
+
email: b.email,
|
|
985
|
+
name: b.name,
|
|
986
|
+
emailVerified: b.email_verified ?? !1,
|
|
987
|
+
pictureUrl: b.picture
|
|
985
988
|
};
|
|
986
|
-
|
|
989
|
+
x.setState({
|
|
987
990
|
isAuthenticated: !0,
|
|
988
991
|
isPending: !1,
|
|
989
|
-
profile:
|
|
992
|
+
profile: h
|
|
990
993
|
});
|
|
991
|
-
const
|
|
992
|
-
return sessionStorage.removeItem("redirect-to"),
|
|
994
|
+
const P = sessionStorage.getItem("redirect-to") ?? "/";
|
|
995
|
+
return sessionStorage.removeItem("redirect-to"), P;
|
|
993
996
|
});
|
|
994
997
|
this.client = {
|
|
995
998
|
client_id: o,
|
|
996
999
|
token_endpoint_auth_method: "none"
|
|
997
|
-
}, this.audience = n, this.issuer = e, this.callbackUrlPath =
|
|
998
|
-
const w =
|
|
1000
|
+
}, this.audience = n, this.issuer = e, this.callbackUrlPath = ie(c, "/oauth/callback"), this.scopes = p ?? ["openid", "profile", "email"];
|
|
1001
|
+
const w = ie(c, "/");
|
|
999
1002
|
this.logoutRedirectUrlPath = w, this.redirectToAfterSignUp = a ?? w, this.redirectToAfterSignIn = r ?? w, this.redirectToAfterSignOut = i ?? w;
|
|
1000
1003
|
}
|
|
1001
1004
|
async getAuthServer() {
|
|
1002
1005
|
if (!this.authorizationServer) {
|
|
1003
|
-
const e = new URL(this.issuer), n = await
|
|
1004
|
-
this.authorizationServer = await
|
|
1006
|
+
const e = new URL(this.issuer), n = await et(e);
|
|
1007
|
+
this.authorizationServer = await tt(
|
|
1005
1008
|
e,
|
|
1006
1009
|
n
|
|
1007
1010
|
);
|
|
@@ -1013,10 +1016,10 @@ class Dt {
|
|
|
1013
1016
|
* @param response
|
|
1014
1017
|
*/
|
|
1015
1018
|
setTokensFromResponse(e) {
|
|
1016
|
-
if (
|
|
1017
|
-
throw
|
|
1019
|
+
if (G(e))
|
|
1020
|
+
throw se.error("Bad Token Response", e), new pe("Bad Token Response", e);
|
|
1018
1021
|
if (!e.expires_in)
|
|
1019
|
-
throw new
|
|
1022
|
+
throw new R("No expires_in in response");
|
|
1020
1023
|
const n = {
|
|
1021
1024
|
accessToken: e.access_token,
|
|
1022
1025
|
refreshToken: e.refresh_token,
|
|
@@ -1024,7 +1027,7 @@ class Dt {
|
|
|
1024
1027
|
expiresOn: new Date(Date.now() + e.expires_in * 1e3),
|
|
1025
1028
|
tokenType: e.token_type
|
|
1026
1029
|
};
|
|
1027
|
-
|
|
1030
|
+
x.setState({
|
|
1028
1031
|
providerData: n
|
|
1029
1032
|
});
|
|
1030
1033
|
}
|
|
@@ -1043,64 +1046,62 @@ class Dt {
|
|
|
1043
1046
|
redirectTo: e,
|
|
1044
1047
|
isSignUp: n = !1
|
|
1045
1048
|
}) {
|
|
1046
|
-
var
|
|
1049
|
+
var v;
|
|
1047
1050
|
const o = "S256", a = await this.getAuthServer();
|
|
1048
1051
|
if (!a.authorization_endpoint)
|
|
1049
|
-
throw new
|
|
1050
|
-
const r =
|
|
1052
|
+
throw new R("No authorization endpoint");
|
|
1053
|
+
const r = nt(), i = await ot(r);
|
|
1051
1054
|
sessionStorage.setItem(M, r);
|
|
1052
1055
|
const c = new URL(
|
|
1053
1056
|
a.authorization_endpoint
|
|
1054
1057
|
), p = e.startsWith(window.location.origin) ? e.slice(window.location.origin.length) : e;
|
|
1055
1058
|
sessionStorage.setItem("redirect-to", p);
|
|
1056
1059
|
const w = new URL(window.location.origin);
|
|
1057
|
-
|
|
1060
|
+
w.pathname = this.callbackUrlPath, w.search = "", c.searchParams.set("client_id", this.client.client_id), c.searchParams.set("redirect_uri", w.toString()), c.searchParams.set("response_type", "code"), c.searchParams.set("scope", this.scopes.join(" ")), c.searchParams.set("code_challenge", i), c.searchParams.set(
|
|
1058
1061
|
"code_challenge_method",
|
|
1059
1062
|
o
|
|
1060
|
-
), this.audience && c.searchParams.set("audience", this.audience), (
|
|
1063
|
+
), this.audience && c.searchParams.set("audience", this.audience), (v = this.onAuthorizationUrl) == null || v.call(this, c, {
|
|
1061
1064
|
isSignIn: !n,
|
|
1062
1065
|
isSignUp: n
|
|
1063
|
-
})
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
}
|
|
1067
|
-
location.href = c.href;
|
|
1066
|
+
});
|
|
1067
|
+
const f = rt();
|
|
1068
|
+
sessionStorage.setItem(q, f), c.searchParams.set("state", f), location.href = c.href;
|
|
1068
1069
|
}
|
|
1069
1070
|
async getAccessToken() {
|
|
1070
|
-
const e = await this.getAuthServer(), { providerData: n } =
|
|
1071
|
+
const e = await this.getAuthServer(), { providerData: n } = x.getState();
|
|
1071
1072
|
if (!n)
|
|
1072
|
-
throw new
|
|
1073
|
+
throw new R("User is not authenticated");
|
|
1073
1074
|
const o = n;
|
|
1074
1075
|
if (new Date(o.expiresOn) < /* @__PURE__ */ new Date()) {
|
|
1075
1076
|
if (!o.refreshToken)
|
|
1076
|
-
return
|
|
1077
|
+
return x.setState({
|
|
1077
1078
|
isAuthenticated: !1,
|
|
1078
1079
|
isPending: !1,
|
|
1079
1080
|
profile: null,
|
|
1080
1081
|
providerData: null
|
|
1081
1082
|
}), "";
|
|
1082
|
-
const a = await
|
|
1083
|
+
const a = await yt(
|
|
1083
1084
|
e,
|
|
1084
1085
|
this.client,
|
|
1085
1086
|
o.refreshToken
|
|
1086
|
-
), r = await
|
|
1087
|
+
), r = await _t(
|
|
1087
1088
|
e,
|
|
1088
1089
|
this.client,
|
|
1089
1090
|
a
|
|
1090
1091
|
);
|
|
1091
1092
|
if (!r.access_token)
|
|
1092
|
-
throw new
|
|
1093
|
+
throw new R("No access token in response");
|
|
1093
1094
|
return this.setTokensFromResponse(r), r.access_token.toString();
|
|
1094
1095
|
} else
|
|
1095
1096
|
return o.accessToken;
|
|
1096
1097
|
}
|
|
1097
1098
|
getAuthenticationPlugin() {
|
|
1098
|
-
return new
|
|
1099
|
+
return new Dt(this.callbackUrlPath, this.handleCallback);
|
|
1099
1100
|
}
|
|
1100
1101
|
}
|
|
1101
|
-
const
|
|
1102
|
+
const Gt = (t) => new Nt(t);
|
|
1102
1103
|
export {
|
|
1103
|
-
|
|
1104
|
-
|
|
1104
|
+
Nt as OpenIDAuthenticationProvider,
|
|
1105
|
+
Gt as default
|
|
1105
1106
|
};
|
|
1106
1107
|
//# sourceMappingURL=zudoku.auth-openid.js.map
|