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