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