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