@gen-epix/ui-client-common 4.4.2 → 4.5.1
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/README.md +7 -6
- package/dist/@types/mui.d.ts +13 -5
- package/dist/@types/ui-client-common.d.ts +1 -0
- package/dist/_chunks/ApplicationFooter.js +44 -44
- package/dist/_chunks/ApplicationFooter.js.map +1 -1
- package/dist/_chunks/Breadcrumbs.js +13 -13
- package/dist/_chunks/Breadcrumbs.js.map +1 -1
- package/dist/_chunks/CrudPage.js +300 -300
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/Notifications.js +51 -51
- package/dist/_chunks/Notifications.js.map +1 -1
- package/dist/_chunks/OutageList.js +29 -29
- package/dist/_chunks/OutageUtil.js +1 -2
- package/dist/_chunks/OutageUtil.js.map +1 -1
- package/dist/_chunks/QueryClientService.js +96 -388
- package/dist/_chunks/QueryClientService.js.map +1 -1
- package/dist/_chunks/Table.js +518 -512
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js +8 -16
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/TextFilter.js +14 -12
- package/dist/_chunks/TextFilter.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +77 -77
- package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
- package/dist/_chunks/UserManagerUtil.js +210 -209
- package/dist/_chunks/UserManagerUtil.js.map +1 -1
- package/dist/_chunks/_baseFlatten.js +8 -8
- package/dist/_chunks/_baseFlatten.js.map +1 -1
- package/dist/_chunks/_baseGet.js +280 -0
- package/dist/_chunks/_baseGet.js.map +1 -0
- package/dist/_chunks/_baseIteratee.js +274 -0
- package/dist/_chunks/_baseIteratee.js.map +1 -0
- package/dist/_chunks/_baseUnset.js +22 -299
- package/dist/_chunks/_baseUnset.js.map +1 -1
- package/dist/_chunks/last.js +13 -0
- package/dist/_chunks/last.js.map +1 -0
- package/dist/_chunks/omit.js +41 -40
- package/dist/_chunks/omit.js.map +1 -1
- package/dist/_chunks/tableStore.js +190 -183
- package/dist/_chunks/tableStore.js.map +1 -1
- package/dist/_chunks/uniq.js +44 -0
- package/dist/_chunks/uniq.js.map +1 -0
- package/dist/_chunks/useMutation.js +22 -22
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +25 -8
- package/dist/_chunks/useQueryMemo.js.map +1 -1
- package/dist/classes/abstracts/FilterAbstract/index.js +3 -1
- package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
- package/dist/classes/filters/MultiSelectFilter.d.ts +1 -1
- package/dist/classes/services/AuthenticationService/AuthenticationService.d.ts +1 -1
- package/dist/classes/services/AuthenticationService/index.js +15 -15
- package/dist/classes/services/AuthenticationService/index.js.map +1 -1
- package/dist/classes/services/AuthorizationService/index.js +4 -4
- package/dist/classes/services/AuthorizationService/index.js.map +1 -1
- package/dist/classes/services/BackendVersionService/index.js +3 -2
- package/dist/classes/services/BackendVersionService/index.js.map +1 -1
- package/dist/classes/services/BreadcrumbService/index.js +16 -38
- package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
- package/dist/classes/services/EmotionCacheService/index.js +9 -8
- package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
- package/dist/classes/services/I18nService/index.js +11 -10
- package/dist/classes/services/I18nService/index.js.map +1 -1
- package/dist/classes/services/InactivityService/index.js +12 -12
- package/dist/classes/services/InactivityService/index.js.map +1 -1
- package/dist/classes/services/LogService/index.js +39 -33
- package/dist/classes/services/LogService/index.js.map +1 -1
- package/dist/classes/services/NotificationService/index.js +8 -8
- package/dist/classes/services/NotificationService/index.js.map +1 -1
- package/dist/classes/services/PageEventBusService/index.js +13 -9
- package/dist/classes/services/PageEventBusService/index.js.map +1 -1
- package/dist/classes/services/RouterService/index.js +3 -6
- package/dist/classes/services/RouterService/index.js.map +1 -1
- package/dist/components/app/App/App.d.ts +1 -1
- package/dist/components/app/App/index.js +34 -38
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +28 -28
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +47 -45
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
- package/dist/components/app/AuthenticationWrapper/index.js +35 -35
- package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
- package/dist/components/app/AuthorizationWrapper/index.js +19 -19
- package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
- package/dist/components/app/RouterRoot/index.js +52 -50
- package/dist/components/app/RouterRoot/index.js.map +1 -1
- package/dist/components/epi/EpiContactDetailsDialog/index.js +21 -21
- package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
- package/dist/components/filters/BooleanFilterField/index.js +5 -5
- package/dist/components/filters/DateFilterField/index.js +3 -3
- package/dist/components/filters/GeoFilterField/index.js +4 -4
- package/dist/components/filters/MultiSelectFilterField/index.js +4 -4
- package/dist/components/filters/NumberRangeFilterField/index.js +3 -3
- package/dist/components/filters/TextFilterField/index.js +3 -3
- package/dist/components/ui/ApplicationBar/index.js +188 -188
- package/dist/components/ui/ApplicationBar/index.js.map +1 -1
- package/dist/components/ui/GenericErrorMessage/index.js +29 -29
- package/dist/components/ui/GenericErrorMessage/index.js.map +1 -1
- package/dist/components/ui/LicensesDialog/index.js +38 -38
- package/dist/components/ui/LicensesDialog/index.js.map +1 -1
- package/dist/components/ui/MyPermissionsDialog/index.js +16 -16
- package/dist/components/ui/MyPermissionsDialog/index.js.map +1 -1
- package/dist/components/ui/NavLink/index.js +6 -6
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +21 -21
- package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
- package/dist/components/ui/PageContainer/index.js +24 -24
- package/dist/components/ui/PageContainer/index.js.map +1 -1
- package/dist/components/ui/Sidebar/index.js +30 -30
- package/dist/components/ui/UserFeedbackDialog/index.js +12 -12
- package/dist/components/ui/UserFeedbackDialog/index.js.map +1 -1
- package/dist/components/ui/UserInactivityConfirmation/index.js.map +1 -1
- package/dist/constants/config.constants.d.ts +0 -2
- package/dist/constants/config.constants.js +2 -2
- package/dist/constants/config.constants.js.map +1 -1
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +12 -12
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js.map +1 -1
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js +14 -14
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js.map +1 -1
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +12 -12
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +13 -13
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +4 -4
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationsQuery/index.js +13 -13
- package/dist/dataHooks/useOrganizationsQuery/index.js.map +1 -1
- package/dist/dataHooks/useUsersQuery/index.js +10 -10
- package/dist/dataHooks/useUsersQuery/index.js.map +1 -1
- package/dist/hoc/withPermissions/index.js.map +1 -1
- package/dist/hooks/useConfig/index.js +2 -2
- package/dist/hooks/useConfig/index.js.map +1 -1
- package/dist/hooks/useCreateMutation/index.js +12 -12
- package/dist/hooks/useCreateMutation/index.js.map +1 -1
- package/dist/hooks/useDeleteMutation/index.js +16 -9
- package/dist/hooks/useDeleteMutation/index.js.map +1 -1
- package/dist/hooks/useEditMutation/index.js +48 -33
- package/dist/hooks/useEditMutation/index.js.map +1 -1
- package/dist/hooks/useItemQuery/index.js +4 -4
- package/dist/hooks/useItemQuery/index.js.map +1 -1
- package/dist/hooks/useUpdateBreadcrumb/index.js.map +1 -1
- package/dist/locale/en.json +1 -0
- package/dist/locale/nl.json +1 -0
- package/dist/models/config.models.d.ts +1 -5
- package/dist/models/theme.models.d.ts +19 -16
- package/dist/pages/AcceptInvitationPage/index.js +25 -25
- package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
- package/dist/pages/AdminPage/index.js +16 -16
- package/dist/pages/AdminPage/index.js.map +1 -1
- package/dist/pages/ChooseIdentityProviderPage/index.js +21 -21
- package/dist/pages/ChooseIdentityProviderPage/index.js.map +1 -1
- package/dist/pages/IdentifierIssuersAdminPage/index.js +5 -5
- package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +5 -5
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationContactsAdminPage/index.js +6 -6
- package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationSitesAdminPage/index.js +9 -9
- package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationsAdminPage/index.js +13 -13
- package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
- package/dist/pages/OutagesAdminPage/index.js +20 -20
- package/dist/pages/OutagesAdminPage/index.js.map +1 -1
- package/dist/pages/PostLoginPage/index.js +6 -6
- package/dist/pages/PostLoginPage/index.js.map +1 -1
- package/dist/pages/PostLogoutPage/index.js +8 -8
- package/dist/pages/PostLogoutPage/index.js.map +1 -1
- package/dist/pages/UsersAdminPage/index.js +39 -39
- package/dist/pages/UsersAdminPage/index.js.map +1 -1
- package/dist/setup/setup.d.ts +1 -1
- package/dist/setup/setup.js +11 -4
- package/dist/setup/setup.js.map +1 -1
- package/dist/theme/demoTheme/index.js +17 -15
- package/dist/theme/demoTheme/index.js.map +1 -1
- package/dist/utils/DataHookUtil/index.js +1 -1
- package/dist/utils/DataHookUtil/index.js.map +1 -1
- package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +2 -3
- package/dist/utils/DependencyContainerUtil/index.js +10 -16
- package/dist/utils/DependencyContainerUtil/index.js.map +1 -1
- package/dist/utils/MenuDataUtil/index.js +1 -1
- package/dist/utils/MenuDataUtil/index.js.map +1 -1
- package/dist/utils/StandardConfigUtil/index.js +0 -4
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/dist/utils/TimeUtil/index.js +1 -1
- package/dist/utils/TimeUtil/index.js.map +1 -1
- package/package.json +11 -14
- package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContext.d.ts +0 -9
- package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContextProvider.d.ts +0 -6
- package/dist/context/uiClientCommonConfigContext/index.d.ts +0 -3
- package/dist/context/uiClientCommonConfigContext/index.js +0 -34
- package/dist/context/uiClientCommonConfigContext/index.js.map +0 -1
- package/dist/context/uiClientCommonConfigContext/useUiClientCommonConfigContext.d.ts +0 -3
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { container as e } from "tsyringe";
|
|
2
|
+
import { WindowService as t } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
2
3
|
//#region ../../node_modules/.pnpm/jwt-decode@4.0.0/node_modules/jwt-decode/build/esm/index.js
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
function
|
|
4
|
+
var n = class extends Error {};
|
|
5
|
+
n.prototype.name = "InvalidTokenError";
|
|
6
|
+
function r(e) {
|
|
6
7
|
return decodeURIComponent(atob(e).replace(/(.)/g, (e, t) => {
|
|
7
8
|
let n = t.charCodeAt(0).toString(16).toUpperCase();
|
|
8
9
|
return n.length < 2 && (n = "0" + n), "%" + n;
|
|
9
10
|
}));
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function i(e) {
|
|
12
13
|
let t = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
13
14
|
switch (t.length % 4) {
|
|
14
15
|
case 0: break;
|
|
@@ -21,66 +22,66 @@ function r(e) {
|
|
|
21
22
|
default: throw Error("base64 string is not of the correct length");
|
|
22
23
|
}
|
|
23
24
|
try {
|
|
24
|
-
return
|
|
25
|
+
return r(t);
|
|
25
26
|
} catch {
|
|
26
27
|
return atob(t);
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
-
if (typeof e != "string") throw new
|
|
31
|
-
|
|
32
|
-
let
|
|
33
|
-
if (typeof a != "string") throw new
|
|
30
|
+
function a(e, t) {
|
|
31
|
+
if (typeof e != "string") throw new n("Invalid token specified: must be a string");
|
|
32
|
+
t ||= {};
|
|
33
|
+
let r = t.header === !0 ? 0 : 1, a = e.split(".")[r];
|
|
34
|
+
if (typeof a != "string") throw new n(`Invalid token specified: missing part #${r + 1}`);
|
|
34
35
|
let o;
|
|
35
36
|
try {
|
|
36
|
-
o =
|
|
37
|
+
o = i(a);
|
|
37
38
|
} catch (e) {
|
|
38
|
-
throw new
|
|
39
|
+
throw new n(`Invalid token specified: invalid base64 for part #${r + 1} (${e.message})`);
|
|
39
40
|
}
|
|
40
41
|
try {
|
|
41
42
|
return JSON.parse(o);
|
|
42
43
|
} catch (e) {
|
|
43
|
-
throw new
|
|
44
|
+
throw new n(`Invalid token specified: invalid json for part #${r + 1} (${e.message})`);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
//#endregion
|
|
47
48
|
//#region ../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js
|
|
48
|
-
var
|
|
49
|
+
var o = {
|
|
49
50
|
debug: () => void 0,
|
|
50
51
|
info: () => void 0,
|
|
51
52
|
warn: () => void 0,
|
|
52
53
|
error: () => void 0
|
|
53
|
-
},
|
|
54
|
+
}, s, c, l = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.ERROR = 1] = "ERROR", e[e.WARN = 2] = "WARN", e[e.INFO = 3] = "INFO", e[e.DEBUG = 4] = "DEBUG", e))(l || {});
|
|
54
55
|
((e) => {
|
|
55
56
|
function t() {
|
|
56
|
-
|
|
57
|
+
s = 3, c = o;
|
|
57
58
|
}
|
|
58
59
|
e.reset = t;
|
|
59
60
|
function n(e) {
|
|
60
61
|
if (!(0 <= e && e <= 4)) throw Error("Invalid log level");
|
|
61
|
-
|
|
62
|
+
s = e;
|
|
62
63
|
}
|
|
63
64
|
e.setLevel = n;
|
|
64
65
|
function r(e) {
|
|
65
|
-
|
|
66
|
+
c = e;
|
|
66
67
|
}
|
|
67
68
|
e.setLogger = r;
|
|
68
|
-
})(
|
|
69
|
-
var
|
|
69
|
+
})(l ||= {});
|
|
70
|
+
var u = class e {
|
|
70
71
|
constructor(e) {
|
|
71
72
|
this._name = e;
|
|
72
73
|
}
|
|
73
74
|
debug(...t) {
|
|
74
|
-
|
|
75
|
+
s >= 4 && c.debug(e._format(this._name, this._method), ...t);
|
|
75
76
|
}
|
|
76
77
|
info(...t) {
|
|
77
|
-
|
|
78
|
+
s >= 3 && c.info(e._format(this._name, this._method), ...t);
|
|
78
79
|
}
|
|
79
80
|
warn(...t) {
|
|
80
|
-
|
|
81
|
+
s >= 2 && c.warn(e._format(this._name, this._method), ...t);
|
|
81
82
|
}
|
|
82
83
|
error(...t) {
|
|
83
|
-
|
|
84
|
+
s >= 1 && c.error(e._format(this._name, this._method), ...t);
|
|
84
85
|
}
|
|
85
86
|
throw(e) {
|
|
86
87
|
throw this.error(e), e;
|
|
@@ -98,45 +99,45 @@ var l = class e {
|
|
|
98
99
|
return t ? `${n} ${t}:` : n;
|
|
99
100
|
}
|
|
100
101
|
static debug(t, ...n) {
|
|
101
|
-
|
|
102
|
+
s >= 4 && c.debug(e._format(t), ...n);
|
|
102
103
|
}
|
|
103
104
|
static info(t, ...n) {
|
|
104
|
-
|
|
105
|
+
s >= 3 && c.info(e._format(t), ...n);
|
|
105
106
|
}
|
|
106
107
|
static warn(t, ...n) {
|
|
107
|
-
|
|
108
|
+
s >= 2 && c.warn(e._format(t), ...n);
|
|
108
109
|
}
|
|
109
110
|
static error(t, ...n) {
|
|
110
|
-
|
|
111
|
+
s >= 1 && c.error(e._format(t), ...n);
|
|
111
112
|
}
|
|
112
113
|
};
|
|
113
|
-
|
|
114
|
-
var
|
|
114
|
+
l.reset();
|
|
115
|
+
var d = class {
|
|
115
116
|
static decode(e) {
|
|
116
117
|
try {
|
|
117
|
-
return
|
|
118
|
+
return a(e);
|
|
118
119
|
} catch (e) {
|
|
119
|
-
throw
|
|
120
|
+
throw u.error("JwtUtils.decode", e), e;
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
static async generateSignedJwt(e, t, n) {
|
|
123
|
-
let r = `${
|
|
124
|
+
let r = `${h.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e)))}.${h.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t)))}`, i = await window.crypto.subtle.sign({
|
|
124
125
|
name: "ECDSA",
|
|
125
126
|
hash: { name: "SHA-256" }
|
|
126
127
|
}, n, new TextEncoder().encode(r));
|
|
127
|
-
return `${r}.${
|
|
128
|
+
return `${r}.${h.encodeBase64Url(new Uint8Array(i))}`;
|
|
128
129
|
}
|
|
129
130
|
static async generateSignedJwtWithHmac(e, t, n) {
|
|
130
|
-
let r = `${
|
|
131
|
-
return `${r}.${
|
|
131
|
+
let r = `${h.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e)))}.${h.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t)))}`, i = await window.crypto.subtle.sign("HMAC", n, new TextEncoder().encode(r));
|
|
132
|
+
return `${r}.${h.encodeBase64Url(new Uint8Array(i))}`;
|
|
132
133
|
}
|
|
133
|
-
},
|
|
134
|
+
}, f = "10000000-1000-4000-8000-100000000000", p = (e) => btoa([...new Uint8Array(e)].map((e) => String.fromCharCode(e)).join("")), m = class e {
|
|
134
135
|
static _randomWord() {
|
|
135
136
|
let e = /* @__PURE__ */ new Uint32Array(1);
|
|
136
137
|
return crypto.getRandomValues(e), e[0];
|
|
137
138
|
}
|
|
138
139
|
static generateUUIDv4() {
|
|
139
|
-
return
|
|
140
|
+
return f.replace(/[018]/g, (t) => (+t ^ e._randomWord() & 15 >> t / 4).toString(16)).replace(/-/g, "");
|
|
140
141
|
}
|
|
141
142
|
static generateCodeVerifier() {
|
|
142
143
|
return e.generateUUIDv4() + e.generateUUIDv4() + e.generateUUIDv4();
|
|
@@ -145,13 +146,13 @@ var u = class {
|
|
|
145
146
|
if (!crypto.subtle) throw Error("Crypto.subtle is available only in secure contexts (HTTPS).");
|
|
146
147
|
try {
|
|
147
148
|
let t = new TextEncoder().encode(e);
|
|
148
|
-
return
|
|
149
|
+
return p(await crypto.subtle.digest("SHA-256", t)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
149
150
|
} catch (e) {
|
|
150
|
-
throw
|
|
151
|
+
throw u.error("CryptoUtils.generateCodeChallenge", e), e;
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
static generateBasicAuth(e, t) {
|
|
154
|
-
return
|
|
155
|
+
return p(new TextEncoder().encode([e, t].join(":")));
|
|
155
156
|
}
|
|
156
157
|
static async hash(e, t) {
|
|
157
158
|
let n = new TextEncoder().encode(t), r = await crypto.subtle.digest(e, n);
|
|
@@ -212,7 +213,7 @@ var u = class {
|
|
|
212
213
|
y: e.y
|
|
213
214
|
}
|
|
214
215
|
};
|
|
215
|
-
return await
|
|
216
|
+
return await d.generateSignedJwt(t, c, i.privateKey);
|
|
216
217
|
} catch (e) {
|
|
217
218
|
throw e instanceof TypeError ? Error(`Error exporting dpop public key: ${e.message}`) : e;
|
|
218
219
|
}
|
|
@@ -248,17 +249,17 @@ var u = class {
|
|
|
248
249
|
HS512: "SHA-512"
|
|
249
250
|
}[i];
|
|
250
251
|
if (!c) throw Error(`Unsupported algorithm: ${i}. Supported algorithms are: HS256, HS384, HS512`);
|
|
251
|
-
let l = new TextEncoder(),
|
|
252
|
+
let l = new TextEncoder(), u = await crypto.subtle.importKey("raw", l.encode(n), {
|
|
252
253
|
name: "HMAC",
|
|
253
254
|
hash: c
|
|
254
255
|
}, !1, ["sign"]);
|
|
255
|
-
return await
|
|
256
|
+
return await d.generateSignedJwtWithHmac(o, s, u);
|
|
256
257
|
}
|
|
257
258
|
};
|
|
258
|
-
|
|
259
|
-
var
|
|
259
|
+
m.encodeBase64Url = (e) => p(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
260
|
+
var h = m, g = class {
|
|
260
261
|
constructor(e) {
|
|
261
|
-
this._name = e, this._callbacks = [], this._logger = new
|
|
262
|
+
this._name = e, this._callbacks = [], this._logger = new u(`Event('${this._name}')`);
|
|
262
263
|
}
|
|
263
264
|
addHandler(e) {
|
|
264
265
|
return this._callbacks.push(e), () => this.removeHandler(e);
|
|
@@ -271,7 +272,7 @@ var m = p, h = class {
|
|
|
271
272
|
this._logger.debug("raise:", ...e);
|
|
272
273
|
for (let t of this._callbacks) await t(...e);
|
|
273
274
|
}
|
|
274
|
-
},
|
|
275
|
+
}, _ = class {
|
|
275
276
|
static center({ ...e }) {
|
|
276
277
|
return e.width ??= [
|
|
277
278
|
800,
|
|
@@ -283,9 +284,9 @@ var m = p, h = class {
|
|
|
283
284
|
static serialize(e) {
|
|
284
285
|
return Object.entries(e).filter(([, e]) => e != null).map(([e, t]) => `${e}=${typeof t == "boolean" ? t ? "yes" : "no" : t}`).join(",");
|
|
285
286
|
}
|
|
286
|
-
},
|
|
287
|
+
}, v = class e extends g {
|
|
287
288
|
constructor() {
|
|
288
|
-
super(...arguments), this._logger = new
|
|
289
|
+
super(...arguments), this._logger = new u(`Timer('${this._name}')`), this._timerHandle = null, this._expiration = 0, this._callback = () => {
|
|
289
290
|
let t = this._expiration - e.getEpochTime();
|
|
290
291
|
this._logger.debug("timer completes in", t), this._expiration <= e.getEpochTime() && (this.cancel(), super.raise());
|
|
291
292
|
};
|
|
@@ -311,24 +312,24 @@ var m = p, h = class {
|
|
|
311
312
|
cancel() {
|
|
312
313
|
this._logger.create("cancel"), this._timerHandle &&= (clearInterval(this._timerHandle), null);
|
|
313
314
|
}
|
|
314
|
-
},
|
|
315
|
+
}, y = class {
|
|
315
316
|
static readParams(e, t = "query") {
|
|
316
317
|
if (!e) throw TypeError("Invalid URL");
|
|
317
318
|
let n = new URL(e, "http://127.0.0.1")[t === "fragment" ? "hash" : "search"];
|
|
318
319
|
return new URLSearchParams(n.slice(1));
|
|
319
320
|
}
|
|
320
|
-
},
|
|
321
|
+
}, b = ";", x = class extends Error {
|
|
321
322
|
constructor(e, t) {
|
|
322
|
-
if (super(e.error_description || e.error || ""), this.form = t, this.name = "ErrorResponse", !e.error) throw
|
|
323
|
+
if (super(e.error_description || e.error || ""), this.form = t, this.name = "ErrorResponse", !e.error) throw u.error("ErrorResponse", "No error passed"), Error("No error passed");
|
|
323
324
|
this.error = e.error, this.error_description = e.error_description ?? null, this.error_uri = e.error_uri ?? null, this.state = e.userState, this.session_state = e.session_state ?? null, this.url_state = e.url_state;
|
|
324
325
|
}
|
|
325
|
-
},
|
|
326
|
+
}, S = class extends Error {
|
|
326
327
|
constructor(e) {
|
|
327
328
|
super(e), this.name = "ErrorTimeout";
|
|
328
329
|
}
|
|
329
|
-
},
|
|
330
|
+
}, C = class {
|
|
330
331
|
constructor(e) {
|
|
331
|
-
this._logger = new
|
|
332
|
+
this._logger = new u("AccessTokenEvents"), this._expiringTimer = new v("Access token expiring"), this._expiredTimer = new v("Access token expired"), this._expiringNotificationTimeInSeconds = e.expiringNotificationTimeInSeconds;
|
|
332
333
|
}
|
|
333
334
|
async load(e) {
|
|
334
335
|
let t = this._logger.create("load");
|
|
@@ -357,9 +358,9 @@ var m = p, h = class {
|
|
|
357
358
|
removeAccessTokenExpired(e) {
|
|
358
359
|
this._expiredTimer.removeHandler(e);
|
|
359
360
|
}
|
|
360
|
-
},
|
|
361
|
+
}, w = class {
|
|
361
362
|
constructor(e, t, n, r, i) {
|
|
362
|
-
this._callback = e, this._client_id = t, this._intervalInSeconds = r, this._stopOnError = i, this._logger = new
|
|
363
|
+
this._callback = e, this._client_id = t, this._intervalInSeconds = r, this._stopOnError = i, this._logger = new u("CheckSessionIFrame"), this._timer = null, this._session_state = null, this._message = (e) => {
|
|
363
364
|
e.origin === this._frame_origin && e.source === this._frame.contentWindow && (e.data === "error" ? (this._logger.error("error message from check session op iframe"), this._stopOnError && this.stop()) : e.data === "changed" ? (this._logger.debug("changed message from check session op iframe"), this.stop(), this._callback()) : this._logger.debug(e.data + " message from check session op iframe"));
|
|
364
365
|
};
|
|
365
366
|
let a = new URL(n);
|
|
@@ -383,9 +384,9 @@ var m = p, h = class {
|
|
|
383
384
|
stop() {
|
|
384
385
|
this._logger.create("stop"), this._session_state = null, this._timer &&= (clearInterval(this._timer), null);
|
|
385
386
|
}
|
|
386
|
-
},
|
|
387
|
+
}, T = class {
|
|
387
388
|
constructor() {
|
|
388
|
-
this._logger = new
|
|
389
|
+
this._logger = new u("InMemoryWebStorage"), this._data = {};
|
|
389
390
|
}
|
|
390
391
|
clear() {
|
|
391
392
|
this._logger.create("clear"), this._data = {};
|
|
@@ -405,13 +406,13 @@ var m = p, h = class {
|
|
|
405
406
|
key(e) {
|
|
406
407
|
return Object.getOwnPropertyNames(this._data)[e];
|
|
407
408
|
}
|
|
408
|
-
},
|
|
409
|
+
}, E = class extends Error {
|
|
409
410
|
constructor(e, t) {
|
|
410
411
|
super(t), this.name = "ErrorDPoPNonce", this.nonce = e;
|
|
411
412
|
}
|
|
412
|
-
},
|
|
413
|
+
}, D = class {
|
|
413
414
|
constructor(e = [], t = null, n = {}) {
|
|
414
|
-
this._jwtHandler = t, this._extraHeaders = n, this._logger = new
|
|
415
|
+
this._jwtHandler = t, this._extraHeaders = n, this._logger = new u("JsonService"), this._contentTypes = [], this._contentTypes.push(...e, "application/json"), t && this._contentTypes.push("application/jwt");
|
|
415
416
|
}
|
|
416
417
|
async fetchWithTimeout(e, t = {}) {
|
|
417
418
|
let { timeoutInSeconds: n, ...r } = t;
|
|
@@ -423,7 +424,7 @@ var m = p, h = class {
|
|
|
423
424
|
signal: i.signal
|
|
424
425
|
});
|
|
425
426
|
} catch (e) {
|
|
426
|
-
throw e instanceof DOMException && e.name === "AbortError" ? new
|
|
427
|
+
throw e instanceof DOMException && e.name === "AbortError" ? new S("Network timed out") : e;
|
|
427
428
|
} finally {
|
|
428
429
|
clearTimeout(a);
|
|
429
430
|
}
|
|
@@ -451,7 +452,7 @@ var m = p, h = class {
|
|
|
451
452
|
} catch (e) {
|
|
452
453
|
throw i.error("Error parsing JSON response", e), o.ok ? e : Error(`${o.statusText} (${o.status})`);
|
|
453
454
|
}
|
|
454
|
-
if (!o.ok) throw i.error("Error from server:", c), c.error ? new
|
|
455
|
+
if (!o.ok) throw i.error("Error from server:", c), c.error ? new x(c) : Error(`${o.statusText} (${o.status}): ${JSON.stringify(c)}`);
|
|
455
456
|
return c;
|
|
456
457
|
}
|
|
457
458
|
async postForm(e, { body: t, basicAuth: n, timeoutInSeconds: r, initCredentials: i, extraHeaders: a }) {
|
|
@@ -482,7 +483,7 @@ var m = p, h = class {
|
|
|
482
483
|
} catch (e) {
|
|
483
484
|
throw o.error("Error parsing JSON response", e), c.ok ? e : Error(`${c.statusText} (${c.status})`);
|
|
484
485
|
}
|
|
485
|
-
if (!c.ok) throw o.error("Error from server:", d), c.headers.has("dpop-nonce") ? new
|
|
486
|
+
if (!c.ok) throw o.error("Error from server:", d), c.headers.has("dpop-nonce") ? new E(c.headers.get("dpop-nonce"), `${JSON.stringify(d)}`) : d.error ? new x(d, t) : Error(`${c.statusText} (${c.status}): ${JSON.stringify(d)}`);
|
|
486
487
|
return d;
|
|
487
488
|
}
|
|
488
489
|
_appendExtraHeaders(e) {
|
|
@@ -500,9 +501,9 @@ var m = p, h = class {
|
|
|
500
501
|
a && a !== "" && (e[n] = a);
|
|
501
502
|
});
|
|
502
503
|
}
|
|
503
|
-
},
|
|
504
|
+
}, O = class {
|
|
504
505
|
constructor(e) {
|
|
505
|
-
this._settings = e, this._logger = new
|
|
506
|
+
this._settings = e, this._logger = new u("MetadataService"), this._signingKeys = null, this._metadata = null, this._metadataUrl = this._settings.metadataUrl, this._jsonService = new D(["application/jwk-set+json"], null, this._settings.extraHeaders), this._settings.signingKeys && (this._logger.debug("using signingKeys from settings"), this._signingKeys = this._settings.signingKeys), this._settings.metadata && (this._logger.debug("using metadata from settings"), this._metadata = this._settings.metadata), this._settings.fetchRequestCredentials && (this._logger.debug("using fetchRequestCredentials from settings"), this._fetchRequestCredentials = this._settings.fetchRequestCredentials);
|
|
506
507
|
}
|
|
507
508
|
resetSigningKeys() {
|
|
508
509
|
this._signingKeys = null;
|
|
@@ -562,9 +563,9 @@ var m = p, h = class {
|
|
|
562
563
|
if (e.debug("got key set", n), !Array.isArray(n.keys)) throw e.throw(/* @__PURE__ */ Error("Missing keys on keyset")), null;
|
|
563
564
|
return this._signingKeys = n.keys, this._signingKeys;
|
|
564
565
|
}
|
|
565
|
-
},
|
|
566
|
+
}, k = class {
|
|
566
567
|
constructor({ prefix: e = "oidc.", store: t = localStorage } = {}) {
|
|
567
|
-
this._logger = new
|
|
568
|
+
this._logger = new u("WebStorageStateStore"), this._store = t, this._prefix = e;
|
|
568
569
|
}
|
|
569
570
|
async set(e, t) {
|
|
570
571
|
this._logger.create(`set('${e}')`), e = this._prefix + e, await this._store.setItem(e, t);
|
|
@@ -586,26 +587,26 @@ var m = p, h = class {
|
|
|
586
587
|
}
|
|
587
588
|
return t;
|
|
588
589
|
}
|
|
589
|
-
},
|
|
590
|
-
constructor({ authority: e, metadataUrl: t, metadata: n, signingKeys: r, metadataSeed: i, client_id: a, client_secret: o, response_type: s =
|
|
591
|
-
if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = n, this.metadataSeed = i, this.signingKeys = r, this.client_id = a, this.client_secret = o, this.response_type = s, this.scope = c, this.redirect_uri = l, this.post_logout_redirect_uri = u, this.client_authentication = d, this.token_endpoint_auth_signing_alg = f, this.prompt = p, this.display = m, this.max_age = h, this.ui_locales = g, this.acr_values = _, this.resource = v, this.response_mode = y, this.filterProtocolClaims = b ?? !0, this.loadUserInfo = !!x, this.staleStateAgeInSeconds = C, this.mergeClaimsStrategy =
|
|
590
|
+
}, A = "code", j = "openid", M = "client_secret_post", ee = 900, N = class {
|
|
591
|
+
constructor({ authority: e, metadataUrl: t, metadata: n, signingKeys: r, metadataSeed: i, client_id: a, client_secret: o, response_type: s = A, scope: c = j, redirect_uri: l, post_logout_redirect_uri: u, client_authentication: d = M, token_endpoint_auth_signing_alg: f = "HS256", prompt: p, display: m, max_age: h, ui_locales: g, acr_values: _, resource: v, response_mode: y, filterProtocolClaims: b = !0, loadUserInfo: x = !1, requestTimeoutInSeconds: S, staleStateAgeInSeconds: C = ee, mergeClaimsStrategy: w = { array: "replace" }, disablePKCE: E = !1, stateStore: D, revokeTokenAdditionalContentTypes: O, fetchRequestCredentials: N, refreshTokenAllowedScope: P, extraQueryParams: F = {}, extraTokenParams: I = {}, extraHeaders: L = {}, dpop: R, omitScopeWhenRequesting: z = !1 }) {
|
|
592
|
+
if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = n, this.metadataSeed = i, this.signingKeys = r, this.client_id = a, this.client_secret = o, this.response_type = s, this.scope = c, this.redirect_uri = l, this.post_logout_redirect_uri = u, this.client_authentication = d, this.token_endpoint_auth_signing_alg = f, this.prompt = p, this.display = m, this.max_age = h, this.ui_locales = g, this.acr_values = _, this.resource = v, this.response_mode = y, this.filterProtocolClaims = b ?? !0, this.loadUserInfo = !!x, this.staleStateAgeInSeconds = C, this.mergeClaimsStrategy = w, this.omitScopeWhenRequesting = z, this.disablePKCE = !!E, this.revokeTokenAdditionalContentTypes = O, this.fetchRequestCredentials = N || "same-origin", this.requestTimeoutInSeconds = S, D) this.stateStore = D;
|
|
592
593
|
else {
|
|
593
|
-
let e = typeof window < "u" ? window.localStorage : new
|
|
594
|
-
this.stateStore = new
|
|
594
|
+
let e = typeof window < "u" ? window.localStorage : new T();
|
|
595
|
+
this.stateStore = new k({ store: e });
|
|
595
596
|
}
|
|
596
597
|
if (this.refreshTokenAllowedScope = P, this.extraQueryParams = F, this.extraTokenParams = I, this.extraHeaders = L, this.dpop = R, this.dpop && !this.dpop?.store) throw Error("A DPoPStore is required when dpop is enabled");
|
|
597
598
|
}
|
|
598
|
-
},
|
|
599
|
+
}, P = class {
|
|
599
600
|
constructor(e, t) {
|
|
600
|
-
this._settings = e, this._metadataService = t, this._logger = new
|
|
601
|
+
this._settings = e, this._metadataService = t, this._logger = new u("UserInfoService"), this._getClaimsFromJwt = async (e) => {
|
|
601
602
|
let t = this._logger.create("_getClaimsFromJwt");
|
|
602
603
|
try {
|
|
603
|
-
let n =
|
|
604
|
+
let n = d.decode(e);
|
|
604
605
|
return t.debug("JWT decoding successful"), n;
|
|
605
606
|
} catch (e) {
|
|
606
607
|
throw t.error("Error parsing JWT response"), e;
|
|
607
608
|
}
|
|
608
|
-
}, this._jsonService = new
|
|
609
|
+
}, this._jsonService = new D(void 0, this._getClaimsFromJwt, this._settings.extraHeaders);
|
|
609
610
|
}
|
|
610
611
|
async getClaims(e) {
|
|
611
612
|
let t = this._logger.create("getClaims");
|
|
@@ -619,9 +620,9 @@ var m = p, h = class {
|
|
|
619
620
|
});
|
|
620
621
|
return t.debug("got claims", r), r;
|
|
621
622
|
}
|
|
622
|
-
},
|
|
623
|
+
}, F = class {
|
|
623
624
|
constructor(e, t) {
|
|
624
|
-
this._settings = e, this._metadataService = t, this._logger = new
|
|
625
|
+
this._settings = e, this._metadataService = t, this._logger = new u("TokenClient"), this._jsonService = new D(this._settings.revokeTokenAdditionalContentTypes, null, this._settings.extraHeaders);
|
|
625
626
|
}
|
|
626
627
|
async exchangeCode({ grant_type: e = "authorization_code", redirect_uri: t = this._settings.redirect_uri, client_id: n = this._settings.client_id, client_secret: r = this._settings.client_secret, extraHeaders: i, ...a }) {
|
|
627
628
|
let o = this._logger.create("exchangeCode");
|
|
@@ -635,13 +636,13 @@ var m = p, h = class {
|
|
|
635
636
|
let c, l = await this._metadataService.getTokenEndpoint(!1);
|
|
636
637
|
switch (this._settings.client_authentication) {
|
|
637
638
|
case "client_secret_basic":
|
|
638
|
-
c =
|
|
639
|
+
c = h.generateBasicAuth(n, r);
|
|
639
640
|
break;
|
|
640
641
|
case "client_secret_post":
|
|
641
642
|
s.append("client_id", n), r && s.append("client_secret", r);
|
|
642
643
|
break;
|
|
643
644
|
case "client_secret_jwt": {
|
|
644
|
-
let e = await
|
|
645
|
+
let e = await h.generateClientAssertionJwt(n, r, l, this._settings.token_endpoint_auth_signing_alg);
|
|
645
646
|
s.append("client_id", n), s.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), s.append("client_assertion", e);
|
|
646
647
|
break;
|
|
647
648
|
}
|
|
@@ -666,13 +667,13 @@ var m = p, h = class {
|
|
|
666
667
|
let s, c = await this._metadataService.getTokenEndpoint(!1);
|
|
667
668
|
switch (this._settings.client_authentication) {
|
|
668
669
|
case "client_secret_basic":
|
|
669
|
-
s =
|
|
670
|
+
s = h.generateBasicAuth(t, n);
|
|
670
671
|
break;
|
|
671
672
|
case "client_secret_post":
|
|
672
673
|
o.append("client_id", t), n && o.append("client_secret", n);
|
|
673
674
|
break;
|
|
674
675
|
case "client_secret_jwt": {
|
|
675
|
-
let e = await
|
|
676
|
+
let e = await h.generateClientAssertionJwt(t, n, c, this._settings.token_endpoint_auth_signing_alg);
|
|
676
677
|
o.append("client_id", t), o.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), o.append("client_assertion", e);
|
|
677
678
|
break;
|
|
678
679
|
}
|
|
@@ -695,13 +696,13 @@ var m = p, h = class {
|
|
|
695
696
|
let c, l = await this._metadataService.getTokenEndpoint(!1);
|
|
696
697
|
switch (this._settings.client_authentication) {
|
|
697
698
|
case "client_secret_basic":
|
|
698
|
-
c =
|
|
699
|
+
c = h.generateBasicAuth(t, n);
|
|
699
700
|
break;
|
|
700
701
|
case "client_secret_post":
|
|
701
702
|
s.append("client_id", t), n && s.append("client_secret", n);
|
|
702
703
|
break;
|
|
703
704
|
case "client_secret_jwt": {
|
|
704
|
-
let e = await
|
|
705
|
+
let e = await h.generateClientAssertionJwt(t, n, l, this._settings.token_endpoint_auth_signing_alg);
|
|
705
706
|
s.append("client_id", t), s.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), s.append("client_assertion", e);
|
|
706
707
|
break;
|
|
707
708
|
}
|
|
@@ -728,9 +729,9 @@ var m = p, h = class {
|
|
|
728
729
|
timeoutInSeconds: this._settings.requestTimeoutInSeconds
|
|
729
730
|
}), t.debug("got response");
|
|
730
731
|
}
|
|
731
|
-
},
|
|
732
|
+
}, I = class {
|
|
732
733
|
constructor(e, t, n) {
|
|
733
|
-
this._settings = e, this._metadataService = t, this._claimsService = n, this._logger = new
|
|
734
|
+
this._settings = e, this._metadataService = t, this._claimsService = n, this._logger = new u("ResponseValidator"), this._userInfoService = new P(this._settings, this._metadataService), this._tokenClient = new F(this._settings, this._metadataService);
|
|
734
735
|
}
|
|
735
736
|
async validateSigninResponse(e, t, n) {
|
|
736
737
|
let r = this._logger.create("validateSigninResponse");
|
|
@@ -748,11 +749,11 @@ var m = p, h = class {
|
|
|
748
749
|
}
|
|
749
750
|
validateSignoutResponse(e, t) {
|
|
750
751
|
let n = this._logger.create("validateSignoutResponse");
|
|
751
|
-
if (t.id !== e.state && n.throw(/* @__PURE__ */ Error("State does not match")), n.debug("state validated"), e.userState = t.data, e.error) throw n.warn("Response was error", e.error), new
|
|
752
|
+
if (t.id !== e.state && n.throw(/* @__PURE__ */ Error("State does not match")), n.debug("state validated"), e.userState = t.data, e.error) throw n.warn("Response was error", e.error), new x(e);
|
|
752
753
|
}
|
|
753
754
|
_processSigninState(e, t) {
|
|
754
755
|
let n = this._logger.create("_processSigninState");
|
|
755
|
-
if (t.id !== e.state && n.throw(/* @__PURE__ */ Error("State does not match")), t.client_id || n.throw(/* @__PURE__ */ Error("No client_id on state")), t.authority || n.throw(/* @__PURE__ */ Error("No authority on state")), this._settings.authority !== t.authority && n.throw(/* @__PURE__ */ Error("authority mismatch on settings vs. signin state")), this._settings.client_id && this._settings.client_id !== t.client_id && n.throw(/* @__PURE__ */ Error("client_id mismatch on settings vs. signin state")), n.debug("state validated"), e.userState = t.data, e.url_state = t.url_state, e.scope ??= t.scope, e.error) throw n.warn("Response was error", e.error), new
|
|
756
|
+
if (t.id !== e.state && n.throw(/* @__PURE__ */ Error("State does not match")), t.client_id || n.throw(/* @__PURE__ */ Error("No client_id on state")), t.authority || n.throw(/* @__PURE__ */ Error("No authority on state")), this._settings.authority !== t.authority && n.throw(/* @__PURE__ */ Error("authority mismatch on settings vs. signin state")), this._settings.client_id && this._settings.client_id !== t.client_id && n.throw(/* @__PURE__ */ Error("client_id mismatch on settings vs. signin state")), n.debug("state validated"), e.userState = t.data, e.url_state = t.url_state, e.scope ??= t.scope, e.error) throw n.warn("Response was error", e.error), new x(e);
|
|
756
757
|
t.code_verifier && !e.code && n.throw(/* @__PURE__ */ Error("Expected code in response"));
|
|
757
758
|
}
|
|
758
759
|
async _processClaims(e, t = !1, n = !0) {
|
|
@@ -784,19 +785,19 @@ var m = p, h = class {
|
|
|
784
785
|
_validateIdTokenAttributes(e, t, n) {
|
|
785
786
|
let r = this._logger.create("_validateIdTokenAttributes");
|
|
786
787
|
r.debug("decoding ID Token JWT");
|
|
787
|
-
let i =
|
|
788
|
+
let i = d.decode(e.id_token ?? "");
|
|
788
789
|
if (i.sub || r.throw(/* @__PURE__ */ Error("ID Token is missing a subject claim")), n && i.nonce !== n && r.throw(/* @__PURE__ */ Error("nonce in id_token does not match nonce in client storage")), t) {
|
|
789
|
-
let e =
|
|
790
|
+
let e = d.decode(t);
|
|
790
791
|
i.sub !== e.sub && r.throw(/* @__PURE__ */ Error("sub in id_token does not match current sub")), i.auth_time && i.auth_time !== e.auth_time && r.throw(/* @__PURE__ */ Error("auth_time in id_token does not match original auth_time")), i.azp && i.azp !== e.azp && r.throw(/* @__PURE__ */ Error("azp in id_token does not match original azp")), !i.azp && e.azp && r.throw(/* @__PURE__ */ Error("azp not in id_token, but present in original id_token"));
|
|
791
792
|
}
|
|
792
793
|
e.profile = i;
|
|
793
794
|
}
|
|
794
|
-
},
|
|
795
|
+
}, L = class e {
|
|
795
796
|
constructor(e) {
|
|
796
|
-
this.id = e.id ||
|
|
797
|
+
this.id = e.id || h.generateUUIDv4(), this.data = e.data, this.created = e.created && e.created > 0 ? e.created : v.getEpochTime(), this.request_type = e.request_type, this.url_state = e.url_state;
|
|
797
798
|
}
|
|
798
799
|
toStorageString() {
|
|
799
|
-
return new
|
|
800
|
+
return new u("State").create("toStorageString"), JSON.stringify({
|
|
800
801
|
id: this.id,
|
|
801
802
|
data: this.data,
|
|
802
803
|
created: this.created,
|
|
@@ -805,10 +806,10 @@ var m = p, h = class {
|
|
|
805
806
|
});
|
|
806
807
|
}
|
|
807
808
|
static fromStorageString(t) {
|
|
808
|
-
return
|
|
809
|
+
return u.createStatic("State", "fromStorageString"), Promise.resolve(new e(JSON.parse(t)));
|
|
809
810
|
}
|
|
810
811
|
static async clearStaleState(t, n) {
|
|
811
|
-
let r =
|
|
812
|
+
let r = u.createStatic("State", "clearStaleState"), i = v.getEpochTime() - n, a = await t.getAllKeys();
|
|
812
813
|
r.debug("got keys", a);
|
|
813
814
|
for (let n = 0; n < a.length; n++) {
|
|
814
815
|
let o = a[n], s = await t.get(o), c = !1;
|
|
@@ -822,12 +823,12 @@ var m = p, h = class {
|
|
|
822
823
|
c && (r.debug("removed item for key:", o), t.remove(o));
|
|
823
824
|
}
|
|
824
825
|
}
|
|
825
|
-
},
|
|
826
|
+
}, R = class e extends L {
|
|
826
827
|
constructor(e) {
|
|
827
828
|
super(e), this.code_verifier = e.code_verifier, this.code_challenge = e.code_challenge, this.authority = e.authority, this.client_id = e.client_id, this.redirect_uri = e.redirect_uri, this.scope = e.scope, this.client_secret = e.client_secret, this.extraTokenParams = e.extraTokenParams, this.response_mode = e.response_mode, this.skipUserInfo = e.skipUserInfo, this.nonce = e.nonce;
|
|
828
829
|
}
|
|
829
830
|
static async create(t) {
|
|
830
|
-
let n = t.code_verifier === !0 ?
|
|
831
|
+
let n = t.code_verifier === !0 ? h.generateCodeVerifier() : t.code_verifier || void 0, r = n ? await h.generateCodeChallenge(n) : void 0;
|
|
831
832
|
return new e({
|
|
832
833
|
...t,
|
|
833
834
|
code_verifier: n,
|
|
@@ -835,7 +836,7 @@ var m = p, h = class {
|
|
|
835
836
|
});
|
|
836
837
|
}
|
|
837
838
|
toStorageString() {
|
|
838
|
-
return new
|
|
839
|
+
return new u("SigninState").create("toStorageString"), JSON.stringify({
|
|
839
840
|
id: this.id,
|
|
840
841
|
data: this.data,
|
|
841
842
|
created: this.created,
|
|
@@ -854,22 +855,22 @@ var m = p, h = class {
|
|
|
854
855
|
});
|
|
855
856
|
}
|
|
856
857
|
static fromStorageString(t) {
|
|
857
|
-
|
|
858
|
+
u.createStatic("SigninState", "fromStorageString");
|
|
858
859
|
let n = JSON.parse(t);
|
|
859
860
|
return e.create(n);
|
|
860
861
|
}
|
|
861
|
-
},
|
|
862
|
+
}, z = class e {
|
|
862
863
|
constructor(e) {
|
|
863
864
|
this.url = e.url, this.state = e.state;
|
|
864
865
|
}
|
|
865
|
-
static async create({ url: t, authority: n, client_id: r, redirect_uri: i, response_type: a, scope: o, state_data: s, response_mode: c, request_type: l, client_secret: u, nonce: d, url_state: f, resource: p, skipUserInfo: m, extraQueryParams: h, extraTokenParams: g, disablePKCE: _, dpopJkt: v, omitScopeWhenRequesting:
|
|
866
|
+
static async create({ url: t, authority: n, client_id: r, redirect_uri: i, response_type: a, scope: o, state_data: s, response_mode: c, request_type: l, client_secret: u, nonce: d, url_state: f, resource: p, skipUserInfo: m, extraQueryParams: h, extraTokenParams: g, disablePKCE: _, dpopJkt: v, omitScopeWhenRequesting: y, ...x }) {
|
|
866
867
|
if (!t) throw this._logger.error("create: No url passed"), Error("url");
|
|
867
868
|
if (!r) throw this._logger.error("create: No client_id passed"), Error("client_id");
|
|
868
869
|
if (!i) throw this._logger.error("create: No redirect_uri passed"), Error("redirect_uri");
|
|
869
870
|
if (!a) throw this._logger.error("create: No response_type passed"), Error("response_type");
|
|
870
871
|
if (!o) throw this._logger.error("create: No scope passed"), Error("scope");
|
|
871
872
|
if (!n) throw this._logger.error("create: No authority passed"), Error("authority");
|
|
872
|
-
let S = await
|
|
873
|
+
let S = await R.create({
|
|
873
874
|
data: s,
|
|
874
875
|
request_type: l,
|
|
875
876
|
url_state: f,
|
|
@@ -884,9 +885,9 @@ var m = p, h = class {
|
|
|
884
885
|
skipUserInfo: m,
|
|
885
886
|
nonce: d
|
|
886
887
|
}), C = new URL(t);
|
|
887
|
-
C.searchParams.append("client_id", r), C.searchParams.append("redirect_uri", i), C.searchParams.append("response_type", a),
|
|
888
|
+
C.searchParams.append("client_id", r), C.searchParams.append("redirect_uri", i), C.searchParams.append("response_type", a), y || C.searchParams.append("scope", o), d && C.searchParams.append("nonce", d), v && C.searchParams.append("dpop_jkt", v);
|
|
888
889
|
let w = S.id;
|
|
889
|
-
f && (w = `${w}${
|
|
890
|
+
f && (w = `${w}${b}${f}`), C.searchParams.append("state", w), S.code_challenge && (C.searchParams.append("code_challenge", S.code_challenge), C.searchParams.append("code_challenge_method", "S256")), p && (Array.isArray(p) ? p : [p]).forEach((e) => C.searchParams.append("resource", e));
|
|
890
891
|
for (let [e, t] of Object.entries({
|
|
891
892
|
response_mode: c,
|
|
892
893
|
...x,
|
|
@@ -898,36 +899,36 @@ var m = p, h = class {
|
|
|
898
899
|
});
|
|
899
900
|
}
|
|
900
901
|
};
|
|
901
|
-
|
|
902
|
-
var
|
|
902
|
+
z._logger = new u("SigninRequest");
|
|
903
|
+
var B = z, V = "openid", H = class {
|
|
903
904
|
constructor(e) {
|
|
904
905
|
if (this.access_token = "", this.token_type = "", this.profile = {}, this.state = e.get("state"), this.session_state = e.get("session_state"), this.state) {
|
|
905
|
-
let e = decodeURIComponent(this.state).split(
|
|
906
|
-
this.state = e[0], e.length > 1 && (this.url_state = e.slice(1).join(
|
|
906
|
+
let e = decodeURIComponent(this.state).split(b);
|
|
907
|
+
this.state = e[0], e.length > 1 && (this.url_state = e.slice(1).join(b));
|
|
907
908
|
}
|
|
908
909
|
this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri"), this.code = e.get("code");
|
|
909
910
|
}
|
|
910
911
|
get expires_in() {
|
|
911
|
-
if (this.expires_at !== void 0) return this.expires_at -
|
|
912
|
+
if (this.expires_at !== void 0) return this.expires_at - v.getEpochTime();
|
|
912
913
|
}
|
|
913
914
|
set expires_in(e) {
|
|
914
|
-
typeof e == "string" && (e = Number(e)), e !== void 0 && e >= 0 && (this.expires_at = Math.floor(e) +
|
|
915
|
+
typeof e == "string" && (e = Number(e)), e !== void 0 && e >= 0 && (this.expires_at = Math.floor(e) + v.getEpochTime());
|
|
915
916
|
}
|
|
916
917
|
get isOpenId() {
|
|
917
|
-
return this.scope?.split(" ").includes(
|
|
918
|
+
return this.scope?.split(" ").includes(V) || !!this.id_token;
|
|
918
919
|
}
|
|
919
|
-
},
|
|
920
|
+
}, te = class {
|
|
920
921
|
constructor({ url: e, state_data: t, id_token_hint: n, post_logout_redirect_uri: r, extraQueryParams: i, request_type: a, client_id: o, url_state: s }) {
|
|
921
|
-
if (this._logger = new
|
|
922
|
+
if (this._logger = new u("SignoutRequest"), !e) throw this._logger.error("ctor: No url passed"), Error("url");
|
|
922
923
|
let c = new URL(e);
|
|
923
924
|
if (n && c.searchParams.append("id_token_hint", n), o && c.searchParams.append("client_id", o), r && (c.searchParams.append("post_logout_redirect_uri", r), t || s)) {
|
|
924
|
-
this.state = new
|
|
925
|
+
this.state = new L({
|
|
925
926
|
data: t,
|
|
926
927
|
request_type: a,
|
|
927
928
|
url_state: s
|
|
928
929
|
});
|
|
929
930
|
let e = this.state.id;
|
|
930
|
-
s && (e = `${e}${
|
|
931
|
+
s && (e = `${e}${b}${s}`), c.searchParams.append("state", e);
|
|
931
932
|
}
|
|
932
933
|
for (let [e, t] of Object.entries({ ...i })) t != null && c.searchParams.append(e, t.toString());
|
|
933
934
|
this.url = c.href;
|
|
@@ -935,8 +936,8 @@ var z = R, te = "openid", B = class {
|
|
|
935
936
|
}, ne = class {
|
|
936
937
|
constructor(e) {
|
|
937
938
|
if (this.state = e.get("state"), this.state) {
|
|
938
|
-
let e = decodeURIComponent(this.state).split(
|
|
939
|
-
this.state = e[0], e.length > 1 && (this.url_state = e.slice(1).join(
|
|
939
|
+
let e = decodeURIComponent(this.state).split(b);
|
|
940
|
+
this.state = e[0], e.length > 1 && (this.url_state = e.slice(1).join(b));
|
|
940
941
|
}
|
|
941
942
|
this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri");
|
|
942
943
|
}
|
|
@@ -957,7 +958,7 @@ var z = R, te = "openid", B = class {
|
|
|
957
958
|
"iat"
|
|
958
959
|
], ae = class {
|
|
959
960
|
constructor(e) {
|
|
960
|
-
this._settings = e, this._logger = new
|
|
961
|
+
this._settings = e, this._logger = new u("ClaimsService");
|
|
961
962
|
}
|
|
962
963
|
filterProtocolClaims(e) {
|
|
963
964
|
let t = { ...e };
|
|
@@ -982,20 +983,20 @@ var z = R, te = "openid", B = class {
|
|
|
982
983
|
}
|
|
983
984
|
return n;
|
|
984
985
|
}
|
|
985
|
-
},
|
|
986
|
+
}, U = class {
|
|
986
987
|
constructor(e, t) {
|
|
987
988
|
this.keys = e, this.nonce = t;
|
|
988
989
|
}
|
|
989
|
-
},
|
|
990
|
+
}, W = class {
|
|
990
991
|
constructor(e, t) {
|
|
991
|
-
this._logger = new
|
|
992
|
+
this._logger = new u("OidcClient"), this.settings = e instanceof N ? e : new N(e), this.metadataService = t ?? new O(this.settings), this._claimsService = new ae(this.settings), this._validator = new I(this.settings, this.metadataService, this._claimsService), this._tokenClient = new F(this.settings, this.metadataService);
|
|
992
993
|
}
|
|
993
994
|
async createSigninRequest({ state: e, request: t, request_uri: n, request_type: r, id_token_hint: i, login_hint: a, skipUserInfo: o, nonce: s, url_state: c, response_type: l = this.settings.response_type, scope: u = this.settings.scope, redirect_uri: d = this.settings.redirect_uri, prompt: f = this.settings.prompt, display: p = this.settings.display, max_age: m = this.settings.max_age, ui_locales: h = this.settings.ui_locales, acr_values: g = this.settings.acr_values, resource: _ = this.settings.resource, response_mode: v = this.settings.response_mode, extraQueryParams: y = this.settings.extraQueryParams, extraTokenParams: b = this.settings.extraTokenParams, dpopJkt: x, omitScopeWhenRequesting: S = this.settings.omitScopeWhenRequesting }) {
|
|
994
995
|
let C = this._logger.create("createSigninRequest");
|
|
995
996
|
if (l !== "code") throw Error("Only the Authorization Code flow (with PKCE) is supported");
|
|
996
997
|
let w = await this.metadataService.getAuthorizationEndpoint();
|
|
997
998
|
C.debug("Received authorization endpoint", w);
|
|
998
|
-
let T = await
|
|
999
|
+
let T = await B.create({
|
|
999
1000
|
url: w,
|
|
1000
1001
|
authority: this.settings.authority,
|
|
1001
1002
|
client_id: this.settings.client_id,
|
|
@@ -1030,12 +1031,12 @@ var z = R, te = "openid", B = class {
|
|
|
1030
1031
|
return await this.settings.stateStore.set(E.id, E.toStorageString()), T;
|
|
1031
1032
|
}
|
|
1032
1033
|
async readSigninResponseState(e, t = !1) {
|
|
1033
|
-
let n = this._logger.create("readSigninResponseState"), r = new
|
|
1034
|
+
let n = this._logger.create("readSigninResponseState"), r = new H(y.readParams(e, this.settings.response_mode));
|
|
1034
1035
|
if (!r.state) throw n.throw(/* @__PURE__ */ Error("No state in response")), null;
|
|
1035
1036
|
let i = await this.settings.stateStore[t ? "remove" : "get"](r.state);
|
|
1036
1037
|
if (!i) throw n.throw(/* @__PURE__ */ Error("No matching state found in storage")), null;
|
|
1037
1038
|
return {
|
|
1038
|
-
state: await
|
|
1039
|
+
state: await R.fromStorageString(i),
|
|
1039
1040
|
response: r
|
|
1040
1041
|
};
|
|
1041
1042
|
}
|
|
@@ -1051,7 +1052,7 @@ var z = R, te = "openid", B = class {
|
|
|
1051
1052
|
try {
|
|
1052
1053
|
await this._validator.validateSigninResponse(a, i, t);
|
|
1053
1054
|
} catch (e) {
|
|
1054
|
-
if (e instanceof
|
|
1055
|
+
if (e instanceof E && this.settings.dpop) {
|
|
1055
1056
|
let n = await this.getDpopProof(this.settings.dpop.store, e.nonce);
|
|
1056
1057
|
t.DPoP = n, await this._validator.validateSigninResponse(a, i, t);
|
|
1057
1058
|
} else throw e;
|
|
@@ -1060,7 +1061,7 @@ var z = R, te = "openid", B = class {
|
|
|
1060
1061
|
}
|
|
1061
1062
|
async getDpopProof(e, t) {
|
|
1062
1063
|
let n, r;
|
|
1063
|
-
return (await e.getAllKeys()).includes(this.settings.client_id) ? (r = await e.get(this.settings.client_id), r.nonce !== t && t && (r.nonce = t, await e.set(this.settings.client_id, r))) : (n = await
|
|
1064
|
+
return (await e.getAllKeys()).includes(this.settings.client_id) ? (r = await e.get(this.settings.client_id), r.nonce !== t && t && (r.nonce = t, await e.set(this.settings.client_id, r))) : (n = await h.generateDPoPKeys(), r = new U(n, t), await e.set(this.settings.client_id, r)), await h.generateDPoPProof({
|
|
1064
1065
|
url: await this.metadataService.getTokenEndpoint(!1),
|
|
1065
1066
|
httpMethod: "POST",
|
|
1066
1067
|
keyPair: r.keys,
|
|
@@ -1072,7 +1073,7 @@ var z = R, te = "openid", B = class {
|
|
|
1072
1073
|
username: e,
|
|
1073
1074
|
password: t,
|
|
1074
1075
|
...r
|
|
1075
|
-
}), a = new
|
|
1076
|
+
}), a = new H(new URLSearchParams());
|
|
1076
1077
|
return Object.assign(a, i), await this._validator.validateCredentialsResponse(a, n), a;
|
|
1077
1078
|
}
|
|
1078
1079
|
async useRefreshToken({ state: e, redirect_uri: t, resource: n, timeoutInSeconds: r, extraHeaders: i, extraTokenParams: a }) {
|
|
@@ -1101,7 +1102,7 @@ var z = R, te = "openid", B = class {
|
|
|
1101
1102
|
...a
|
|
1102
1103
|
});
|
|
1103
1104
|
} catch (o) {
|
|
1104
|
-
if (o instanceof
|
|
1105
|
+
if (o instanceof E && this.settings.dpop) i.DPoP = await this.getDpopProof(this.settings.dpop.store, o.nonce), c = await this._tokenClient.exchangeRefreshToken({
|
|
1105
1106
|
refresh_token: e.refresh_token,
|
|
1106
1107
|
scope: s,
|
|
1107
1108
|
redirect_uri: t,
|
|
@@ -1112,7 +1113,7 @@ var z = R, te = "openid", B = class {
|
|
|
1112
1113
|
});
|
|
1113
1114
|
else throw o;
|
|
1114
1115
|
}
|
|
1115
|
-
let l = new
|
|
1116
|
+
let l = new H(new URLSearchParams());
|
|
1116
1117
|
return Object.assign(l, c), o.debug("validating response", l), await this._validator.validateRefreshResponse(l, {
|
|
1117
1118
|
...e,
|
|
1118
1119
|
scope: s
|
|
@@ -1122,7 +1123,7 @@ var z = R, te = "openid", B = class {
|
|
|
1122
1123
|
let s = this._logger.create("createSignoutRequest"), c = await this.metadataService.getEndSessionEndpoint();
|
|
1123
1124
|
if (!c) throw s.throw(/* @__PURE__ */ Error("No end session endpoint")), null;
|
|
1124
1125
|
s.debug("Received end session endpoint", c), !n && a && !t && (n = this.settings.client_id);
|
|
1125
|
-
let l = new
|
|
1126
|
+
let l = new te({
|
|
1126
1127
|
url: c,
|
|
1127
1128
|
id_token_hint: t,
|
|
1128
1129
|
client_id: n,
|
|
@@ -1137,9 +1138,9 @@ var z = R, te = "openid", B = class {
|
|
|
1137
1138
|
return u && (s.debug("Signout request has state to persist"), await this.settings.stateStore.set(u.id, u.toStorageString())), l;
|
|
1138
1139
|
}
|
|
1139
1140
|
async readSignoutResponseState(e, t = !1) {
|
|
1140
|
-
let n = this._logger.create("readSignoutResponseState"), r = new ne(
|
|
1141
|
+
let n = this._logger.create("readSignoutResponseState"), r = new ne(y.readParams(e, this.settings.response_mode));
|
|
1141
1142
|
if (!r.state) {
|
|
1142
|
-
if (n.debug("No state in response"), r.error) throw n.warn("Response was error:", r.error), new
|
|
1143
|
+
if (n.debug("No state in response"), r.error) throw n.warn("Response was error:", r.error), new x(r);
|
|
1143
1144
|
return {
|
|
1144
1145
|
state: void 0,
|
|
1145
1146
|
response: r
|
|
@@ -1148,7 +1149,7 @@ var z = R, te = "openid", B = class {
|
|
|
1148
1149
|
let i = await this.settings.stateStore[t ? "remove" : "get"](r.state);
|
|
1149
1150
|
if (!i) throw n.throw(/* @__PURE__ */ Error("No matching state found in storage")), null;
|
|
1150
1151
|
return {
|
|
1151
|
-
state: await
|
|
1152
|
+
state: await L.fromStorageString(i),
|
|
1152
1153
|
response: r
|
|
1153
1154
|
};
|
|
1154
1155
|
}
|
|
@@ -1157,7 +1158,7 @@ var z = R, te = "openid", B = class {
|
|
|
1157
1158
|
return n ? (t.debug("Received state from storage; validating response"), this._validator.validateSignoutResponse(r, n)) : t.debug("No state from storage; skipping response validation"), r;
|
|
1158
1159
|
}
|
|
1159
1160
|
clearStaleState() {
|
|
1160
|
-
return this._logger.create("clearStaleState"),
|
|
1161
|
+
return this._logger.create("clearStaleState"), L.clearStaleState(this.settings.stateStore, this.settings.staleStateAgeInSeconds);
|
|
1161
1162
|
}
|
|
1162
1163
|
async revokeToken(e, t) {
|
|
1163
1164
|
return this._logger.create("revokeToken"), await this._tokenClient.revoke({
|
|
@@ -1165,9 +1166,9 @@ var z = R, te = "openid", B = class {
|
|
|
1165
1166
|
token_type_hint: t
|
|
1166
1167
|
});
|
|
1167
1168
|
}
|
|
1168
|
-
},
|
|
1169
|
+
}, G = class {
|
|
1169
1170
|
constructor(e) {
|
|
1170
|
-
this._userManager = e, this._logger = new
|
|
1171
|
+
this._userManager = e, this._logger = new u("SessionMonitor"), this._start = async (e) => {
|
|
1171
1172
|
let t = e.session_state;
|
|
1172
1173
|
if (!t) return;
|
|
1173
1174
|
let n = this._logger.create("_start");
|
|
@@ -1176,7 +1177,7 @@ var z = R, te = "openid", B = class {
|
|
|
1176
1177
|
let e = await this._userManager.metadataService.getCheckSessionIframe();
|
|
1177
1178
|
if (e) {
|
|
1178
1179
|
n.debug("initializing check session iframe");
|
|
1179
|
-
let r = this._userManager.settings.client_id, i = this._userManager.settings.checkSessionIntervalInSeconds, a = this._userManager.settings.stopCheckSessionOnError, o = new
|
|
1180
|
+
let r = this._userManager.settings.client_id, i = this._userManager.settings.checkSessionIntervalInSeconds, a = this._userManager.settings.stopCheckSessionOnError, o = new w(this._callback, r, e, i, a);
|
|
1180
1181
|
await o.load(), this._checkSessionIFrame = o, o.start(t);
|
|
1181
1182
|
} else n.warn("no check session iframe found in the metadata");
|
|
1182
1183
|
} catch (e) {
|
|
@@ -1228,15 +1229,15 @@ var z = R, te = "openid", B = class {
|
|
|
1228
1229
|
}
|
|
1229
1230
|
}
|
|
1230
1231
|
}
|
|
1231
|
-
},
|
|
1232
|
+
}, K = class e {
|
|
1232
1233
|
constructor(e) {
|
|
1233
1234
|
this.id_token = e.id_token, this.session_state = e.session_state ?? null, this.access_token = e.access_token, this.refresh_token = e.refresh_token, this.token_type = e.token_type, this.scope = e.scope, this.profile = e.profile, this.expires_at = e.expires_at, this.state = e.userState, this.url_state = e.url_state;
|
|
1234
1235
|
}
|
|
1235
1236
|
get expires_in() {
|
|
1236
|
-
if (this.expires_at !== void 0) return this.expires_at -
|
|
1237
|
+
if (this.expires_at !== void 0) return this.expires_at - v.getEpochTime();
|
|
1237
1238
|
}
|
|
1238
1239
|
set expires_in(e) {
|
|
1239
|
-
e !== void 0 && (this.expires_at = Math.floor(e) +
|
|
1240
|
+
e !== void 0 && (this.expires_at = Math.floor(e) + v.getEpochTime());
|
|
1240
1241
|
}
|
|
1241
1242
|
get expired() {
|
|
1242
1243
|
let e = this.expires_in;
|
|
@@ -1246,7 +1247,7 @@ var z = R, te = "openid", B = class {
|
|
|
1246
1247
|
return this.scope?.split(" ") ?? [];
|
|
1247
1248
|
}
|
|
1248
1249
|
toStorageString() {
|
|
1249
|
-
return new
|
|
1250
|
+
return new u("User").create("toStorageString"), JSON.stringify({
|
|
1250
1251
|
id_token: this.id_token,
|
|
1251
1252
|
session_state: this.session_state,
|
|
1252
1253
|
access_token: this.access_token,
|
|
@@ -1258,11 +1259,11 @@ var z = R, te = "openid", B = class {
|
|
|
1258
1259
|
});
|
|
1259
1260
|
}
|
|
1260
1261
|
static fromStorageString(t) {
|
|
1261
|
-
return
|
|
1262
|
+
return u.createStatic("User", "fromStorageString"), new e(JSON.parse(t));
|
|
1262
1263
|
}
|
|
1263
|
-
},
|
|
1264
|
+
}, q = "oidc-client", J = class {
|
|
1264
1265
|
constructor() {
|
|
1265
|
-
this._abort = new
|
|
1266
|
+
this._abort = new g("Window navigation aborted"), this._disposeHandlers = /* @__PURE__ */ new Set(), this._window = null;
|
|
1266
1267
|
}
|
|
1267
1268
|
async navigate(e) {
|
|
1268
1269
|
let t = this._logger.create("navigate");
|
|
@@ -1271,9 +1272,9 @@ var z = R, te = "openid", B = class {
|
|
|
1271
1272
|
let { url: n, keepOpen: r } = await new Promise((n, r) => {
|
|
1272
1273
|
let i = (i) => {
|
|
1273
1274
|
let a = i.data, o = e.scriptOrigin ?? window.location.origin;
|
|
1274
|
-
if (i.origin === o && a?.source ===
|
|
1275
|
+
if (i.origin === o && a?.source === q) {
|
|
1275
1276
|
try {
|
|
1276
|
-
let n =
|
|
1277
|
+
let n = y.readParams(a.url, e.response_mode).get("state");
|
|
1277
1278
|
if (n || t.warn("no state found in response url"), i.source !== this._window && n !== e.state) return;
|
|
1278
1279
|
} catch {
|
|
1279
1280
|
this._dispose(), r(/* @__PURE__ */ Error("Invalid response from window"));
|
|
@@ -1296,10 +1297,10 @@ var z = R, te = "openid", B = class {
|
|
|
1296
1297
|
}
|
|
1297
1298
|
static _notifyParent(e, t, n = !1, r = window.location.origin) {
|
|
1298
1299
|
let i = {
|
|
1299
|
-
source:
|
|
1300
|
+
source: q,
|
|
1300
1301
|
url: t,
|
|
1301
1302
|
keepOpen: n
|
|
1302
|
-
}, a = new
|
|
1303
|
+
}, a = new u("_notifyParent");
|
|
1303
1304
|
if (e) a.debug("With parent. Using parent.postMessage."), e.postMessage(i, r);
|
|
1304
1305
|
else {
|
|
1305
1306
|
a.debug("No parent. Using BroadcastChannel.");
|
|
@@ -1309,23 +1310,23 @@ var z = R, te = "openid", B = class {
|
|
|
1309
1310
|
n.postMessage(i), n.close();
|
|
1310
1311
|
}
|
|
1311
1312
|
}
|
|
1312
|
-
},
|
|
1313
|
+
}, Y = {
|
|
1313
1314
|
location: !1,
|
|
1314
1315
|
toolbar: !1,
|
|
1315
1316
|
height: 640,
|
|
1316
1317
|
closePopupWindowAfterInSeconds: -1
|
|
1317
|
-
},
|
|
1318
|
+
}, X = "_blank", oe = 60, se = 2, Z = 10, ce = class extends N {
|
|
1318
1319
|
constructor(e) {
|
|
1319
|
-
let { popup_redirect_uri: t = e.redirect_uri, popup_post_logout_redirect_uri: n = e.post_logout_redirect_uri, popupWindowFeatures: r =
|
|
1320
|
-
if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = n, this.popupWindowFeatures = r, this.popupWindowTarget = i, this.redirectMethod = a, this.redirectTarget = o, this.iframeNotifyParentOrigin = s, this.iframeScriptOrigin = c, this.silent_redirect_uri = u, this.silentRequestTimeoutInSeconds = d || l ||
|
|
1320
|
+
let { popup_redirect_uri: t = e.redirect_uri, popup_post_logout_redirect_uri: n = e.post_logout_redirect_uri, popupWindowFeatures: r = Y, popupWindowTarget: i = X, redirectMethod: a = "assign", redirectTarget: o = "self", iframeNotifyParentOrigin: s = e.iframeNotifyParentOrigin, iframeScriptOrigin: c = e.iframeScriptOrigin, requestTimeoutInSeconds: l, silent_redirect_uri: u = e.redirect_uri, silentRequestTimeoutInSeconds: d, automaticSilentRenew: f = !0, validateSubOnSilentRenew: p = !0, includeIdTokenInSilentRenew: m = !1, monitorSession: h = !1, monitorAnonymousSession: g = !1, checkSessionIntervalInSeconds: _ = se, query_status_response_type: v = "code", stopCheckSessionOnError: y = !0, revokeTokenTypes: b = ["access_token", "refresh_token"], revokeTokensOnSignout: x = !1, includeIdTokenInSilentSignout: S = !1, accessTokenExpiringNotificationTimeInSeconds: C = oe, maxSilentRenewTimeoutRetries: w, userStore: E } = e;
|
|
1321
|
+
if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = n, this.popupWindowFeatures = r, this.popupWindowTarget = i, this.redirectMethod = a, this.redirectTarget = o, this.iframeNotifyParentOrigin = s, this.iframeScriptOrigin = c, this.silent_redirect_uri = u, this.silentRequestTimeoutInSeconds = d || l || Z, this.automaticSilentRenew = f, this.validateSubOnSilentRenew = p, this.includeIdTokenInSilentRenew = m, this.monitorSession = h, this.monitorAnonymousSession = g, this.checkSessionIntervalInSeconds = _, this.stopCheckSessionOnError = y, this.query_status_response_type = v, this.revokeTokenTypes = b, this.revokeTokensOnSignout = x, this.includeIdTokenInSilentSignout = S, this.accessTokenExpiringNotificationTimeInSeconds = C, this.maxSilentRenewTimeoutRetries = w, E) this.userStore = E;
|
|
1321
1322
|
else {
|
|
1322
|
-
let e = typeof window < "u" ? window.sessionStorage : new
|
|
1323
|
-
this.userStore = new
|
|
1323
|
+
let e = typeof window < "u" ? window.sessionStorage : new T();
|
|
1324
|
+
this.userStore = new k({ store: e });
|
|
1324
1325
|
}
|
|
1325
1326
|
}
|
|
1326
|
-
},
|
|
1327
|
-
constructor({ silentRequestTimeoutInSeconds: t =
|
|
1328
|
-
super(), this._logger = new
|
|
1327
|
+
}, Q = class e extends J {
|
|
1328
|
+
constructor({ silentRequestTimeoutInSeconds: t = Z }) {
|
|
1329
|
+
super(), this._logger = new u("IFrameWindow"), this._timeoutInSeconds = t, this._frame = e.createHiddenIframe(), this._window = this._frame.contentWindow;
|
|
1329
1330
|
}
|
|
1330
1331
|
static createHiddenIframe() {
|
|
1331
1332
|
let e = window.document.createElement("iframe");
|
|
@@ -1333,7 +1334,7 @@ var z = R, te = "openid", B = class {
|
|
|
1333
1334
|
}
|
|
1334
1335
|
async navigate(e) {
|
|
1335
1336
|
this._logger.debug("navigate: Using timeout of:", this._timeoutInSeconds);
|
|
1336
|
-
let t = setTimeout(() => void this._abort.raise(new
|
|
1337
|
+
let t = setTimeout(() => void this._abort.raise(new S("IFrame timed out without a response")), this._timeoutInSeconds * 1e3);
|
|
1337
1338
|
return this._disposeHandlers.add(() => clearTimeout(t)), await super.navigate(e);
|
|
1338
1339
|
}
|
|
1339
1340
|
close() {
|
|
@@ -1349,22 +1350,22 @@ var z = R, te = "openid", B = class {
|
|
|
1349
1350
|
}
|
|
1350
1351
|
}, le = class {
|
|
1351
1352
|
constructor(e) {
|
|
1352
|
-
this._settings = e, this._logger = new
|
|
1353
|
+
this._settings = e, this._logger = new u("IFrameNavigator");
|
|
1353
1354
|
}
|
|
1354
1355
|
async prepare({ silentRequestTimeoutInSeconds: e = this._settings.silentRequestTimeoutInSeconds }) {
|
|
1355
|
-
return new
|
|
1356
|
+
return new Q({ silentRequestTimeoutInSeconds: e });
|
|
1356
1357
|
}
|
|
1357
1358
|
async callback(e) {
|
|
1358
|
-
this._logger.create("callback"),
|
|
1359
|
+
this._logger.create("callback"), Q.notifyParent(e, this._settings.iframeNotifyParentOrigin);
|
|
1359
1360
|
}
|
|
1360
|
-
}, ue = 500, de = 1e3,
|
|
1361
|
-
constructor({ popupWindowTarget: e =
|
|
1362
|
-
super(), this._logger = new
|
|
1363
|
-
let i =
|
|
1364
|
-
...
|
|
1361
|
+
}, ue = 500, de = 1e3, $ = class extends J {
|
|
1362
|
+
constructor({ popupWindowTarget: e = X, popupWindowFeatures: t = {}, popupSignal: n, popupAbortOnClose: r }) {
|
|
1363
|
+
super(), this._logger = new u("PopupWindow");
|
|
1364
|
+
let i = _.center({
|
|
1365
|
+
...Y,
|
|
1365
1366
|
...t
|
|
1366
1367
|
});
|
|
1367
|
-
this._window = window.open(void 0, e,
|
|
1368
|
+
this._window = window.open(void 0, e, _.serialize(i)), this.abortOnClose = !!r, n && n.addEventListener("abort", () => {
|
|
1368
1369
|
this._abort.raise(Error(n.reason ?? "Popup aborted"));
|
|
1369
1370
|
}), t.closePopupWindowAfterInSeconds && t.closePopupWindowAfterInSeconds > 0 && setTimeout(() => {
|
|
1370
1371
|
!this._window || typeof this._window.closed != "boolean" || this._window.closed ? this._abort.raise(/* @__PURE__ */ Error("Popup blocked by user")) : this.close();
|
|
@@ -1384,12 +1385,12 @@ var z = R, te = "openid", B = class {
|
|
|
1384
1385
|
static notifyOpener(e, t) {
|
|
1385
1386
|
super._notifyParent(window.opener, e, t), !t && !window.opener && window.close();
|
|
1386
1387
|
}
|
|
1387
|
-
},
|
|
1388
|
+
}, fe = class {
|
|
1388
1389
|
constructor(e) {
|
|
1389
|
-
this._settings = e, this._logger = new
|
|
1390
|
+
this._settings = e, this._logger = new u("PopupNavigator");
|
|
1390
1391
|
}
|
|
1391
1392
|
async prepare({ popupWindowFeatures: e = this._settings.popupWindowFeatures, popupWindowTarget: t = this._settings.popupWindowTarget, popupSignal: n, popupAbortOnClose: r }) {
|
|
1392
|
-
return new
|
|
1393
|
+
return new $({
|
|
1393
1394
|
popupWindowFeatures: e,
|
|
1394
1395
|
popupWindowTarget: t,
|
|
1395
1396
|
popupSignal: n,
|
|
@@ -1397,11 +1398,11 @@ var z = R, te = "openid", B = class {
|
|
|
1397
1398
|
});
|
|
1398
1399
|
}
|
|
1399
1400
|
async callback(e, { keepOpen: t = !1 }) {
|
|
1400
|
-
this._logger.create("callback"),
|
|
1401
|
+
this._logger.create("callback"), $.notifyOpener(e, t);
|
|
1401
1402
|
}
|
|
1402
|
-
},
|
|
1403
|
+
}, pe = class {
|
|
1403
1404
|
constructor(e) {
|
|
1404
|
-
this._settings = e, this._logger = new
|
|
1405
|
+
this._settings = e, this._logger = new u("RedirectNavigator");
|
|
1405
1406
|
}
|
|
1406
1407
|
async prepare({ redirectMethod: e = this._settings.redirectMethod, redirectTarget: t = this._settings.redirectTarget }) {
|
|
1407
1408
|
this._logger.create("prepare");
|
|
@@ -1418,9 +1419,9 @@ var z = R, te = "openid", B = class {
|
|
|
1418
1419
|
};
|
|
1419
1420
|
}
|
|
1420
1421
|
async callback() {}
|
|
1421
|
-
},
|
|
1422
|
+
}, me = class extends C {
|
|
1422
1423
|
constructor(e) {
|
|
1423
|
-
super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new
|
|
1424
|
+
super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new u("UserManagerEvents"), this._userLoaded = new g("User loaded"), this._userUnloaded = new g("User unloaded"), this._silentRenewError = new g("Silent renew error"), this._userSignedIn = new g("User signed in"), this._userSignedOut = new g("User signed out"), this._userSessionChanged = new g("User session changed");
|
|
1424
1425
|
}
|
|
1425
1426
|
async load(e, t = !0) {
|
|
1426
1427
|
await super.load(e), t && await this._userLoaded.raise(e);
|
|
@@ -1476,14 +1477,14 @@ var z = R, te = "openid", B = class {
|
|
|
1476
1477
|
async _raiseUserSessionChanged() {
|
|
1477
1478
|
await this._userSessionChanged.raise();
|
|
1478
1479
|
}
|
|
1479
|
-
},
|
|
1480
|
+
}, he = class {
|
|
1480
1481
|
constructor(e) {
|
|
1481
|
-
this._userManager = e, this._logger = new
|
|
1482
|
+
this._userManager = e, this._logger = new u("SilentRenewService"), this._isStarted = !1, this._retryTimer = new v("Retry Silent Renew"), this._timeoutRetryCount = 0, this._tokenExpiring = async () => {
|
|
1482
1483
|
let e = this._logger.create("_tokenExpiring");
|
|
1483
1484
|
try {
|
|
1484
1485
|
await this._userManager.signinSilent(), this._timeoutRetryCount = 0, e.debug("silent token renewal successful");
|
|
1485
1486
|
} catch (t) {
|
|
1486
|
-
if (t instanceof
|
|
1487
|
+
if (t instanceof S) {
|
|
1487
1488
|
this._timeoutRetryCount++;
|
|
1488
1489
|
let n = this._userManager.settings.maxSilentRenewTimeoutRetries;
|
|
1489
1490
|
if (n !== void 0 && this._timeoutRetryCount > n) {
|
|
@@ -1511,13 +1512,13 @@ var z = R, te = "openid", B = class {
|
|
|
1511
1512
|
stop() {
|
|
1512
1513
|
this._isStarted &&= (this._retryTimer.cancel(), this._retryTimer.removeHandler(this._tokenExpiring), this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring), !1);
|
|
1513
1514
|
}
|
|
1514
|
-
},
|
|
1515
|
+
}, ge = class {
|
|
1515
1516
|
constructor(e) {
|
|
1516
1517
|
this.refresh_token = e.refresh_token, this.id_token = e.id_token, this.session_state = e.session_state, this.scope = e.scope, this.profile = e.profile, this.data = e.state;
|
|
1517
1518
|
}
|
|
1518
|
-
},
|
|
1519
|
+
}, _e = class {
|
|
1519
1520
|
constructor(e, t, n, r) {
|
|
1520
|
-
this._logger = new
|
|
1521
|
+
this._logger = new u("UserManager"), this.settings = new ce(e), this._client = new W(e), this._redirectNavigator = t ?? new pe(this.settings), this._popupNavigator = n ?? new fe(this.settings), this._iframeNavigator = r ?? new le(this.settings), this._events = new me(this.settings), this._silentRenewService = new he(this), this.settings.automaticSilentRenew && this.startSilentRenew(), this._sessionMonitor = null, this.settings.monitorSession && (this._sessionMonitor = new G(this));
|
|
1521
1522
|
}
|
|
1522
1523
|
get events() {
|
|
1523
1524
|
return this._events;
|
|
@@ -1586,7 +1587,7 @@ var z = R, te = "openid", B = class {
|
|
|
1586
1587
|
let t = this._logger.create("signinSilent"), { silentRequestTimeoutInSeconds: n, ...r } = e, i = await this._loadUser();
|
|
1587
1588
|
if (!e.forceIframeAuth && i?.refresh_token) {
|
|
1588
1589
|
t.debug("using refresh token");
|
|
1589
|
-
let e = new
|
|
1590
|
+
let e = new ge(i);
|
|
1590
1591
|
return await this._useRefreshToken({
|
|
1591
1592
|
state: e,
|
|
1592
1593
|
redirect_uri: r.redirect_uri,
|
|
@@ -1615,7 +1616,7 @@ var z = R, te = "openid", B = class {
|
|
|
1615
1616
|
let t = await this._client.useRefreshToken({
|
|
1616
1617
|
timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds,
|
|
1617
1618
|
...e
|
|
1618
|
-
}), n = new
|
|
1619
|
+
}), n = new K({
|
|
1619
1620
|
...e.state,
|
|
1620
1621
|
...t
|
|
1621
1622
|
});
|
|
@@ -1671,7 +1672,7 @@ var z = R, te = "openid", B = class {
|
|
|
1671
1672
|
sub: e.profile.sub
|
|
1672
1673
|
}) : (t.info("success, user not authenticated"), null);
|
|
1673
1674
|
} catch (e) {
|
|
1674
|
-
if (this.settings.monitorAnonymousSession && e instanceof
|
|
1675
|
+
if (this.settings.monitorAnonymousSession && e instanceof x) switch (e.error) {
|
|
1675
1676
|
case "login_required":
|
|
1676
1677
|
case "consent_required":
|
|
1677
1678
|
case "interaction_required":
|
|
@@ -1703,9 +1704,9 @@ var z = R, te = "openid", B = class {
|
|
|
1703
1704
|
return n.debug("got signin response"), await this._buildUser(r, t);
|
|
1704
1705
|
}
|
|
1705
1706
|
async _buildUser(e, t) {
|
|
1706
|
-
let n = this._logger.create("_buildUser"), r = new
|
|
1707
|
+
let n = this._logger.create("_buildUser"), r = new K(e);
|
|
1707
1708
|
if (t) {
|
|
1708
|
-
if (t !== r.profile.sub) throw n.debug("current user does not match user returned from signin. sub from signin:", r.profile.sub), new
|
|
1709
|
+
if (t !== r.profile.sub) throw n.debug("current user does not match user returned from signin. sub from signin:", r.profile.sub), new x({
|
|
1709
1710
|
...e,
|
|
1710
1711
|
error: "login_required"
|
|
1711
1712
|
});
|
|
@@ -1805,7 +1806,7 @@ var z = R, te = "openid", B = class {
|
|
|
1805
1806
|
}
|
|
1806
1807
|
async _loadUser() {
|
|
1807
1808
|
let e = this._logger.create("_loadUser"), t = await this.settings.userStore.get(this._userStoreKey);
|
|
1808
|
-
return t ? (e.debug("user storageString loaded"),
|
|
1809
|
+
return t ? (e.debug("user storageString loaded"), K.fromStorageString(t)) : (e.debug("no user storageString"), null);
|
|
1809
1810
|
}
|
|
1810
1811
|
async storeUser(e) {
|
|
1811
1812
|
let t = this._logger.create("storeUser");
|
|
@@ -1820,7 +1821,7 @@ var z = R, te = "openid", B = class {
|
|
|
1820
1821
|
}
|
|
1821
1822
|
async dpopProof(e, t, n, r) {
|
|
1822
1823
|
let i = await (this.settings.dpop?.store)?.get(this.settings.client_id);
|
|
1823
|
-
if (i) return await
|
|
1824
|
+
if (i) return await h.generateDPoPProof({
|
|
1824
1825
|
url: e,
|
|
1825
1826
|
accessToken: t?.access_token,
|
|
1826
1827
|
httpMethod: n,
|
|
@@ -1830,33 +1831,33 @@ var z = R, te = "openid", B = class {
|
|
|
1830
1831
|
}
|
|
1831
1832
|
async generateDPoPJkt(e) {
|
|
1832
1833
|
let t = await e.store.get(this.settings.client_id);
|
|
1833
|
-
return t || (t = new
|
|
1834
|
+
return t || (t = new U(await h.generateDPoPKeys()), await e.store.set(this.settings.client_id, t)), await h.generateDPoPJkt(t.keys);
|
|
1834
1835
|
}
|
|
1835
|
-
},
|
|
1836
|
+
}, ve = class {
|
|
1836
1837
|
static userManager;
|
|
1837
|
-
static getSettings(
|
|
1838
|
-
let
|
|
1839
|
-
|
|
1840
|
-
let
|
|
1841
|
-
|
|
1842
|
-
let
|
|
1838
|
+
static getSettings(n) {
|
|
1839
|
+
let r = new URL(e.resolve(t).window.location.href);
|
|
1840
|
+
r.search = "", r.pathname = "/post-login";
|
|
1841
|
+
let i = r.toString();
|
|
1842
|
+
r.pathname = "/post-logout";
|
|
1843
|
+
let a = r.toString();
|
|
1843
1844
|
return {
|
|
1844
|
-
authority:
|
|
1845
|
+
authority: n.issuer,
|
|
1845
1846
|
automaticSilentRenew: !0,
|
|
1846
|
-
client_id:
|
|
1847
|
-
client_secret:
|
|
1848
|
-
metadataUrl:
|
|
1849
|
-
post_logout_redirect_uri:
|
|
1850
|
-
redirect_uri:
|
|
1847
|
+
client_id: n.client_id,
|
|
1848
|
+
client_secret: n.client_secret,
|
|
1849
|
+
metadataUrl: n.discovery_url,
|
|
1850
|
+
post_logout_redirect_uri: a,
|
|
1851
|
+
redirect_uri: i,
|
|
1851
1852
|
refreshTokenAllowedScope: "",
|
|
1852
1853
|
response_type: "code",
|
|
1853
|
-
scope:
|
|
1854
|
-
userStore: new
|
|
1854
|
+
scope: n.scope,
|
|
1855
|
+
userStore: new k({ store: sessionStorage }),
|
|
1855
1856
|
validateSubOnSilentRenew: !0
|
|
1856
1857
|
};
|
|
1857
1858
|
}
|
|
1858
1859
|
};
|
|
1859
1860
|
//#endregion
|
|
1860
|
-
export {
|
|
1861
|
+
export { _e as n, ve as t };
|
|
1861
1862
|
|
|
1862
1863
|
//# sourceMappingURL=UserManagerUtil.js.map
|