zudoku 0.3.0-dev.55 → 0.3.0-dev.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/demo.js +6 -1
- package/dist/app/demo.js.map +1 -1
- package/dist/app/entry.client.d.ts +1 -1
- package/dist/app/entry.client.js +1 -1
- package/dist/app/entry.client.js.map +1 -1
- package/dist/app/entry.server.d.ts +1 -1
- package/dist/app/entry.server.js +1 -1
- package/dist/app/entry.server.js.map +1 -1
- package/dist/app/main.d.ts +1 -1
- package/dist/app/main.js +9 -2
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js +6 -1
- package/dist/app/standalone.js.map +1 -1
- package/dist/config/validators/validate.d.ts +77 -17
- package/dist/config/validators/validate.js +7 -1
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/lib/components/DeveloperHint.d.ts +5 -0
- package/dist/lib/components/DeveloperHint.js +10 -0
- package/dist/lib/components/DeveloperHint.js.map +1 -0
- package/dist/lib/components/Header.js +1 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/NotFoundPage.js +2 -2
- package/dist/lib/components/NotFoundPage.js.map +1 -1
- package/dist/lib/components/navigation/SideNavigationCategory.js +2 -2
- package/dist/lib/components/navigation/SideNavigationCategory.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +8 -1
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/oas/graphql/index.js +5 -3
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/ProtectedRoute.d.ts +1 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js +14 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -0
- package/dist/lib/plugins/api-keys/index.js +2 -12
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +4 -3
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/StaggeredRender.d.ts +5 -0
- package/dist/lib/plugins/openapi/StaggeredRender.js +13 -0
- package/dist/lib/plugins/openapi/StaggeredRender.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +3 -3
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
- package/dist/vite/plugin-custom-css.js +2 -3
- package/dist/vite/plugin-custom-css.js.map +1 -1
- package/lib/AnchorLink-GNsUeGSX.js +705 -0
- package/lib/{AnchorLink-BaXHjhF-.js.map → AnchorLink-GNsUeGSX.js.map} +1 -1
- package/lib/Button-DpHMZvVs.js +4571 -0
- package/lib/Button-DpHMZvVs.js.map +1 -0
- package/lib/DevPortalProvider-Do9oJqme.js +1081 -0
- package/lib/{DevPortalProvider-GjdO0Xr-.js.map → DevPortalProvider-Do9oJqme.js.map} +1 -1
- package/lib/Markdown-DtLFdxD1.js +15031 -0
- package/lib/Markdown-DtLFdxD1.js.map +1 -0
- package/lib/MdxPage-CbwYRKf5.js +190 -0
- package/lib/{MdxPage-Dlujuj-J.js.map → MdxPage-CbwYRKf5.js.map} +1 -1
- package/lib/OperationList-DypxLtSC.js +5578 -0
- package/lib/OperationList-DypxLtSC.js.map +1 -0
- package/lib/Route-C1LyvITr.js +13 -0
- package/lib/{Route-CR6TEwVC.js.map → Route-C1LyvITr.js.map} +1 -1
- package/lib/Spinner-Bhbs5aPI.js +182 -0
- package/lib/Spinner-Bhbs5aPI.js.map +1 -0
- package/lib/_commonjsHelpers-BVfed4GL.js +29 -0
- package/lib/_commonjsHelpers-BVfed4GL.js.map +1 -0
- package/lib/assets/index-BPdJm2ty.js +4765 -0
- package/lib/assets/{index-CpIig0AX.js.map → index-BPdJm2ty.js.map} +1 -1
- package/lib/assets/worker-BWwCA-wk.js +14900 -0
- package/lib/assets/{worker-B5k2aBV9.js.map → worker-BWwCA-wk.js.map} +1 -1
- package/lib/context-_fYfJFgk.js +14 -0
- package/lib/{context-BoN_3uxi.js.map → context-_fYfJFgk.js.map} +1 -1
- package/lib/hook-Biq3zYel.js +92 -0
- package/lib/hook-Biq3zYel.js.map +1 -0
- package/lib/{index-Dih8IAqw.js → index-Bg82-bqR.js} +83 -103
- package/lib/{index-Dih8IAqw.js.map → index-Bg82-bqR.js.map} +1 -1
- package/lib/index-gsAuUwQh.js +418 -0
- package/lib/index-gsAuUwQh.js.map +1 -0
- package/lib/index-pI9JkN46.js +4765 -0
- package/lib/{index-Bn03IPZt.js.map → index-pI9JkN46.js.map} +1 -1
- package/lib/jsx-runtime-CJZJivg2.js +1526 -0
- package/lib/{jsx-runtime-DvZ6OKMM.js.map → jsx-runtime-CJZJivg2.js.map} +1 -1
- package/lib/prism-bash.min-DadFsM4Z.js +7 -0
- package/lib/{prism-bash.min-BtBk0onv.js.map → prism-bash.min-DadFsM4Z.js.map} +1 -1
- package/lib/prism-csharp.min-Yizuc34Y.js +35 -0
- package/lib/{prism-csharp.min-Cv7D49bv.js.map → prism-csharp.min-Yizuc34Y.js.map} +1 -1
- package/lib/prism-java.min-d5iT_mOd.js +7 -0
- package/lib/{prism-java.min-tNK-JX6x.js.map → prism-java.min-d5iT_mOd.js.map} +1 -1
- package/lib/prism-json.min-B1GJqK1k.js +2 -0
- package/lib/{prism-json.min-Cdtv-CME.js.map → prism-json.min-B1GJqK1k.js.map} +1 -1
- package/lib/prism-markup-templating-DZrrEs0A.js +62 -0
- package/lib/{prism-markup-templating-iotg2sCU.js.map → prism-markup-templating-DZrrEs0A.js.map} +1 -1
- package/lib/prism-objectivec.min-BXSWqpJJ.js +2 -0
- package/lib/{prism-objectivec.min-CY4WGixz.js.map → prism-objectivec.min-BXSWqpJJ.js.map} +1 -1
- package/lib/prism-php.min-o7FpoMP_.js +11 -0
- package/lib/{prism-php.min-T6sIVgED.js.map → prism-php.min-o7FpoMP_.js.map} +1 -1
- package/lib/prism-ruby.min-C7LwcKyz.js +10 -0
- package/lib/{prism-ruby.min-B-2KAa4y.js.map → prism-ruby.min-C7LwcKyz.js.map} +1 -1
- package/lib/router-CBw2vqJE.js +2973 -0
- package/lib/{router-ButO1QyY.js.map → router-CBw2vqJE.js.map} +1 -1
- package/lib/slugify-CiPVjteN.js +28 -0
- package/lib/{slugify-CmS97Vy8.js.map → slugify-CiPVjteN.js.map} +1 -1
- package/lib/state-DKdaQzvh.js +288 -0
- package/lib/{state-CmGfNKhR.js.map → state-DKdaQzvh.js.map} +1 -1
- package/lib/urql-DMlBWUKL.js +1592 -0
- package/lib/{urql-DtVKPBx_.js.map → urql-DMlBWUKL.js.map} +1 -1
- package/lib/util-_jwUlTBU.js +41 -0
- package/lib/{util-B5KX4h4M.js.map → util-_jwUlTBU.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +18 -24
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +34 -43
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +734 -1121
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +830 -1076
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +9689 -13781
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +171 -208
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +33 -41
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +6 -6
- package/lib/zudoku.plugin-redirect.js +8 -10
- package/lib/zudoku.plugin-redirect.js.map +1 -1
- package/package.json +2 -2
- package/src/app/demo.tsx +6 -1
- package/src/app/entry.client.tsx +1 -1
- package/src/app/entry.server.tsx +1 -1
- package/src/app/main.tsx +11 -2
- package/src/app/standalone.tsx +6 -1
- package/src/lib/components/DeveloperHint.tsx +25 -0
- package/src/lib/components/Header.tsx +6 -1
- package/src/lib/components/NotFoundPage.tsx +8 -14
- package/src/lib/components/navigation/SideNavigationCategory.tsx +3 -3
- package/src/lib/core/DevPortalContext.ts +8 -1
- package/src/lib/oas/graphql/index.ts +7 -3
- package/src/lib/plugins/api-keys/ProtectedRoute.tsx +29 -0
- package/src/lib/plugins/api-keys/index.tsx +2 -21
- package/src/lib/plugins/openapi/OperationList.tsx +14 -14
- package/src/lib/plugins/openapi/StaggeredRender.tsx +17 -0
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +3 -5
- package/lib/AnchorLink-BaXHjhF-.js +0 -989
- package/lib/Combination-BfufJFkX.js +0 -1365
- package/lib/Combination-BfufJFkX.js.map +0 -1
- package/lib/DevPortalProvider-GjdO0Xr-.js +0 -1610
- package/lib/Markdown-B8nPVql1.js +0 -19708
- package/lib/Markdown-B8nPVql1.js.map +0 -1
- package/lib/MdxPage-Dlujuj-J.js +0 -223
- package/lib/OperationList-krPgt6sE.js +0 -8041
- package/lib/OperationList-krPgt6sE.js.map +0 -1
- package/lib/Playground-DOHxca0P.js +0 -539
- package/lib/Playground-DOHxca0P.js.map +0 -1
- package/lib/Route-CR6TEwVC.js +0 -13
- package/lib/Select-Boi_pe3L.js +0 -5298
- package/lib/Select-Boi_pe3L.js.map +0 -1
- package/lib/Spinner-oU0QJmi_.js +0 -16
- package/lib/Spinner-oU0QJmi_.js.map +0 -1
- package/lib/_commonjsHelpers-BxmBWJD2.js +0 -34
- package/lib/_commonjsHelpers-BxmBWJD2.js.map +0 -1
- package/lib/assets/index-CpIig0AX.js +0 -6341
- package/lib/assets/worker-B5k2aBV9.js +0 -18921
- package/lib/context-BoN_3uxi.js +0 -17
- package/lib/hook-CIuFuyBT.js +0 -90
- package/lib/hook-CIuFuyBT.js.map +0 -1
- package/lib/index-BL1P4Gqq.js +0 -280
- package/lib/index-BL1P4Gqq.js.map +0 -1
- package/lib/index-Bn03IPZt.js +0 -6341
- package/lib/index-FprhHF51.js +0 -253
- package/lib/index-FprhHF51.js.map +0 -1
- package/lib/jsx-runtime-DvZ6OKMM.js +0 -2110
- package/lib/mutation-DWY9x2Uc.js +0 -250
- package/lib/mutation-DWY9x2Uc.js.map +0 -1
- package/lib/prism-bash.min-BtBk0onv.js +0 -7
- package/lib/prism-csharp.min-Cv7D49bv.js +0 -30
- package/lib/prism-java.min-tNK-JX6x.js +0 -7
- package/lib/prism-json.min-Cdtv-CME.js +0 -2
- package/lib/prism-markup-templating-iotg2sCU.js +0 -94
- package/lib/prism-objectivec.min-CY4WGixz.js +0 -2
- package/lib/prism-php.min-T6sIVgED.js +0 -11
- package/lib/prism-ruby.min-B-2KAa4y.js +0 -8
- package/lib/router-ButO1QyY.js +0 -4062
- package/lib/slugify-CmS97Vy8.js +0 -50
- package/lib/state-CmGfNKhR.js +0 -436
- package/lib/urql-DtVKPBx_.js +0 -2567
- package/lib/util-B5KX4h4M.js +0 -55
|
@@ -1,529 +1,348 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
(function(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
root.log = definition();
|
|
16
|
-
}
|
|
17
|
-
})(commonjsGlobal, function() {
|
|
18
|
-
var noop = function() {
|
|
19
|
-
};
|
|
20
|
-
var undefinedType = "undefined";
|
|
21
|
-
var isIE = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
|
|
22
|
-
var logMethods = [
|
|
1
|
+
var Re = Object.defineProperty;
|
|
2
|
+
var xe = (e, t, n) => t in e ? Re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var S = (e, t, n) => xe(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { a as Pe, j as T } from "./jsx-runtime-CJZJivg2.js";
|
|
5
|
+
import { c as Le, a as Ue } from "./_commonjsHelpers-BVfed4GL.js";
|
|
6
|
+
import { useRef as Ce, useState as je, useEffect as ze } from "react";
|
|
7
|
+
import { u as re } from "./state-DKdaQzvh.js";
|
|
8
|
+
var he = { exports: {} };
|
|
9
|
+
(function(e) {
|
|
10
|
+
(function(t, n) {
|
|
11
|
+
e.exports ? e.exports = n() : t.log = n();
|
|
12
|
+
})(Le, function() {
|
|
13
|
+
var t = function() {
|
|
14
|
+
}, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), s = [
|
|
23
15
|
"trace",
|
|
24
16
|
"debug",
|
|
25
17
|
"info",
|
|
26
18
|
"warn",
|
|
27
19
|
"error"
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return Function.prototype.
|
|
38
|
-
}
|
|
39
|
-
return function() {
|
|
40
|
-
return Function.prototype.apply.apply(method, [obj, arguments]);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
20
|
+
], r = {}, i = null;
|
|
21
|
+
function d(u, f) {
|
|
22
|
+
var c = u[f];
|
|
23
|
+
if (typeof c.bind == "function")
|
|
24
|
+
return c.bind(u);
|
|
25
|
+
try {
|
|
26
|
+
return Function.prototype.bind.call(c, u);
|
|
27
|
+
} catch {
|
|
28
|
+
return function() {
|
|
29
|
+
return Function.prototype.apply.apply(c, [u, arguments]);
|
|
30
|
+
};
|
|
43
31
|
}
|
|
44
32
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
if (console.log.apply) {
|
|
48
|
-
console.log.apply(console, arguments);
|
|
49
|
-
} else {
|
|
50
|
-
Function.prototype.apply.apply(console.log, [console, arguments]);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (console.trace) console.trace();
|
|
33
|
+
function g() {
|
|
34
|
+
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
54
35
|
}
|
|
55
|
-
function
|
|
56
|
-
|
|
57
|
-
methodName = "log";
|
|
58
|
-
}
|
|
59
|
-
if (typeof console === undefinedType) {
|
|
60
|
-
return false;
|
|
61
|
-
} else if (methodName === "trace" && isIE) {
|
|
62
|
-
return traceForIE;
|
|
63
|
-
} else if (console[methodName] !== void 0) {
|
|
64
|
-
return bindMethod(console, methodName);
|
|
65
|
-
} else if (console.log !== void 0) {
|
|
66
|
-
return bindMethod(console, "log");
|
|
67
|
-
} else {
|
|
68
|
-
return noop;
|
|
69
|
-
}
|
|
36
|
+
function m(u) {
|
|
37
|
+
return u === "debug" && (u = "log"), typeof console === n ? !1 : u === "trace" && o ? g : console[u] !== void 0 ? d(console, u) : console.log !== void 0 ? d(console, "log") : t;
|
|
70
38
|
}
|
|
71
|
-
function
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name);
|
|
39
|
+
function _() {
|
|
40
|
+
for (var u = this.getLevel(), f = 0; f < s.length; f++) {
|
|
41
|
+
var c = s[f];
|
|
42
|
+
this[c] = f < u ? t : this.methodFactory(c, u, this.name);
|
|
76
43
|
}
|
|
77
|
-
this.log = this.debug
|
|
78
|
-
if (typeof console === undefinedType && level < this.levels.SILENT) {
|
|
44
|
+
if (this.log = this.debug, typeof console === n && u < this.levels.SILENT)
|
|
79
45
|
return "No console available for logging";
|
|
80
|
-
}
|
|
81
46
|
}
|
|
82
|
-
function
|
|
47
|
+
function y(u) {
|
|
83
48
|
return function() {
|
|
84
|
-
|
|
85
|
-
replaceLoggingMethods.call(this);
|
|
86
|
-
this[methodName].apply(this, arguments);
|
|
87
|
-
}
|
|
49
|
+
typeof console !== n && (_.call(this), this[u].apply(this, arguments));
|
|
88
50
|
};
|
|
89
51
|
}
|
|
90
|
-
function
|
|
91
|
-
return
|
|
52
|
+
function h(u, f, c) {
|
|
53
|
+
return m(u) || y.apply(this, arguments);
|
|
92
54
|
}
|
|
93
|
-
function
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
window.localStorage[storageKey] = levelName;
|
|
109
|
-
return;
|
|
110
|
-
} catch (ignore) {
|
|
111
|
-
}
|
|
112
|
-
try {
|
|
113
|
-
window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
|
|
114
|
-
} catch (ignore) {
|
|
55
|
+
function L(u, f) {
|
|
56
|
+
var c = this, J, $, x, b = "loglevel";
|
|
57
|
+
typeof u == "string" ? b += ":" + u : typeof u == "symbol" && (b = void 0);
|
|
58
|
+
function ke(l) {
|
|
59
|
+
var p = (s[l] || "silent").toUpperCase();
|
|
60
|
+
if (!(typeof window === n || !b)) {
|
|
61
|
+
try {
|
|
62
|
+
window.localStorage[b] = p;
|
|
63
|
+
return;
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
window.document.cookie = encodeURIComponent(b) + "=" + p + ";";
|
|
68
|
+
} catch {
|
|
69
|
+
}
|
|
115
70
|
}
|
|
116
71
|
}
|
|
117
|
-
function
|
|
118
|
-
var
|
|
119
|
-
if (typeof window ===
|
|
120
|
-
try {
|
|
121
|
-
storedLevel = window.localStorage[storageKey];
|
|
122
|
-
} catch (ignore) {
|
|
123
|
-
}
|
|
124
|
-
if (typeof storedLevel === undefinedType) {
|
|
72
|
+
function ee() {
|
|
73
|
+
var l;
|
|
74
|
+
if (!(typeof window === n || !b)) {
|
|
125
75
|
try {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
var location2 = cookie.indexOf(cookieName + "=");
|
|
129
|
-
if (location2 !== -1) {
|
|
130
|
-
storedLevel = /^([^;]+)/.exec(
|
|
131
|
-
cookie.slice(location2 + cookieName.length + 1)
|
|
132
|
-
)[1];
|
|
133
|
-
}
|
|
134
|
-
} catch (ignore) {
|
|
76
|
+
l = window.localStorage[b];
|
|
77
|
+
} catch {
|
|
135
78
|
}
|
|
79
|
+
if (typeof l === n)
|
|
80
|
+
try {
|
|
81
|
+
var p = window.document.cookie, O = encodeURIComponent(b), ne = p.indexOf(O + "=");
|
|
82
|
+
ne !== -1 && (l = /^([^;]+)/.exec(
|
|
83
|
+
p.slice(ne + O.length + 1)
|
|
84
|
+
)[1]);
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
return c.levels[l] === void 0 && (l = void 0), l;
|
|
136
88
|
}
|
|
137
|
-
if (self.levels[storedLevel] === void 0) {
|
|
138
|
-
storedLevel = void 0;
|
|
139
|
-
}
|
|
140
|
-
return storedLevel;
|
|
141
89
|
}
|
|
142
|
-
function
|
|
143
|
-
if (typeof window ===
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
90
|
+
function Te() {
|
|
91
|
+
if (!(typeof window === n || !b)) {
|
|
92
|
+
try {
|
|
93
|
+
window.localStorage.removeItem(b);
|
|
94
|
+
} catch {
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
window.document.cookie = encodeURIComponent(b) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
151
100
|
}
|
|
152
101
|
}
|
|
153
|
-
function
|
|
154
|
-
var
|
|
155
|
-
if (typeof
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
|
|
159
|
-
return level;
|
|
160
|
-
} else {
|
|
161
|
-
throw new TypeError("log.setLevel() called with invalid level: " + input);
|
|
162
|
-
}
|
|
102
|
+
function U(l) {
|
|
103
|
+
var p = l;
|
|
104
|
+
if (typeof p == "string" && c.levels[p.toUpperCase()] !== void 0 && (p = c.levels[p.toUpperCase()]), typeof p == "number" && p >= 0 && p <= c.levels.SILENT)
|
|
105
|
+
return p;
|
|
106
|
+
throw new TypeError("log.setLevel() called with invalid level: " + l);
|
|
163
107
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
};
|
|
190
|
-
self.setDefaultLevel = function(level) {
|
|
191
|
-
defaultLevel = normalizeLevel(level);
|
|
192
|
-
if (!getPersistedLevel()) {
|
|
193
|
-
self.setLevel(level, false);
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
self.resetLevel = function() {
|
|
197
|
-
userLevel = null;
|
|
198
|
-
clearPersistedLevel();
|
|
199
|
-
replaceLoggingMethods.call(self);
|
|
200
|
-
};
|
|
201
|
-
self.enableAll = function(persist) {
|
|
202
|
-
self.setLevel(self.levels.TRACE, persist);
|
|
203
|
-
};
|
|
204
|
-
self.disableAll = function(persist) {
|
|
205
|
-
self.setLevel(self.levels.SILENT, persist);
|
|
206
|
-
};
|
|
207
|
-
self.rebuild = function() {
|
|
208
|
-
if (defaultLogger !== self) {
|
|
209
|
-
inheritedLevel = normalizeLevel(defaultLogger.getLevel());
|
|
210
|
-
}
|
|
211
|
-
replaceLoggingMethods.call(self);
|
|
212
|
-
if (defaultLogger === self) {
|
|
213
|
-
for (var childName in _loggersByName) {
|
|
214
|
-
_loggersByName[childName].rebuild();
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
inheritedLevel = normalizeLevel(
|
|
219
|
-
defaultLogger ? defaultLogger.getLevel() : "WARN"
|
|
108
|
+
c.name = u, c.levels = {
|
|
109
|
+
TRACE: 0,
|
|
110
|
+
DEBUG: 1,
|
|
111
|
+
INFO: 2,
|
|
112
|
+
WARN: 3,
|
|
113
|
+
ERROR: 4,
|
|
114
|
+
SILENT: 5
|
|
115
|
+
}, c.methodFactory = f || h, c.getLevel = function() {
|
|
116
|
+
return x ?? $ ?? J;
|
|
117
|
+
}, c.setLevel = function(l, p) {
|
|
118
|
+
return x = U(l), p !== !1 && ke(x), _.call(c);
|
|
119
|
+
}, c.setDefaultLevel = function(l) {
|
|
120
|
+
$ = U(l), ee() || c.setLevel(l, !1);
|
|
121
|
+
}, c.resetLevel = function() {
|
|
122
|
+
x = null, Te(), _.call(c);
|
|
123
|
+
}, c.enableAll = function(l) {
|
|
124
|
+
c.setLevel(c.levels.TRACE, l);
|
|
125
|
+
}, c.disableAll = function(l) {
|
|
126
|
+
c.setLevel(c.levels.SILENT, l);
|
|
127
|
+
}, c.rebuild = function() {
|
|
128
|
+
if (i !== c && (J = U(i.getLevel())), _.call(c), i === c)
|
|
129
|
+
for (var l in r)
|
|
130
|
+
r[l].rebuild();
|
|
131
|
+
}, J = U(
|
|
132
|
+
i ? i.getLevel() : "WARN"
|
|
220
133
|
);
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
userLevel = normalizeLevel(initialLevel);
|
|
224
|
-
}
|
|
225
|
-
replaceLoggingMethods.call(self);
|
|
134
|
+
var te = ee();
|
|
135
|
+
te != null && (x = U(te)), _.call(c);
|
|
226
136
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (typeof name !== "symbol" && typeof name !== "string" || name === "") {
|
|
137
|
+
i = new L(), i.getLogger = function(f) {
|
|
138
|
+
if (typeof f != "symbol" && typeof f != "string" || f === "")
|
|
230
139
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
defaultLogger.methodFactory
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
return logger2;
|
|
240
|
-
};
|
|
241
|
-
var _log = typeof window !== undefinedType ? window.log : void 0;
|
|
242
|
-
defaultLogger.noConflict = function() {
|
|
243
|
-
if (typeof window !== undefinedType && window.log === defaultLogger) {
|
|
244
|
-
window.log = _log;
|
|
245
|
-
}
|
|
246
|
-
return defaultLogger;
|
|
140
|
+
var c = r[f];
|
|
141
|
+
return c || (c = r[f] = new L(
|
|
142
|
+
f,
|
|
143
|
+
i.methodFactory
|
|
144
|
+
)), c;
|
|
247
145
|
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
146
|
+
var R = typeof window !== n ? window.log : void 0;
|
|
147
|
+
return i.noConflict = function() {
|
|
148
|
+
return typeof window !== n && window.log === i && (window.log = R), i;
|
|
149
|
+
}, i.getLoggers = function() {
|
|
150
|
+
return r;
|
|
151
|
+
}, i.default = i, i;
|
|
253
152
|
});
|
|
254
|
-
})(
|
|
255
|
-
var
|
|
256
|
-
const
|
|
257
|
-
let
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
function looseInstanceOf(input, expected) {
|
|
264
|
-
if (input == null) {
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
153
|
+
})(he);
|
|
154
|
+
var Je = he.exports;
|
|
155
|
+
const oe = /* @__PURE__ */ Ue(Je);
|
|
156
|
+
let M;
|
|
157
|
+
var I, de;
|
|
158
|
+
(typeof navigator > "u" || !((de = (I = navigator.userAgent) == null ? void 0 : I.startsWith) != null && de.call(I, "Mozilla/5.0 "))) && (M = "oauth4webapi/v2.11.1");
|
|
159
|
+
function q(e, t) {
|
|
160
|
+
if (e == null)
|
|
161
|
+
return !1;
|
|
267
162
|
try {
|
|
268
|
-
return
|
|
163
|
+
return e instanceof t || Object.getPrototypeOf(e)[Symbol.toStringTag] === t.prototype[Symbol.toStringTag];
|
|
269
164
|
} catch {
|
|
270
|
-
return
|
|
165
|
+
return !1;
|
|
271
166
|
}
|
|
272
167
|
}
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const encoder = new TextEncoder();
|
|
277
|
-
const decoder = new TextDecoder();
|
|
278
|
-
function buf(input) {
|
|
279
|
-
if (typeof input === "string") {
|
|
280
|
-
return encoder.encode(input);
|
|
281
|
-
}
|
|
282
|
-
return decoder.decode(input);
|
|
168
|
+
const K = Symbol(), Oe = Symbol(), V = Symbol(), Ie = new TextEncoder(), Ne = new TextDecoder();
|
|
169
|
+
function A(e) {
|
|
170
|
+
return typeof e == "string" ? Ie.encode(e) : Ne.decode(e);
|
|
283
171
|
}
|
|
284
|
-
const
|
|
285
|
-
function
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));
|
|
292
|
-
}
|
|
293
|
-
return btoa(arr.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
172
|
+
const ie = 32768;
|
|
173
|
+
function Ke(e) {
|
|
174
|
+
e instanceof ArrayBuffer && (e = new Uint8Array(e));
|
|
175
|
+
const t = [];
|
|
176
|
+
for (let n = 0; n < e.byteLength; n += ie)
|
|
177
|
+
t.push(String.fromCharCode.apply(null, e.subarray(n, n + ie)));
|
|
178
|
+
return btoa(t.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
294
179
|
}
|
|
295
|
-
function
|
|
180
|
+
function We(e) {
|
|
296
181
|
try {
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
} catch (cause) {
|
|
304
|
-
throw new OPE("The input to be decoded is not correctly encoded.", { cause });
|
|
182
|
+
const t = atob(e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")), n = new Uint8Array(t.length);
|
|
183
|
+
for (let o = 0; o < t.length; o++)
|
|
184
|
+
n[o] = t.charCodeAt(o);
|
|
185
|
+
return n;
|
|
186
|
+
} catch (t) {
|
|
187
|
+
throw new a("The input to be decoded is not correctly encoded.", { cause: t });
|
|
305
188
|
}
|
|
306
189
|
}
|
|
307
|
-
function
|
|
308
|
-
|
|
309
|
-
return decodeBase64Url(input);
|
|
310
|
-
}
|
|
311
|
-
return encodeBase64Url(input);
|
|
190
|
+
function k(e) {
|
|
191
|
+
return typeof e == "string" ? We(e) : Ke(e);
|
|
312
192
|
}
|
|
313
|
-
class
|
|
314
|
-
constructor(
|
|
315
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
316
|
-
this._cache = /* @__PURE__ */ new Map();
|
|
317
|
-
this.maxSize = maxSize;
|
|
193
|
+
class De {
|
|
194
|
+
constructor(t) {
|
|
195
|
+
this.cache = /* @__PURE__ */ new Map(), this._cache = /* @__PURE__ */ new Map(), this.maxSize = t;
|
|
318
196
|
}
|
|
319
|
-
get(
|
|
320
|
-
let
|
|
321
|
-
if (
|
|
322
|
-
return
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
this.update(key, v);
|
|
326
|
-
return v;
|
|
327
|
-
}
|
|
328
|
-
return void 0;
|
|
197
|
+
get(t) {
|
|
198
|
+
let n = this.cache.get(t);
|
|
199
|
+
if (n)
|
|
200
|
+
return n;
|
|
201
|
+
if (n = this._cache.get(t))
|
|
202
|
+
return this.update(t, n), n;
|
|
329
203
|
}
|
|
330
|
-
has(
|
|
331
|
-
return this.cache.has(
|
|
204
|
+
has(t) {
|
|
205
|
+
return this.cache.has(t) || this._cache.has(t);
|
|
332
206
|
}
|
|
333
|
-
set(
|
|
334
|
-
|
|
335
|
-
this.cache.set(key, value);
|
|
336
|
-
} else {
|
|
337
|
-
this.update(key, value);
|
|
338
|
-
}
|
|
339
|
-
return this;
|
|
207
|
+
set(t, n) {
|
|
208
|
+
return this.cache.has(t) ? this.cache.set(t, n) : this.update(t, n), this;
|
|
340
209
|
}
|
|
341
|
-
delete(
|
|
342
|
-
|
|
343
|
-
return this.cache.delete(key);
|
|
344
|
-
}
|
|
345
|
-
if (this._cache.has(key)) {
|
|
346
|
-
return this._cache.delete(key);
|
|
347
|
-
}
|
|
348
|
-
return false;
|
|
210
|
+
delete(t) {
|
|
211
|
+
return this.cache.has(t) ? this.cache.delete(t) : this._cache.has(t) ? this._cache.delete(t) : !1;
|
|
349
212
|
}
|
|
350
|
-
update(
|
|
351
|
-
this.cache.set(
|
|
352
|
-
if (this.cache.size >= this.maxSize) {
|
|
353
|
-
this._cache = this.cache;
|
|
354
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
355
|
-
}
|
|
213
|
+
update(t, n) {
|
|
214
|
+
this.cache.set(t, n), this.cache.size >= this.maxSize && (this._cache = this.cache, this.cache = /* @__PURE__ */ new Map());
|
|
356
215
|
}
|
|
357
216
|
}
|
|
358
|
-
class
|
|
359
|
-
constructor(
|
|
360
|
-
var
|
|
361
|
-
super(
|
|
362
|
-
this.name = this.constructor.name;
|
|
363
|
-
(_a2 = Error.captureStackTrace) == null ? void 0 : _a2.call(Error, this, this.constructor);
|
|
217
|
+
class v extends Error {
|
|
218
|
+
constructor(t) {
|
|
219
|
+
var n;
|
|
220
|
+
super(t ?? "operation not supported"), this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
|
|
364
221
|
}
|
|
365
222
|
}
|
|
366
|
-
class
|
|
367
|
-
constructor(
|
|
368
|
-
var
|
|
369
|
-
super(
|
|
370
|
-
this.name = this.constructor.name;
|
|
371
|
-
(_a2 = Error.captureStackTrace) == null ? void 0 : _a2.call(Error, this, this.constructor);
|
|
223
|
+
class He extends Error {
|
|
224
|
+
constructor(t, n) {
|
|
225
|
+
var o;
|
|
226
|
+
super(t, n), this.name = this.constructor.name, (o = Error.captureStackTrace) == null || o.call(Error, this, this.constructor);
|
|
372
227
|
}
|
|
373
228
|
}
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
return key instanceof CryptoKey;
|
|
229
|
+
const a = He, fe = new De(100);
|
|
230
|
+
function pe(e) {
|
|
231
|
+
return e instanceof CryptoKey;
|
|
378
232
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
233
|
+
function we(e) {
|
|
234
|
+
return pe(e) && e.type === "private";
|
|
381
235
|
}
|
|
382
|
-
function
|
|
383
|
-
return
|
|
236
|
+
function $e(e) {
|
|
237
|
+
return pe(e) && e.type === "public";
|
|
384
238
|
}
|
|
385
|
-
function
|
|
239
|
+
function Y(e) {
|
|
386
240
|
try {
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
dpopNonces.set(new URL(response.url).origin, nonce);
|
|
390
|
-
}
|
|
241
|
+
const t = e.headers.get("dpop-nonce");
|
|
242
|
+
t && fe.set(new URL(e.url).origin, t);
|
|
391
243
|
} catch {
|
|
392
244
|
}
|
|
393
|
-
return
|
|
245
|
+
return e;
|
|
394
246
|
}
|
|
395
|
-
function
|
|
396
|
-
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
return true;
|
|
247
|
+
function C(e) {
|
|
248
|
+
return !(e === null || typeof e != "object" || Array.isArray(e));
|
|
400
249
|
}
|
|
401
|
-
function
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
const headers = new Headers(input);
|
|
406
|
-
if (USER_AGENT && !headers.has("user-agent")) {
|
|
407
|
-
headers.set("user-agent", USER_AGENT);
|
|
408
|
-
}
|
|
409
|
-
if (headers.has("authorization")) {
|
|
250
|
+
function W(e) {
|
|
251
|
+
q(e, Headers) && (e = Object.fromEntries(e.entries()));
|
|
252
|
+
const t = new Headers(e);
|
|
253
|
+
if (M && !t.has("user-agent") && t.set("user-agent", M), t.has("authorization"))
|
|
410
254
|
throw new TypeError('"options.headers" must not include the "authorization" header name');
|
|
411
|
-
|
|
412
|
-
if (headers.has("dpop")) {
|
|
255
|
+
if (t.has("dpop"))
|
|
413
256
|
throw new TypeError('"options.headers" must not include the "dpop" header name');
|
|
414
|
-
|
|
415
|
-
return headers;
|
|
257
|
+
return t;
|
|
416
258
|
}
|
|
417
|
-
function
|
|
418
|
-
if (typeof
|
|
419
|
-
value = value();
|
|
420
|
-
}
|
|
421
|
-
if (!(value instanceof AbortSignal)) {
|
|
259
|
+
function Z(e) {
|
|
260
|
+
if (typeof e == "function" && (e = e()), !(e instanceof AbortSignal))
|
|
422
261
|
throw new TypeError('"options.signal" must return or be an instance of AbortSignal');
|
|
423
|
-
|
|
424
|
-
return value;
|
|
262
|
+
return e;
|
|
425
263
|
}
|
|
426
|
-
async function
|
|
427
|
-
if (!(
|
|
264
|
+
async function Fe(e, t) {
|
|
265
|
+
if (!(e instanceof URL))
|
|
428
266
|
throw new TypeError('"issuerIdentifier" must be an instance of URL');
|
|
429
|
-
|
|
430
|
-
if (issuerIdentifier.protocol !== "https:" && issuerIdentifier.protocol !== "http:") {
|
|
267
|
+
if (e.protocol !== "https:" && e.protocol !== "http:")
|
|
431
268
|
throw new TypeError('"issuer.protocol" must be "https:" or "http:"');
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
switch (options == null ? void 0 : options.algorithm) {
|
|
269
|
+
const n = new URL(e.href);
|
|
270
|
+
switch (t == null ? void 0 : t.algorithm) {
|
|
435
271
|
case void 0:
|
|
436
272
|
case "oidc":
|
|
437
|
-
|
|
273
|
+
n.pathname = `${n.pathname}/.well-known/openid-configuration`.replace("//", "/");
|
|
438
274
|
break;
|
|
439
275
|
case "oauth2":
|
|
440
|
-
|
|
441
|
-
url.pathname = ".well-known/oauth-authorization-server";
|
|
442
|
-
} else {
|
|
443
|
-
url.pathname = `.well-known/oauth-authorization-server/${url.pathname}`.replace("//", "/");
|
|
444
|
-
}
|
|
276
|
+
n.pathname === "/" ? n.pathname = ".well-known/oauth-authorization-server" : n.pathname = `.well-known/oauth-authorization-server/${n.pathname}`.replace("//", "/");
|
|
445
277
|
break;
|
|
446
278
|
default:
|
|
447
279
|
throw new TypeError('"options.algorithm" must be "oidc" (default), or "oauth2"');
|
|
448
280
|
}
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
headers: Object.fromEntries(headers.entries()),
|
|
281
|
+
const o = W(t == null ? void 0 : t.headers);
|
|
282
|
+
return o.set("accept", "application/json"), ((t == null ? void 0 : t[V]) || fetch)(n.href, {
|
|
283
|
+
headers: Object.fromEntries(o.entries()),
|
|
453
284
|
method: "GET",
|
|
454
285
|
redirect: "manual",
|
|
455
|
-
signal:
|
|
456
|
-
}).then(
|
|
286
|
+
signal: t != null && t.signal ? Z(t.signal) : null
|
|
287
|
+
}).then(Y);
|
|
457
288
|
}
|
|
458
|
-
function
|
|
459
|
-
return typeof
|
|
289
|
+
function w(e) {
|
|
290
|
+
return typeof e == "string" && e.length !== 0;
|
|
460
291
|
}
|
|
461
|
-
async function
|
|
462
|
-
if (!(
|
|
292
|
+
async function Me(e, t) {
|
|
293
|
+
if (!(e instanceof URL))
|
|
463
294
|
throw new TypeError('"expectedIssuer" must be an instance of URL');
|
|
464
|
-
|
|
465
|
-
if (!looseInstanceOf(response, Response)) {
|
|
295
|
+
if (!q(t, Response))
|
|
466
296
|
throw new TypeError('"response" must be an instance of Response');
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
assertReadableResponse(response);
|
|
472
|
-
let json;
|
|
297
|
+
if (t.status !== 200)
|
|
298
|
+
throw new a('"response" is not a conform Authorization Server Metadata response');
|
|
299
|
+
X(t);
|
|
300
|
+
let n;
|
|
473
301
|
try {
|
|
474
|
-
|
|
475
|
-
} catch (
|
|
476
|
-
throw new
|
|
477
|
-
}
|
|
478
|
-
if (!isJsonObject(json)) {
|
|
479
|
-
throw new OPE('"response" body must be a top level object');
|
|
480
|
-
}
|
|
481
|
-
if (!validateString(json.issuer)) {
|
|
482
|
-
throw new OPE('"response" body "issuer" property must be a non-empty string');
|
|
302
|
+
n = await t.json();
|
|
303
|
+
} catch (o) {
|
|
304
|
+
throw new a('failed to parse "response" body as JSON', { cause: o });
|
|
483
305
|
}
|
|
484
|
-
if (
|
|
485
|
-
throw new
|
|
486
|
-
|
|
487
|
-
|
|
306
|
+
if (!C(n))
|
|
307
|
+
throw new a('"response" body must be a top level object');
|
|
308
|
+
if (!w(n.issuer))
|
|
309
|
+
throw new a('"response" body "issuer" property must be a non-empty string');
|
|
310
|
+
if (new URL(n.issuer).href !== e.href)
|
|
311
|
+
throw new a('"response" body "issuer" does not match "expectedIssuer"');
|
|
312
|
+
return n;
|
|
488
313
|
}
|
|
489
|
-
function
|
|
490
|
-
return
|
|
314
|
+
function D() {
|
|
315
|
+
return k(crypto.getRandomValues(new Uint8Array(32)));
|
|
491
316
|
}
|
|
492
|
-
function
|
|
493
|
-
return
|
|
317
|
+
function Be() {
|
|
318
|
+
return D();
|
|
494
319
|
}
|
|
495
|
-
function
|
|
496
|
-
return
|
|
320
|
+
function Ge() {
|
|
321
|
+
return D();
|
|
497
322
|
}
|
|
498
|
-
async function
|
|
499
|
-
if (!
|
|
323
|
+
async function qe(e) {
|
|
324
|
+
if (!w(e))
|
|
500
325
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
501
|
-
|
|
502
|
-
return b64u(await crypto.subtle.digest("SHA-256", buf(codeVerifier)));
|
|
326
|
+
return k(await crypto.subtle.digest("SHA-256", A(e)));
|
|
503
327
|
}
|
|
504
|
-
function
|
|
505
|
-
if (
|
|
506
|
-
return { key:
|
|
507
|
-
|
|
508
|
-
if (!((input == null ? void 0 : input.key) instanceof CryptoKey)) {
|
|
328
|
+
function Ve(e) {
|
|
329
|
+
if (e instanceof CryptoKey)
|
|
330
|
+
return { key: e };
|
|
331
|
+
if (!((e == null ? void 0 : e.key) instanceof CryptoKey))
|
|
509
332
|
return {};
|
|
510
|
-
|
|
511
|
-
if (input.kid !== void 0 && !validateString(input.kid)) {
|
|
333
|
+
if (e.kid !== void 0 && !w(e.kid))
|
|
512
334
|
throw new TypeError('"kid" must be a non-empty string');
|
|
513
|
-
}
|
|
514
|
-
return { key: input.key, kid: input.kid };
|
|
335
|
+
return { key: e.key, kid: e.kid };
|
|
515
336
|
}
|
|
516
|
-
function
|
|
517
|
-
return encodeURIComponent(
|
|
337
|
+
function se(e) {
|
|
338
|
+
return encodeURIComponent(e).replace(/%20/g, "+");
|
|
518
339
|
}
|
|
519
|
-
function
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
const credentials = btoa(`${username}:${password}`);
|
|
523
|
-
return `Basic ${credentials}`;
|
|
340
|
+
function Ye(e, t) {
|
|
341
|
+
const n = se(e), o = se(t);
|
|
342
|
+
return `Basic ${btoa(`${n}:${o}`)}`;
|
|
524
343
|
}
|
|
525
|
-
function
|
|
526
|
-
switch (
|
|
344
|
+
function Ze(e) {
|
|
345
|
+
switch (e.algorithm.hash.name) {
|
|
527
346
|
case "SHA-256":
|
|
528
347
|
return "PS256";
|
|
529
348
|
case "SHA-384":
|
|
@@ -531,11 +350,11 @@ function psAlg(key) {
|
|
|
531
350
|
case "SHA-512":
|
|
532
351
|
return "PS512";
|
|
533
352
|
default:
|
|
534
|
-
throw new
|
|
353
|
+
throw new v("unsupported RsaHashedKeyAlgorithm hash name");
|
|
535
354
|
}
|
|
536
355
|
}
|
|
537
|
-
function
|
|
538
|
-
switch (
|
|
356
|
+
function Qe(e) {
|
|
357
|
+
switch (e.algorithm.hash.name) {
|
|
539
358
|
case "SHA-256":
|
|
540
359
|
return "RS256";
|
|
541
360
|
case "SHA-384":
|
|
@@ -543,11 +362,11 @@ function rsAlg(key) {
|
|
|
543
362
|
case "SHA-512":
|
|
544
363
|
return "RS512";
|
|
545
364
|
default:
|
|
546
|
-
throw new
|
|
365
|
+
throw new v("unsupported RsaHashedKeyAlgorithm hash name");
|
|
547
366
|
}
|
|
548
367
|
}
|
|
549
|
-
function
|
|
550
|
-
switch (
|
|
368
|
+
function Xe(e) {
|
|
369
|
+
switch (e.algorithm.namedCurve) {
|
|
551
370
|
case "P-256":
|
|
552
371
|
return "ES256";
|
|
553
372
|
case "P-384":
|
|
@@ -555,367 +374,281 @@ function esAlg(key) {
|
|
|
555
374
|
case "P-521":
|
|
556
375
|
return "ES512";
|
|
557
376
|
default:
|
|
558
|
-
throw new
|
|
377
|
+
throw new v("unsupported EcKeyAlgorithm namedCurve");
|
|
559
378
|
}
|
|
560
379
|
}
|
|
561
|
-
function
|
|
562
|
-
switch (
|
|
380
|
+
function ge(e) {
|
|
381
|
+
switch (e.algorithm.name) {
|
|
563
382
|
case "RSA-PSS":
|
|
564
|
-
return
|
|
383
|
+
return Ze(e);
|
|
565
384
|
case "RSASSA-PKCS1-v1_5":
|
|
566
|
-
return
|
|
385
|
+
return Qe(e);
|
|
567
386
|
case "ECDSA":
|
|
568
|
-
return
|
|
387
|
+
return Xe(e);
|
|
569
388
|
case "Ed25519":
|
|
570
389
|
case "Ed448":
|
|
571
390
|
return "EdDSA";
|
|
572
391
|
default:
|
|
573
|
-
throw new
|
|
392
|
+
throw new v("unsupported CryptoKey algorithm name");
|
|
574
393
|
}
|
|
575
394
|
}
|
|
576
|
-
function
|
|
577
|
-
const
|
|
578
|
-
return typeof
|
|
395
|
+
function H(e) {
|
|
396
|
+
const t = e == null ? void 0 : e[K];
|
|
397
|
+
return typeof t == "number" && Number.isFinite(t) ? t : 0;
|
|
579
398
|
}
|
|
580
|
-
function
|
|
581
|
-
const
|
|
582
|
-
return typeof
|
|
399
|
+
function et(e) {
|
|
400
|
+
const t = e == null ? void 0 : e[Oe];
|
|
401
|
+
return typeof t == "number" && Number.isFinite(t) && Math.sign(t) !== -1 ? t : 30;
|
|
583
402
|
}
|
|
584
|
-
function
|
|
403
|
+
function Q() {
|
|
585
404
|
return Math.floor(Date.now() / 1e3);
|
|
586
405
|
}
|
|
587
|
-
function
|
|
588
|
-
const
|
|
406
|
+
function tt(e, t) {
|
|
407
|
+
const n = Q() + H(t);
|
|
589
408
|
return {
|
|
590
|
-
jti:
|
|
591
|
-
aud: [
|
|
592
|
-
exp:
|
|
593
|
-
iat:
|
|
594
|
-
nbf:
|
|
595
|
-
iss:
|
|
596
|
-
sub:
|
|
409
|
+
jti: D(),
|
|
410
|
+
aud: [e.issuer, e.token_endpoint],
|
|
411
|
+
exp: n + 60,
|
|
412
|
+
iat: n,
|
|
413
|
+
nbf: n,
|
|
414
|
+
iss: t.client_id,
|
|
415
|
+
sub: t.client_id
|
|
597
416
|
};
|
|
598
417
|
}
|
|
599
|
-
async function
|
|
600
|
-
return
|
|
601
|
-
alg:
|
|
602
|
-
kid
|
|
603
|
-
},
|
|
418
|
+
async function nt(e, t, n, o) {
|
|
419
|
+
return me({
|
|
420
|
+
alg: ge(n),
|
|
421
|
+
kid: o
|
|
422
|
+
}, tt(e, t), n);
|
|
604
423
|
}
|
|
605
|
-
function
|
|
606
|
-
if (typeof
|
|
424
|
+
function j(e) {
|
|
425
|
+
if (typeof e != "object" || e === null)
|
|
607
426
|
throw new TypeError('"as" must be an object');
|
|
608
|
-
|
|
609
|
-
if (!validateString(as.issuer)) {
|
|
427
|
+
if (!w(e.issuer))
|
|
610
428
|
throw new TypeError('"as.issuer" property must be a non-empty string');
|
|
611
|
-
|
|
612
|
-
return true;
|
|
429
|
+
return !0;
|
|
613
430
|
}
|
|
614
|
-
function
|
|
615
|
-
if (typeof
|
|
431
|
+
function z(e) {
|
|
432
|
+
if (typeof e != "object" || e === null)
|
|
616
433
|
throw new TypeError('"client" must be an object');
|
|
617
|
-
|
|
618
|
-
if (!validateString(client.client_id)) {
|
|
434
|
+
if (!w(e.client_id))
|
|
619
435
|
throw new TypeError('"client.client_id" property must be a non-empty string');
|
|
620
|
-
|
|
621
|
-
return true;
|
|
436
|
+
return !0;
|
|
622
437
|
}
|
|
623
|
-
function
|
|
624
|
-
if (!
|
|
438
|
+
function ae(e) {
|
|
439
|
+
if (!w(e))
|
|
625
440
|
throw new TypeError('"client.client_secret" property must be a non-empty string');
|
|
626
|
-
|
|
627
|
-
return clientSecret;
|
|
441
|
+
return e;
|
|
628
442
|
}
|
|
629
|
-
function
|
|
630
|
-
if (
|
|
631
|
-
throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${
|
|
632
|
-
}
|
|
443
|
+
function F(e, t) {
|
|
444
|
+
if (t !== void 0)
|
|
445
|
+
throw new TypeError(`"options.clientPrivateKey" property must not be provided when ${e} client authentication method is used.`);
|
|
633
446
|
}
|
|
634
|
-
function
|
|
635
|
-
if (
|
|
636
|
-
throw new TypeError(`"client.client_secret" property must not be provided when ${
|
|
637
|
-
}
|
|
447
|
+
function ce(e, t) {
|
|
448
|
+
if (t !== void 0)
|
|
449
|
+
throw new TypeError(`"client.client_secret" property must not be provided when ${e} client authentication method is used.`);
|
|
638
450
|
}
|
|
639
|
-
async function
|
|
640
|
-
|
|
641
|
-
body.delete("client_assertion_type");
|
|
642
|
-
body.delete("client_assertion");
|
|
643
|
-
switch (client.token_endpoint_auth_method) {
|
|
451
|
+
async function rt(e, t, n, o, s) {
|
|
452
|
+
switch (n.delete("client_secret"), n.delete("client_assertion_type"), n.delete("client_assertion"), t.token_endpoint_auth_method) {
|
|
644
453
|
case void 0:
|
|
645
454
|
case "client_secret_basic": {
|
|
646
|
-
|
|
647
|
-
headers.set("authorization", clientSecretBasic(client.client_id, assertClientSecret(client.client_secret)));
|
|
455
|
+
F("client_secret_basic", s), o.set("authorization", Ye(t.client_id, ae(t.client_secret)));
|
|
648
456
|
break;
|
|
649
457
|
}
|
|
650
458
|
case "client_secret_post": {
|
|
651
|
-
|
|
652
|
-
body.set("client_id", client.client_id);
|
|
653
|
-
body.set("client_secret", assertClientSecret(client.client_secret));
|
|
459
|
+
F("client_secret_post", s), n.set("client_id", t.client_id), n.set("client_secret", ae(t.client_secret));
|
|
654
460
|
break;
|
|
655
461
|
}
|
|
656
462
|
case "private_key_jwt": {
|
|
657
|
-
|
|
658
|
-
if (clientPrivateKey === void 0) {
|
|
463
|
+
if (ce("private_key_jwt", t.client_secret), s === void 0)
|
|
659
464
|
throw new TypeError('"options.clientPrivateKey" must be provided when "client.token_endpoint_auth_method" is "private_key_jwt"');
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
if (!isPrivateKey(key)) {
|
|
465
|
+
const { key: r, kid: i } = Ve(s);
|
|
466
|
+
if (!we(r))
|
|
663
467
|
throw new TypeError('"options.clientPrivateKey.key" must be a private CryptoKey');
|
|
664
|
-
|
|
665
|
-
body.set("client_id", client.client_id);
|
|
666
|
-
body.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer");
|
|
667
|
-
body.set("client_assertion", await privateKeyJwt(as, client, key, kid));
|
|
468
|
+
n.set("client_id", t.client_id), n.set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.set("client_assertion", await nt(e, t, r, i));
|
|
668
469
|
break;
|
|
669
470
|
}
|
|
670
471
|
case "tls_client_auth":
|
|
671
472
|
case "self_signed_tls_client_auth":
|
|
672
473
|
case "none": {
|
|
673
|
-
|
|
674
|
-
assertNoClientPrivateKey(client.token_endpoint_auth_method, clientPrivateKey);
|
|
675
|
-
body.set("client_id", client.client_id);
|
|
474
|
+
ce(t.token_endpoint_auth_method, t.client_secret), F(t.token_endpoint_auth_method, s), n.set("client_id", t.client_id);
|
|
676
475
|
break;
|
|
677
476
|
}
|
|
678
477
|
default:
|
|
679
|
-
throw new
|
|
478
|
+
throw new v("unsupported client token_endpoint_auth_method");
|
|
680
479
|
}
|
|
681
480
|
}
|
|
682
|
-
async function
|
|
683
|
-
if (!
|
|
481
|
+
async function me(e, t, n) {
|
|
482
|
+
if (!n.usages.includes("sign"))
|
|
684
483
|
throw new TypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"');
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
const signature = b64u(await crypto.subtle.sign(keyToSubtle(key), key, buf(input)));
|
|
688
|
-
return `${input}.${signature}`;
|
|
484
|
+
const o = `${k(A(JSON.stringify(e)))}.${k(A(JSON.stringify(t)))}`, s = k(await crypto.subtle.sign(Se(n), n, A(o)));
|
|
485
|
+
return `${o}.${s}`;
|
|
689
486
|
}
|
|
690
|
-
async function
|
|
691
|
-
const { privateKey, publicKey, nonce =
|
|
692
|
-
if (!
|
|
487
|
+
async function ot(e, t, n, o, s, r) {
|
|
488
|
+
const { privateKey: i, publicKey: d, nonce: g = fe.get(n.origin) } = t;
|
|
489
|
+
if (!we(i))
|
|
693
490
|
throw new TypeError('"DPoP.privateKey" must be a private CryptoKey');
|
|
694
|
-
|
|
695
|
-
if (!isPublicKey(publicKey)) {
|
|
491
|
+
if (!$e(d))
|
|
696
492
|
throw new TypeError('"DPoP.publicKey" must be a public CryptoKey');
|
|
697
|
-
|
|
698
|
-
if (nonce !== void 0 && !validateString(nonce)) {
|
|
493
|
+
if (g !== void 0 && !w(g))
|
|
699
494
|
throw new TypeError('"DPoP.nonce" must be a non-empty string or undefined');
|
|
700
|
-
|
|
701
|
-
if (!publicKey.extractable) {
|
|
495
|
+
if (!d.extractable)
|
|
702
496
|
throw new TypeError('"DPoP.publicKey.extractable" must be true');
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
const proof = await jwt({
|
|
706
|
-
alg: keyToJws(privateKey),
|
|
497
|
+
const m = Q() + s, _ = await me({
|
|
498
|
+
alg: ge(i),
|
|
707
499
|
typ: "dpop+jwt",
|
|
708
|
-
jwk: await
|
|
500
|
+
jwk: await st(d)
|
|
709
501
|
}, {
|
|
710
|
-
iat:
|
|
711
|
-
jti:
|
|
712
|
-
htm,
|
|
713
|
-
nonce,
|
|
714
|
-
htu: `${
|
|
715
|
-
ath:
|
|
716
|
-
},
|
|
717
|
-
|
|
718
|
-
}
|
|
719
|
-
let
|
|
720
|
-
async function
|
|
721
|
-
const { kty, e, n, x, y, crv } = await crypto.subtle.exportKey("jwk",
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
return
|
|
738
|
-
}
|
|
739
|
-
function
|
|
740
|
-
|
|
741
|
-
if (typeof value !== "object" || Array.isArray(value) || value === null) {
|
|
742
|
-
return false;
|
|
743
|
-
}
|
|
744
|
-
return value.error !== void 0;
|
|
745
|
-
}
|
|
746
|
-
async function protectedResourceRequest(accessToken, method, url, headers, body, options) {
|
|
747
|
-
if (!validateString(accessToken)) {
|
|
502
|
+
iat: m,
|
|
503
|
+
jti: D(),
|
|
504
|
+
htm: o,
|
|
505
|
+
nonce: g,
|
|
506
|
+
htu: `${n.origin}${n.pathname}`,
|
|
507
|
+
ath: r ? k(await crypto.subtle.digest("SHA-256", A(r))) : void 0
|
|
508
|
+
}, i);
|
|
509
|
+
e.set("dpop", _);
|
|
510
|
+
}
|
|
511
|
+
let N;
|
|
512
|
+
async function it(e) {
|
|
513
|
+
const { kty: t, e: n, n: o, x: s, y: r, crv: i } = await crypto.subtle.exportKey("jwk", e), d = { kty: t, e: n, n: o, x: s, y: r, crv: i };
|
|
514
|
+
return N.set(e, d), d;
|
|
515
|
+
}
|
|
516
|
+
async function st(e) {
|
|
517
|
+
return N || (N = /* @__PURE__ */ new WeakMap()), N.get(e) || it(e);
|
|
518
|
+
}
|
|
519
|
+
function at(e, t, n) {
|
|
520
|
+
if (typeof e != "string")
|
|
521
|
+
throw new TypeError(`"as.${t}" must be a string`);
|
|
522
|
+
return new URL(e);
|
|
523
|
+
}
|
|
524
|
+
function ye(e, t, n) {
|
|
525
|
+
return at(e[t], t);
|
|
526
|
+
}
|
|
527
|
+
function B(e) {
|
|
528
|
+
const t = e;
|
|
529
|
+
return typeof t != "object" || Array.isArray(t) || t === null ? !1 : t.error !== void 0;
|
|
530
|
+
}
|
|
531
|
+
async function ct(e, t, n, o, s, r) {
|
|
532
|
+
if (!w(e))
|
|
748
533
|
throw new TypeError('"accessToken" must be a non-empty string');
|
|
749
|
-
|
|
750
|
-
if (!(url instanceof URL)) {
|
|
534
|
+
if (!(n instanceof URL))
|
|
751
535
|
throw new TypeError('"url" must be an instance of URL');
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
} else {
|
|
757
|
-
await dpopProofJwt(headers, options.DPoP, url, "GET", getClockSkew({ [clockSkew]: options == null ? void 0 : options[clockSkew] }), accessToken);
|
|
758
|
-
headers.set("authorization", `DPoP ${accessToken}`);
|
|
759
|
-
}
|
|
760
|
-
return ((options == null ? void 0 : options[customFetch]) || fetch)(url.href, {
|
|
761
|
-
body,
|
|
762
|
-
headers: Object.fromEntries(headers.entries()),
|
|
763
|
-
method,
|
|
536
|
+
return o = W(o), (r == null ? void 0 : r.DPoP) === void 0 ? o.set("authorization", `Bearer ${e}`) : (await ot(o, r.DPoP, n, "GET", H({ [K]: r == null ? void 0 : r[K] }), e), o.set("authorization", `DPoP ${e}`)), ((r == null ? void 0 : r[V]) || fetch)(n.href, {
|
|
537
|
+
body: s,
|
|
538
|
+
headers: Object.fromEntries(o.entries()),
|
|
539
|
+
method: t,
|
|
764
540
|
redirect: "manual",
|
|
765
|
-
signal:
|
|
766
|
-
}).then(
|
|
767
|
-
}
|
|
768
|
-
async function
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
headers.set("accept", "application/jwt");
|
|
775
|
-
} else {
|
|
776
|
-
headers.set("accept", "application/json");
|
|
777
|
-
headers.append("accept", "application/jwt");
|
|
778
|
-
}
|
|
779
|
-
return protectedResourceRequest(accessToken, "GET", url, headers, null, {
|
|
780
|
-
...options,
|
|
781
|
-
[clockSkew]: getClockSkew(client)
|
|
541
|
+
signal: r != null && r.signal ? Z(r.signal) : null
|
|
542
|
+
}).then(Y);
|
|
543
|
+
}
|
|
544
|
+
async function ut(e, t, n, o) {
|
|
545
|
+
j(e), z(t);
|
|
546
|
+
const s = ye(e, "userinfo_endpoint"), r = W(o == null ? void 0 : o.headers);
|
|
547
|
+
return t.userinfo_signed_response_alg ? r.set("accept", "application/jwt") : (r.set("accept", "application/json"), r.append("accept", "application/jwt")), ct(n, "GET", s, r, null, {
|
|
548
|
+
...o,
|
|
549
|
+
[K]: H(t)
|
|
782
550
|
});
|
|
783
551
|
}
|
|
784
|
-
async function
|
|
785
|
-
await
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
headers: Object.fromEntries(headers.entries()),
|
|
790
|
-
method,
|
|
552
|
+
async function lt(e, t, n, o, s, r, i) {
|
|
553
|
+
return await rt(e, t, 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[V]) || fetch)(o.href, {
|
|
554
|
+
body: s,
|
|
555
|
+
headers: Object.fromEntries(r.entries()),
|
|
556
|
+
method: n,
|
|
791
557
|
redirect: "manual",
|
|
792
|
-
signal:
|
|
793
|
-
}).then(
|
|
794
|
-
}
|
|
795
|
-
async function
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
const
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
assertAs(as);
|
|
804
|
-
assertClient(client);
|
|
805
|
-
if (!validateString(refreshToken)) {
|
|
558
|
+
signal: i != null && i.signal ? Z(i.signal) : null
|
|
559
|
+
}).then(Y);
|
|
560
|
+
}
|
|
561
|
+
async function _e(e, t, n, o, s) {
|
|
562
|
+
const r = ye(e, "token_endpoint");
|
|
563
|
+
o.set("grant_type", n);
|
|
564
|
+
const i = W(s == null ? void 0 : s.headers);
|
|
565
|
+
return i.set("accept", "application/json"), lt(e, t, "POST", r, o, i, s);
|
|
566
|
+
}
|
|
567
|
+
async function dt(e, t, n, o) {
|
|
568
|
+
if (j(e), z(t), !w(n))
|
|
806
569
|
throw new TypeError('"refreshToken" must be a non-empty string');
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
async function processGenericAccessTokenResponse(as, client, response, ignoreIdToken = false, ignoreRefreshToken = false) {
|
|
814
|
-
assertAs(as);
|
|
815
|
-
assertClient(client);
|
|
816
|
-
if (!looseInstanceOf(response, Response)) {
|
|
570
|
+
const s = new URLSearchParams(o == null ? void 0 : o.additionalParameters);
|
|
571
|
+
return s.set("refresh_token", n), _e(e, t, "refresh_token", s, o);
|
|
572
|
+
}
|
|
573
|
+
const ht = /* @__PURE__ */ new WeakMap();
|
|
574
|
+
async function be(e, t, n, o = !1, s = !1) {
|
|
575
|
+
if (j(e), z(t), !q(n, Response))
|
|
817
576
|
throw new TypeError('"response" must be an instance of Response');
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
assertReadableResponse(response);
|
|
827
|
-
let json;
|
|
577
|
+
if (n.status !== 200) {
|
|
578
|
+
let i;
|
|
579
|
+
if (i = await vt(n))
|
|
580
|
+
return i;
|
|
581
|
+
throw new a('"response" is not a conform Token Endpoint response');
|
|
582
|
+
}
|
|
583
|
+
X(n);
|
|
584
|
+
let r;
|
|
828
585
|
try {
|
|
829
|
-
|
|
830
|
-
} catch (
|
|
831
|
-
throw new
|
|
832
|
-
}
|
|
833
|
-
if (!
|
|
834
|
-
throw new
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
if (
|
|
840
|
-
throw new
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
if (
|
|
844
|
-
throw new
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
throw new OPE('"response" body "id_token" property must be a non-empty string');
|
|
858
|
-
}
|
|
859
|
-
if (json.id_token) {
|
|
860
|
-
const { claims } = await validateJwt(json.id_token, checkSigningAlgorithm.bind(void 0, client.id_token_signed_response_alg, as.id_token_signing_alg_values_supported), noSignatureCheck, getClockSkew(client), getClockTolerance(client)).then(validatePresence.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(validateIssuer.bind(void 0, as.issuer)).then(validateAudience.bind(void 0, client.client_id));
|
|
861
|
-
if (Array.isArray(claims.aud) && claims.aud.length !== 1 && claims.azp !== client.client_id) {
|
|
862
|
-
throw new OPE('unexpected ID Token "azp" (authorized party) claim value');
|
|
863
|
-
}
|
|
864
|
-
if (claims.auth_time !== void 0 && (!Number.isFinite(claims.auth_time) || Math.sign(claims.auth_time) !== 1)) {
|
|
865
|
-
throw new OPE('ID Token "auth_time" (authentication time) must be a positive number');
|
|
866
|
-
}
|
|
867
|
-
idTokenClaims.set(json, claims);
|
|
586
|
+
r = await n.json();
|
|
587
|
+
} catch (i) {
|
|
588
|
+
throw new a('failed to parse "response" body as JSON', { cause: i });
|
|
589
|
+
}
|
|
590
|
+
if (!C(r))
|
|
591
|
+
throw new a('"response" body must be a top level object');
|
|
592
|
+
if (!w(r.access_token))
|
|
593
|
+
throw new a('"response" body "access_token" property must be a non-empty string');
|
|
594
|
+
if (!w(r.token_type))
|
|
595
|
+
throw new a('"response" body "token_type" property must be a non-empty string');
|
|
596
|
+
if (r.token_type = r.token_type.toLowerCase(), r.token_type !== "dpop" && r.token_type !== "bearer")
|
|
597
|
+
throw new v("unsupported `token_type` value");
|
|
598
|
+
if (r.expires_in !== void 0 && (typeof r.expires_in != "number" || r.expires_in <= 0))
|
|
599
|
+
throw new a('"response" body "expires_in" property must be a positive number');
|
|
600
|
+
if (!s && r.refresh_token !== void 0 && !w(r.refresh_token))
|
|
601
|
+
throw new a('"response" body "refresh_token" property must be a non-empty string');
|
|
602
|
+
if (r.scope !== void 0 && typeof r.scope != "string")
|
|
603
|
+
throw new a('"response" body "scope" property must be a string');
|
|
604
|
+
if (!o) {
|
|
605
|
+
if (r.id_token !== void 0 && !w(r.id_token))
|
|
606
|
+
throw new a('"response" body "id_token" property must be a non-empty string');
|
|
607
|
+
if (r.id_token) {
|
|
608
|
+
const { claims: i } = await Et(r.id_token, kt.bind(void 0, t.id_token_signed_response_alg, e.id_token_signing_alg_values_supported), Ee, H(t), et(t)).then(_t.bind(void 0, ["aud", "exp", "iat", "iss", "sub"])).then(wt.bind(void 0, e.issuer)).then(pt.bind(void 0, t.client_id));
|
|
609
|
+
if (Array.isArray(i.aud) && i.aud.length !== 1 && i.azp !== t.client_id)
|
|
610
|
+
throw new a('unexpected ID Token "azp" (authorized party) claim value');
|
|
611
|
+
if (i.auth_time !== void 0 && (!Number.isFinite(i.auth_time) || Math.sign(i.auth_time) !== 1))
|
|
612
|
+
throw new a('ID Token "auth_time" (authentication time) must be a positive number');
|
|
613
|
+
ht.set(r, i);
|
|
868
614
|
}
|
|
869
615
|
}
|
|
870
|
-
return
|
|
616
|
+
return r;
|
|
871
617
|
}
|
|
872
|
-
async function
|
|
873
|
-
return
|
|
618
|
+
async function ft(e, t, n) {
|
|
619
|
+
return be(e, t, n);
|
|
874
620
|
}
|
|
875
|
-
function
|
|
876
|
-
if (Array.isArray(
|
|
877
|
-
if (!
|
|
878
|
-
throw new
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
}
|
|
883
|
-
return result;
|
|
621
|
+
function pt(e, t) {
|
|
622
|
+
if (Array.isArray(t.claims.aud)) {
|
|
623
|
+
if (!t.claims.aud.includes(e))
|
|
624
|
+
throw new a('unexpected JWT "aud" (audience) claim value');
|
|
625
|
+
} else if (t.claims.aud !== e)
|
|
626
|
+
throw new a('unexpected JWT "aud" (audience) claim value');
|
|
627
|
+
return t;
|
|
884
628
|
}
|
|
885
|
-
function
|
|
886
|
-
if (
|
|
887
|
-
throw new
|
|
888
|
-
|
|
889
|
-
return result;
|
|
629
|
+
function wt(e, t) {
|
|
630
|
+
if (t.claims.iss !== e)
|
|
631
|
+
throw new a('unexpected JWT "iss" (issuer) claim value');
|
|
632
|
+
return t;
|
|
890
633
|
}
|
|
891
|
-
const
|
|
892
|
-
function
|
|
893
|
-
|
|
894
|
-
return searchParams;
|
|
634
|
+
const ve = /* @__PURE__ */ new WeakSet();
|
|
635
|
+
function gt(e) {
|
|
636
|
+
return ve.add(e), e;
|
|
895
637
|
}
|
|
896
|
-
async function
|
|
897
|
-
|
|
898
|
-
assertClient(client);
|
|
899
|
-
if (!branded.has(callbackParameters)) {
|
|
638
|
+
async function mt(e, t, n, o, s, r) {
|
|
639
|
+
if (j(e), z(t), !ve.has(n))
|
|
900
640
|
throw new TypeError('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()');
|
|
901
|
-
|
|
902
|
-
if (!validateString(redirectUri)) {
|
|
641
|
+
if (!w(o))
|
|
903
642
|
throw new TypeError('"redirectUri" must be a non-empty string');
|
|
904
|
-
|
|
905
|
-
if (!validateString(codeVerifier)) {
|
|
643
|
+
if (!w(s))
|
|
906
644
|
throw new TypeError('"codeVerifier" must be a non-empty string');
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
const parameters = new URLSearchParams(options == null ? void 0 : options.additionalParameters);
|
|
913
|
-
parameters.set("redirect_uri", redirectUri);
|
|
914
|
-
parameters.set("code_verifier", codeVerifier);
|
|
915
|
-
parameters.set("code", code);
|
|
916
|
-
return tokenEndpointRequest(as, client, "authorization_code", parameters, options);
|
|
645
|
+
const i = E(n, "code");
|
|
646
|
+
if (!i)
|
|
647
|
+
throw new a('no authorization code in "callbackParameters"');
|
|
648
|
+
const d = new URLSearchParams(r == null ? void 0 : r.additionalParameters);
|
|
649
|
+
return d.set("redirect_uri", o), d.set("code_verifier", s), d.set("code", i), _e(e, t, "authorization_code", d, r);
|
|
917
650
|
}
|
|
918
|
-
const
|
|
651
|
+
const yt = {
|
|
919
652
|
aud: "audience",
|
|
920
653
|
c_hash: "code hash",
|
|
921
654
|
client_id: "client id",
|
|
@@ -931,64 +664,44 @@ const jwtClaimNames = {
|
|
|
931
664
|
htu: "http uri",
|
|
932
665
|
cnf: "confirmation"
|
|
933
666
|
};
|
|
934
|
-
function
|
|
935
|
-
for (const
|
|
936
|
-
if (
|
|
937
|
-
throw new
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
if (
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
return result;
|
|
954
|
-
}
|
|
955
|
-
function assertReadableResponse(response) {
|
|
956
|
-
if (response.bodyUsed) {
|
|
667
|
+
function _t(e, t) {
|
|
668
|
+
for (const n of e)
|
|
669
|
+
if (t.claims[n] === void 0)
|
|
670
|
+
throw new a(`JWT "${n}" (${yt[n]}) claim missing`);
|
|
671
|
+
return t;
|
|
672
|
+
}
|
|
673
|
+
async function bt(e, t, n) {
|
|
674
|
+
const o = await be(e, t, n, !0);
|
|
675
|
+
if (B(o))
|
|
676
|
+
return o;
|
|
677
|
+
if (o.id_token !== void 0) {
|
|
678
|
+
if (typeof o.id_token == "string" && o.id_token.length)
|
|
679
|
+
throw new a("Unexpected ID Token returned, use processAuthorizationCodeOpenIDResponse() for OpenID Connect callback processing");
|
|
680
|
+
delete o.id_token;
|
|
681
|
+
}
|
|
682
|
+
return o;
|
|
683
|
+
}
|
|
684
|
+
function X(e) {
|
|
685
|
+
if (e.bodyUsed)
|
|
957
686
|
throw new TypeError('"response" body has been used already');
|
|
958
|
-
}
|
|
959
687
|
}
|
|
960
|
-
async function
|
|
961
|
-
if (
|
|
962
|
-
|
|
688
|
+
async function vt(e) {
|
|
689
|
+
if (e.status > 399 && e.status < 500) {
|
|
690
|
+
X(e);
|
|
963
691
|
try {
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
966
|
-
|
|
967
|
-
delete json.error_description;
|
|
968
|
-
}
|
|
969
|
-
if (json.error_uri !== void 0 && typeof json.error_uri !== "string") {
|
|
970
|
-
delete json.error_uri;
|
|
971
|
-
}
|
|
972
|
-
if (json.algs !== void 0 && typeof json.algs !== "string") {
|
|
973
|
-
delete json.algs;
|
|
974
|
-
}
|
|
975
|
-
if (json.scope !== void 0 && typeof json.scope !== "string") {
|
|
976
|
-
delete json.scope;
|
|
977
|
-
}
|
|
978
|
-
return json;
|
|
979
|
-
}
|
|
692
|
+
const t = await e.json();
|
|
693
|
+
if (C(t) && typeof t.error == "string" && t.error.length)
|
|
694
|
+
return t.error_description !== void 0 && typeof t.error_description != "string" && delete t.error_description, t.error_uri !== void 0 && typeof t.error_uri != "string" && delete t.error_uri, t.algs !== void 0 && typeof t.algs != "string" && delete t.algs, t.scope !== void 0 && typeof t.scope != "string" && delete t.scope, t;
|
|
980
695
|
} catch {
|
|
981
696
|
}
|
|
982
697
|
}
|
|
983
|
-
return void 0;
|
|
984
698
|
}
|
|
985
|
-
function
|
|
986
|
-
if (typeof
|
|
987
|
-
throw new
|
|
988
|
-
}
|
|
699
|
+
function ue(e) {
|
|
700
|
+
if (typeof e.modulusLength != "number" || e.modulusLength < 2048)
|
|
701
|
+
throw new a(`${e.name} modulusLength must be at least 2048 bits`);
|
|
989
702
|
}
|
|
990
|
-
function
|
|
991
|
-
switch (
|
|
703
|
+
function St(e) {
|
|
704
|
+
switch (e) {
|
|
992
705
|
case "P-256":
|
|
993
706
|
return "SHA-256";
|
|
994
707
|
case "P-384":
|
|
@@ -996,453 +709,353 @@ function ecdsaHashName(namedCurve) {
|
|
|
996
709
|
case "P-521":
|
|
997
710
|
return "SHA-512";
|
|
998
711
|
default:
|
|
999
|
-
throw new
|
|
712
|
+
throw new v();
|
|
1000
713
|
}
|
|
1001
714
|
}
|
|
1002
|
-
function
|
|
1003
|
-
switch (
|
|
715
|
+
function Se(e) {
|
|
716
|
+
switch (e.algorithm.name) {
|
|
1004
717
|
case "ECDSA":
|
|
1005
718
|
return {
|
|
1006
|
-
name:
|
|
1007
|
-
hash:
|
|
719
|
+
name: e.algorithm.name,
|
|
720
|
+
hash: St(e.algorithm.namedCurve)
|
|
1008
721
|
};
|
|
1009
|
-
case "RSA-PSS":
|
|
1010
|
-
|
|
1011
|
-
switch (key.algorithm.hash.name) {
|
|
722
|
+
case "RSA-PSS":
|
|
723
|
+
switch (ue(e.algorithm), e.algorithm.hash.name) {
|
|
1012
724
|
case "SHA-256":
|
|
1013
725
|
case "SHA-384":
|
|
1014
726
|
case "SHA-512":
|
|
1015
727
|
return {
|
|
1016
|
-
name:
|
|
1017
|
-
saltLength: parseInt(
|
|
728
|
+
name: e.algorithm.name,
|
|
729
|
+
saltLength: parseInt(e.algorithm.hash.name.slice(-3), 10) >> 3
|
|
1018
730
|
};
|
|
1019
731
|
default:
|
|
1020
|
-
throw new
|
|
732
|
+
throw new v();
|
|
1021
733
|
}
|
|
1022
|
-
}
|
|
1023
734
|
case "RSASSA-PKCS1-v1_5":
|
|
1024
|
-
|
|
1025
|
-
return key.algorithm.name;
|
|
735
|
+
return ue(e.algorithm), e.algorithm.name;
|
|
1026
736
|
case "Ed448":
|
|
1027
737
|
case "Ed25519":
|
|
1028
|
-
return
|
|
1029
|
-
}
|
|
1030
|
-
throw new
|
|
1031
|
-
}
|
|
1032
|
-
const
|
|
1033
|
-
async function
|
|
1034
|
-
const { 0:
|
|
1035
|
-
if (
|
|
1036
|
-
throw new
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
}
|
|
1041
|
-
let header;
|
|
738
|
+
return e.algorithm.name;
|
|
739
|
+
}
|
|
740
|
+
throw new v();
|
|
741
|
+
}
|
|
742
|
+
const Ee = Symbol();
|
|
743
|
+
async function Et(e, t, n, o, s) {
|
|
744
|
+
const { 0: r, 1: i, 2: d, length: g } = e.split(".");
|
|
745
|
+
if (g === 5)
|
|
746
|
+
throw new v("JWE structure JWTs are not supported");
|
|
747
|
+
if (g !== 3)
|
|
748
|
+
throw new a("Invalid JWT");
|
|
749
|
+
let m;
|
|
1042
750
|
try {
|
|
1043
|
-
|
|
1044
|
-
} catch (
|
|
1045
|
-
throw new
|
|
1046
|
-
}
|
|
1047
|
-
if (!
|
|
1048
|
-
throw new
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
if (!verified) {
|
|
1061
|
-
throw new OPE("JWT signature verification failed");
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
let claims;
|
|
751
|
+
m = JSON.parse(A(k(r)));
|
|
752
|
+
} catch (R) {
|
|
753
|
+
throw new a("failed to parse JWT Header body as base64url encoded JSON", { cause: R });
|
|
754
|
+
}
|
|
755
|
+
if (!C(m))
|
|
756
|
+
throw new a("JWT Header must be a top level object");
|
|
757
|
+
if (t(m), m.crit !== void 0)
|
|
758
|
+
throw new a('unexpected JWT "crit" header parameter');
|
|
759
|
+
const _ = k(d);
|
|
760
|
+
let y;
|
|
761
|
+
if (n !== Ee) {
|
|
762
|
+
y = await n(m);
|
|
763
|
+
const R = `${r}.${i}`;
|
|
764
|
+
if (!await crypto.subtle.verify(Se(y), y, _, A(R)))
|
|
765
|
+
throw new a("JWT signature verification failed");
|
|
766
|
+
}
|
|
767
|
+
let h;
|
|
1065
768
|
try {
|
|
1066
|
-
|
|
1067
|
-
} catch (
|
|
1068
|
-
throw new
|
|
1069
|
-
}
|
|
1070
|
-
if (!
|
|
1071
|
-
throw new
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
throw new OPE('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
if (claims.aud !== void 0) {
|
|
1101
|
-
if (typeof claims.aud !== "string" && !Array.isArray(claims.aud)) {
|
|
1102
|
-
throw new OPE('unexpected JWT "aud" (audience) claim type');
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
return { header, claims, signature, key };
|
|
1106
|
-
}
|
|
1107
|
-
function checkSigningAlgorithm(client, issuer, header) {
|
|
1108
|
-
if (client !== void 0) {
|
|
1109
|
-
if (header.alg !== client) {
|
|
1110
|
-
throw new OPE('unexpected JWT "alg" header parameter');
|
|
1111
|
-
}
|
|
769
|
+
h = JSON.parse(A(k(i)));
|
|
770
|
+
} catch (R) {
|
|
771
|
+
throw new a("failed to parse JWT Payload body as base64url encoded JSON", { cause: R });
|
|
772
|
+
}
|
|
773
|
+
if (!C(h))
|
|
774
|
+
throw new a("JWT Payload must be a top level object");
|
|
775
|
+
const L = Q() + o;
|
|
776
|
+
if (h.exp !== void 0) {
|
|
777
|
+
if (typeof h.exp != "number")
|
|
778
|
+
throw new a('unexpected JWT "exp" (expiration time) claim type');
|
|
779
|
+
if (h.exp <= L - s)
|
|
780
|
+
throw new a('unexpected JWT "exp" (expiration time) claim value, timestamp is <= now()');
|
|
781
|
+
}
|
|
782
|
+
if (h.iat !== void 0 && typeof h.iat != "number")
|
|
783
|
+
throw new a('unexpected JWT "iat" (issued at) claim type');
|
|
784
|
+
if (h.iss !== void 0 && typeof h.iss != "string")
|
|
785
|
+
throw new a('unexpected JWT "iss" (issuer) claim type');
|
|
786
|
+
if (h.nbf !== void 0) {
|
|
787
|
+
if (typeof h.nbf != "number")
|
|
788
|
+
throw new a('unexpected JWT "nbf" (not before) claim type');
|
|
789
|
+
if (h.nbf > L + s)
|
|
790
|
+
throw new a('unexpected JWT "nbf" (not before) claim value, timestamp is > now()');
|
|
791
|
+
}
|
|
792
|
+
if (h.aud !== void 0 && typeof h.aud != "string" && !Array.isArray(h.aud))
|
|
793
|
+
throw new a('unexpected JWT "aud" (audience) claim type');
|
|
794
|
+
return { header: m, claims: h, signature: _, key: y };
|
|
795
|
+
}
|
|
796
|
+
function kt(e, t, n) {
|
|
797
|
+
if (e !== void 0) {
|
|
798
|
+
if (n.alg !== e)
|
|
799
|
+
throw new a('unexpected JWT "alg" header parameter');
|
|
1112
800
|
return;
|
|
1113
801
|
}
|
|
1114
|
-
if (Array.isArray(
|
|
1115
|
-
if (!
|
|
1116
|
-
throw new
|
|
1117
|
-
}
|
|
802
|
+
if (Array.isArray(t)) {
|
|
803
|
+
if (!t.includes(n.alg))
|
|
804
|
+
throw new a('unexpected JWT "alg" header parameter');
|
|
1118
805
|
return;
|
|
1119
806
|
}
|
|
1120
|
-
if (
|
|
1121
|
-
throw new
|
|
1122
|
-
}
|
|
807
|
+
if (n.alg !== "RS256")
|
|
808
|
+
throw new a('unexpected JWT "alg" header parameter');
|
|
1123
809
|
}
|
|
1124
|
-
function
|
|
1125
|
-
const { 0:
|
|
1126
|
-
if (
|
|
1127
|
-
throw new
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
function validateAuthResponse(as, client, parameters, expectedState) {
|
|
1134
|
-
assertAs(as);
|
|
1135
|
-
assertClient(client);
|
|
1136
|
-
if (parameters instanceof URL) {
|
|
1137
|
-
parameters = parameters.searchParams;
|
|
1138
|
-
}
|
|
1139
|
-
if (!(parameters instanceof URLSearchParams)) {
|
|
810
|
+
function E(e, t) {
|
|
811
|
+
const { 0: n, length: o } = e.getAll(t);
|
|
812
|
+
if (o > 1)
|
|
813
|
+
throw new a(`"${t}" parameter must be provided only once`);
|
|
814
|
+
return n;
|
|
815
|
+
}
|
|
816
|
+
const Tt = Symbol(), At = Symbol();
|
|
817
|
+
function Rt(e, t, n, o) {
|
|
818
|
+
if (j(e), z(t), n instanceof URL && (n = n.searchParams), !(n instanceof URLSearchParams))
|
|
1140
819
|
throw new TypeError('"parameters" must be an instance of URLSearchParams, or URL');
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
}
|
|
1150
|
-
if (iss && iss !== as.issuer) {
|
|
1151
|
-
throw new OPE('unexpected "iss" (issuer) response parameter value');
|
|
1152
|
-
}
|
|
1153
|
-
switch (expectedState) {
|
|
820
|
+
if (E(n, "response"))
|
|
821
|
+
throw new a('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()');
|
|
822
|
+
const s = E(n, "iss"), r = E(n, "state");
|
|
823
|
+
if (!s && e.authorization_response_iss_parameter_supported)
|
|
824
|
+
throw new a('response parameter "iss" (issuer) missing');
|
|
825
|
+
if (s && s !== e.issuer)
|
|
826
|
+
throw new a('unexpected "iss" (issuer) response parameter value');
|
|
827
|
+
switch (o) {
|
|
1154
828
|
case void 0:
|
|
1155
|
-
case
|
|
1156
|
-
if (
|
|
1157
|
-
throw new
|
|
1158
|
-
}
|
|
829
|
+
case At:
|
|
830
|
+
if (r !== void 0)
|
|
831
|
+
throw new a('unexpected "state" response parameter encountered');
|
|
1159
832
|
break;
|
|
1160
|
-
case
|
|
833
|
+
case Tt:
|
|
1161
834
|
break;
|
|
1162
835
|
default:
|
|
1163
|
-
if (!
|
|
1164
|
-
throw new
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
}
|
|
1173
|
-
const error = getURLSearchParameter(parameters, "error");
|
|
1174
|
-
if (error) {
|
|
836
|
+
if (!w(o))
|
|
837
|
+
throw new a('"expectedState" must be a non-empty string');
|
|
838
|
+
if (r === void 0)
|
|
839
|
+
throw new a('response parameter "state" missing');
|
|
840
|
+
if (r !== o)
|
|
841
|
+
throw new a('unexpected "state" response parameter value');
|
|
842
|
+
}
|
|
843
|
+
const i = E(n, "error");
|
|
844
|
+
if (i)
|
|
1175
845
|
return {
|
|
1176
|
-
error,
|
|
1177
|
-
error_description:
|
|
1178
|
-
error_uri:
|
|
846
|
+
error: i,
|
|
847
|
+
error_description: E(n, "error_description"),
|
|
848
|
+
error_uri: E(n, "error_uri")
|
|
1179
849
|
};
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
throw new UnsupportedOperationError("implicit and hybrid flows are not supported");
|
|
1185
|
-
}
|
|
1186
|
-
return brand(new URLSearchParams(parameters));
|
|
850
|
+
const d = E(n, "id_token"), g = E(n, "token");
|
|
851
|
+
if (d !== void 0 || g !== void 0)
|
|
852
|
+
throw new v("implicit and hybrid flows are not supported");
|
|
853
|
+
return gt(new URLSearchParams(n));
|
|
1187
854
|
}
|
|
1188
|
-
class
|
|
855
|
+
class P extends Error {
|
|
1189
856
|
}
|
|
1190
|
-
class
|
|
1191
|
-
constructor(
|
|
1192
|
-
super(
|
|
1193
|
-
this.error = error;
|
|
857
|
+
class G extends P {
|
|
858
|
+
constructor(t, n, o) {
|
|
859
|
+
super(t, o), this.error = n;
|
|
1194
860
|
}
|
|
1195
861
|
}
|
|
1196
|
-
function
|
|
1197
|
-
handleCallback
|
|
862
|
+
function xt({
|
|
863
|
+
handleCallback: e
|
|
1198
864
|
}) {
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
}
|
|
1224
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
1225
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: "Error" }),
|
|
1226
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { children: [
|
|
1227
|
-
error.message,
|
|
1228
|
-
error.stack
|
|
1229
|
-
] })
|
|
1230
|
-
] });
|
|
1231
|
-
}
|
|
1232
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." });
|
|
1233
|
-
}
|
|
1234
|
-
const CODE_VERIFIER_KEY = "code-verifier";
|
|
1235
|
-
class OpenIDAuthenticationProvider {
|
|
865
|
+
const t = Ce(!1), [n, o] = je(void 0), s = Pe();
|
|
866
|
+
return ze(() => {
|
|
867
|
+
t.current || (t.current = !0, e().then(() => {
|
|
868
|
+
s("/");
|
|
869
|
+
}).catch((r) => {
|
|
870
|
+
o(r);
|
|
871
|
+
}));
|
|
872
|
+
}, []), n ? n instanceof G ? /* @__PURE__ */ T.jsxs("div", { children: [
|
|
873
|
+
/* @__PURE__ */ T.jsx("h2", { children: "Error" }),
|
|
874
|
+
/* @__PURE__ */ T.jsxs("pre", { children: [
|
|
875
|
+
n.error.error,
|
|
876
|
+
n.error.error_description,
|
|
877
|
+
n.error.error_uri
|
|
878
|
+
] })
|
|
879
|
+
] }) : /* @__PURE__ */ T.jsxs("div", { children: [
|
|
880
|
+
/* @__PURE__ */ T.jsx("h2", { children: "Error" }),
|
|
881
|
+
/* @__PURE__ */ T.jsxs("pre", { children: [
|
|
882
|
+
n.message,
|
|
883
|
+
n.stack
|
|
884
|
+
] })
|
|
885
|
+
] }) : /* @__PURE__ */ T.jsx("div", { children: "Loading..." });
|
|
886
|
+
}
|
|
887
|
+
const le = "code-verifier";
|
|
888
|
+
class Pt {
|
|
1236
889
|
constructor({
|
|
1237
|
-
issuer,
|
|
1238
|
-
authorizationEndpoint,
|
|
1239
|
-
tokenEndpoint,
|
|
1240
|
-
clientId
|
|
890
|
+
issuer: t,
|
|
891
|
+
authorizationEndpoint: n,
|
|
892
|
+
tokenEndpoint: o,
|
|
893
|
+
clientId: s
|
|
1241
894
|
}) {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
if (!codeVerifier) {
|
|
1255
|
-
throw new AuthorizationError(
|
|
895
|
+
S(this, "client");
|
|
896
|
+
S(this, "issuer");
|
|
897
|
+
S(this, "authorizationEndpoint");
|
|
898
|
+
S(this, "tokenEndpoint");
|
|
899
|
+
S(this, "authorizationServer");
|
|
900
|
+
S(this, "tokens");
|
|
901
|
+
S(this, "callbackUrlPath", "/oauth/callback");
|
|
902
|
+
S(this, "logoutRedirectUrlPath", "/");
|
|
903
|
+
S(this, "handleCallback", async () => {
|
|
904
|
+
const t = new URL(window.location.href), n = t.searchParams.get("state"), o = localStorage.getItem(le);
|
|
905
|
+
if (!o)
|
|
906
|
+
throw new P(
|
|
1256
907
|
"Code verifier not found. Invalid auth state."
|
|
1257
908
|
);
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
const params = validateAuthResponse(
|
|
1261
|
-
authServer,
|
|
909
|
+
const s = await this.getAuthServer(), r = Rt(
|
|
910
|
+
s,
|
|
1262
911
|
this.client,
|
|
1263
|
-
|
|
1264
|
-
|
|
912
|
+
t.searchParams,
|
|
913
|
+
n ?? void 0
|
|
1265
914
|
);
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1268
|
-
throw new OAuthAuthorizationError(
|
|
915
|
+
if (B(r))
|
|
916
|
+
throw oe.error("Error validating OAuth response", r), new G(
|
|
1269
917
|
"Error validating OAuth response",
|
|
1270
|
-
|
|
918
|
+
r
|
|
1271
919
|
);
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
const response = await authorizationCodeGrantRequest(
|
|
1277
|
-
authServer,
|
|
920
|
+
const i = new URL(t);
|
|
921
|
+
i.pathname = this.callbackUrlPath, i.search = "";
|
|
922
|
+
const d = await mt(
|
|
923
|
+
s,
|
|
1278
924
|
this.client,
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
)
|
|
1283
|
-
|
|
1284
|
-
authServer,
|
|
925
|
+
r,
|
|
926
|
+
i.toString(),
|
|
927
|
+
o
|
|
928
|
+
), g = await bt(
|
|
929
|
+
s,
|
|
1285
930
|
this.client,
|
|
1286
|
-
|
|
931
|
+
d
|
|
1287
932
|
);
|
|
1288
|
-
this.setTokensFromResponse(
|
|
1289
|
-
const
|
|
1290
|
-
|
|
1291
|
-
authServer,
|
|
933
|
+
this.setTokensFromResponse(g);
|
|
934
|
+
const m = await this.getAccessToken(), y = await (await ut(
|
|
935
|
+
s,
|
|
1292
936
|
this.client,
|
|
1293
|
-
|
|
1294
|
-
)
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
emailVerified: userInfo.email_verified ?? false,
|
|
1301
|
-
pictureUrl: userInfo.picture
|
|
937
|
+
m
|
|
938
|
+
)).json(), h = {
|
|
939
|
+
sub: y.sub,
|
|
940
|
+
email: y.email,
|
|
941
|
+
name: y.name,
|
|
942
|
+
emailVerified: y.email_verified ?? !1,
|
|
943
|
+
pictureUrl: y.picture
|
|
1302
944
|
};
|
|
1303
|
-
|
|
1304
|
-
isAuthenticated:
|
|
1305
|
-
isPending:
|
|
1306
|
-
profile
|
|
945
|
+
re.setState({
|
|
946
|
+
isAuthenticated: !0,
|
|
947
|
+
isPending: !1,
|
|
948
|
+
profile: h
|
|
1307
949
|
});
|
|
1308
950
|
});
|
|
1309
951
|
this.client = {
|
|
1310
|
-
client_id:
|
|
952
|
+
client_id: s,
|
|
1311
953
|
token_endpoint_auth_method: "none"
|
|
1312
|
-
};
|
|
1313
|
-
this.issuer = issuer;
|
|
1314
|
-
this.authorizationEndpoint = authorizationEndpoint;
|
|
1315
|
-
this.tokenEndpoint = tokenEndpoint;
|
|
954
|
+
}, this.issuer = t, this.authorizationEndpoint = n, this.tokenEndpoint = o;
|
|
1316
955
|
}
|
|
1317
956
|
async getAuthServer() {
|
|
1318
|
-
if (!this.authorizationServer)
|
|
1319
|
-
if (this.tokenEndpoint && this.authorizationEndpoint)
|
|
957
|
+
if (!this.authorizationServer)
|
|
958
|
+
if (this.tokenEndpoint && this.authorizationEndpoint)
|
|
1320
959
|
this.authorizationServer = {
|
|
1321
960
|
issuer: new URL(this.authorizationEndpoint).origin,
|
|
1322
961
|
authorization_endpoint: this.authorizationEndpoint,
|
|
1323
962
|
token_endpoint: this.tokenEndpoint,
|
|
1324
963
|
code_challenge_methods_supported: []
|
|
1325
964
|
};
|
|
1326
|
-
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
response
|
|
965
|
+
else {
|
|
966
|
+
const t = new URL(this.issuer), n = await Fe(t);
|
|
967
|
+
this.authorizationServer = await Me(
|
|
968
|
+
t,
|
|
969
|
+
n
|
|
1332
970
|
);
|
|
1333
971
|
}
|
|
1334
|
-
}
|
|
1335
972
|
return this.authorizationServer;
|
|
1336
973
|
}
|
|
1337
974
|
/**
|
|
1338
975
|
* Sets the tokens from various OAuth responses
|
|
1339
976
|
* @param response
|
|
1340
977
|
*/
|
|
1341
|
-
setTokensFromResponse(
|
|
1342
|
-
if (
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
if (!response.expires_in) {
|
|
1347
|
-
throw new AuthorizationError("No expires_in in response");
|
|
1348
|
-
}
|
|
978
|
+
setTokensFromResponse(t) {
|
|
979
|
+
if (B(t))
|
|
980
|
+
throw oe.error("Bad Token Response", t), new G("Bad Token Response", t);
|
|
981
|
+
if (!t.expires_in)
|
|
982
|
+
throw new P("No expires_in in response");
|
|
1349
983
|
this.tokens = {
|
|
1350
|
-
accessToken:
|
|
1351
|
-
refreshToken:
|
|
1352
|
-
expiresOn: new Date(Date.now() +
|
|
1353
|
-
tokenType:
|
|
984
|
+
accessToken: t.access_token,
|
|
985
|
+
refreshToken: t.refresh_token,
|
|
986
|
+
expiresOn: new Date(Date.now() + t.expires_in * 1e3),
|
|
987
|
+
tokenType: t.token_type
|
|
1354
988
|
};
|
|
1355
989
|
}
|
|
1356
990
|
async initialize() {
|
|
1357
991
|
}
|
|
1358
992
|
async login() {
|
|
1359
|
-
var
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
const
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
authorizationServer.authorization_endpoint
|
|
1370
|
-
);
|
|
1371
|
-
const redirectUrl = new URL(window.location.href);
|
|
1372
|
-
redirectUrl.pathname = this.callbackUrlPath;
|
|
1373
|
-
redirectUrl.search = "";
|
|
1374
|
-
authorizationUrl.searchParams.set("client_id", this.client.client_id);
|
|
1375
|
-
authorizationUrl.searchParams.set("redirect_uri", redirectUrl.toString());
|
|
1376
|
-
authorizationUrl.searchParams.set("response_type", "code");
|
|
1377
|
-
authorizationUrl.searchParams.set("scope", "openid+profile+email");
|
|
1378
|
-
authorizationUrl.searchParams.set("code_challenge", codeChallenge);
|
|
1379
|
-
authorizationUrl.searchParams.set(
|
|
993
|
+
var d;
|
|
994
|
+
const t = "S256", n = await this.getAuthServer();
|
|
995
|
+
if (!n.authorization_endpoint)
|
|
996
|
+
throw new P("No authorization endpoint");
|
|
997
|
+
const o = Be(), s = await qe(o);
|
|
998
|
+
localStorage.setItem(le, o);
|
|
999
|
+
const r = new URL(
|
|
1000
|
+
n.authorization_endpoint
|
|
1001
|
+
), i = new URL(window.location.href);
|
|
1002
|
+
if (i.pathname = this.callbackUrlPath, i.search = "", r.searchParams.set("client_id", this.client.client_id), r.searchParams.set("redirect_uri", i.toString()), r.searchParams.set("response_type", "code"), r.searchParams.set("scope", "openid+profile+email"), r.searchParams.set("code_challenge", s), r.searchParams.set(
|
|
1380
1003
|
"code_challenge_method",
|
|
1381
|
-
|
|
1382
|
-
)
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
authorizationUrl.searchParams.set("state", state);
|
|
1004
|
+
t
|
|
1005
|
+
), ((d = n.code_challenge_methods_supported) == null ? void 0 : d.includes("S256")) !== !0) {
|
|
1006
|
+
const g = Ge();
|
|
1007
|
+
r.searchParams.set("state", g);
|
|
1386
1008
|
}
|
|
1387
|
-
location.href =
|
|
1009
|
+
location.href = r.href;
|
|
1388
1010
|
}
|
|
1389
1011
|
async getAccessToken() {
|
|
1390
|
-
const
|
|
1391
|
-
if (!this.tokens)
|
|
1392
|
-
throw new
|
|
1393
|
-
}
|
|
1012
|
+
const t = await this.getAuthServer();
|
|
1013
|
+
if (!this.tokens)
|
|
1014
|
+
throw new P("User is not authenticated");
|
|
1394
1015
|
if (this.tokens.expiresOn < /* @__PURE__ */ new Date()) {
|
|
1395
|
-
if (!this.tokens.refreshToken)
|
|
1396
|
-
throw new
|
|
1016
|
+
if (!this.tokens.refreshToken)
|
|
1017
|
+
throw new P(
|
|
1397
1018
|
"Token expired and no refresh token available"
|
|
1398
1019
|
);
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
as,
|
|
1020
|
+
const n = await dt(
|
|
1021
|
+
t,
|
|
1402
1022
|
this.client,
|
|
1403
1023
|
this.tokens.refreshToken
|
|
1404
|
-
)
|
|
1405
|
-
|
|
1406
|
-
as,
|
|
1024
|
+
), o = await ft(
|
|
1025
|
+
t,
|
|
1407
1026
|
this.client,
|
|
1408
|
-
|
|
1027
|
+
n
|
|
1409
1028
|
);
|
|
1410
|
-
this.setTokensFromResponse(
|
|
1029
|
+
this.setTokensFromResponse(o);
|
|
1411
1030
|
}
|
|
1412
1031
|
return this.tokens.accessToken;
|
|
1413
1032
|
}
|
|
1414
1033
|
async logout() {
|
|
1415
|
-
|
|
1416
|
-
isAuthenticated:
|
|
1417
|
-
isPending:
|
|
1034
|
+
re.setState({
|
|
1035
|
+
isAuthenticated: !1,
|
|
1036
|
+
isPending: !1,
|
|
1418
1037
|
profile: void 0
|
|
1419
1038
|
});
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
"post_logout_redirect_uri",
|
|
1428
|
-
redirectUrl.toString()
|
|
1429
|
-
);
|
|
1430
|
-
} else {
|
|
1431
|
-
logoutUrl = redirectUrl;
|
|
1432
|
-
}
|
|
1039
|
+
const t = await this.getAuthServer(), n = new URL(window.location.href);
|
|
1040
|
+
n.pathname = this.logoutRedirectUrlPath;
|
|
1041
|
+
let o;
|
|
1042
|
+
t.end_session_endpoint ? (o = new URL(t.end_session_endpoint), o.searchParams.set(
|
|
1043
|
+
"post_logout_redirect_uri",
|
|
1044
|
+
n.toString()
|
|
1045
|
+
)) : o = n;
|
|
1433
1046
|
}
|
|
1434
1047
|
getRoutes() {
|
|
1435
1048
|
return [
|
|
1436
1049
|
{
|
|
1437
1050
|
path: this.callbackUrlPath,
|
|
1438
|
-
element: /* @__PURE__ */
|
|
1051
|
+
element: /* @__PURE__ */ T.jsx(xt, { handleCallback: this.handleCallback })
|
|
1439
1052
|
}
|
|
1440
1053
|
];
|
|
1441
1054
|
}
|
|
1442
1055
|
}
|
|
1443
|
-
const
|
|
1056
|
+
const Jt = (e) => new Pt(e);
|
|
1444
1057
|
export {
|
|
1445
|
-
OpenIDAuthenticationProvider,
|
|
1446
|
-
|
|
1058
|
+
Pt as OpenIDAuthenticationProvider,
|
|
1059
|
+
Jt as default
|
|
1447
1060
|
};
|
|
1448
1061
|
//# sourceMappingURL=zudoku.auth-openid.js.map
|