zudoku 0.3.1-dev.2 → 0.3.1-dev.20
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/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 +20 -1
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +3 -10
- package/dist/lib/authentication/providers/openid.js +46 -31
- 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/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.d.ts +9 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js +14 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.d.ts +6 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js +17 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.d.ts +7 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js +10 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/SchemaComponents.d.ts +3 -3
- package/dist/lib/plugins/openapi/schema/SchemaComponents.js +15 -15
- package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/utils.d.ts +6 -0
- package/dist/lib/plugins/openapi/schema/utils.js +5 -0
- package/dist/lib/plugins/openapi/schema/utils.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-DB9VROFR.js → Input-CBfi9Yjc.js} +5 -4
- package/lib/{Input-DB9VROFR.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-CZiSz5JH.js +590 -0
- package/lib/OperationList-CZiSz5JH.js.map +1 -0
- package/lib/{Route-DfAFiR7v.js → Route-Cle-r-bq.js} +4 -4
- package/lib/{Route-DfAFiR7v.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-D-9zqIOh.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 +31 -17
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +491 -421
- 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 +26 -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 +28 -2
- package/src/lib/authentication/providers/openid.tsx +50 -37
- 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 +3 -4
- package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -1
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +27 -5
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.tsx +47 -0
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.tsx +54 -0
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.tsx +30 -0
- package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +41 -41
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +4 -4
- package/src/lib/plugins/openapi/schema/utils.ts +8 -0
- 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-Cxiw2Z-v.js +0 -457
- package/lib/OperationList-Cxiw2Z-v.js.map +0 -1
- package/lib/Spinner-BT_AYFrA.js.map +0 -1
- package/lib/index-D-9zqIOh.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 xe = Object.defineProperty;
|
|
2
|
+
var Le = (t, e, n) => e in t ? xe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var y = (t, e, n) => Le(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { j as k } 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 ze, useRef as Je, useEffect as Oe } from "react";
|
|
8
|
+
import { D as Ne } 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 N } from "./state-DsXXkBLH.js";
|
|
14
|
+
var fe = { exports: {} };
|
|
9
15
|
(function(t) {
|
|
10
16
|
(function(e, n) {
|
|
11
17
|
t.exports ? t.exports = n() : e.log = n();
|
|
12
|
-
})(
|
|
18
|
+
})(Ce, function() {
|
|
13
19
|
var e = function() {
|
|
14
|
-
}, n = "undefined",
|
|
20
|
+
}, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /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
|
+
], r = {}, 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 {
|
|
@@ -30,46 +36,46 @@ var de = { exports: {} };
|
|
|
30
36
|
};
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
|
-
function
|
|
39
|
+
function h() {
|
|
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 === n ? !1 : l === "trace" &&
|
|
42
|
+
function m(l) {
|
|
43
|
+
return l === "debug" && (l = "log"), typeof console === n ? !1 : l === "trace" && o ? h : 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 b() {
|
|
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
50
|
if (this.log = this.debug, typeof console === n && l < this.levels.SILENT)
|
|
45
51
|
return "No console available for logging";
|
|
46
52
|
}
|
|
47
|
-
function
|
|
53
|
+
function _(l) {
|
|
48
54
|
return function() {
|
|
49
|
-
typeof console !== n && (
|
|
55
|
+
typeof console !== n && (b.call(this), this[l].apply(this, arguments));
|
|
50
56
|
};
|
|
51
57
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
58
|
+
function f(l, w, c) {
|
|
59
|
+
return m(l) || _.apply(this, arguments);
|
|
54
60
|
}
|
|
55
|
-
function
|
|
56
|
-
var c = this,
|
|
61
|
+
function R(l, w) {
|
|
62
|
+
var c = this, J, B, U, v = "loglevel";
|
|
57
63
|
typeof l == "string" ? v += ":" + l : typeof l == "symbol" && (v = void 0);
|
|
58
|
-
function
|
|
59
|
-
var
|
|
64
|
+
function Re(d) {
|
|
65
|
+
var g = (s[d] || "silent").toUpperCase();
|
|
60
66
|
if (!(typeof window === n || !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 re() {
|
|
73
79
|
var d;
|
|
74
80
|
if (!(typeof window === n || !v)) {
|
|
75
81
|
try {
|
|
@@ -78,16 +84,16 @@ var de = { exports: {} };
|
|
|
78
84
|
}
|
|
79
85
|
if (typeof d === n)
|
|
80
86
|
try {
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
var g = window.document.cookie, O = encodeURIComponent(v), ie = g.indexOf(O + "=");
|
|
88
|
+
ie !== -1 && (d = /^([^;]+)/.exec(
|
|
89
|
+
g.slice(ie + O.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
|
|
96
|
+
function Pe() {
|
|
91
97
|
if (!(typeof window === n || !v)) {
|
|
92
98
|
try {
|
|
93
99
|
window.localStorage.removeItem(v);
|
|
@@ -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 || f, c.getLevel = function() {
|
|
122
|
+
return U ?? B ?? J;
|
|
123
|
+
}, c.setLevel = function(d, g) {
|
|
124
|
+
return U = L(d), g !== !1 && Re(U), b.call(c);
|
|
119
125
|
}, c.setDefaultLevel = function(d) {
|
|
120
|
-
|
|
126
|
+
B = L(d), re() || c.setLevel(d, !1);
|
|
121
127
|
}, c.resetLevel = function() {
|
|
122
|
-
|
|
128
|
+
U = null, Pe(), b.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 && (J = L(i.getLevel())), b.call(c), i === c)
|
|
135
|
+
for (var d in r)
|
|
136
|
+
r[d].rebuild();
|
|
137
|
+
}, J = L(
|
|
132
138
|
i ? i.getLevel() : "WARN"
|
|
133
139
|
);
|
|
134
|
-
var
|
|
135
|
-
|
|
140
|
+
var oe = re();
|
|
141
|
+
oe != null && (U = L(oe)), b.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 = r[w];
|
|
147
|
+
return c || (c = r[w] = new R(
|
|
148
|
+
w,
|
|
143
149
|
i.methodFactory
|
|
144
150
|
)), c;
|
|
145
151
|
};
|
|
146
|
-
var
|
|
152
|
+
var P = typeof window !== n ? window.log : void 0;
|
|
147
153
|
return i.noConflict = function() {
|
|
148
|
-
return typeof window !== n && window.log === i && (window.log =
|
|
154
|
+
return typeof window !== n && window.log === i && (window.log = P), i;
|
|
149
155
|
}, i.getLoggers = function() {
|
|
150
|
-
return
|
|
156
|
+
return r;
|
|
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,32 +171,32 @@ 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 n = 0; n < t.byteLength; n +=
|
|
177
|
-
e.push(String.fromCharCode.apply(null, t.subarray(n, n +
|
|
182
|
+
for (let n = 0; n < t.byteLength; n += se)
|
|
183
|
+
e.push(String.fromCharCode.apply(null, t.subarray(n, n + 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
188
|
const e = atob(t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(e.length);
|
|
183
|
-
for (let
|
|
184
|
-
n[
|
|
189
|
+
for (let o = 0; o < e.length; o++)
|
|
190
|
+
n[o] = e.charCodeAt(o);
|
|
185
191
|
return n;
|
|
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 E(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
|
}
|
|
@@ -220,48 +226,48 @@ class S extends Error {
|
|
|
220
226
|
super(e ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
|
|
221
227
|
}
|
|
222
228
|
}
|
|
223
|
-
class
|
|
229
|
+
class Ye extends Error {
|
|
224
230
|
constructor(e, n) {
|
|
225
|
-
var
|
|
226
|
-
super(e, n), this.name = this.constructor.name, (
|
|
231
|
+
var o;
|
|
232
|
+
super(e, n), 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:")
|
|
@@ -278,70 +284,70 @@ async function De(t, e) {
|
|
|
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)(n.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
|
-
|
|
305
|
+
ne(e);
|
|
300
306
|
let n;
|
|
301
307
|
try {
|
|
302
308
|
n = await e.json();
|
|
303
|
-
} catch (
|
|
304
|
-
throw new a('failed to parse "response" body as JSON', { cause:
|
|
309
|
+
} catch (o) {
|
|
310
|
+
throw new a('failed to parse "response" body as JSON', { cause: o });
|
|
305
311
|
}
|
|
306
|
-
if (!
|
|
312
|
+
if (!C(n))
|
|
307
313
|
throw new a('"response" body must be a top level object');
|
|
308
|
-
if (!
|
|
314
|
+
if (!p(n.issuer))
|
|
309
315
|
throw new a('"response" body "issuer" property must be a non-empty string');
|
|
310
316
|
if (new URL(n.issuer).href !== t.href)
|
|
311
317
|
throw new a('"response" body "issuer" does not match "expectedIssuer"');
|
|
312
318
|
return n;
|
|
313
319
|
}
|
|
314
|
-
function
|
|
315
|
-
return
|
|
320
|
+
function F() {
|
|
321
|
+
return E(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 nt(t) {
|
|
330
|
+
if (!p(t))
|
|
325
331
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
326
|
-
return
|
|
332
|
+
return E(await crypto.subtle.digest("SHA-256", A(t)));
|
|
327
333
|
}
|
|
328
|
-
function
|
|
334
|
+
function rt(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 n =
|
|
342
|
-
return `Basic ${btoa(`${n}:${
|
|
346
|
+
function ot(t, e) {
|
|
347
|
+
const n = ae(t), o = ae(e);
|
|
348
|
+
return `Basic ${btoa(`${n}:${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,21 +398,21 @@ 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 n =
|
|
412
|
+
function ct(t, e) {
|
|
413
|
+
const n = M() + I(e);
|
|
408
414
|
return {
|
|
409
|
-
jti:
|
|
415
|
+
jti: F(),
|
|
410
416
|
aud: [t.issuer, t.token_endpoint],
|
|
411
417
|
exp: n + 60,
|
|
412
418
|
iat: n,
|
|
@@ -415,210 +421,218 @@ function Qe(t, e) {
|
|
|
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, n, o) {
|
|
425
|
+
return be({
|
|
426
|
+
alg: me(n),
|
|
427
|
+
kid: o
|
|
428
|
+
}, ct(t, e), n);
|
|
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 z(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
|
|
457
|
+
async function lt(t, e, n, o, s) {
|
|
452
458
|
switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.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), n.set("client_id", e.client_id), n.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: r, kid: i } = rt(s);
|
|
472
|
+
if (!ge(r))
|
|
467
473
|
throw new TypeError('"options.clientPrivateKey.key" must be a private CryptoKey');
|
|
468
|
-
n.set("client_id", e.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await
|
|
474
|
+
n.set("client_id", e.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await ut(t, e, r, i));
|
|
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), n.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
|
|
487
|
+
async function be(t, e, n) {
|
|
482
488
|
if (!n.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 = `${E(A(JSON.stringify(t)))}.${E(A(JSON.stringify(e)))}`, s = E(await crypto.subtle.sign(ke(n), n, A(o)));
|
|
491
|
+
return `${o}.${s}`;
|
|
486
492
|
}
|
|
487
|
-
async function
|
|
488
|
-
const { privateKey: i, publicKey: u, nonce:
|
|
489
|
-
if (!
|
|
493
|
+
async function dt(t, e, n, o, s, r) {
|
|
494
|
+
const { privateKey: i, publicKey: u, nonce: h = pe.get(n.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 (
|
|
499
|
+
if (h !== void 0 && !p(h))
|
|
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, b = 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:
|
|
505
|
-
nonce:
|
|
508
|
+
iat: m,
|
|
509
|
+
jti: F(),
|
|
510
|
+
htm: o,
|
|
511
|
+
nonce: h,
|
|
506
512
|
htu: `${n.origin}${n.pathname}`,
|
|
507
|
-
ath:
|
|
513
|
+
ath: r ? E(await crypto.subtle.digest("SHA-256", A(r))) : void 0
|
|
508
514
|
}, i);
|
|
509
|
-
t.set("dpop",
|
|
515
|
+
t.set("dpop", b);
|
|
510
516
|
}
|
|
511
|
-
let
|
|
512
|
-
async function
|
|
513
|
-
const { kty: e, e: n, n:
|
|
514
|
-
return
|
|
517
|
+
let W;
|
|
518
|
+
async function ht(t) {
|
|
519
|
+
const { kty: e, e: n, n: o, x: s, y: r, crv: i } = await crypto.subtle.exportKey("jwk", t), u = { kty: e, e: n, n: o, x: s, y: r, crv: i };
|
|
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, n) {
|
|
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, n) {
|
|
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, n, o, s, r) {
|
|
538
|
+
if (!p(t))
|
|
533
539
|
throw new TypeError('"accessToken" must be a non-empty string');
|
|
534
540
|
if (!(n instanceof URL))
|
|
535
541
|
throw new TypeError('"url" must be an instance of URL');
|
|
536
|
-
return
|
|
542
|
+
return o = $(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${t}`) : (await dt(o, r.DPoP, n, "GET", I({ [H]: r == null ? void 0 : r[H] }), t), o.set("authorization", `DPoP ${t}`)), ((r == null ? void 0 : r[X]) || fetch)(n.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: r != null && r.signal ? te(r.signal) : null
|
|
548
|
+
}).then(ee);
|
|
549
|
+
}
|
|
550
|
+
async function gt(t, e, n, o) {
|
|
551
|
+
j(t), z(e);
|
|
552
|
+
const s = _e(t, "userinfo_endpoint"), r = $(o == null ? void 0 : o.headers);
|
|
553
|
+
return e.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), wt(n, "GET", s, r, null, {
|
|
554
|
+
...o,
|
|
555
|
+
[H]: I(e)
|
|
550
556
|
});
|
|
551
557
|
}
|
|
552
|
-
async function
|
|
553
|
-
return await
|
|
558
|
+
async function mt(t, e, n, o, s, r, i) {
|
|
559
|
+
return await lt(t, e, s, r, i == null ? void 0 : i.clientPrivateKey), r.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"), ((i == null ? void 0 : i[X]) || fetch)(o.href, {
|
|
554
560
|
body: s,
|
|
555
|
-
headers: Object.fromEntries(
|
|
561
|
+
headers: Object.fromEntries(r.entries()),
|
|
556
562
|
method: n,
|
|
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, n, o, s) {
|
|
568
|
+
const r = _e(t, "token_endpoint");
|
|
569
|
+
o.set("grant_type", n);
|
|
570
|
+
const i = $(s == null ? void 0 : s.headers);
|
|
571
|
+
return i.set("accept", "application/json"), mt(t, e, "POST", r, o, i, s);
|
|
566
572
|
}
|
|
567
|
-
async function
|
|
568
|
-
if (
|
|
573
|
+
async function yt(t, e, n, o) {
|
|
574
|
+
if (j(t), z(e), !p(n))
|
|
569
575
|
throw new TypeError('"refreshToken" must be a non-empty string');
|
|
570
|
-
const s = new URLSearchParams(
|
|
571
|
-
return s.set("refresh_token", n),
|
|
576
|
+
const s = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
|
|
577
|
+
return s.set("refresh_token", n), ve(t, e, "refresh_token", s, o);
|
|
572
578
|
}
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
if (
|
|
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;
|
|
587
|
+
}
|
|
588
|
+
async function Te(t, e, n, o = !1, s = !1) {
|
|
589
|
+
if (j(t), z(e), !Q(n, Response))
|
|
576
590
|
throw new TypeError('"response" must be an instance of Response');
|
|
577
591
|
if (n.status !== 200) {
|
|
578
592
|
let i;
|
|
579
|
-
if (i = await
|
|
593
|
+
if (i = await Ut(n))
|
|
580
594
|
return i;
|
|
581
595
|
throw new a('"response" is not a conform Token Endpoint response');
|
|
582
596
|
}
|
|
583
|
-
|
|
584
|
-
let
|
|
597
|
+
ne(n);
|
|
598
|
+
let r;
|
|
585
599
|
try {
|
|
586
|
-
|
|
600
|
+
r = await n.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(r))
|
|
591
605
|
throw new a('"response" body must be a top level object');
|
|
592
|
-
if (!
|
|
606
|
+
if (!p(r.access_token))
|
|
593
607
|
throw new a('"response" body "access_token" property must be a non-empty string');
|
|
594
|
-
if (!
|
|
608
|
+
if (!p(r.token_type))
|
|
595
609
|
throw new a('"response" body "token_type" property must be a non-empty string');
|
|
596
|
-
if (
|
|
610
|
+
if (r.token_type = r.token_type.toLowerCase(), r.token_type !== "dpop" && r.token_type !== "bearer")
|
|
597
611
|
throw new S("unsupported `token_type` value");
|
|
598
|
-
if (
|
|
612
|
+
if (r.expires_in !== void 0 && (typeof r.expires_in != "number" || r.expires_in <= 0))
|
|
599
613
|
throw new a('"response" body "expires_in" property must be a positive number');
|
|
600
|
-
if (!s &&
|
|
614
|
+
if (!s && r.refresh_token !== void 0 && !p(r.refresh_token))
|
|
601
615
|
throw new a('"response" body "refresh_token" property must be a non-empty string');
|
|
602
|
-
if (
|
|
616
|
+
if (r.scope !== void 0 && typeof r.scope != "string")
|
|
603
617
|
throw new a('"response" body "scope" property must be a string');
|
|
604
|
-
if (!
|
|
605
|
-
if (
|
|
618
|
+
if (!o) {
|
|
619
|
+
if (r.id_token !== void 0 && !p(r.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 (r.id_token) {
|
|
622
|
+
const { claims: i } = await Lt(r.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(r, i);
|
|
614
628
|
}
|
|
615
629
|
}
|
|
616
|
-
return
|
|
630
|
+
return r;
|
|
617
631
|
}
|
|
618
|
-
async function
|
|
619
|
-
return
|
|
632
|
+
async function _t(t, e, n) {
|
|
633
|
+
return Te(t, e, n);
|
|
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 Ee = /* @__PURE__ */ new WeakSet();
|
|
649
|
+
function Tt(t) {
|
|
650
|
+
return Ee.add(t), t;
|
|
637
651
|
}
|
|
638
|
-
async function
|
|
639
|
-
if (
|
|
652
|
+
async function Et(t, e, n, o, s, r) {
|
|
653
|
+
if (j(t), z(e), !Ee.has(n))
|
|
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
659
|
const i = T(n, "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(r == null ? void 0 : r.additionalParameters);
|
|
663
|
+
return u.set("redirect_uri", o), u.set("code_verifier", s), u.set("code", i), ve(t, e, "authorization_code", u, r);
|
|
650
664
|
}
|
|
651
|
-
const
|
|
665
|
+
const kt = {
|
|
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
|
|
681
|
+
function At(t, e) {
|
|
668
682
|
for (const n of t)
|
|
669
683
|
if (e.claims[n] === void 0)
|
|
670
|
-
throw new a(`JWT "${n}" (${
|
|
684
|
+
throw new a(`JWT "${n}" (${kt[n]}) claim missing`);
|
|
671
685
|
return e;
|
|
672
686
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
687
|
+
const Rt = Symbol(), G = Symbol();
|
|
688
|
+
async function Pt(t, e, n, o, s) {
|
|
689
|
+
const r = await Te(t, e, n);
|
|
690
|
+
if (Z(r))
|
|
676
691
|
return r;
|
|
677
|
-
if (r.id_token
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
692
|
+
if (!p(r.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(r);
|
|
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), h = ye(e);
|
|
702
|
+
if (i.auth_time + s < u - h)
|
|
703
|
+
throw new a("too much time has elapsed since the last End-User authentication");
|
|
704
|
+
}
|
|
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');
|
|
681
718
|
}
|
|
682
719
|
return r;
|
|
683
720
|
}
|
|
684
|
-
function
|
|
721
|
+
function ne(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 Ut(t) {
|
|
689
726
|
if (t.status > 399 && t.status < 500) {
|
|
690
|
-
|
|
727
|
+
ne(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 xt(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 ke(t) {
|
|
716
753
|
switch (t.algorithm.name) {
|
|
717
754
|
case "ECDSA":
|
|
718
755
|
return {
|
|
719
756
|
name: t.algorithm.name,
|
|
720
|
-
hash:
|
|
757
|
+
hash: xt(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,68 +769,68 @@ 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:
|
|
745
|
-
if (
|
|
779
|
+
const Ae = Symbol();
|
|
780
|
+
async function Lt(t, e, n, o, s) {
|
|
781
|
+
const { 0: r, 1: i, 2: u, length: h } = t.split(".");
|
|
782
|
+
if (h === 5)
|
|
746
783
|
throw new S("JWE structure JWTs are not supported");
|
|
747
|
-
if (
|
|
784
|
+
if (h !== 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(E(r)));
|
|
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
|
|
760
|
-
let
|
|
761
|
-
if (n !==
|
|
762
|
-
|
|
763
|
-
const
|
|
764
|
-
if (!await crypto.subtle.verify(
|
|
796
|
+
const b = E(u);
|
|
797
|
+
let _;
|
|
798
|
+
if (n !== Ae) {
|
|
799
|
+
_ = await n(m);
|
|
800
|
+
const P = `${r}.${i}`;
|
|
801
|
+
if (!await crypto.subtle.verify(ke(_), _, b, A(P)))
|
|
765
802
|
throw new a("JWT signature verification failed");
|
|
766
803
|
}
|
|
767
|
-
let
|
|
804
|
+
let f;
|
|
768
805
|
try {
|
|
769
|
-
|
|
770
|
-
} catch (
|
|
771
|
-
throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause:
|
|
806
|
+
f = JSON.parse(A(E(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(f))
|
|
774
811
|
throw new a("JWT Payload must be a top level object");
|
|
775
|
-
const
|
|
776
|
-
if (
|
|
777
|
-
if (typeof
|
|
812
|
+
const R = M() + o;
|
|
813
|
+
if (f.exp !== void 0) {
|
|
814
|
+
if (typeof f.exp != "number")
|
|
778
815
|
throw new a('unexpected JWT "exp" (expiration time) claim type');
|
|
779
|
-
if (
|
|
816
|
+
if (f.exp <= R - s)
|
|
780
817
|
throw new a('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
|
|
781
818
|
}
|
|
782
|
-
if (
|
|
819
|
+
if (f.iat !== void 0 && typeof f.iat != "number")
|
|
783
820
|
throw new a('unexpected JWT "iat" (issued at) claim type');
|
|
784
|
-
if (
|
|
821
|
+
if (f.iss !== void 0 && typeof f.iss != "string")
|
|
785
822
|
throw new a('unexpected JWT "iss" (issuer) claim type');
|
|
786
|
-
if (
|
|
787
|
-
if (typeof
|
|
823
|
+
if (f.nbf !== void 0) {
|
|
824
|
+
if (typeof f.nbf != "number")
|
|
788
825
|
throw new a('unexpected JWT "nbf" (not before) claim type');
|
|
789
|
-
if (
|
|
826
|
+
if (f.nbf > R + s)
|
|
790
827
|
throw new a('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
|
|
791
828
|
}
|
|
792
|
-
if (
|
|
829
|
+
if (f.aud !== void 0 && typeof f.aud != "string" && !Array.isArray(f.aud))
|
|
793
830
|
throw new a('unexpected JWT "aud" (audience) claim type');
|
|
794
|
-
return { header:
|
|
831
|
+
return { header: m, claims: f, signature: b, key: _ };
|
|
795
832
|
}
|
|
796
|
-
function
|
|
833
|
+
function Ct(t, e, n) {
|
|
797
834
|
if (t !== void 0) {
|
|
798
835
|
if (n.alg !== t)
|
|
799
836
|
throw new a('unexpected JWT "alg" header parameter');
|
|
@@ -808,36 +845,36 @@ function vt(t, e, n) {
|
|
|
808
845
|
throw new a('unexpected JWT "alg" header parameter');
|
|
809
846
|
}
|
|
810
847
|
function T(t, e) {
|
|
811
|
-
const { 0: n, length:
|
|
812
|
-
if (
|
|
848
|
+
const { 0: n, length: o } = t.getAll(e);
|
|
849
|
+
if (o > 1)
|
|
813
850
|
throw new a(`"${e}" parameter must be provided only once`);
|
|
814
851
|
return n;
|
|
815
852
|
}
|
|
816
|
-
const
|
|
817
|
-
function
|
|
818
|
-
if (
|
|
853
|
+
const It = Symbol(), jt = Symbol();
|
|
854
|
+
function zt(t, e, n, o) {
|
|
855
|
+
if (j(t), z(e), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
|
|
819
856
|
throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
|
|
820
857
|
if (T(n, "response"))
|
|
821
858
|
throw new a('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
|
|
822
|
-
const s = T(n, "iss"),
|
|
859
|
+
const s = T(n, "iss"), r = T(n, "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 (r !== 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 (r === void 0)
|
|
839
876
|
throw new a('response parameter "state" missing');
|
|
840
|
-
if (
|
|
877
|
+
if (r !== o)
|
|
841
878
|
throw new a('unexpected "state" response parameter value');
|
|
842
879
|
}
|
|
843
880
|
const i = T(n, "error");
|
|
@@ -847,123 +884,150 @@ function At(t, e, n, r) {
|
|
|
847
884
|
error_description: T(n, "error_description"),
|
|
848
885
|
error_uri: T(n, "error_uri")
|
|
849
886
|
};
|
|
850
|
-
const u = T(n, "id_token"),
|
|
851
|
-
if (u !== void 0 ||
|
|
887
|
+
const u = T(n, "id_token"), h = T(n, "token");
|
|
888
|
+
if (u !== void 0 || h !== void 0)
|
|
852
889
|
throw new S("implicit and hybrid flows are not supported");
|
|
853
|
-
return
|
|
890
|
+
return Tt(new URLSearchParams(n));
|
|
891
|
+
}
|
|
892
|
+
function Jt({
|
|
893
|
+
handleCallback: t
|
|
894
|
+
}) {
|
|
895
|
+
const [e, n] = ze(null), o = He(), s = Je(!1);
|
|
896
|
+
return Oe(() => {
|
|
897
|
+
s.current || (s.current = !0, t().then((r) => {
|
|
898
|
+
o(r);
|
|
899
|
+
}).catch((r) => {
|
|
900
|
+
K.error(r), n(r);
|
|
901
|
+
}));
|
|
902
|
+
}, [o, t]), e ? /* @__PURE__ */ k.jsx(
|
|
903
|
+
De,
|
|
904
|
+
{
|
|
905
|
+
category: "Error",
|
|
906
|
+
title: "Authentication Error",
|
|
907
|
+
message: /* @__PURE__ */ k.jsxs(k.Fragment, { children: [
|
|
908
|
+
/* @__PURE__ */ k.jsx(Ne, { 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__ */ k.jsx(We, { code: e.toString(), language: "plain" })
|
|
911
|
+
] })
|
|
912
|
+
}
|
|
913
|
+
) : /* @__PURE__ */ k.jsx("div", { className: "grid h-full place-items-center", children: /* @__PURE__ */ k.jsx(Ke, {}) });
|
|
854
914
|
}
|
|
855
|
-
class
|
|
915
|
+
class x extends Error {
|
|
856
916
|
}
|
|
857
|
-
class
|
|
858
|
-
constructor(e, n,
|
|
859
|
-
super(e,
|
|
917
|
+
class de extends x {
|
|
918
|
+
constructor(e, n, o) {
|
|
919
|
+
super(e, o), this.error = n;
|
|
860
920
|
}
|
|
861
921
|
}
|
|
862
|
-
const
|
|
863
|
-
class
|
|
922
|
+
const V = "code-verifier";
|
|
923
|
+
class Ot extends je {
|
|
864
924
|
constructor(e, n) {
|
|
865
|
-
super(), this.callbackUrlPath = e, this.
|
|
925
|
+
super(), this.callbackUrlPath = e, this.handleCallback = n;
|
|
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__ */ k.jsx(Jt, { handleCallback: this.handleCallback })
|
|
873
933
|
}
|
|
874
934
|
];
|
|
875
935
|
}
|
|
876
936
|
}
|
|
877
|
-
class
|
|
937
|
+
class Nt {
|
|
878
938
|
constructor({
|
|
879
939
|
issuer: e,
|
|
880
940
|
audience: n,
|
|
881
|
-
authorizationEndpoint:
|
|
941
|
+
authorizationEndpoint: o,
|
|
882
942
|
tokenEndpoint: s,
|
|
883
|
-
clientId:
|
|
943
|
+
clientId: r,
|
|
884
944
|
redirectToAfterSignUp: i,
|
|
885
945
|
redirectToAfterSignIn: u,
|
|
886
|
-
redirectToAfterSignOut:
|
|
946
|
+
redirectToAfterSignOut: h
|
|
887
947
|
}) {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
ne.setState({
|
|
948
|
+
y(this, "client");
|
|
949
|
+
y(this, "issuer");
|
|
950
|
+
y(this, "authorizationEndpoint");
|
|
951
|
+
y(this, "tokenEndpoint");
|
|
952
|
+
y(this, "authorizationServer");
|
|
953
|
+
y(this, "callbackUrlPath", "/oauth/callback");
|
|
954
|
+
y(this, "logoutRedirectUrlPath", "/");
|
|
955
|
+
y(this, "onAuthorizationUrl");
|
|
956
|
+
y(this, "redirectToAfterSignUp");
|
|
957
|
+
y(this, "redirectToAfterSignIn");
|
|
958
|
+
y(this, "redirectToAfterSignOut");
|
|
959
|
+
y(this, "audience");
|
|
960
|
+
y(this, "signOut", async () => {
|
|
961
|
+
N.setState({
|
|
903
962
|
isAuthenticated: !1,
|
|
904
963
|
isPending: !1,
|
|
905
964
|
profile: void 0
|
|
906
|
-
}),
|
|
965
|
+
}), sessionStorage.clear();
|
|
907
966
|
const e = await this.getAuthServer(), n = new URL(
|
|
908
967
|
window.location.origin + this.redirectToAfterSignOut
|
|
909
968
|
);
|
|
910
969
|
n.pathname = this.logoutRedirectUrlPath;
|
|
911
|
-
let
|
|
912
|
-
e.end_session_endpoint ? (
|
|
970
|
+
let o;
|
|
971
|
+
e.end_session_endpoint ? (o = new URL(e.end_session_endpoint), o.searchParams.set(
|
|
913
972
|
"post_logout_redirect_uri",
|
|
914
973
|
n.toString()
|
|
915
|
-
)) :
|
|
974
|
+
)) : o = n;
|
|
916
975
|
});
|
|
917
|
-
|
|
918
|
-
const e = new URL(window.location.href), n = e.searchParams.get("state"),
|
|
919
|
-
if (sessionStorage.removeItem(
|
|
920
|
-
|
|
921
|
-
const s = await this.getAuthServer(),
|
|
976
|
+
y(this, "handleCallback", async () => {
|
|
977
|
+
const e = new URL(window.location.href), n = e.searchParams.get("state"), o = sessionStorage.getItem(V);
|
|
978
|
+
if (sessionStorage.removeItem(V), !o)
|
|
979
|
+
throw new x("No code verifier found in state.");
|
|
980
|
+
const s = await this.getAuthServer(), r = zt(
|
|
922
981
|
s,
|
|
923
982
|
this.client,
|
|
924
983
|
e.searchParams,
|
|
925
984
|
n ?? void 0
|
|
926
985
|
);
|
|
927
|
-
if (
|
|
928
|
-
throw
|
|
986
|
+
if (Z(r))
|
|
987
|
+
throw K.error("Error validating OAuth response", r), new de(
|
|
929
988
|
"Error validating OAuth response",
|
|
930
|
-
|
|
989
|
+
r
|
|
931
990
|
);
|
|
932
991
|
const i = new URL(e);
|
|
933
992
|
i.pathname = this.redirectToAfterSignIn, i.search = "";
|
|
934
|
-
const u = await
|
|
993
|
+
const u = await Et(
|
|
935
994
|
s,
|
|
936
995
|
this.client,
|
|
937
|
-
|
|
996
|
+
r,
|
|
938
997
|
i.toString(),
|
|
939
|
-
|
|
940
|
-
),
|
|
998
|
+
o
|
|
999
|
+
), h = await Pt(
|
|
941
1000
|
s,
|
|
942
1001
|
this.client,
|
|
943
1002
|
u
|
|
944
1003
|
);
|
|
945
|
-
this.setTokensFromResponse(
|
|
946
|
-
const
|
|
1004
|
+
this.setTokensFromResponse(h);
|
|
1005
|
+
const m = await this.getAccessToken(), _ = await (await gt(
|
|
947
1006
|
s,
|
|
948
1007
|
this.client,
|
|
949
|
-
|
|
950
|
-
)).json(),
|
|
951
|
-
sub:
|
|
952
|
-
email:
|
|
953
|
-
name:
|
|
954
|
-
emailVerified:
|
|
955
|
-
pictureUrl:
|
|
1008
|
+
m
|
|
1009
|
+
)).json(), f = {
|
|
1010
|
+
sub: _.sub,
|
|
1011
|
+
email: _.email,
|
|
1012
|
+
name: _.name,
|
|
1013
|
+
emailVerified: _.email_verified ?? !1,
|
|
1014
|
+
pictureUrl: _.picture
|
|
956
1015
|
};
|
|
957
|
-
|
|
1016
|
+
N.setState({
|
|
958
1017
|
isAuthenticated: !0,
|
|
959
1018
|
isPending: !1,
|
|
960
|
-
profile:
|
|
961
|
-
}),
|
|
1019
|
+
profile: f
|
|
1020
|
+
}), sessionStorage.setItem(
|
|
1021
|
+
"profile-state",
|
|
1022
|
+
JSON.stringify(N.getState().profile)
|
|
1023
|
+
);
|
|
1024
|
+
const R = sessionStorage.getItem("redirect-to") ?? "/";
|
|
1025
|
+
return sessionStorage.removeItem("redirect-to"), R;
|
|
962
1026
|
});
|
|
963
1027
|
this.client = {
|
|
964
|
-
client_id:
|
|
1028
|
+
client_id: r,
|
|
965
1029
|
token_endpoint_auth_method: "none"
|
|
966
|
-
}, this.audience = n, this.issuer = e, this.authorizationEndpoint =
|
|
1030
|
+
}, this.audience = n, this.issuer = e, this.authorizationEndpoint = o, this.tokenEndpoint = s, this.redirectToAfterSignUp = i ?? "/", this.redirectToAfterSignIn = u ?? "/", this.redirectToAfterSignOut = h ?? "/";
|
|
967
1031
|
}
|
|
968
1032
|
async getAuthServer() {
|
|
969
1033
|
if (!this.authorizationServer)
|
|
@@ -975,8 +1039,8 @@ class Et {
|
|
|
975
1039
|
code_challenge_methods_supported: []
|
|
976
1040
|
};
|
|
977
1041
|
else {
|
|
978
|
-
const e = new URL(this.issuer), n = await
|
|
979
|
-
this.authorizationServer = await
|
|
1042
|
+
const e = new URL(this.issuer), n = await Qe(e);
|
|
1043
|
+
this.authorizationServer = await Xe(
|
|
980
1044
|
e,
|
|
981
1045
|
n
|
|
982
1046
|
);
|
|
@@ -988,16 +1052,17 @@ class Et {
|
|
|
988
1052
|
* @param response
|
|
989
1053
|
*/
|
|
990
1054
|
setTokensFromResponse(e) {
|
|
991
|
-
if (
|
|
992
|
-
throw
|
|
1055
|
+
if (Z(e))
|
|
1056
|
+
throw K.error("Bad Token Response", e), new de("Bad Token Response", e);
|
|
993
1057
|
if (!e.expires_in)
|
|
994
|
-
throw new
|
|
995
|
-
|
|
1058
|
+
throw new x("No expires_in in response");
|
|
1059
|
+
const n = {
|
|
996
1060
|
accessToken: e.access_token,
|
|
997
1061
|
refreshToken: e.refresh_token,
|
|
998
1062
|
expiresOn: new Date(Date.now() + e.expires_in * 1e3),
|
|
999
1063
|
tokenType: e.token_type
|
|
1000
|
-
}
|
|
1064
|
+
};
|
|
1065
|
+
sessionStorage.setItem("token-state", JSON.stringify(n));
|
|
1001
1066
|
}
|
|
1002
1067
|
async signUp({ redirectTo: e } = {}) {
|
|
1003
1068
|
return this.authorize({
|
|
@@ -1014,68 +1079,73 @@ class Et {
|
|
|
1014
1079
|
redirectTo: e,
|
|
1015
1080
|
isSignUp: n = !1
|
|
1016
1081
|
}) {
|
|
1017
|
-
var
|
|
1018
|
-
const
|
|
1082
|
+
var m, b;
|
|
1083
|
+
const o = "S256", s = await this.getAuthServer();
|
|
1019
1084
|
if (!s.authorization_endpoint)
|
|
1020
|
-
throw new
|
|
1021
|
-
const
|
|
1022
|
-
sessionStorage.setItem(
|
|
1085
|
+
throw new x("No authorization endpoint");
|
|
1086
|
+
const r = et(), i = await nt(r);
|
|
1087
|
+
sessionStorage.setItem(V, r);
|
|
1023
1088
|
const u = new URL(
|
|
1024
1089
|
s.authorization_endpoint
|
|
1025
1090
|
);
|
|
1026
1091
|
sessionStorage.setItem("redirect-to", e);
|
|
1027
|
-
const
|
|
1028
|
-
if (
|
|
1092
|
+
const h = new URL(window.location.origin);
|
|
1093
|
+
if (h.pathname = this.callbackUrlPath, h.search = "", u.searchParams.set("client_id", this.client.client_id), u.searchParams.set("redirect_uri", h.toString()), u.searchParams.set("response_type", "code"), u.searchParams.set("scope", "openid profile email"), u.searchParams.set("code_challenge", i), u.searchParams.set(
|
|
1029
1094
|
"code_challenge_method",
|
|
1030
|
-
|
|
1031
|
-
), this.audience && u.searchParams.set("audience", this.audience), (
|
|
1095
|
+
o
|
|
1096
|
+
), this.audience && u.searchParams.set("audience", this.audience), (m = this.onAuthorizationUrl) == null || m.call(this, u, {
|
|
1032
1097
|
isSignIn: !n,
|
|
1033
1098
|
isSignUp: n
|
|
1034
|
-
}), ((
|
|
1035
|
-
const
|
|
1036
|
-
u.searchParams.set("state",
|
|
1099
|
+
}), ((b = s.code_challenge_methods_supported) == null ? void 0 : b.includes("S256")) !== !0) {
|
|
1100
|
+
const _ = tt();
|
|
1101
|
+
u.searchParams.set("state", _);
|
|
1037
1102
|
}
|
|
1038
1103
|
location.href = u.href;
|
|
1039
1104
|
}
|
|
1040
1105
|
async getAccessToken() {
|
|
1041
|
-
const e = await this.getAuthServer();
|
|
1042
|
-
if (!
|
|
1043
|
-
throw new
|
|
1044
|
-
|
|
1045
|
-
|
|
1106
|
+
const e = await this.getAuthServer(), n = sessionStorage.getItem("token-state");
|
|
1107
|
+
if (!n)
|
|
1108
|
+
throw new x("User is not authenticated");
|
|
1109
|
+
const o = JSON.parse(n);
|
|
1110
|
+
if (o.expiresOn < /* @__PURE__ */ new Date()) {
|
|
1111
|
+
if (!o.refreshToken)
|
|
1046
1112
|
return await this.signIn(), "";
|
|
1047
|
-
const
|
|
1113
|
+
const s = await yt(
|
|
1048
1114
|
e,
|
|
1049
1115
|
this.client,
|
|
1050
|
-
|
|
1051
|
-
), r = await
|
|
1116
|
+
o.refreshToken
|
|
1117
|
+
), r = await _t(
|
|
1052
1118
|
e,
|
|
1053
1119
|
this.client,
|
|
1054
|
-
|
|
1120
|
+
s
|
|
1055
1121
|
);
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1122
|
+
if (!r.access_token)
|
|
1123
|
+
throw new x("No access token in response");
|
|
1124
|
+
return this.setTokensFromResponse(r), r.access_token.toString();
|
|
1125
|
+
} else
|
|
1126
|
+
return o.accessToken;
|
|
1059
1127
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1128
|
+
pageLoad() {
|
|
1129
|
+
const e = sessionStorage.getItem("profile-state");
|
|
1130
|
+
if (e)
|
|
1131
|
+
try {
|
|
1132
|
+
const n = JSON.parse(e);
|
|
1133
|
+
N.setState({
|
|
1134
|
+
isAuthenticated: !0,
|
|
1135
|
+
isPending: !1,
|
|
1136
|
+
profile: n
|
|
1137
|
+
});
|
|
1138
|
+
} catch (n) {
|
|
1139
|
+
K.error("Error parsing auth state", n);
|
|
1072
1140
|
}
|
|
1073
|
-
|
|
1141
|
+
}
|
|
1142
|
+
getAuthenticationPlugin() {
|
|
1143
|
+
return new Ot(this.callbackUrlPath, this.handleCallback);
|
|
1074
1144
|
}
|
|
1075
1145
|
}
|
|
1076
|
-
const
|
|
1146
|
+
const Yt = (t) => new Nt(t);
|
|
1077
1147
|
export {
|
|
1078
|
-
|
|
1079
|
-
|
|
1148
|
+
Nt as OpenIDAuthenticationProvider,
|
|
1149
|
+
Yt as default
|
|
1080
1150
|
};
|
|
1081
1151
|
//# sourceMappingURL=zudoku.auth-openid.js.map
|