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