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