zudoku 0.7.2-dev.2 → 0.8.0
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/cli/dev/handler.js +5 -0
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/vite/config.d.ts +2 -2
- package/dist/vite/config.js +21 -20
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/config.test.js +1 -4
- package/dist/vite/config.test.js.map +1 -1
- package/dist/vite/dev-server.js +1 -4
- package/dist/vite/dev-server.js.map +1 -1
- package/lib/AuthenticationPlugin-Bx9FK124.js +55 -0
- package/lib/{AuthenticationPlugin-BMjOjKqE.js.map → AuthenticationPlugin-Bx9FK124.js.map} +1 -1
- package/lib/CategoryHeading-XnFqN2lJ.js +10 -0
- package/lib/{CategoryHeading-BE8e6QdS.js.map → CategoryHeading-XnFqN2lJ.js.map} +1 -1
- package/lib/DeveloperHint-FBb2uXJe.js +16 -0
- package/lib/{DeveloperHint-Bl9gIdNI.js.map → DeveloperHint-FBb2uXJe.js.map} +1 -1
- package/lib/ErrorPage-knunPbKI.js +18 -0
- package/lib/{ErrorPage-CPR1XVKW.js.map → ErrorPage-knunPbKI.js.map} +1 -1
- package/lib/Input-BEDZAKw0.js +2198 -0
- package/lib/{Input-BBlyeDuG.js.map → Input-BEDZAKw0.js.map} +1 -1
- package/lib/{Markdown-CCNihH_N.js → Markdown-B4aR03g6.js} +2650 -2641
- package/lib/{Markdown-CCNihH_N.js.map → Markdown-B4aR03g6.js.map} +1 -1
- package/lib/MdxPage-BZyQsH8Z.js +172 -0
- package/lib/{MdxPage-BavkYqzi.js.map → MdxPage-BZyQsH8Z.js.map} +1 -1
- package/lib/OperationList-2NeWEM0u.js +560 -0
- package/lib/{OperationList-C6Ps2keZ.js.map → OperationList-2NeWEM0u.js.map} +1 -1
- package/lib/Route-BZPewmrN.js +14 -0
- package/lib/{Route-xRJ9mJgH.js.map → Route-BZPewmrN.js.map} +1 -1
- package/lib/{SidebarBadge-2JcxswKF.js → SidebarBadge-COz0hgfa.js} +41 -41
- package/lib/{SidebarBadge-2JcxswKF.js.map → SidebarBadge-COz0hgfa.js.map} +1 -1
- package/lib/SlotletProvider-DJMaOUDs.js +238 -0
- package/lib/{SlotletProvider-CuB3Ts8r.js.map → SlotletProvider-DJMaOUDs.js.map} +1 -1
- package/lib/Spinner-3cQDBVGr.js +7 -0
- package/lib/Spinner-3cQDBVGr.js.map +1 -0
- package/lib/{ZudokuContext-JoyeA9dT.js → ZudokuContext-cr-pTRY1.js} +66 -65
- package/lib/{ZudokuContext-JoyeA9dT.js.map → ZudokuContext-cr-pTRY1.js.map} +1 -1
- package/lib/{index-G1-TGLO1.js → index-1EDgIO6b.js} +4 -4
- package/lib/{index-G1-TGLO1.js.map → index-1EDgIO6b.js.map} +1 -1
- package/lib/index-BG0g4WW0.js +1771 -0
- package/lib/index-BG0g4WW0.js.map +1 -0
- package/lib/{index-BF4cn28H.js → index-Dv2KZuEw.js} +1991 -1804
- package/lib/{index-BF4cn28H.js.map → index-Dv2KZuEw.js.map} +1 -1
- package/lib/{index-BLvMkqjO.js → index-Zezcv0xb.js} +5 -5
- package/lib/{index-BLvMkqjO.js.map → index-Zezcv0xb.js.map} +1 -1
- package/lib/jsx-runtime-B6kdoens.js +635 -0
- package/lib/jsx-runtime-B6kdoens.js.map +1 -0
- package/lib/{utils-B8R4grFM.js → utils-ByIc_KIM.js} +98 -97
- package/lib/{utils-B8R4grFM.js.map → utils-ByIc_KIM.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +21 -16
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +37 -32
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +505 -485
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +1659 -1531
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +214 -150
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-page.js +6 -5
- package/lib/zudoku.plugin-custom-page.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +13 -12
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +8 -7
- package/lib/zudoku.plugin-openapi.js.map +1 -1
- package/lib/zudoku.plugin-search-inkeep.js +21 -20
- package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
- package/package.json +2 -2
- package/dist/lib/util/fetchTimeout.d.ts +0 -1
- package/dist/lib/util/fetchTimeout.js +0 -14
- package/dist/lib/util/fetchTimeout.js.map +0 -1
- package/dist/vite/esbuild-yaml.d.ts +0 -2
- package/dist/vite/esbuild-yaml.js +0 -50
- package/dist/vite/esbuild-yaml.js.map +0 -1
- package/dist/vite/plugin-vercel.d.ts +0 -3
- package/dist/vite/plugin-vercel.js +0 -8
- package/dist/vite/plugin-vercel.js.map +0 -1
- package/dist/vite/plugin-yaml.d.ts +0 -3
- package/dist/vite/plugin-yaml.js +0 -24
- package/dist/vite/plugin-yaml.js.map +0 -1
- package/dist/vite/sitemap.d.ts +0 -19
- package/dist/vite/sitemap.js +0 -36
- package/dist/vite/sitemap.js.map +0 -1
- package/lib/AuthenticationPlugin-BMjOjKqE.js +0 -54
- package/lib/CategoryHeading-BE8e6QdS.js +0 -9
- package/lib/DeveloperHint-Bl9gIdNI.js +0 -12
- package/lib/ErrorPage-CPR1XVKW.js +0 -12
- package/lib/Input-BBlyeDuG.js +0 -2192
- package/lib/MdxPage-BavkYqzi.js +0 -140
- package/lib/OperationList-C6Ps2keZ.js +0 -460
- package/lib/Route-xRJ9mJgH.js +0 -13
- package/lib/SlotletProvider-CuB3Ts8r.js +0 -213
- package/lib/Spinner-BlxzaFFF.js +0 -6
- package/lib/Spinner-BlxzaFFF.js.map +0 -1
- package/lib/jsx-runtime-lNnQYwFN.js +0 -2403
- package/lib/jsx-runtime-lNnQYwFN.js.map +0 -1
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
var Ue = Object.defineProperty;
|
|
2
|
+
var Le = (t, e, r) => e in t ? Ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var _ = (t, e, r) => Le(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { j as E } from "./jsx-runtime-B6kdoens.js";
|
|
5
|
+
import { c as Ce, g as Ie } from "./_commonjsHelpers-BkfeUUK-.js";
|
|
6
|
+
import { A as je } from "./AuthenticationPlugin-Bx9FK124.js";
|
|
7
|
+
import { useState as Je, useRef as Oe, useEffect as Ne } from "react";
|
|
8
|
+
import { D as ze } from "./DeveloperHint-FBb2uXJe.js";
|
|
9
|
+
import { E as De } from "./ErrorPage-knunPbKI.js";
|
|
10
|
+
import { S as Ke } from "./Spinner-3cQDBVGr.js";
|
|
11
|
+
import { S as We } from "./Markdown-B4aR03g6.js";
|
|
12
|
+
import { a as He } from "./index-BG0g4WW0.js";
|
|
13
|
+
import { u as z } from "./state-lIwt9isb.js";
|
|
14
|
+
var fe = { exports: {} };
|
|
11
15
|
(function(t) {
|
|
12
|
-
(function(e,
|
|
13
|
-
t.exports ? t.exports =
|
|
14
|
-
})(
|
|
16
|
+
(function(e, r) {
|
|
17
|
+
t.exports ? t.exports = r() : e.log = r();
|
|
18
|
+
})(Ce, function() {
|
|
15
19
|
var e = function() {
|
|
16
|
-
},
|
|
20
|
+
}, r = "undefined", o = typeof window !== r && typeof window.navigator !== r && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
|
|
17
21
|
"trace",
|
|
18
22
|
"debug",
|
|
19
23
|
"info",
|
|
20
24
|
"warn",
|
|
21
25
|
"error"
|
|
22
|
-
],
|
|
23
|
-
function u(l,
|
|
24
|
-
var c = l[
|
|
26
|
+
], n = {}, i = null;
|
|
27
|
+
function u(l, w) {
|
|
28
|
+
var c = l[w];
|
|
25
29
|
if (typeof c.bind == "function")
|
|
26
30
|
return c.bind(l);
|
|
27
31
|
try {
|
|
@@ -32,80 +36,80 @@ var he = { exports: {} };
|
|
|
32
36
|
};
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
|
-
function
|
|
39
|
+
function f() {
|
|
36
40
|
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
37
41
|
}
|
|
38
|
-
function
|
|
39
|
-
return l === "debug" && (l = "log"), typeof console ===
|
|
42
|
+
function m(l) {
|
|
43
|
+
return l === "debug" && (l = "log"), typeof console === r ? !1 : l === "trace" && o ? f : console[l] !== void 0 ? u(console, l) : console.log !== void 0 ? u(console, "log") : e;
|
|
40
44
|
}
|
|
41
|
-
function
|
|
42
|
-
for (var l = this.getLevel(),
|
|
43
|
-
var c = s[
|
|
44
|
-
this[c] =
|
|
45
|
+
function y() {
|
|
46
|
+
for (var l = this.getLevel(), w = 0; w < s.length; w++) {
|
|
47
|
+
var c = s[w];
|
|
48
|
+
this[c] = w < l ? e : this.methodFactory(c, l, this.name);
|
|
45
49
|
}
|
|
46
|
-
if (this.log = this.debug, typeof console ===
|
|
50
|
+
if (this.log = this.debug, typeof console === r && l < this.levels.SILENT)
|
|
47
51
|
return "No console available for logging";
|
|
48
52
|
}
|
|
49
53
|
function b(l) {
|
|
50
54
|
return function() {
|
|
51
|
-
typeof console !==
|
|
55
|
+
typeof console !== r && (y.call(this), this[l].apply(this, arguments));
|
|
52
56
|
};
|
|
53
57
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
58
|
+
function h(l, w, c) {
|
|
59
|
+
return m(l) || b.apply(this, arguments);
|
|
56
60
|
}
|
|
57
|
-
function
|
|
58
|
-
var c = this,
|
|
59
|
-
typeof l == "string" ?
|
|
60
|
-
function
|
|
61
|
-
var
|
|
62
|
-
if (!(typeof window ===
|
|
61
|
+
function R(l, w) {
|
|
62
|
+
var c = this, O, B, x, v = "loglevel";
|
|
63
|
+
typeof l == "string" ? v += ":" + l : typeof l == "symbol" && (v = void 0);
|
|
64
|
+
function Re(d) {
|
|
65
|
+
var g = (s[d] || "silent").toUpperCase();
|
|
66
|
+
if (!(typeof window === r || !v)) {
|
|
63
67
|
try {
|
|
64
|
-
window.localStorage[
|
|
68
|
+
window.localStorage[v] = g;
|
|
65
69
|
return;
|
|
66
70
|
} catch {
|
|
67
71
|
}
|
|
68
72
|
try {
|
|
69
|
-
window.document.cookie = encodeURIComponent(
|
|
73
|
+
window.document.cookie = encodeURIComponent(v) + "=" + g + ";";
|
|
70
74
|
} catch {
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
|
-
function
|
|
75
|
-
var
|
|
76
|
-
if (!(typeof window ===
|
|
78
|
+
function ne() {
|
|
79
|
+
var d;
|
|
80
|
+
if (!(typeof window === r || !v)) {
|
|
77
81
|
try {
|
|
78
|
-
|
|
82
|
+
d = window.localStorage[v];
|
|
79
83
|
} catch {
|
|
80
84
|
}
|
|
81
|
-
if (typeof
|
|
85
|
+
if (typeof d === r)
|
|
82
86
|
try {
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
var g = window.document.cookie, N = encodeURIComponent(v), ie = g.indexOf(N + "=");
|
|
88
|
+
ie !== -1 && (d = /^([^;]+)/.exec(
|
|
89
|
+
g.slice(ie + N.length + 1)
|
|
86
90
|
)[1]);
|
|
87
91
|
} catch {
|
|
88
92
|
}
|
|
89
|
-
return c.levels[
|
|
93
|
+
return c.levels[d] === void 0 && (d = void 0), d;
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
|
-
function
|
|
93
|
-
if (!(typeof window ===
|
|
96
|
+
function Pe() {
|
|
97
|
+
if (!(typeof window === r || !v)) {
|
|
94
98
|
try {
|
|
95
|
-
window.localStorage.removeItem(
|
|
99
|
+
window.localStorage.removeItem(v);
|
|
96
100
|
} catch {
|
|
97
101
|
}
|
|
98
102
|
try {
|
|
99
|
-
window.document.cookie = encodeURIComponent(
|
|
103
|
+
window.document.cookie = encodeURIComponent(v) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
100
104
|
} catch {
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
|
-
function
|
|
105
|
-
var
|
|
106
|
-
if (typeof
|
|
107
|
-
return
|
|
108
|
-
throw new TypeError("log.setLevel() called with invalid level: " +
|
|
108
|
+
function L(d) {
|
|
109
|
+
var g = d;
|
|
110
|
+
if (typeof g == "string" && c.levels[g.toUpperCase()] !== void 0 && (g = c.levels[g.toUpperCase()]), typeof g == "number" && g >= 0 && g <= c.levels.SILENT)
|
|
111
|
+
return g;
|
|
112
|
+
throw new TypeError("log.setLevel() called with invalid level: " + d);
|
|
109
113
|
}
|
|
110
114
|
c.name = l, c.levels = {
|
|
111
115
|
TRACE: 0,
|
|
@@ -114,51 +118,51 @@ var he = { exports: {} };
|
|
|
114
118
|
WARN: 3,
|
|
115
119
|
ERROR: 4,
|
|
116
120
|
SILENT: 5
|
|
117
|
-
}, c.methodFactory =
|
|
118
|
-
return
|
|
119
|
-
}, c.setLevel = function(
|
|
120
|
-
return
|
|
121
|
-
}, c.setDefaultLevel = function(
|
|
122
|
-
|
|
121
|
+
}, c.methodFactory = w || h, c.getLevel = function() {
|
|
122
|
+
return x ?? B ?? O;
|
|
123
|
+
}, c.setLevel = function(d, g) {
|
|
124
|
+
return x = L(d), g !== !1 && Re(x), y.call(c);
|
|
125
|
+
}, c.setDefaultLevel = function(d) {
|
|
126
|
+
B = L(d), ne() || c.setLevel(d, !1);
|
|
123
127
|
}, c.resetLevel = function() {
|
|
124
|
-
|
|
125
|
-
}, c.enableAll = function(
|
|
126
|
-
c.setLevel(c.levels.TRACE,
|
|
127
|
-
}, c.disableAll = function(
|
|
128
|
-
c.setLevel(c.levels.SILENT,
|
|
128
|
+
x = null, Pe(), y.call(c);
|
|
129
|
+
}, c.enableAll = function(d) {
|
|
130
|
+
c.setLevel(c.levels.TRACE, d);
|
|
131
|
+
}, c.disableAll = function(d) {
|
|
132
|
+
c.setLevel(c.levels.SILENT, d);
|
|
129
133
|
}, c.rebuild = function() {
|
|
130
|
-
if (i !== c && (
|
|
131
|
-
for (var
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
+
if (i !== c && (O = L(i.getLevel())), y.call(c), i === c)
|
|
135
|
+
for (var d in n)
|
|
136
|
+
n[d].rebuild();
|
|
137
|
+
}, O = L(
|
|
134
138
|
i ? i.getLevel() : "WARN"
|
|
135
139
|
);
|
|
136
|
-
var
|
|
137
|
-
|
|
140
|
+
var oe = ne();
|
|
141
|
+
oe != null && (x = L(oe)), y.call(c);
|
|
138
142
|
}
|
|
139
|
-
i = new
|
|
140
|
-
if (typeof
|
|
143
|
+
i = new R(), i.getLogger = function(w) {
|
|
144
|
+
if (typeof w != "symbol" && typeof w != "string" || w === "")
|
|
141
145
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
142
|
-
var c =
|
|
143
|
-
return c || (c =
|
|
144
|
-
|
|
146
|
+
var c = n[w];
|
|
147
|
+
return c || (c = n[w] = new R(
|
|
148
|
+
w,
|
|
145
149
|
i.methodFactory
|
|
146
150
|
)), c;
|
|
147
151
|
};
|
|
148
|
-
var
|
|
152
|
+
var P = typeof window !== r ? window.log : void 0;
|
|
149
153
|
return i.noConflict = function() {
|
|
150
|
-
return typeof window !==
|
|
154
|
+
return typeof window !== r && window.log === i && (window.log = P), i;
|
|
151
155
|
}, i.getLoggers = function() {
|
|
152
|
-
return
|
|
156
|
+
return n;
|
|
153
157
|
}, i.default = i, i;
|
|
154
158
|
});
|
|
155
|
-
})(
|
|
156
|
-
var
|
|
157
|
-
const
|
|
158
|
-
let
|
|
159
|
-
var
|
|
160
|
-
(typeof navigator > "u" || !((
|
|
161
|
-
function
|
|
159
|
+
})(fe);
|
|
160
|
+
var $e = fe.exports;
|
|
161
|
+
const K = /* @__PURE__ */ Ie($e);
|
|
162
|
+
let Y;
|
|
163
|
+
var D, he;
|
|
164
|
+
(typeof navigator > "u" || !((he = (D = navigator.userAgent) == null ? void 0 : D.startsWith) != null && he.call(D, "Mozilla/5.0 "))) && (Y = "oauth4webapi/v2.11.1");
|
|
165
|
+
function Q(t, e) {
|
|
162
166
|
if (t == null)
|
|
163
167
|
return !1;
|
|
164
168
|
try {
|
|
@@ -167,183 +171,183 @@ function Y(t, e) {
|
|
|
167
171
|
return !1;
|
|
168
172
|
}
|
|
169
173
|
}
|
|
170
|
-
const
|
|
171
|
-
function
|
|
172
|
-
return typeof t == "string" ?
|
|
174
|
+
const H = Symbol(), Fe = Symbol(), X = Symbol(), Me = new TextEncoder(), Be = new TextDecoder();
|
|
175
|
+
function A(t) {
|
|
176
|
+
return typeof t == "string" ? Me.encode(t) : Be.decode(t);
|
|
173
177
|
}
|
|
174
|
-
const
|
|
175
|
-
function
|
|
178
|
+
const se = 32768;
|
|
179
|
+
function qe(t) {
|
|
176
180
|
t instanceof ArrayBuffer && (t = new Uint8Array(t));
|
|
177
181
|
const e = [];
|
|
178
|
-
for (let
|
|
179
|
-
e.push(String.fromCharCode.apply(null, t.subarray(
|
|
182
|
+
for (let r = 0; r < t.byteLength; r += se)
|
|
183
|
+
e.push(String.fromCharCode.apply(null, t.subarray(r, r + se)));
|
|
180
184
|
return btoa(e.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
181
185
|
}
|
|
182
|
-
function
|
|
186
|
+
function Ge(t) {
|
|
183
187
|
try {
|
|
184
|
-
const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")),
|
|
188
|
+
const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), r = new Uint8Array(e.length);
|
|
185
189
|
for (let o = 0; o < e.length; o++)
|
|
186
|
-
|
|
187
|
-
return
|
|
190
|
+
r[o] = e.charCodeAt(o);
|
|
191
|
+
return r;
|
|
188
192
|
} catch (e) {
|
|
189
193
|
throw new a("The input to be decoded is not correctly encoded.", { cause: e });
|
|
190
194
|
}
|
|
191
195
|
}
|
|
192
|
-
function
|
|
193
|
-
return typeof t == "string" ?
|
|
196
|
+
function k(t) {
|
|
197
|
+
return typeof t == "string" ? Ge(t) : qe(t);
|
|
194
198
|
}
|
|
195
|
-
class
|
|
199
|
+
class Ve {
|
|
196
200
|
constructor(e) {
|
|
197
201
|
this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = e;
|
|
198
202
|
}
|
|
199
203
|
get(e) {
|
|
200
|
-
let
|
|
201
|
-
if (
|
|
202
|
-
return
|
|
203
|
-
if (
|
|
204
|
-
return this.update(e,
|
|
204
|
+
let r = this.cache.get(e);
|
|
205
|
+
if (r)
|
|
206
|
+
return r;
|
|
207
|
+
if (r = this._cache.get(e))
|
|
208
|
+
return this.update(e, r), r;
|
|
205
209
|
}
|
|
206
210
|
has(e) {
|
|
207
211
|
return this.cache.has(e) || this._cache.has(e);
|
|
208
212
|
}
|
|
209
|
-
set(e,
|
|
210
|
-
return this.cache.has(e) ? this.cache.set(e,
|
|
213
|
+
set(e, r) {
|
|
214
|
+
return this.cache.has(e) ? this.cache.set(e, r) : this.update(e, r), this;
|
|
211
215
|
}
|
|
212
216
|
delete(e) {
|
|
213
217
|
return this.cache.has(e) ? this.cache.delete(e) : this._cache.has(e) ? this._cache.delete(e) : !1;
|
|
214
218
|
}
|
|
215
|
-
update(e,
|
|
216
|
-
this.cache.set(e,
|
|
219
|
+
update(e, r) {
|
|
220
|
+
this.cache.set(e, r), this.cache.size >= this.maxSize && (this._cache = this.cache, this.cache = /* @__PURE__ */ new Map());
|
|
217
221
|
}
|
|
218
222
|
}
|
|
219
|
-
class
|
|
223
|
+
class S extends Error {
|
|
220
224
|
constructor(e) {
|
|
221
|
-
var
|
|
222
|
-
super(e ?? "operation not supported"), this.name = this.constructor.name, (
|
|
225
|
+
var r;
|
|
226
|
+
super(e ?? "operation not supported"), this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
|
|
223
227
|
}
|
|
224
228
|
}
|
|
225
|
-
class
|
|
226
|
-
constructor(e,
|
|
229
|
+
class Ye extends Error {
|
|
230
|
+
constructor(e, r) {
|
|
227
231
|
var o;
|
|
228
|
-
super(e,
|
|
232
|
+
super(e, r), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
|
|
229
233
|
}
|
|
230
234
|
}
|
|
231
|
-
const a =
|
|
232
|
-
function
|
|
235
|
+
const a = Ye, pe = new Ve(100);
|
|
236
|
+
function we(t) {
|
|
233
237
|
return t instanceof CryptoKey;
|
|
234
238
|
}
|
|
235
|
-
function
|
|
236
|
-
return
|
|
239
|
+
function ge(t) {
|
|
240
|
+
return we(t) && t.type === "private";
|
|
237
241
|
}
|
|
238
|
-
function
|
|
239
|
-
return
|
|
242
|
+
function Ze(t) {
|
|
243
|
+
return we(t) && t.type === "public";
|
|
240
244
|
}
|
|
241
|
-
function
|
|
245
|
+
function ee(t) {
|
|
242
246
|
try {
|
|
243
247
|
const e = t.headers.get("dpop-nonce");
|
|
244
|
-
e &&
|
|
248
|
+
e && pe.set(new URL(t.url).origin, e);
|
|
245
249
|
} catch {
|
|
246
250
|
}
|
|
247
251
|
return t;
|
|
248
252
|
}
|
|
249
|
-
function
|
|
253
|
+
function C(t) {
|
|
250
254
|
return !(t === null || typeof t != "object" || Array.isArray(t));
|
|
251
255
|
}
|
|
252
|
-
function
|
|
253
|
-
|
|
256
|
+
function $(t) {
|
|
257
|
+
Q(t, Headers) && (t = Object.fromEntries(t.entries()));
|
|
254
258
|
const e = new Headers(t);
|
|
255
|
-
if (
|
|
259
|
+
if (Y && !e.has("user-agent") && e.set("user-agent", Y), e.has("authorization"))
|
|
256
260
|
throw new TypeError('"options.headers" must not include the "authorization" header name');
|
|
257
261
|
if (e.has("dpop"))
|
|
258
262
|
throw new TypeError('"options.headers" must not include the "dpop" header name');
|
|
259
263
|
return e;
|
|
260
264
|
}
|
|
261
|
-
function
|
|
265
|
+
function te(t) {
|
|
262
266
|
if (typeof t == "function" && (t = t()), !(t instanceof AbortSignal))
|
|
263
267
|
throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
|
|
264
268
|
return t;
|
|
265
269
|
}
|
|
266
|
-
async function
|
|
270
|
+
async function Qe(t, e) {
|
|
267
271
|
if (!(t instanceof URL))
|
|
268
272
|
throw new TypeError('"issuerIdentifier" must be an instance of URL');
|
|
269
273
|
if (t.protocol !== "https:" && t.protocol !== "http:")
|
|
270
274
|
throw new TypeError('"issuer.protocol" must be "https:" or "http:"');
|
|
271
|
-
const
|
|
275
|
+
const r = new URL(t.href);
|
|
272
276
|
switch (e == null ? void 0 : e.algorithm) {
|
|
273
277
|
case void 0:
|
|
274
278
|
case "oidc":
|
|
275
|
-
|
|
279
|
+
r.pathname = `${r.pathname}/.well-known/openid-configuration`.replace("//", "/");
|
|
276
280
|
break;
|
|
277
281
|
case "oauth2":
|
|
278
|
-
|
|
282
|
+
r.pathname === "/" ? r.pathname = ".well-known/oauth-authorization-server" : r.pathname = `.well-known/oauth-authorization-server/${r.pathname}`.replace("//", "/");
|
|
279
283
|
break;
|
|
280
284
|
default:
|
|
281
285
|
throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
|
|
282
286
|
}
|
|
283
|
-
const o =
|
|
284
|
-
return o.set("accept", "application/json"), ((e == null ? void 0 : e[
|
|
287
|
+
const o = $(e == null ? void 0 : e.headers);
|
|
288
|
+
return o.set("accept", "application/json"), ((e == null ? void 0 : e[X]) || fetch)(r.href, {
|
|
285
289
|
headers: Object.fromEntries(o.entries()),
|
|
286
290
|
method: "GET",
|
|
287
291
|
redirect: "manual",
|
|
288
|
-
signal: e != null && e.signal ?
|
|
289
|
-
}).then(
|
|
292
|
+
signal: e != null && e.signal ? te(e.signal) : null
|
|
293
|
+
}).then(ee);
|
|
290
294
|
}
|
|
291
|
-
function
|
|
295
|
+
function p(t) {
|
|
292
296
|
return typeof t == "string" && t.length !== 0;
|
|
293
297
|
}
|
|
294
|
-
async function
|
|
298
|
+
async function Xe(t, e) {
|
|
295
299
|
if (!(t instanceof URL))
|
|
296
300
|
throw new TypeError('"expectedIssuer" must be an instance of URL');
|
|
297
|
-
if (!
|
|
301
|
+
if (!Q(e, Response))
|
|
298
302
|
throw new TypeError('"response" must be an instance of Response');
|
|
299
303
|
if (e.status !== 200)
|
|
300
304
|
throw new a('"response" is not a conform Authorization Server Metadata response');
|
|
301
|
-
|
|
302
|
-
let
|
|
305
|
+
re(e);
|
|
306
|
+
let r;
|
|
303
307
|
try {
|
|
304
|
-
|
|
308
|
+
r = await e.json();
|
|
305
309
|
} catch (o) {
|
|
306
310
|
throw new a('failed to parse "response" body as JSON', { cause: o });
|
|
307
311
|
}
|
|
308
|
-
if (!
|
|
312
|
+
if (!C(r))
|
|
309
313
|
throw new a('"response" body must be a top level object');
|
|
310
|
-
if (!
|
|
314
|
+
if (!p(r.issuer))
|
|
311
315
|
throw new a('"response" body "issuer" property must be a non-empty string');
|
|
312
|
-
if (new URL(
|
|
316
|
+
if (new URL(r.issuer).href !== t.href)
|
|
313
317
|
throw new a('"response" body "issuer" does not match "expectedIssuer"');
|
|
314
|
-
return
|
|
318
|
+
return r;
|
|
315
319
|
}
|
|
316
|
-
function
|
|
317
|
-
return
|
|
320
|
+
function F() {
|
|
321
|
+
return k(crypto.getRandomValues(new Uint8Array(32)));
|
|
318
322
|
}
|
|
319
|
-
function
|
|
320
|
-
return
|
|
323
|
+
function et() {
|
|
324
|
+
return F();
|
|
321
325
|
}
|
|
322
|
-
function
|
|
323
|
-
return
|
|
326
|
+
function tt() {
|
|
327
|
+
return F();
|
|
324
328
|
}
|
|
325
|
-
async function
|
|
326
|
-
if (!
|
|
329
|
+
async function rt(t) {
|
|
330
|
+
if (!p(t))
|
|
327
331
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
328
|
-
return
|
|
332
|
+
return k(await crypto.subtle.digest("SHA-256", A(t)));
|
|
329
333
|
}
|
|
330
|
-
function
|
|
334
|
+
function nt(t) {
|
|
331
335
|
if (t instanceof CryptoKey)
|
|
332
336
|
return { key: t };
|
|
333
337
|
if (!((t == null ? void 0 : t.key) instanceof CryptoKey))
|
|
334
338
|
return {};
|
|
335
|
-
if (t.kid !== void 0 && !
|
|
339
|
+
if (t.kid !== void 0 && !p(t.kid))
|
|
336
340
|
throw new TypeError('"kid" must be a non-empty string');
|
|
337
341
|
return { key: t.key, kid: t.kid };
|
|
338
342
|
}
|
|
339
|
-
function
|
|
343
|
+
function ae(t) {
|
|
340
344
|
return encodeURIComponent(t).replace(/%20/g, "+");
|
|
341
345
|
}
|
|
342
|
-
function
|
|
343
|
-
const
|
|
344
|
-
return `Basic ${btoa(`${
|
|
346
|
+
function ot(t, e) {
|
|
347
|
+
const r = ae(t), o = ae(e);
|
|
348
|
+
return `Basic ${btoa(`${r}:${o}`)}`;
|
|
345
349
|
}
|
|
346
|
-
function
|
|
350
|
+
function it(t) {
|
|
347
351
|
switch (t.algorithm.hash.name) {
|
|
348
352
|
case "SHA-256":
|
|
349
353
|
return "PS256";
|
|
@@ -352,10 +356,10 @@ function tt(t) {
|
|
|
352
356
|
case "SHA-512":
|
|
353
357
|
return "PS512";
|
|
354
358
|
default:
|
|
355
|
-
throw new
|
|
359
|
+
throw new S("unsupported RsaHashedKeyAlgorithm hash name");
|
|
356
360
|
}
|
|
357
361
|
}
|
|
358
|
-
function
|
|
362
|
+
function st(t) {
|
|
359
363
|
switch (t.algorithm.hash.name) {
|
|
360
364
|
case "SHA-256":
|
|
361
365
|
return "RS256";
|
|
@@ -364,10 +368,10 @@ function nt(t) {
|
|
|
364
368
|
case "SHA-512":
|
|
365
369
|
return "RS512";
|
|
366
370
|
default:
|
|
367
|
-
throw new
|
|
371
|
+
throw new S("unsupported RsaHashedKeyAlgorithm hash name");
|
|
368
372
|
}
|
|
369
373
|
}
|
|
370
|
-
function
|
|
374
|
+
function at(t) {
|
|
371
375
|
switch (t.algorithm.namedCurve) {
|
|
372
376
|
case "P-256":
|
|
373
377
|
return "ES256";
|
|
@@ -376,259 +380,259 @@ function rt(t) {
|
|
|
376
380
|
case "P-521":
|
|
377
381
|
return "ES512";
|
|
378
382
|
default:
|
|
379
|
-
throw new
|
|
383
|
+
throw new S("unsupported EcKeyAlgorithm namedCurve");
|
|
380
384
|
}
|
|
381
385
|
}
|
|
382
|
-
function
|
|
386
|
+
function me(t) {
|
|
383
387
|
switch (t.algorithm.name) {
|
|
384
388
|
case "RSA-PSS":
|
|
385
|
-
return
|
|
389
|
+
return it(t);
|
|
386
390
|
case "RSASSA-PKCS1-v1_5":
|
|
387
|
-
return
|
|
391
|
+
return st(t);
|
|
388
392
|
case "ECDSA":
|
|
389
|
-
return
|
|
393
|
+
return at(t);
|
|
390
394
|
case "Ed25519":
|
|
391
395
|
case "Ed448":
|
|
392
396
|
return "EdDSA";
|
|
393
397
|
default:
|
|
394
|
-
throw new
|
|
398
|
+
throw new S("unsupported CryptoKey algorithm name");
|
|
395
399
|
}
|
|
396
400
|
}
|
|
397
401
|
function I(t) {
|
|
398
|
-
const e = t == null ? void 0 : t[
|
|
402
|
+
const e = t == null ? void 0 : t[H];
|
|
399
403
|
return typeof e == "number" && Number.isFinite(e) ? e : 0;
|
|
400
404
|
}
|
|
401
|
-
function
|
|
402
|
-
const e = t == null ? void 0 : t[
|
|
405
|
+
function ye(t) {
|
|
406
|
+
const e = t == null ? void 0 : t[Fe];
|
|
403
407
|
return typeof e == "number" && Number.isFinite(e) && Math.sign(e) !== -1 ? e : 30;
|
|
404
408
|
}
|
|
405
|
-
function
|
|
409
|
+
function M() {
|
|
406
410
|
return Math.floor(Date.now() / 1e3);
|
|
407
411
|
}
|
|
408
|
-
function
|
|
409
|
-
const
|
|
412
|
+
function ct(t, e) {
|
|
413
|
+
const r = M() + I(e);
|
|
410
414
|
return {
|
|
411
|
-
jti:
|
|
415
|
+
jti: F(),
|
|
412
416
|
aud: [t.issuer, t.token_endpoint],
|
|
413
|
-
exp:
|
|
414
|
-
iat:
|
|
415
|
-
nbf:
|
|
417
|
+
exp: r + 60,
|
|
418
|
+
iat: r,
|
|
419
|
+
nbf: r,
|
|
416
420
|
iss: e.client_id,
|
|
417
421
|
sub: e.client_id
|
|
418
422
|
};
|
|
419
423
|
}
|
|
420
|
-
async function
|
|
421
|
-
return
|
|
422
|
-
alg:
|
|
424
|
+
async function ut(t, e, r, o) {
|
|
425
|
+
return be({
|
|
426
|
+
alg: me(r),
|
|
423
427
|
kid: o
|
|
424
|
-
},
|
|
428
|
+
}, ct(t, e), r);
|
|
425
429
|
}
|
|
426
|
-
function
|
|
430
|
+
function j(t) {
|
|
427
431
|
if (typeof t != "object" || t === null)
|
|
428
432
|
throw new TypeError('"as" must be an object');
|
|
429
|
-
if (!
|
|
433
|
+
if (!p(t.issuer))
|
|
430
434
|
throw new TypeError('"as.issuer" property must be a non-empty string');
|
|
431
435
|
return !0;
|
|
432
436
|
}
|
|
433
|
-
function
|
|
437
|
+
function J(t) {
|
|
434
438
|
if (typeof t != "object" || t === null)
|
|
435
439
|
throw new TypeError('"client" must be an object');
|
|
436
|
-
if (!
|
|
440
|
+
if (!p(t.client_id))
|
|
437
441
|
throw new TypeError('"client.client_id" property must be a non-empty string');
|
|
438
442
|
return !0;
|
|
439
443
|
}
|
|
440
|
-
function
|
|
441
|
-
if (!
|
|
444
|
+
function ce(t) {
|
|
445
|
+
if (!p(t))
|
|
442
446
|
throw new TypeError('"client.client_secret" property must be a non-empty string');
|
|
443
447
|
return t;
|
|
444
448
|
}
|
|
445
|
-
function
|
|
449
|
+
function q(t, e) {
|
|
446
450
|
if (e !== void 0)
|
|
447
451
|
throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${t} client authentication method is used.`);
|
|
448
452
|
}
|
|
449
|
-
function
|
|
453
|
+
function ue(t, e) {
|
|
450
454
|
if (e !== void 0)
|
|
451
455
|
throw new TypeError(`"client.client_secret" property must not be provided when ${t} client authentication method is used.`);
|
|
452
456
|
}
|
|
453
|
-
async function
|
|
454
|
-
switch (
|
|
457
|
+
async function lt(t, e, r, o, s) {
|
|
458
|
+
switch (r.delete("client_secret"), r.delete("client_assertion_type"), r.delete("client_assertion"), e.token_endpoint_auth_method) {
|
|
455
459
|
case void 0:
|
|
456
460
|
case "client_secret_basic": {
|
|
457
|
-
|
|
461
|
+
q("client_secret_basic", s), o.set("authorization", ot(e.client_id, ce(e.client_secret)));
|
|
458
462
|
break;
|
|
459
463
|
}
|
|
460
464
|
case "client_secret_post": {
|
|
461
|
-
|
|
465
|
+
q("client_secret_post", s), r.set("client_id", e.client_id), r.set("client_secret", ce(e.client_secret));
|
|
462
466
|
break;
|
|
463
467
|
}
|
|
464
468
|
case "private_key_jwt": {
|
|
465
|
-
if (
|
|
469
|
+
if (ue("private_key_jwt", e.client_secret), s === void 0)
|
|
466
470
|
throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
|
|
467
|
-
const { key:
|
|
468
|
-
if (!
|
|
471
|
+
const { key: n, kid: i } = nt(s);
|
|
472
|
+
if (!ge(n))
|
|
469
473
|
throw new TypeError('"options.clientPrivateKey.key" must be a private CryptoKey');
|
|
470
|
-
|
|
474
|
+
r.set("client_id", e.client_id), r.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), r.set("client_assertion", await ut(t, e, n, i));
|
|
471
475
|
break;
|
|
472
476
|
}
|
|
473
477
|
case "tls_client_auth":
|
|
474
478
|
case "self_signed_tls_client_auth":
|
|
475
479
|
case "none": {
|
|
476
|
-
|
|
480
|
+
ue(e.token_endpoint_auth_method, e.client_secret), q(e.token_endpoint_auth_method, s), r.set("client_id", e.client_id);
|
|
477
481
|
break;
|
|
478
482
|
}
|
|
479
483
|
default:
|
|
480
|
-
throw new
|
|
484
|
+
throw new S("unsupported client token_endpoint_auth_method");
|
|
481
485
|
}
|
|
482
486
|
}
|
|
483
|
-
async function
|
|
484
|
-
if (!
|
|
487
|
+
async function be(t, e, r) {
|
|
488
|
+
if (!r.usages.includes("sign"))
|
|
485
489
|
throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
|
|
486
|
-
const o = `${
|
|
490
|
+
const o = `${k(A(JSON.stringify(t)))}.${k(A(JSON.stringify(e)))}`, s = k(await crypto.subtle.sign(Ee(r), r, A(o)));
|
|
487
491
|
return `${o}.${s}`;
|
|
488
492
|
}
|
|
489
|
-
async function
|
|
490
|
-
const { privateKey: i, publicKey: u, nonce:
|
|
491
|
-
if (!
|
|
493
|
+
async function dt(t, e, r, o, s, n) {
|
|
494
|
+
const { privateKey: i, publicKey: u, nonce: f = pe.get(r.origin) } = e;
|
|
495
|
+
if (!ge(i))
|
|
492
496
|
throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
|
|
493
|
-
if (!
|
|
497
|
+
if (!Ze(u))
|
|
494
498
|
throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
|
|
495
|
-
if (
|
|
499
|
+
if (f !== void 0 && !p(f))
|
|
496
500
|
throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
|
|
497
501
|
if (!u.extractable)
|
|
498
502
|
throw new TypeError('"DPoP.publicKey.extractable" must be true');
|
|
499
|
-
const
|
|
500
|
-
alg:
|
|
503
|
+
const m = M() + s, y = await be({
|
|
504
|
+
alg: me(i),
|
|
501
505
|
typ: "dpop+jwt",
|
|
502
|
-
jwk: await
|
|
506
|
+
jwk: await ft(u)
|
|
503
507
|
}, {
|
|
504
|
-
iat:
|
|
505
|
-
jti:
|
|
508
|
+
iat: m,
|
|
509
|
+
jti: F(),
|
|
506
510
|
htm: o,
|
|
507
|
-
nonce:
|
|
508
|
-
htu: `${
|
|
509
|
-
ath:
|
|
511
|
+
nonce: f,
|
|
512
|
+
htu: `${r.origin}${r.pathname}`,
|
|
513
|
+
ath: n ? k(await crypto.subtle.digest("SHA-256", A(n))) : void 0
|
|
510
514
|
}, i);
|
|
511
|
-
t.set("dpop",
|
|
515
|
+
t.set("dpop", y);
|
|
512
516
|
}
|
|
513
|
-
let
|
|
514
|
-
async function
|
|
515
|
-
const { kty: e, e:
|
|
516
|
-
return
|
|
517
|
+
let W;
|
|
518
|
+
async function ht(t) {
|
|
519
|
+
const { kty: e, e: r, n: o, x: s, y: n, crv: i } = await crypto.subtle.exportKey("jwk", t), u = { kty: e, e: r, n: o, x: s, y: n, crv: i };
|
|
520
|
+
return W.set(t, u), u;
|
|
517
521
|
}
|
|
518
|
-
async function
|
|
519
|
-
return
|
|
522
|
+
async function ft(t) {
|
|
523
|
+
return W || (W = /* @__PURE__ */ new WeakMap()), W.get(t) || ht(t);
|
|
520
524
|
}
|
|
521
|
-
function
|
|
525
|
+
function pt(t, e, r) {
|
|
522
526
|
if (typeof t != "string")
|
|
523
527
|
throw new TypeError(`"as.${e}" must be a string`);
|
|
524
528
|
return new URL(t);
|
|
525
529
|
}
|
|
526
|
-
function
|
|
527
|
-
return
|
|
530
|
+
function _e(t, e, r) {
|
|
531
|
+
return pt(t[e], e);
|
|
528
532
|
}
|
|
529
|
-
function
|
|
533
|
+
function Z(t) {
|
|
530
534
|
const e = t;
|
|
531
535
|
return typeof e != "object" || Array.isArray(e) || e === null ? !1 : e.error !== void 0;
|
|
532
536
|
}
|
|
533
|
-
async function
|
|
534
|
-
if (!
|
|
537
|
+
async function wt(t, e, r, o, s, n) {
|
|
538
|
+
if (!p(t))
|
|
535
539
|
throw new TypeError('"accessToken" must be a non-empty string');
|
|
536
|
-
if (!(
|
|
540
|
+
if (!(r instanceof URL))
|
|
537
541
|
throw new TypeError('"url" must be an instance of URL');
|
|
538
|
-
return o =
|
|
542
|
+
return o = $(o), (n == null ? void 0 : n.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await dt(o, n.DPoP, r, "GET", I({ [H]: n == null ? void 0 : n[H] }), t), o.set("authorization", `DPoP ${t}`)), ((n == null ? void 0 : n[X]) || fetch)(r.href, {
|
|
539
543
|
body: s,
|
|
540
544
|
headers: Object.fromEntries(o.entries()),
|
|
541
545
|
method: e,
|
|
542
546
|
redirect: "manual",
|
|
543
|
-
signal:
|
|
544
|
-
}).then(
|
|
547
|
+
signal: n != null && n.signal ? te(n.signal) : null
|
|
548
|
+
}).then(ee);
|
|
545
549
|
}
|
|
546
|
-
async function
|
|
547
|
-
|
|
548
|
-
const s =
|
|
549
|
-
return e.userinfo_signed_response_alg ?
|
|
550
|
+
async function gt(t, e, r, o) {
|
|
551
|
+
j(t), J(e);
|
|
552
|
+
const s = _e(t, "userinfo_endpoint"), n = $(o == null ? void 0 : o.headers);
|
|
553
|
+
return e.userinfo_signed_response_alg ? n.set("accept", "application/jwt") : (n.set("accept", "application/json"), n.append("accept", "application/jwt")), wt(r, "GET", s, n, null, {
|
|
550
554
|
...o,
|
|
551
|
-
[
|
|
555
|
+
[H]: I(e)
|
|
552
556
|
});
|
|
553
557
|
}
|
|
554
|
-
async function
|
|
555
|
-
return await
|
|
558
|
+
async function mt(t, e, r, o, s, n, i) {
|
|
559
|
+
return await lt(t, e, s, n, i == null ? void 0 : i.clientPrivateKey), n.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[X]) || fetch)(o.href, {
|
|
556
560
|
body: s,
|
|
557
|
-
headers: Object.fromEntries(
|
|
558
|
-
method:
|
|
561
|
+
headers: Object.fromEntries(n.entries()),
|
|
562
|
+
method: r,
|
|
559
563
|
redirect: "manual",
|
|
560
|
-
signal: i != null && i.signal ?
|
|
561
|
-
}).then(
|
|
564
|
+
signal: i != null && i.signal ? te(i.signal) : null
|
|
565
|
+
}).then(ee);
|
|
562
566
|
}
|
|
563
|
-
async function
|
|
564
|
-
const
|
|
565
|
-
o.set("grant_type",
|
|
566
|
-
const i =
|
|
567
|
-
return i.set("accept", "application/json"),
|
|
567
|
+
async function ve(t, e, r, o, s) {
|
|
568
|
+
const n = _e(t, "token_endpoint");
|
|
569
|
+
o.set("grant_type", r);
|
|
570
|
+
const i = $(s == null ? void 0 : s.headers);
|
|
571
|
+
return i.set("accept", "application/json"), mt(t, e, "POST", n, o, i, s);
|
|
568
572
|
}
|
|
569
|
-
async function
|
|
570
|
-
if (
|
|
573
|
+
async function yt(t, e, r, o) {
|
|
574
|
+
if (j(t), J(e), !p(r))
|
|
571
575
|
throw new TypeError('"refreshToken" must be a non-empty string');
|
|
572
576
|
const s = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
|
|
573
|
-
return s.set("refresh_token",
|
|
577
|
+
return s.set("refresh_token", r), ve(t, e, "refresh_token", s, o);
|
|
574
578
|
}
|
|
575
|
-
const
|
|
576
|
-
function
|
|
579
|
+
const Se = /* @__PURE__ */ new WeakMap();
|
|
580
|
+
function bt(t) {
|
|
577
581
|
if (!t.id_token)
|
|
578
582
|
return;
|
|
579
|
-
const e =
|
|
583
|
+
const e = Se.get(t);
|
|
580
584
|
if (!e)
|
|
581
585
|
throw new TypeError('"ref" was already garbage collected or did not resolve from the proper sources');
|
|
582
586
|
return e;
|
|
583
587
|
}
|
|
584
|
-
async function
|
|
585
|
-
if (
|
|
588
|
+
async function Te(t, e, r, o = !1, s = !1) {
|
|
589
|
+
if (j(t), J(e), !Q(r, Response))
|
|
586
590
|
throw new TypeError('"response" must be an instance of Response');
|
|
587
|
-
if (
|
|
591
|
+
if (r.status !== 200) {
|
|
588
592
|
let i;
|
|
589
|
-
if (i = await
|
|
593
|
+
if (i = await xt(r))
|
|
590
594
|
return i;
|
|
591
595
|
throw new a('"response" is not a conform Token Endpoint response');
|
|
592
596
|
}
|
|
593
|
-
|
|
594
|
-
let
|
|
597
|
+
re(r);
|
|
598
|
+
let n;
|
|
595
599
|
try {
|
|
596
|
-
|
|
600
|
+
n = await r.json();
|
|
597
601
|
} catch (i) {
|
|
598
602
|
throw new a('failed to parse "response" body as JSON', { cause: i });
|
|
599
603
|
}
|
|
600
|
-
if (!
|
|
604
|
+
if (!C(n))
|
|
601
605
|
throw new a('"response" body must be a top level object');
|
|
602
|
-
if (!
|
|
606
|
+
if (!p(n.access_token))
|
|
603
607
|
throw new a('"response" body "access_token" property must be a non-empty string');
|
|
604
|
-
if (!
|
|
608
|
+
if (!p(n.token_type))
|
|
605
609
|
throw new a('"response" body "token_type" property must be a non-empty string');
|
|
606
|
-
if (
|
|
607
|
-
throw new
|
|
608
|
-
if (
|
|
610
|
+
if (n.token_type = n.token_type.toLowerCase(), n.token_type !== "dpop" && n.token_type !== "bearer")
|
|
611
|
+
throw new S("unsupported `token_type` value");
|
|
612
|
+
if (n.expires_in !== void 0 && (typeof n.expires_in != "number" || n.expires_in <= 0))
|
|
609
613
|
throw new a('"response" body "expires_in" property must be a positive number');
|
|
610
|
-
if (!s &&
|
|
614
|
+
if (!s && n.refresh_token !== void 0 && !p(n.refresh_token))
|
|
611
615
|
throw new a('"response" body "refresh_token" property must be a non-empty string');
|
|
612
|
-
if (
|
|
616
|
+
if (n.scope !== void 0 && typeof n.scope != "string")
|
|
613
617
|
throw new a('"response" body "scope" property must be a string');
|
|
614
618
|
if (!o) {
|
|
615
|
-
if (
|
|
619
|
+
if (n.id_token !== void 0 && !p(n.id_token))
|
|
616
620
|
throw new a('"response" body "id_token" property must be a non-empty string');
|
|
617
|
-
if (
|
|
618
|
-
const { claims: i } = await
|
|
621
|
+
if (n.id_token) {
|
|
622
|
+
const { claims: i } = await Lt(n.id_token, Ct.bind(void 0, e.id_token_signed_response_alg, t.id_token_signing_alg_values_supported), Ae, I(e), ye(e)).then(At.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(St.bind(void 0, t.issuer)).then(vt.bind(void 0, e.client_id));
|
|
619
623
|
if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== e.client_id)
|
|
620
624
|
throw new a('unexpected ID Token "azp" (authorized party) claim value');
|
|
621
625
|
if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
|
|
622
626
|
throw new a('ID Token "auth_time" (authentication time) must be a positive number');
|
|
623
|
-
|
|
627
|
+
Se.set(n, i);
|
|
624
628
|
}
|
|
625
629
|
}
|
|
626
|
-
return
|
|
630
|
+
return n;
|
|
627
631
|
}
|
|
628
|
-
async function
|
|
629
|
-
return
|
|
632
|
+
async function _t(t, e, r) {
|
|
633
|
+
return Te(t, e, r);
|
|
630
634
|
}
|
|
631
|
-
function
|
|
635
|
+
function vt(t, e) {
|
|
632
636
|
if (Array.isArray(e.claims.aud)) {
|
|
633
637
|
if (!e.claims.aud.includes(t))
|
|
634
638
|
throw new a('unexpected JWT "aud" (audience) claim value');
|
|
@@ -636,29 +640,29 @@ function mt(t, e) {
|
|
|
636
640
|
throw new a('unexpected JWT "aud" (audience) claim value');
|
|
637
641
|
return e;
|
|
638
642
|
}
|
|
639
|
-
function
|
|
643
|
+
function St(t, e) {
|
|
640
644
|
if (e.claims.iss !== t)
|
|
641
645
|
throw new a('unexpected JWT "iss" (issuer) claim value');
|
|
642
646
|
return e;
|
|
643
647
|
}
|
|
644
|
-
const
|
|
645
|
-
function
|
|
646
|
-
return
|
|
648
|
+
const ke = /* @__PURE__ */ new WeakSet();
|
|
649
|
+
function Tt(t) {
|
|
650
|
+
return ke.add(t), t;
|
|
647
651
|
}
|
|
648
|
-
async function
|
|
649
|
-
if (
|
|
652
|
+
async function kt(t, e, r, o, s, n) {
|
|
653
|
+
if (j(t), J(e), !ke.has(r))
|
|
650
654
|
throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
|
|
651
|
-
if (!
|
|
655
|
+
if (!p(o))
|
|
652
656
|
throw new TypeError('"redirectUri" must be a non-empty string');
|
|
653
|
-
if (!
|
|
657
|
+
if (!p(s))
|
|
654
658
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
655
|
-
const i = T(
|
|
659
|
+
const i = T(r, "code");
|
|
656
660
|
if (!i)
|
|
657
661
|
throw new a('no authorization code in "callbackParameters"');
|
|
658
|
-
const u = new URLSearchParams(
|
|
659
|
-
return u.set("redirect_uri", o), u.set("code_verifier", s), u.set("code", i),
|
|
662
|
+
const u = new URLSearchParams(n == null ? void 0 : n.additionalParameters);
|
|
663
|
+
return u.set("redirect_uri", o), u.set("code_verifier", s), u.set("code", i), ve(t, e, "authorization_code", u, n);
|
|
660
664
|
}
|
|
661
|
-
const
|
|
665
|
+
const Et = {
|
|
662
666
|
aud: "audience",
|
|
663
667
|
c_hash: "code hash",
|
|
664
668
|
client_id: "client id",
|
|
@@ -674,66 +678,66 @@ const vt = {
|
|
|
674
678
|
htu: "http uri",
|
|
675
679
|
cnf: "confirmation"
|
|
676
680
|
};
|
|
677
|
-
function
|
|
678
|
-
for (const
|
|
679
|
-
if (e.claims[
|
|
680
|
-
throw new a(`JWT "${
|
|
681
|
+
function At(t, e) {
|
|
682
|
+
for (const r of t)
|
|
683
|
+
if (e.claims[r] === void 0)
|
|
684
|
+
throw new a(`JWT "${r}" (${Et[r]}) claim missing`);
|
|
681
685
|
return e;
|
|
682
686
|
}
|
|
683
|
-
const
|
|
684
|
-
async function
|
|
685
|
-
const
|
|
686
|
-
if (
|
|
687
|
-
return
|
|
688
|
-
if (!
|
|
687
|
+
const Rt = Symbol(), G = Symbol();
|
|
688
|
+
async function Pt(t, e, r, o, s) {
|
|
689
|
+
const n = await Te(t, e, r);
|
|
690
|
+
if (Z(n))
|
|
691
|
+
return n;
|
|
692
|
+
if (!p(n.id_token))
|
|
689
693
|
throw new a('"response" body "id_token" property must be a non-empty string');
|
|
690
|
-
s ?? (s = e.default_max_age ??
|
|
691
|
-
const i =
|
|
692
|
-
if ((e.require_auth_time || s !==
|
|
694
|
+
s ?? (s = e.default_max_age ?? G);
|
|
695
|
+
const i = bt(n);
|
|
696
|
+
if ((e.require_auth_time || s !== G) && i.auth_time === void 0)
|
|
693
697
|
throw new a('ID Token "auth_time" (authentication time) claim missing');
|
|
694
|
-
if (s !==
|
|
698
|
+
if (s !== G) {
|
|
695
699
|
if (typeof s != "number" || s < 0)
|
|
696
700
|
throw new TypeError('"maxAge" must be a non-negative number');
|
|
697
|
-
const u =
|
|
698
|
-
if (i.auth_time + s < u -
|
|
701
|
+
const u = M() + I(e), f = ye(e);
|
|
702
|
+
if (i.auth_time + s < u - f)
|
|
699
703
|
throw new a("too much time has elapsed since the last End-User authentication");
|
|
700
704
|
}
|
|
701
705
|
switch (o) {
|
|
702
706
|
case void 0:
|
|
703
|
-
case
|
|
707
|
+
case Rt:
|
|
704
708
|
if (i.nonce !== void 0)
|
|
705
709
|
throw new a('unexpected ID Token "nonce" claim value');
|
|
706
710
|
break;
|
|
707
711
|
default:
|
|
708
|
-
if (!
|
|
712
|
+
if (!p(o))
|
|
709
713
|
throw new TypeError('"expectedNonce" must be a non-empty string');
|
|
710
714
|
if (i.nonce === void 0)
|
|
711
715
|
throw new a('ID Token "nonce" claim missing');
|
|
712
716
|
if (i.nonce !== o)
|
|
713
717
|
throw new a('unexpected ID Token "nonce" claim value');
|
|
714
718
|
}
|
|
715
|
-
return
|
|
719
|
+
return n;
|
|
716
720
|
}
|
|
717
|
-
function
|
|
721
|
+
function re(t) {
|
|
718
722
|
if (t.bodyUsed)
|
|
719
723
|
throw new TypeError('"response" body has been used already');
|
|
720
724
|
}
|
|
721
|
-
async function
|
|
725
|
+
async function xt(t) {
|
|
722
726
|
if (t.status > 399 && t.status < 500) {
|
|
723
|
-
|
|
727
|
+
re(t);
|
|
724
728
|
try {
|
|
725
729
|
const e = await t.json();
|
|
726
|
-
if (
|
|
730
|
+
if (C(e) && typeof e.error == "string" && e.error.length)
|
|
727
731
|
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;
|
|
728
732
|
} catch {
|
|
729
733
|
}
|
|
730
734
|
}
|
|
731
735
|
}
|
|
732
|
-
function
|
|
736
|
+
function le(t) {
|
|
733
737
|
if (typeof t.modulusLength != "number" || t.modulusLength < 2048)
|
|
734
738
|
throw new a(`${t.name} modulusLength must be at least 2048 bits`);
|
|
735
739
|
}
|
|
736
|
-
function
|
|
740
|
+
function Ut(t) {
|
|
737
741
|
switch (t) {
|
|
738
742
|
case "P-256":
|
|
739
743
|
return "SHA-256";
|
|
@@ -742,18 +746,18 @@ function At(t) {
|
|
|
742
746
|
case "P-521":
|
|
743
747
|
return "SHA-512";
|
|
744
748
|
default:
|
|
745
|
-
throw new
|
|
749
|
+
throw new S();
|
|
746
750
|
}
|
|
747
751
|
}
|
|
748
|
-
function
|
|
752
|
+
function Ee(t) {
|
|
749
753
|
switch (t.algorithm.name) {
|
|
750
754
|
case "ECDSA":
|
|
751
755
|
return {
|
|
752
756
|
name: t.algorithm.name,
|
|
753
|
-
hash:
|
|
757
|
+
hash: Ut(t.algorithm.namedCurve)
|
|
754
758
|
};
|
|
755
759
|
case "RSA-PSS":
|
|
756
|
-
switch (
|
|
760
|
+
switch (le(t.algorithm), t.algorithm.hash.name) {
|
|
757
761
|
case "SHA-256":
|
|
758
762
|
case "SHA-384":
|
|
759
763
|
case "SHA-512":
|
|
@@ -762,255 +766,271 @@ function Te(t) {
|
|
|
762
766
|
saltLength: parseInt(t.algorithm.hash.name.slice(-3), 10) >> 3
|
|
763
767
|
};
|
|
764
768
|
default:
|
|
765
|
-
throw new
|
|
769
|
+
throw new S();
|
|
766
770
|
}
|
|
767
771
|
case "RSASSA-PKCS1-v1_5":
|
|
768
|
-
return
|
|
772
|
+
return le(t.algorithm), t.algorithm.name;
|
|
769
773
|
case "Ed448":
|
|
770
774
|
case "Ed25519":
|
|
771
775
|
return t.algorithm.name;
|
|
772
776
|
}
|
|
773
|
-
throw new
|
|
774
|
-
}
|
|
775
|
-
const
|
|
776
|
-
async function
|
|
777
|
-
const { 0:
|
|
778
|
-
if (
|
|
779
|
-
throw new
|
|
780
|
-
if (
|
|
777
|
+
throw new S();
|
|
778
|
+
}
|
|
779
|
+
const Ae = Symbol();
|
|
780
|
+
async function Lt(t, e, r, o, s) {
|
|
781
|
+
const { 0: n, 1: i, 2: u, length: f } = t.split(".");
|
|
782
|
+
if (f === 5)
|
|
783
|
+
throw new S("JWE structure JWTs are not supported");
|
|
784
|
+
if (f !== 3)
|
|
781
785
|
throw new a("Invalid JWT");
|
|
782
|
-
let
|
|
786
|
+
let m;
|
|
783
787
|
try {
|
|
784
|
-
|
|
785
|
-
} catch (
|
|
786
|
-
throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause:
|
|
788
|
+
m = JSON.parse(A(k(n)));
|
|
789
|
+
} catch (P) {
|
|
790
|
+
throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: P });
|
|
787
791
|
}
|
|
788
|
-
if (!
|
|
792
|
+
if (!C(m))
|
|
789
793
|
throw new a("JWT Header must be a top level object");
|
|
790
|
-
if (e(
|
|
794
|
+
if (e(m), m.crit !== void 0)
|
|
791
795
|
throw new a('unexpected JWT "crit" header parameter');
|
|
792
|
-
const
|
|
796
|
+
const y = k(u);
|
|
793
797
|
let b;
|
|
794
|
-
if (
|
|
795
|
-
b = await
|
|
796
|
-
const
|
|
797
|
-
if (!await crypto.subtle.verify(
|
|
798
|
+
if (r !== Ae) {
|
|
799
|
+
b = await r(m);
|
|
800
|
+
const P = `${n}.${i}`;
|
|
801
|
+
if (!await crypto.subtle.verify(Ee(b), b, y, A(P)))
|
|
798
802
|
throw new a("JWT signature verification failed");
|
|
799
803
|
}
|
|
800
|
-
let
|
|
804
|
+
let h;
|
|
801
805
|
try {
|
|
802
|
-
|
|
803
|
-
} catch (
|
|
804
|
-
throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause:
|
|
806
|
+
h = JSON.parse(A(k(i)));
|
|
807
|
+
} catch (P) {
|
|
808
|
+
throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: P });
|
|
805
809
|
}
|
|
806
|
-
if (!
|
|
810
|
+
if (!C(h))
|
|
807
811
|
throw new a("JWT Payload must be a top level object");
|
|
808
|
-
const
|
|
809
|
-
if (
|
|
810
|
-
if (typeof
|
|
812
|
+
const R = M() + o;
|
|
813
|
+
if (h.exp !== void 0) {
|
|
814
|
+
if (typeof h.exp != "number")
|
|
811
815
|
throw new a('unexpected JWT "exp" (expiration time) claim type');
|
|
812
|
-
if (
|
|
816
|
+
if (h.exp <= R - s)
|
|
813
817
|
throw new a('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
|
|
814
818
|
}
|
|
815
|
-
if (
|
|
819
|
+
if (h.iat !== void 0 && typeof h.iat != "number")
|
|
816
820
|
throw new a('unexpected JWT "iat" (issued at) claim type');
|
|
817
|
-
if (
|
|
821
|
+
if (h.iss !== void 0 && typeof h.iss != "string")
|
|
818
822
|
throw new a('unexpected JWT "iss" (issuer) claim type');
|
|
819
|
-
if (
|
|
820
|
-
if (typeof
|
|
823
|
+
if (h.nbf !== void 0) {
|
|
824
|
+
if (typeof h.nbf != "number")
|
|
821
825
|
throw new a('unexpected JWT "nbf" (not before) claim type');
|
|
822
|
-
if (
|
|
826
|
+
if (h.nbf > R + s)
|
|
823
827
|
throw new a('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
|
|
824
828
|
}
|
|
825
|
-
if (
|
|
829
|
+
if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
|
|
826
830
|
throw new a('unexpected JWT "aud" (audience) claim type');
|
|
827
|
-
return { header:
|
|
831
|
+
return { header: m, claims: h, signature: y, key: b };
|
|
828
832
|
}
|
|
829
|
-
function
|
|
833
|
+
function Ct(t, e, r) {
|
|
830
834
|
if (t !== void 0) {
|
|
831
|
-
if (
|
|
835
|
+
if (r.alg !== t)
|
|
832
836
|
throw new a('unexpected JWT "alg" header parameter');
|
|
833
837
|
return;
|
|
834
838
|
}
|
|
835
839
|
if (Array.isArray(e)) {
|
|
836
|
-
if (!e.includes(
|
|
840
|
+
if (!e.includes(r.alg))
|
|
837
841
|
throw new a('unexpected JWT "alg" header parameter');
|
|
838
842
|
return;
|
|
839
843
|
}
|
|
840
|
-
if (
|
|
844
|
+
if (r.alg !== "RS256")
|
|
841
845
|
throw new a('unexpected JWT "alg" header parameter');
|
|
842
846
|
}
|
|
843
847
|
function T(t, e) {
|
|
844
|
-
const { 0:
|
|
848
|
+
const { 0: r, length: o } = t.getAll(e);
|
|
845
849
|
if (o > 1)
|
|
846
850
|
throw new a(`"${e}" parameter must be provided only once`);
|
|
847
|
-
return
|
|
851
|
+
return r;
|
|
848
852
|
}
|
|
849
|
-
const
|
|
850
|
-
function
|
|
851
|
-
if (
|
|
853
|
+
const It = Symbol(), jt = Symbol();
|
|
854
|
+
function Jt(t, e, r, o) {
|
|
855
|
+
if (j(t), J(e), r instanceof URL && (r = r.searchParams), !(r instanceof URLSearchParams))
|
|
852
856
|
throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
|
|
853
|
-
if (T(
|
|
857
|
+
if (T(r, "response"))
|
|
854
858
|
throw new a('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
|
|
855
|
-
const s = T(
|
|
859
|
+
const s = T(r, "iss"), n = T(r, "state");
|
|
856
860
|
if (!s && t.authorization_response_iss_parameter_supported)
|
|
857
861
|
throw new a('response parameter "iss" (issuer) missing');
|
|
858
862
|
if (s && s !== t.issuer)
|
|
859
863
|
throw new a('unexpected "iss" (issuer) response parameter value');
|
|
860
864
|
switch (o) {
|
|
861
865
|
case void 0:
|
|
862
|
-
case
|
|
863
|
-
if (
|
|
866
|
+
case jt:
|
|
867
|
+
if (n !== void 0)
|
|
864
868
|
throw new a('unexpected "state" response parameter encountered');
|
|
865
869
|
break;
|
|
866
|
-
case
|
|
870
|
+
case It:
|
|
867
871
|
break;
|
|
868
872
|
default:
|
|
869
|
-
if (!
|
|
873
|
+
if (!p(o))
|
|
870
874
|
throw new a('"expectedState" must be a non-empty string');
|
|
871
|
-
if (
|
|
875
|
+
if (n === void 0)
|
|
872
876
|
throw new a('response parameter "state" missing');
|
|
873
|
-
if (
|
|
877
|
+
if (n !== o)
|
|
874
878
|
throw new a('unexpected "state" response parameter value');
|
|
875
879
|
}
|
|
876
|
-
const i = T(
|
|
880
|
+
const i = T(r, "error");
|
|
877
881
|
if (i)
|
|
878
882
|
return {
|
|
879
883
|
error: i,
|
|
880
|
-
error_description: T(
|
|
881
|
-
error_uri: T(
|
|
884
|
+
error_description: T(r, "error_description"),
|
|
885
|
+
error_uri: T(r, "error_uri")
|
|
882
886
|
};
|
|
883
|
-
const u = T(
|
|
884
|
-
if (u !== void 0 ||
|
|
885
|
-
throw new
|
|
886
|
-
return
|
|
887
|
+
const u = T(r, "id_token"), f = T(r, "token");
|
|
888
|
+
if (u !== void 0 || f !== void 0)
|
|
889
|
+
throw new S("implicit and hybrid flows are not supported");
|
|
890
|
+
return Tt(new URLSearchParams(r));
|
|
887
891
|
}
|
|
888
|
-
function
|
|
892
|
+
function Ot({
|
|
889
893
|
handleCallback: t
|
|
890
894
|
}) {
|
|
891
|
-
const [e,
|
|
892
|
-
return
|
|
893
|
-
s.current || (s.current = !0, t().then((
|
|
894
|
-
o(
|
|
895
|
-
}).catch((
|
|
896
|
-
|
|
895
|
+
const [e, r] = Je(null), o = He(), s = Oe(!1);
|
|
896
|
+
return Ne(() => {
|
|
897
|
+
s.current || (s.current = !0, t().then((n) => {
|
|
898
|
+
o(n);
|
|
899
|
+
}).catch((n) => {
|
|
900
|
+
K.error(n), r(n);
|
|
897
901
|
}));
|
|
898
|
-
}, [o, t]), e ? /* @__PURE__ */
|
|
899
|
-
|
|
902
|
+
}, [o, t]), e ? /* @__PURE__ */ E.jsx(
|
|
903
|
+
De,
|
|
900
904
|
{
|
|
901
905
|
category: "Error",
|
|
902
906
|
title: "Authentication Error",
|
|
903
|
-
message: /* @__PURE__ */
|
|
907
|
+
message: /* @__PURE__ */ E.jsxs(E.Fragment, { children: [
|
|
908
|
+
/* @__PURE__ */ E.jsx(ze, { className: "mb-4", children: "Check the configuration of your authorization provider and ensure all settings such as the callback URL are configured correctly." }),
|
|
909
|
+
"An error occurred while authorizing the user.",
|
|
910
|
+
/* @__PURE__ */ E.jsx(We, { code: e.toString(), language: "plain" })
|
|
911
|
+
] })
|
|
904
912
|
}
|
|
905
|
-
) : /* @__PURE__ */
|
|
913
|
+
) : /* @__PURE__ */ E.jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ E.jsx(Ke, {}) });
|
|
906
914
|
}
|
|
907
915
|
class U extends Error {
|
|
908
916
|
}
|
|
909
|
-
class
|
|
910
|
-
constructor(e,
|
|
911
|
-
super(e, o), this.error =
|
|
917
|
+
class de extends U {
|
|
918
|
+
constructor(e, r, o) {
|
|
919
|
+
super(e, o), this.error = r;
|
|
912
920
|
}
|
|
913
921
|
}
|
|
914
|
-
const
|
|
915
|
-
class
|
|
916
|
-
constructor(e,
|
|
917
|
-
super(), this.callbackUrlPath = e, this.handleCallback =
|
|
922
|
+
const V = "code-verifier";
|
|
923
|
+
class Nt extends je {
|
|
924
|
+
constructor(e, r) {
|
|
925
|
+
super(), this.callbackUrlPath = e, this.handleCallback = r;
|
|
918
926
|
}
|
|
919
927
|
getRoutes() {
|
|
920
928
|
return [
|
|
921
929
|
...super.getRoutes(),
|
|
922
930
|
{
|
|
923
931
|
path: this.callbackUrlPath,
|
|
924
|
-
element: /* @__PURE__ */
|
|
932
|
+
element: /* @__PURE__ */ E.jsx(Ot, { handleCallback: this.handleCallback })
|
|
925
933
|
}
|
|
926
934
|
];
|
|
927
935
|
}
|
|
928
936
|
}
|
|
929
|
-
class
|
|
937
|
+
class zt {
|
|
930
938
|
constructor({
|
|
931
939
|
issuer: e,
|
|
932
|
-
audience:
|
|
940
|
+
audience: r,
|
|
933
941
|
clientId: o,
|
|
934
942
|
redirectToAfterSignUp: s,
|
|
935
|
-
redirectToAfterSignIn:
|
|
943
|
+
redirectToAfterSignIn: n,
|
|
936
944
|
redirectToAfterSignOut: i
|
|
937
945
|
}) {
|
|
938
|
-
this
|
|
939
|
-
|
|
946
|
+
_(this, "client");
|
|
947
|
+
_(this, "issuer");
|
|
948
|
+
_(this, "authorizationServer");
|
|
949
|
+
_(this, "callbackUrlPath", "/oauth/callback");
|
|
950
|
+
_(this, "logoutRedirectUrlPath", "/");
|
|
951
|
+
_(this, "onAuthorizationUrl");
|
|
952
|
+
_(this, "redirectToAfterSignUp");
|
|
953
|
+
_(this, "redirectToAfterSignIn");
|
|
954
|
+
_(this, "redirectToAfterSignOut");
|
|
955
|
+
_(this, "audience");
|
|
956
|
+
_(this, "signOut", async () => {
|
|
957
|
+
z.setState({
|
|
940
958
|
isAuthenticated: !1,
|
|
941
959
|
isPending: !1,
|
|
942
960
|
profile: void 0
|
|
943
961
|
}), sessionStorage.clear();
|
|
944
|
-
const
|
|
962
|
+
const e = await this.getAuthServer(), r = new URL(
|
|
945
963
|
window.location.origin + this.redirectToAfterSignOut
|
|
946
964
|
);
|
|
947
|
-
|
|
948
|
-
let
|
|
949
|
-
|
|
965
|
+
r.pathname = this.logoutRedirectUrlPath;
|
|
966
|
+
let o;
|
|
967
|
+
e.end_session_endpoint ? (o = new URL(e.end_session_endpoint), o.searchParams.set(
|
|
950
968
|
"post_logout_redirect_uri",
|
|
951
|
-
|
|
952
|
-
)) :
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
|
|
969
|
+
r.toString()
|
|
970
|
+
)) : o = r;
|
|
971
|
+
});
|
|
972
|
+
_(this, "handleCallback", async () => {
|
|
973
|
+
const e = new URL(window.location.href), r = e.searchParams.get("state"), o = sessionStorage.getItem(V);
|
|
974
|
+
if (sessionStorage.removeItem(V), !o)
|
|
956
975
|
throw new U("No code verifier found in state.");
|
|
957
|
-
const
|
|
958
|
-
|
|
976
|
+
const s = await this.getAuthServer(), n = Jt(
|
|
977
|
+
s,
|
|
959
978
|
this.client,
|
|
960
|
-
|
|
961
|
-
|
|
979
|
+
e.searchParams,
|
|
980
|
+
r ?? void 0
|
|
962
981
|
);
|
|
963
|
-
if (
|
|
964
|
-
throw
|
|
982
|
+
if (Z(n))
|
|
983
|
+
throw K.error("Error validating OAuth response", n), new de(
|
|
965
984
|
"Error validating OAuth response",
|
|
966
|
-
|
|
985
|
+
n
|
|
967
986
|
);
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
const
|
|
971
|
-
|
|
987
|
+
const i = new URL(e);
|
|
988
|
+
i.pathname = this.redirectToAfterSignIn, i.search = "";
|
|
989
|
+
const u = await kt(
|
|
990
|
+
s,
|
|
972
991
|
this.client,
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
),
|
|
977
|
-
|
|
992
|
+
n,
|
|
993
|
+
i.toString(),
|
|
994
|
+
o
|
|
995
|
+
), f = await Pt(
|
|
996
|
+
s,
|
|
978
997
|
this.client,
|
|
979
|
-
|
|
998
|
+
u
|
|
980
999
|
);
|
|
981
|
-
this.setTokensFromResponse(
|
|
982
|
-
const
|
|
983
|
-
|
|
1000
|
+
this.setTokensFromResponse(f);
|
|
1001
|
+
const m = await this.getAccessToken(), b = await (await gt(
|
|
1002
|
+
s,
|
|
984
1003
|
this.client,
|
|
985
|
-
|
|
986
|
-
)).json(),
|
|
987
|
-
sub:
|
|
988
|
-
email:
|
|
989
|
-
name:
|
|
990
|
-
emailVerified:
|
|
991
|
-
pictureUrl:
|
|
1004
|
+
m
|
|
1005
|
+
)).json(), h = {
|
|
1006
|
+
sub: b.sub,
|
|
1007
|
+
email: b.email,
|
|
1008
|
+
name: b.name,
|
|
1009
|
+
emailVerified: b.email_verified ?? !1,
|
|
1010
|
+
pictureUrl: b.picture
|
|
992
1011
|
};
|
|
993
|
-
|
|
1012
|
+
z.setState({
|
|
994
1013
|
isAuthenticated: !0,
|
|
995
1014
|
isPending: !1,
|
|
996
|
-
profile:
|
|
1015
|
+
profile: h
|
|
997
1016
|
}), sessionStorage.setItem(
|
|
998
1017
|
"profile-state",
|
|
999
|
-
JSON.stringify(
|
|
1018
|
+
JSON.stringify(z.getState().profile)
|
|
1000
1019
|
);
|
|
1001
|
-
const
|
|
1002
|
-
return sessionStorage.removeItem("redirect-to"),
|
|
1003
|
-
}
|
|
1020
|
+
const R = sessionStorage.getItem("redirect-to") ?? "/";
|
|
1021
|
+
return sessionStorage.removeItem("redirect-to"), R;
|
|
1022
|
+
});
|
|
1023
|
+
this.client = {
|
|
1004
1024
|
client_id: o,
|
|
1005
1025
|
token_endpoint_auth_method: "none"
|
|
1006
|
-
}, this.audience =
|
|
1026
|
+
}, this.audience = r, this.issuer = e, this.redirectToAfterSignUp = s ?? "/", this.redirectToAfterSignIn = n ?? "/", this.redirectToAfterSignOut = i ?? "/";
|
|
1007
1027
|
}
|
|
1008
1028
|
async getAuthServer() {
|
|
1009
1029
|
if (!this.authorizationServer) {
|
|
1010
|
-
const e = new URL(this.issuer),
|
|
1011
|
-
this.authorizationServer = await
|
|
1030
|
+
const e = new URL(this.issuer), r = await Qe(e);
|
|
1031
|
+
this.authorizationServer = await Xe(
|
|
1012
1032
|
e,
|
|
1013
|
-
|
|
1033
|
+
r
|
|
1014
1034
|
);
|
|
1015
1035
|
}
|
|
1016
1036
|
return this.authorizationServer;
|
|
@@ -1020,17 +1040,17 @@ class Jt {
|
|
|
1020
1040
|
* @param response
|
|
1021
1041
|
*/
|
|
1022
1042
|
setTokensFromResponse(e) {
|
|
1023
|
-
if (
|
|
1024
|
-
throw
|
|
1043
|
+
if (Z(e))
|
|
1044
|
+
throw K.error("Bad Token Response", e), new de("Bad Token Response", e);
|
|
1025
1045
|
if (!e.expires_in)
|
|
1026
1046
|
throw new U("No expires_in in response");
|
|
1027
|
-
const
|
|
1047
|
+
const r = {
|
|
1028
1048
|
accessToken: e.access_token,
|
|
1029
1049
|
refreshToken: e.refresh_token,
|
|
1030
1050
|
expiresOn: new Date(Date.now() + e.expires_in * 1e3),
|
|
1031
1051
|
tokenType: e.token_type
|
|
1032
1052
|
};
|
|
1033
|
-
sessionStorage.setItem("token-state", JSON.stringify(
|
|
1053
|
+
sessionStorage.setItem("token-state", JSON.stringify(r));
|
|
1034
1054
|
}
|
|
1035
1055
|
async signUp({ redirectTo: e } = {}) {
|
|
1036
1056
|
return this.authorize({
|
|
@@ -1045,51 +1065,51 @@ class Jt {
|
|
|
1045
1065
|
}
|
|
1046
1066
|
async authorize({
|
|
1047
1067
|
redirectTo: e,
|
|
1048
|
-
isSignUp:
|
|
1068
|
+
isSignUp: r = !1
|
|
1049
1069
|
}) {
|
|
1050
|
-
var
|
|
1070
|
+
var m, y;
|
|
1051
1071
|
const o = "S256", s = await this.getAuthServer();
|
|
1052
1072
|
if (!s.authorization_endpoint)
|
|
1053
1073
|
throw new U("No authorization endpoint");
|
|
1054
|
-
const
|
|
1055
|
-
sessionStorage.setItem(
|
|
1074
|
+
const n = et(), i = await rt(n);
|
|
1075
|
+
sessionStorage.setItem(V, n);
|
|
1056
1076
|
const u = new URL(
|
|
1057
1077
|
s.authorization_endpoint
|
|
1058
1078
|
);
|
|
1059
1079
|
sessionStorage.setItem("redirect-to", e);
|
|
1060
|
-
const
|
|
1061
|
-
if (
|
|
1080
|
+
const f = new URL(window.location.origin);
|
|
1081
|
+
if (f.pathname = this.callbackUrlPath, f.search = "", u.searchParams.set("client_id", this.client.client_id), u.searchParams.set("redirect_uri", f.toString()), u.searchParams.set("response_type", "code"), u.searchParams.set("scope", "openid profile email"), u.searchParams.set("code_challenge", i), u.searchParams.set(
|
|
1062
1082
|
"code_challenge_method",
|
|
1063
1083
|
o
|
|
1064
|
-
), this.audience && u.searchParams.set("audience", this.audience), (
|
|
1065
|
-
isSignIn: !
|
|
1066
|
-
isSignUp:
|
|
1067
|
-
}), ((
|
|
1068
|
-
const b =
|
|
1084
|
+
), this.audience && u.searchParams.set("audience", this.audience), (m = this.onAuthorizationUrl) == null || m.call(this, u, {
|
|
1085
|
+
isSignIn: !r,
|
|
1086
|
+
isSignUp: r
|
|
1087
|
+
}), ((y = s.code_challenge_methods_supported) == null ? void 0 : y.includes("S256")) !== !0) {
|
|
1088
|
+
const b = tt();
|
|
1069
1089
|
u.searchParams.set("state", b);
|
|
1070
1090
|
}
|
|
1071
1091
|
location.href = u.href;
|
|
1072
1092
|
}
|
|
1073
1093
|
async getAccessToken() {
|
|
1074
|
-
const e = await this.getAuthServer(),
|
|
1075
|
-
if (!
|
|
1094
|
+
const e = await this.getAuthServer(), r = sessionStorage.getItem("token-state");
|
|
1095
|
+
if (!r)
|
|
1076
1096
|
throw new U("User is not authenticated");
|
|
1077
|
-
const o = JSON.parse(
|
|
1097
|
+
const o = JSON.parse(r);
|
|
1078
1098
|
if (o.expiresOn < /* @__PURE__ */ new Date()) {
|
|
1079
1099
|
if (!o.refreshToken)
|
|
1080
1100
|
return await this.signIn(), "";
|
|
1081
|
-
const s = await
|
|
1101
|
+
const s = await yt(
|
|
1082
1102
|
e,
|
|
1083
1103
|
this.client,
|
|
1084
1104
|
o.refreshToken
|
|
1085
|
-
),
|
|
1105
|
+
), n = await _t(
|
|
1086
1106
|
e,
|
|
1087
1107
|
this.client,
|
|
1088
1108
|
s
|
|
1089
1109
|
);
|
|
1090
|
-
if (!
|
|
1110
|
+
if (!n.access_token)
|
|
1091
1111
|
throw new U("No access token in response");
|
|
1092
|
-
return this.setTokensFromResponse(
|
|
1112
|
+
return this.setTokensFromResponse(n), n.access_token.toString();
|
|
1093
1113
|
} else
|
|
1094
1114
|
return o.accessToken;
|
|
1095
1115
|
}
|
|
@@ -1097,23 +1117,23 @@ class Jt {
|
|
|
1097
1117
|
const e = sessionStorage.getItem("profile-state");
|
|
1098
1118
|
if (e)
|
|
1099
1119
|
try {
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1120
|
+
const r = JSON.parse(e);
|
|
1121
|
+
z.setState({
|
|
1102
1122
|
isAuthenticated: !0,
|
|
1103
1123
|
isPending: !1,
|
|
1104
|
-
profile:
|
|
1124
|
+
profile: r
|
|
1105
1125
|
});
|
|
1106
|
-
} catch (
|
|
1107
|
-
|
|
1126
|
+
} catch (r) {
|
|
1127
|
+
K.error("Error parsing auth state", r);
|
|
1108
1128
|
}
|
|
1109
1129
|
}
|
|
1110
1130
|
getAuthenticationPlugin() {
|
|
1111
|
-
return new
|
|
1131
|
+
return new Nt(this.callbackUrlPath, this.handleCallback);
|
|
1112
1132
|
}
|
|
1113
1133
|
}
|
|
1114
|
-
const
|
|
1134
|
+
const Yt = (t) => new zt(t);
|
|
1115
1135
|
export {
|
|
1116
|
-
|
|
1117
|
-
|
|
1136
|
+
zt as OpenIDAuthenticationProvider,
|
|
1137
|
+
Yt as default
|
|
1118
1138
|
};
|
|
1119
1139
|
//# sourceMappingURL=zudoku.auth-openid.js.map
|