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