@axa-fr/oidc-client 7.15.0-alpha.1286 → 7.15.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/dist/index.js +580 -583
- package/dist/index.umd.cjs +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/jwt.ts +2 -2
- package/src/parseTokens.spec.ts +77 -1
- package/src/version.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
const L = console;
|
|
2
|
-
class
|
|
3
|
-
constructor(
|
|
4
|
-
this._callback =
|
|
2
|
+
class Oe {
|
|
3
|
+
constructor(s, n, t, o = 2e3, i = !0) {
|
|
4
|
+
this._callback = s, this._client_id = n, this._url = t, this._interval = o || 2e3, this._stopOnError = i;
|
|
5
5
|
const r = t.indexOf("/", t.indexOf("//") + 2);
|
|
6
6
|
this._frame_origin = t.substr(0, r), this._frame = window.document.createElement("iframe"), this._frame.style.visibility = "hidden", this._frame.style.position = "absolute", this._frame.style.display = "none", this._frame.width = 0, this._frame.height = 0, this._frame.src = t;
|
|
7
7
|
}
|
|
8
8
|
load() {
|
|
9
|
-
return new Promise((
|
|
9
|
+
return new Promise((s) => {
|
|
10
10
|
this._frame.onload = () => {
|
|
11
|
-
|
|
11
|
+
s();
|
|
12
12
|
}, window.document.body.appendChild(this._frame), this._boundMessageEvent = this._message.bind(this), window.addEventListener("message", this._boundMessageEvent, !1);
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
_message(
|
|
16
|
-
|
|
15
|
+
_message(s) {
|
|
16
|
+
s.origin === this._frame_origin && s.source === this._frame.contentWindow && (s.data === "error" ? (L.error("CheckSessionIFrame: error message from check session op iframe"), this._stopOnError && this.stop()) : s.data === "changed" ? (L.debug(s), L.debug("CheckSessionIFrame: changed message from check session op iframe"), this.stop(), this._callback()) : L.debug("CheckSessionIFrame: " + s.data + " message from check session op iframe"));
|
|
17
17
|
}
|
|
18
|
-
start(
|
|
19
|
-
L.debug("CheckSessionIFrame.start :" +
|
|
20
|
-
const
|
|
21
|
-
this._frame.contentWindow.postMessage(this._client_id + " " +
|
|
18
|
+
start(s) {
|
|
19
|
+
L.debug("CheckSessionIFrame.start :" + s), this.stop();
|
|
20
|
+
const n = () => {
|
|
21
|
+
this._frame.contentWindow.postMessage(this._client_id + " " + s, this._frame_origin);
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
n(), this._timer = window.setInterval(n, this._interval);
|
|
24
24
|
}
|
|
25
25
|
stop() {
|
|
26
26
|
this._timer && (L.debug("CheckSessionIFrame.stop"), window.clearInterval(this._timer), this._timer = null);
|
|
@@ -54,26 +54,26 @@ const m = {
|
|
|
54
54
|
syncTokensAsync_lock_not_available: "syncTokensAsync_lock_not_available",
|
|
55
55
|
syncTokensAsync_end: "syncTokensAsync_end",
|
|
56
56
|
syncTokensAsync_error: "syncTokensAsync_error"
|
|
57
|
-
}, I = (
|
|
58
|
-
const
|
|
59
|
-
if (!
|
|
60
|
-
return
|
|
61
|
-
const p = JSON.parse(
|
|
57
|
+
}, I = (e, s = sessionStorage) => {
|
|
58
|
+
const n = (p) => (s[`oidc.${e}`] = JSON.stringify({ tokens: null, status: p }), Promise.resolve()), t = async () => {
|
|
59
|
+
if (!s[`oidc.${e}`])
|
|
60
|
+
return s[`oidc.${e}`] = JSON.stringify({ tokens: null, status: null }), { tokens: null, status: null };
|
|
61
|
+
const p = JSON.parse(s[`oidc.${e}`]);
|
|
62
62
|
return Promise.resolve({ tokens: p.tokens, status: p.status });
|
|
63
63
|
}, o = (p) => {
|
|
64
|
-
|
|
64
|
+
s[`oidc.${e}`] = JSON.stringify({ tokens: p });
|
|
65
65
|
}, i = async (p) => {
|
|
66
|
-
|
|
67
|
-
}, r = async () =>
|
|
68
|
-
|
|
66
|
+
s[`oidc.session_state.${e}`] = p;
|
|
67
|
+
}, r = async () => s[`oidc.session_state.${e}`], c = (p) => {
|
|
68
|
+
s[`oidc.nonce.${e}`] = p.nonce;
|
|
69
69
|
}, a = (p) => {
|
|
70
|
-
|
|
71
|
-
}, u = () => JSON.parse(
|
|
72
|
-
|
|
73
|
-
}, l = () =>
|
|
70
|
+
s[`oidc.jwk.${e}`] = JSON.stringify(p);
|
|
71
|
+
}, u = () => JSON.parse(s[`oidc.jwk.${e}`]), f = async () => ({ nonce: s[`oidc.nonce.${e}`] }), d = async (p) => {
|
|
72
|
+
s[`oidc.dpop_nonce.${e}`] = p;
|
|
73
|
+
}, l = () => s[`oidc.dpop_nonce.${e}`], _ = () => s[`oidc.${e}`] ? JSON.stringify({ tokens: JSON.parse(s[`oidc.${e}`]).tokens }) : null;
|
|
74
74
|
let y = {};
|
|
75
75
|
return {
|
|
76
|
-
clearAsync:
|
|
76
|
+
clearAsync: n,
|
|
77
77
|
initAsync: t,
|
|
78
78
|
setTokens: o,
|
|
79
79
|
getTokens: _,
|
|
@@ -82,110 +82,110 @@ const m = {
|
|
|
82
82
|
setNonceAsync: c,
|
|
83
83
|
getNonceAsync: f,
|
|
84
84
|
setLoginParams: (p) => {
|
|
85
|
-
y[
|
|
85
|
+
y[e] = p, s[`oidc.login.${e}`] = JSON.stringify(p);
|
|
86
86
|
},
|
|
87
87
|
getLoginParams: () => {
|
|
88
|
-
const p =
|
|
89
|
-
return y[
|
|
88
|
+
const p = s[`oidc.login.${e}`];
|
|
89
|
+
return y[e] || (y[e] = JSON.parse(p)), y[e];
|
|
90
90
|
},
|
|
91
|
-
getStateAsync: async () =>
|
|
91
|
+
getStateAsync: async () => s[`oidc.state.${e}`],
|
|
92
92
|
setStateAsync: async (p) => {
|
|
93
|
-
|
|
93
|
+
s[`oidc.state.${e}`] = p;
|
|
94
94
|
},
|
|
95
|
-
getCodeVerifierAsync: async () =>
|
|
95
|
+
getCodeVerifierAsync: async () => s[`oidc.code_verifier.${e}`],
|
|
96
96
|
setCodeVerifierAsync: async (p) => {
|
|
97
|
-
|
|
97
|
+
s[`oidc.code_verifier.${e}`] = p;
|
|
98
98
|
},
|
|
99
99
|
setDemonstratingProofOfPossessionNonce: d,
|
|
100
100
|
getDemonstratingProofOfPossessionNonce: l,
|
|
101
101
|
setDemonstratingProofOfPossessionJwkAsync: a,
|
|
102
102
|
getDemonstratingProofOfPossessionJwkAsync: u
|
|
103
103
|
};
|
|
104
|
-
},
|
|
104
|
+
}, Ee = (e) => decodeURIComponent(Array.prototype.map.call(atob(e), (s) => "%" + ("00" + s.charCodeAt(0).toString(16)).slice(-2)).join("")), Ie = (e) => JSON.parse(Ee(e.replace(/-/g, "+").replace(/_/g, "/"))), ce = (e) => {
|
|
105
105
|
try {
|
|
106
|
-
return
|
|
107
|
-
} catch (
|
|
108
|
-
console.warn(
|
|
106
|
+
return e && Ce(e, ".") === 2 ? Ie(e.split(".")[1]) : null;
|
|
107
|
+
} catch (s) {
|
|
108
|
+
console.warn(s);
|
|
109
109
|
}
|
|
110
110
|
return null;
|
|
111
|
-
},
|
|
111
|
+
}, Ce = (e, s) => e.split(s).length - 1, z = {
|
|
112
112
|
access_token_or_id_token_invalid: "access_token_or_id_token_invalid",
|
|
113
113
|
access_token_invalid: "access_token_invalid",
|
|
114
114
|
id_token_invalid: "id_token_invalid"
|
|
115
115
|
};
|
|
116
|
-
function
|
|
117
|
-
if (
|
|
118
|
-
if (typeof
|
|
119
|
-
return parseInt(
|
|
116
|
+
function Ne(e, s, n) {
|
|
117
|
+
if (e.issuedAt) {
|
|
118
|
+
if (typeof e.issuedAt == "string")
|
|
119
|
+
return parseInt(e.issuedAt, 10);
|
|
120
120
|
} else
|
|
121
|
-
return
|
|
122
|
-
return
|
|
121
|
+
return s && s.iat ? s.iat : n && n.iat ? n.iat : (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
122
|
+
return e.issuedAt;
|
|
123
123
|
}
|
|
124
|
-
const te = (
|
|
125
|
-
if (!
|
|
124
|
+
const te = (e, s = null, n) => {
|
|
125
|
+
if (!e)
|
|
126
126
|
return null;
|
|
127
127
|
let t;
|
|
128
|
-
const o = typeof
|
|
129
|
-
|
|
128
|
+
const o = typeof e.expiresIn == "string" ? parseInt(e.expiresIn, 10) : e.expiresIn;
|
|
129
|
+
e.accessTokenPayload !== void 0 ? t = e.accessTokenPayload : t = ce(e.accessToken);
|
|
130
130
|
let i;
|
|
131
|
-
|
|
132
|
-
const r =
|
|
133
|
-
|
|
131
|
+
s != null && "idToken" in s && !("idToken" in e) ? i = s.idToken : i = e.idToken;
|
|
132
|
+
const r = e.idTokenPayload ? e.idTokenPayload : ce(i), c = r && r.exp ? r.exp : Number.MAX_VALUE, a = t && t.exp ? t.exp : e.issuedAt + o;
|
|
133
|
+
e.issuedAt = Ne(e, t, r);
|
|
134
134
|
let u;
|
|
135
|
-
|
|
136
|
-
const f = { ...
|
|
137
|
-
if (
|
|
138
|
-
const d =
|
|
135
|
+
e.expiresAt ? u = e.expiresAt : n === z.access_token_invalid ? u = a : n === z.id_token_invalid ? u = c : u = c < a ? c : a;
|
|
136
|
+
const f = { ...e, idTokenPayload: r, accessTokenPayload: t, expiresAt: u, idToken: i };
|
|
137
|
+
if (s != null && "refreshToken" in s && !("refreshToken" in e)) {
|
|
138
|
+
const d = s.refreshToken;
|
|
139
139
|
return { ...f, refreshToken: d };
|
|
140
140
|
}
|
|
141
141
|
return f;
|
|
142
|
-
}, oe = (
|
|
143
|
-
if (!
|
|
142
|
+
}, oe = (e, s, n) => {
|
|
143
|
+
if (!e)
|
|
144
144
|
return null;
|
|
145
|
-
if (!
|
|
145
|
+
if (!e.issued_at) {
|
|
146
146
|
const o = (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
147
|
-
|
|
147
|
+
e.issued_at = o;
|
|
148
148
|
}
|
|
149
149
|
const t = {
|
|
150
|
-
accessToken:
|
|
151
|
-
expiresIn:
|
|
152
|
-
idToken:
|
|
153
|
-
scope:
|
|
154
|
-
tokenType:
|
|
155
|
-
issuedAt:
|
|
150
|
+
accessToken: e.access_token,
|
|
151
|
+
expiresIn: e.expires_in,
|
|
152
|
+
idToken: e.id_token,
|
|
153
|
+
scope: e.scope,
|
|
154
|
+
tokenType: e.token_type,
|
|
155
|
+
issuedAt: e.issued_at
|
|
156
156
|
};
|
|
157
|
-
return "refresh_token" in
|
|
158
|
-
}, V = (
|
|
159
|
-
const
|
|
160
|
-
return Math.round(t -
|
|
161
|
-
}, Q = (
|
|
162
|
-
let t =
|
|
163
|
-
if (!
|
|
157
|
+
return "refresh_token" in e && (t.refreshToken = e.refresh_token), e.accessTokenPayload !== void 0 && (t.accessTokenPayload = e.accessTokenPayload), e.idTokenPayload !== void 0 && (t.idTokenPayload = e.idTokenPayload), te(t, s, n);
|
|
158
|
+
}, V = (e, s) => {
|
|
159
|
+
const n = (/* @__PURE__ */ new Date()).getTime() / 1e3, t = s - n;
|
|
160
|
+
return Math.round(t - e);
|
|
161
|
+
}, Q = (e) => e ? V(0, e.expiresAt) > 0 : !1, xe = async (e, s = 200, n = 50) => {
|
|
162
|
+
let t = n;
|
|
163
|
+
if (!e.tokens)
|
|
164
164
|
return null;
|
|
165
|
-
for (; !Q(
|
|
166
|
-
await R({ milliseconds:
|
|
165
|
+
for (; !Q(e.tokens) && t > 0; )
|
|
166
|
+
await R({ milliseconds: s }), t = t - 1;
|
|
167
167
|
return {
|
|
168
|
-
isTokensValid: Q(
|
|
169
|
-
tokens:
|
|
170
|
-
numberWaited: t -
|
|
168
|
+
isTokensValid: Q(e.tokens),
|
|
169
|
+
tokens: e.tokens,
|
|
170
|
+
numberWaited: t - n
|
|
171
171
|
};
|
|
172
|
-
},
|
|
173
|
-
if (
|
|
174
|
-
const t =
|
|
175
|
-
if (
|
|
176
|
-
return { isValid: !1, reason: `Issuer does not match (oidcServerConfiguration issuer) ${
|
|
172
|
+
}, ge = (e, s, n) => {
|
|
173
|
+
if (e.idTokenPayload) {
|
|
174
|
+
const t = e.idTokenPayload;
|
|
175
|
+
if (n.issuer !== t.iss)
|
|
176
|
+
return { isValid: !1, reason: `Issuer does not match (oidcServerConfiguration issuer) ${n.issuer} !== (idTokenPayload issuer) ${t.iss}` };
|
|
177
177
|
const o = (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
178
178
|
if (t.exp && t.exp < o)
|
|
179
179
|
return { isValid: !1, reason: `Token expired (idTokenPayload exp) ${t.exp} < (currentTimeUnixSecond) ${o}` };
|
|
180
180
|
const i = 60 * 60 * 24 * 7;
|
|
181
181
|
if (t.iat && t.iat + i < o)
|
|
182
182
|
return { isValid: !1, reason: `Token is used from too long time (idTokenPayload iat + timeInSevenDays) ${t.iat + i} < (currentTimeUnixSecond) ${o}` };
|
|
183
|
-
if (t.nonce && t.nonce !==
|
|
184
|
-
return { isValid: !1, reason: `Nonce does not match (idTokenPayload nonce) ${t.nonce} !== (nonce) ${
|
|
183
|
+
if (t.nonce && t.nonce !== s)
|
|
184
|
+
return { isValid: !1, reason: `Nonce does not match (idTokenPayload nonce) ${t.nonce} !== (nonce) ${s}` };
|
|
185
185
|
}
|
|
186
186
|
return { isValid: !0, reason: "" };
|
|
187
187
|
}, J = function() {
|
|
188
|
-
const
|
|
188
|
+
const e = function() {
|
|
189
189
|
let a, u;
|
|
190
190
|
const f = (function() {
|
|
191
191
|
const l = {}, _ = {
|
|
@@ -240,7 +240,7 @@ const te = (n, e = null, s) => {
|
|
|
240
240
|
}
|
|
241
241
|
return null;
|
|
242
242
|
}();
|
|
243
|
-
if (!
|
|
243
|
+
if (!e) {
|
|
244
244
|
const a = typeof window > "u" ? global : window;
|
|
245
245
|
return {
|
|
246
246
|
setTimeout: setTimeout.bind(a),
|
|
@@ -249,34 +249,34 @@ const te = (n, e = null, s) => {
|
|
|
249
249
|
clearInterval: clearInterval.bind(a)
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
const
|
|
252
|
+
const s = function() {
|
|
253
253
|
let a = 0;
|
|
254
254
|
return function() {
|
|
255
255
|
return a++, a;
|
|
256
256
|
};
|
|
257
|
-
}(),
|
|
258
|
-
|
|
259
|
-
const u = a.data, f =
|
|
257
|
+
}(), n = {}, t = {};
|
|
258
|
+
e.onmessage = function(a) {
|
|
259
|
+
const u = a.data, f = n[u];
|
|
260
260
|
if (f) {
|
|
261
|
-
f(),
|
|
261
|
+
f(), n[u] = null;
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
264
|
const d = t[u];
|
|
265
265
|
d && d();
|
|
266
266
|
};
|
|
267
267
|
function o(a, u) {
|
|
268
|
-
const f =
|
|
269
|
-
return
|
|
268
|
+
const f = s();
|
|
269
|
+
return e.postMessage(["setTimeout", f, u]), n[f] = a, f;
|
|
270
270
|
}
|
|
271
271
|
function i(a) {
|
|
272
|
-
|
|
272
|
+
e.postMessage(["clearTimeout", a]), n[a] = null;
|
|
273
273
|
}
|
|
274
274
|
function r(a, u) {
|
|
275
|
-
const f =
|
|
276
|
-
return
|
|
275
|
+
const f = s();
|
|
276
|
+
return e.postMessage(["setInterval", f, u]), t[f] = a, f;
|
|
277
277
|
}
|
|
278
278
|
function c(a) {
|
|
279
|
-
|
|
279
|
+
e.postMessage(["clearInterval", a]), t[a] = null;
|
|
280
280
|
}
|
|
281
281
|
return {
|
|
282
282
|
setTimeout: o,
|
|
@@ -284,45 +284,45 @@ const te = (n, e = null, s) => {
|
|
|
284
284
|
setInterval: r,
|
|
285
285
|
clearInterval: c
|
|
286
286
|
};
|
|
287
|
-
}(), le = "7.15.
|
|
288
|
-
let ue = null,
|
|
289
|
-
const R = ({ milliseconds:
|
|
287
|
+
}(), le = "7.15.1";
|
|
288
|
+
let ue = null, j;
|
|
289
|
+
const R = ({ milliseconds: e }) => new Promise((s) => J.setTimeout(s, e)), ke = (e = "/") => {
|
|
290
290
|
try {
|
|
291
|
-
|
|
291
|
+
j = new AbortController(), fetch(`${e}OidcKeepAliveServiceWorker.json?minSleepSeconds=150`, { signal: j.signal }).catch((t) => {
|
|
292
292
|
console.log(t);
|
|
293
|
-
}), R({ milliseconds: 150 * 1e3 }).then(
|
|
294
|
-
} catch (
|
|
295
|
-
console.log(
|
|
293
|
+
}), R({ milliseconds: 150 * 1e3 }).then(ke);
|
|
294
|
+
} catch (s) {
|
|
295
|
+
console.log(s);
|
|
296
296
|
}
|
|
297
|
-
},
|
|
298
|
-
|
|
299
|
-
},
|
|
297
|
+
}, We = () => {
|
|
298
|
+
j && j.abort();
|
|
299
|
+
}, Le = (e = "/") => fetch(`${e}OidcKeepAliveServiceWorker.json`, {
|
|
300
300
|
headers: {
|
|
301
301
|
"oidc-vanilla": "true"
|
|
302
302
|
}
|
|
303
|
-
}).then((
|
|
304
|
-
console.log(
|
|
305
|
-
}),
|
|
306
|
-
|
|
307
|
-
const t = await
|
|
308
|
-
console.log(`Service worker unregistering ${t}`), await R({ milliseconds: 2e3 }),
|
|
309
|
-
}, b = (
|
|
303
|
+
}).then((s) => s.statusText === "oidc-service-worker").catch((s) => {
|
|
304
|
+
console.log(s);
|
|
305
|
+
}), De = (e) => async (s, n) => {
|
|
306
|
+
n(), await s.update();
|
|
307
|
+
const t = await s.unregister();
|
|
308
|
+
console.log(`Service worker unregistering ${t}`), await R({ milliseconds: 2e3 }), e.reload();
|
|
309
|
+
}, b = (e) => (s) => new Promise(function(n, t) {
|
|
310
310
|
const o = new MessageChannel();
|
|
311
311
|
o.port1.onmessage = function(i) {
|
|
312
|
-
i.data && i.data.error ? t(i.data.error) :
|
|
313
|
-
},
|
|
314
|
-
}), E = async (
|
|
315
|
-
const
|
|
316
|
-
if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !
|
|
312
|
+
i.data && i.data.error ? t(i.data.error) : n(i.data);
|
|
313
|
+
}, e.active.postMessage(s, [o.port2]);
|
|
314
|
+
}), E = async (e, s) => {
|
|
315
|
+
const n = e.service_worker_relative_url;
|
|
316
|
+
if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !n || e.service_worker_activate() === !1)
|
|
317
317
|
return null;
|
|
318
318
|
let t = null;
|
|
319
|
-
|
|
319
|
+
e.register ? t = await e.service_worker_register(n) : t = await navigator.serviceWorker.register(n);
|
|
320
320
|
try {
|
|
321
321
|
await navigator.serviceWorker.ready, navigator.serviceWorker.controller || await b(t)({ type: "claim" });
|
|
322
322
|
} catch {
|
|
323
323
|
return null;
|
|
324
324
|
}
|
|
325
|
-
const o = async (k) => b(t)({ type: "clear", data: { status: k }, configurationName:
|
|
325
|
+
const o = async (k) => b(t)({ type: "clear", data: { status: k }, configurationName: s }), i = async (k, A, O) => {
|
|
326
326
|
const N = await b(t)({
|
|
327
327
|
type: "init",
|
|
328
328
|
data: {
|
|
@@ -333,84 +333,84 @@ const R = ({ milliseconds: n }) => new Promise((e) => J.setTimeout(e, n)), me =
|
|
|
333
333
|
service_worker_convert_all_requests_to_cors: O.service_worker_convert_all_requests_to_cors
|
|
334
334
|
}
|
|
335
335
|
},
|
|
336
|
-
configurationName:
|
|
336
|
+
configurationName: s
|
|
337
337
|
}), P = N.version;
|
|
338
|
-
return P !== le && (console.warn(`Service worker ${P} version mismatch with js client version ${le}, unregistering and reloading`), await O.service_worker_update_require_callback(t,
|
|
338
|
+
return P !== le && (console.warn(`Service worker ${P} version mismatch with js client version ${le}, unregistering and reloading`), await O.service_worker_update_require_callback(t, We)), { tokens: oe(N.tokens, null, O.token_renew_mode), status: N.status };
|
|
339
339
|
}, r = (k = "/") => {
|
|
340
|
-
ue == null && (ue = "not_null",
|
|
341
|
-
}, c = (k) => b(t)({ type: "setSessionState", data: { sessionState: k }, configurationName:
|
|
342
|
-
let A = (await b(t)({ type: "getNonce", data: null, configurationName:
|
|
343
|
-
return A || (A = sessionStorage[`oidc.nonce.${
|
|
340
|
+
ue == null && (ue = "not_null", ke(k));
|
|
341
|
+
}, c = (k) => b(t)({ type: "setSessionState", data: { sessionState: k }, configurationName: s }), a = async () => (await b(t)({ type: "getSessionState", data: null, configurationName: s })).sessionState, u = (k) => (sessionStorage[`oidc.nonce.${s}`] = k.nonce, b(t)({ type: "setNonce", data: { nonce: k }, configurationName: s })), f = async () => {
|
|
342
|
+
let A = (await b(t)({ type: "getNonce", data: null, configurationName: s })).nonce;
|
|
343
|
+
return A || (A = sessionStorage[`oidc.nonce.${s}`], console.warn("nonce not found in service worker, using sessionStorage")), { nonce: A };
|
|
344
344
|
};
|
|
345
345
|
let d = {};
|
|
346
346
|
return {
|
|
347
347
|
clearAsync: o,
|
|
348
348
|
initAsync: i,
|
|
349
|
-
startKeepAliveServiceWorker: () => r(
|
|
350
|
-
isServiceWorkerProxyActiveAsync: () =>
|
|
349
|
+
startKeepAliveServiceWorker: () => r(e.service_worker_keep_alive_path),
|
|
350
|
+
isServiceWorkerProxyActiveAsync: () => Le(e.service_worker_keep_alive_path),
|
|
351
351
|
setSessionStateAsync: c,
|
|
352
352
|
getSessionStateAsync: a,
|
|
353
353
|
setNonceAsync: u,
|
|
354
354
|
getNonceAsync: f,
|
|
355
355
|
setLoginParams: (k) => {
|
|
356
|
-
d[
|
|
356
|
+
d[s] = k, localStorage[`oidc.login.${s}`] = JSON.stringify(k);
|
|
357
357
|
},
|
|
358
358
|
getLoginParams: () => {
|
|
359
|
-
const k = localStorage[`oidc.login.${
|
|
360
|
-
return d[
|
|
359
|
+
const k = localStorage[`oidc.login.${s}`];
|
|
360
|
+
return d[s] || (d[s] = JSON.parse(k)), d[s];
|
|
361
361
|
},
|
|
362
362
|
getStateAsync: async () => {
|
|
363
|
-
let A = (await b(t)({ type: "getState", data: null, configurationName:
|
|
364
|
-
return A || (A = sessionStorage[`oidc.state.${
|
|
363
|
+
let A = (await b(t)({ type: "getState", data: null, configurationName: s })).state;
|
|
364
|
+
return A || (A = sessionStorage[`oidc.state.${s}`], console.warn("state not found in service worker, using sessionStorage")), A;
|
|
365
365
|
},
|
|
366
|
-
setStateAsync: async (k) => (sessionStorage[`oidc.state.${
|
|
366
|
+
setStateAsync: async (k) => (sessionStorage[`oidc.state.${s}`] = k, b(t)({ type: "setState", data: { state: k }, configurationName: s })),
|
|
367
367
|
getCodeVerifierAsync: async () => {
|
|
368
|
-
let A = (await b(t)({ type: "getCodeVerifier", data: null, configurationName:
|
|
369
|
-
return A || (A = sessionStorage[`oidc.code_verifier.${
|
|
368
|
+
let A = (await b(t)({ type: "getCodeVerifier", data: null, configurationName: s })).codeVerifier;
|
|
369
|
+
return A || (A = sessionStorage[`oidc.code_verifier.${s}`], console.warn("codeVerifier not found in service worker, using sessionStorage")), A;
|
|
370
370
|
},
|
|
371
|
-
setCodeVerifierAsync: async (k) => (sessionStorage[`oidc.code_verifier.${
|
|
371
|
+
setCodeVerifierAsync: async (k) => (sessionStorage[`oidc.code_verifier.${s}`] = k, b(t)({ type: "setCodeVerifier", data: { codeVerifier: k }, configurationName: s })),
|
|
372
372
|
setDemonstratingProofOfPossessionNonce: async (k) => {
|
|
373
|
-
await b(t)({ type: "setDemonstratingProofOfPossessionNonce", data: { demonstratingProofOfPossessionNonce: k }, configurationName:
|
|
373
|
+
await b(t)({ type: "setDemonstratingProofOfPossessionNonce", data: { demonstratingProofOfPossessionNonce: k }, configurationName: s });
|
|
374
374
|
},
|
|
375
|
-
getDemonstratingProofOfPossessionNonce: async () => (await b(t)({ type: "getDemonstratingProofOfPossessionNonce", data: null, configurationName:
|
|
375
|
+
getDemonstratingProofOfPossessionNonce: async () => (await b(t)({ type: "getDemonstratingProofOfPossessionNonce", data: null, configurationName: s })).demonstratingProofOfPossessionNonce,
|
|
376
376
|
setDemonstratingProofOfPossessionJwkAsync: async (k) => {
|
|
377
377
|
const A = JSON.stringify(k);
|
|
378
|
-
b(t)({ type: "setDemonstratingProofOfPossessionJwk", data: { demonstratingProofOfPossessionJwkJson: A }, configurationName:
|
|
378
|
+
b(t)({ type: "setDemonstratingProofOfPossessionJwk", data: { demonstratingProofOfPossessionJwkJson: A }, configurationName: s });
|
|
379
379
|
},
|
|
380
380
|
getDemonstratingProofOfPossessionJwkAsync: async () => {
|
|
381
|
-
const k = await b(t)({ type: "getDemonstratingProofOfPossessionJwk", data: null, configurationName:
|
|
381
|
+
const k = await b(t)({ type: "getDemonstratingProofOfPossessionJwk", data: null, configurationName: s });
|
|
382
382
|
return k.demonstratingProofOfPossessionJwkJson ? JSON.parse(k.demonstratingProofOfPossessionJwkJson) : null;
|
|
383
383
|
}
|
|
384
384
|
};
|
|
385
385
|
};
|
|
386
|
-
async function de(
|
|
386
|
+
async function de(e, s, n, t) {
|
|
387
387
|
const o = (a) => {
|
|
388
|
-
|
|
389
|
-
}, { tokens: i, status: r } = await
|
|
390
|
-
return await E(
|
|
388
|
+
e.tokens = a;
|
|
389
|
+
}, { tokens: i, status: r } = await e.synchroniseTokensAsync(s, 0, n, t, o);
|
|
390
|
+
return await E(e.configuration, e.configurationName) || await I(e.configurationName, e.configuration.storage).setTokens(e.tokens), e.tokens ? i : (await e.destroyAsync(r), null);
|
|
391
391
|
}
|
|
392
|
-
async function
|
|
393
|
-
const
|
|
394
|
-
if (
|
|
395
|
-
const t = await
|
|
392
|
+
async function $e(e, s) {
|
|
393
|
+
const n = await E(s, e.configurationName);
|
|
394
|
+
if (n) {
|
|
395
|
+
const t = await e.initAsync(s.authority, s.authority_configuration), { tokens: o } = await n.initAsync(t, "tryKeepExistingSessionAsync", s);
|
|
396
396
|
return o;
|
|
397
397
|
} else {
|
|
398
|
-
const t = I(
|
|
398
|
+
const t = I(e.configurationName, s.storage ?? sessionStorage);
|
|
399
399
|
let { tokens: o } = await t.initAsync();
|
|
400
|
-
return o = te(o,
|
|
400
|
+
return o = te(o, e.tokens, s.token_renew_mode), o;
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
async function
|
|
404
|
-
const o =
|
|
403
|
+
async function me(e, s, n = !1, t = null) {
|
|
404
|
+
const o = e.configuration, i = `${o.client_id}_${e.configurationName}_${o.authority}`;
|
|
405
405
|
let r;
|
|
406
|
-
const c = await E(
|
|
407
|
-
return (o == null ? void 0 : o.storage) === (window == null ? void 0 : window.sessionStorage) && !c ? r = await de(
|
|
406
|
+
const c = await E(e.configuration, e.configurationName);
|
|
407
|
+
return (o == null ? void 0 : o.storage) === (window == null ? void 0 : window.sessionStorage) && !c ? r = await de(e, s, n, t) : r = await navigator.locks.request(i, { ifAvailable: !0 }, async (a) => a ? await de(e, s, n, t) : (e.publishEvent(K.eventNames.syncTokensAsync_lock_not_available, { lock: "lock not available" }), await $e(e, o))), r ? (e.timeoutId && (e.timeoutId = M(e, r.refreshToken, e.tokens.expiresAt, t)), e.tokens) : null;
|
|
408
408
|
}
|
|
409
|
-
const M = (
|
|
410
|
-
const o =
|
|
409
|
+
const M = (e, s, n, t = null) => {
|
|
410
|
+
const o = e.configuration.refresh_time_before_tokens_expiration_in_second;
|
|
411
411
|
return J.setTimeout(async () => {
|
|
412
|
-
const r = { timeLeft: V(o,
|
|
413
|
-
|
|
412
|
+
const r = { timeLeft: V(o, n) };
|
|
413
|
+
e.publishEvent(K.eventNames.token_timer, r), await me(e, s, !1, t);
|
|
414
414
|
}, 1e3);
|
|
415
415
|
}, D = {
|
|
416
416
|
SESSION_LOST: "SESSION_LOST",
|
|
@@ -419,14 +419,14 @@ const M = (n, e, s, t = null) => {
|
|
|
419
419
|
TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID",
|
|
420
420
|
LOGOUT_FROM_ANOTHER_TAB: "LOGOUT_FROM_ANOTHER_TAB",
|
|
421
421
|
REQUIRE_SYNC_TOKENS: "REQUIRE_SYNC_TOKENS"
|
|
422
|
-
},
|
|
422
|
+
}, Re = (e) => async (s, n, t, o = !1) => {
|
|
423
423
|
const i = { nonce: null };
|
|
424
424
|
if (!t)
|
|
425
425
|
return { tokens: null, status: "NOT_CONNECTED", nonce: i };
|
|
426
426
|
let r = i;
|
|
427
|
-
const c = await
|
|
427
|
+
const c = await e.initAsync(s.authority, s.authority_configuration), a = await E(s, n);
|
|
428
428
|
if (a) {
|
|
429
|
-
const { status: d, tokens: l } = await a.initAsync(c, "syncTokensAsync",
|
|
429
|
+
const { status: d, tokens: l } = await a.initAsync(c, "syncTokensAsync", s);
|
|
430
430
|
if (d === "LOGGED_OUT")
|
|
431
431
|
return { tokens: null, status: "LOGOUT_FROM_ANOTHER_TAB", nonce: i };
|
|
432
432
|
if (d === "SESSIONS_LOST")
|
|
@@ -434,72 +434,72 @@ const M = (n, e, s, t = null) => {
|
|
|
434
434
|
if (!d || !l)
|
|
435
435
|
return { tokens: null, status: "REQUIRE_SYNC_TOKENS", nonce: i };
|
|
436
436
|
if (l.issuedAt !== t.issuedAt) {
|
|
437
|
-
const y = V(
|
|
437
|
+
const y = V(s.refresh_time_before_tokens_expiration_in_second, l.expiresAt) > 0 ? "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID" : "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID", h = await a.getNonceAsync();
|
|
438
438
|
return { tokens: l, status: y, nonce: h };
|
|
439
439
|
}
|
|
440
440
|
r = await a.getNonceAsync();
|
|
441
441
|
} else {
|
|
442
|
-
const d = I(
|
|
442
|
+
const d = I(n, s.storage ?? sessionStorage), { tokens: l, status: _ } = await d.initAsync();
|
|
443
443
|
if (l) {
|
|
444
444
|
if (_ === "SESSIONS_LOST")
|
|
445
445
|
return { tokens: null, status: "SESSIONS_LOST", nonce: i };
|
|
446
446
|
if (l.issuedAt !== t.issuedAt) {
|
|
447
|
-
const h = V(
|
|
447
|
+
const h = V(s.refresh_time_before_tokens_expiration_in_second, l.expiresAt) > 0 ? "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID" : "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID", g = await d.getNonceAsync();
|
|
448
448
|
return { tokens: l, status: h, nonce: g };
|
|
449
449
|
}
|
|
450
450
|
} else
|
|
451
451
|
return { tokens: null, status: "LOGOUT_FROM_ANOTHER_TAB", nonce: i };
|
|
452
452
|
r = await d.getNonceAsync();
|
|
453
453
|
}
|
|
454
|
-
const f = V(
|
|
454
|
+
const f = V(s.refresh_time_before_tokens_expiration_in_second, t.expiresAt) > 0 ? "TOKENS_VALID" : "TOKENS_INVALID";
|
|
455
455
|
return o ? { tokens: t, status: "FORCE_REFRESH", nonce: r } : { tokens: t, status: f, nonce: r };
|
|
456
|
-
}, ie = (
|
|
457
|
-
if (!
|
|
456
|
+
}, ie = (e, s, n) => (t = null, o = null, i = null) => {
|
|
457
|
+
if (!s.silent_redirect_uri || !s.silent_login_uri)
|
|
458
458
|
return Promise.resolve(null);
|
|
459
459
|
try {
|
|
460
|
-
|
|
460
|
+
n(m.silentLoginAsync_begin, {});
|
|
461
461
|
let r = "";
|
|
462
462
|
if (o && (t == null && (t = {}), t.state = o), i && (t == null && (t = {}), t.scope = i), t != null)
|
|
463
463
|
for (const [d, l] of Object.entries(t))
|
|
464
464
|
r === "" ? r = `?${encodeURIComponent(d)}=${encodeURIComponent(l)}` : r += `&${encodeURIComponent(d)}=${encodeURIComponent(l)}`;
|
|
465
|
-
const c =
|
|
466
|
-
return f.width = "0px", f.height = "0px", f.id = `${
|
|
465
|
+
const c = s.silent_login_uri + r, a = c.indexOf("/", c.indexOf("//") + 2), u = c.substr(0, a), f = document.createElement("iframe");
|
|
466
|
+
return f.width = "0px", f.height = "0px", f.id = `${e}_oidc_iframe`, f.setAttribute("src", c), document.body.appendChild(f), new Promise((d, l) => {
|
|
467
467
|
try {
|
|
468
468
|
let _ = !1;
|
|
469
469
|
window.onmessage = (h) => {
|
|
470
470
|
if (h.origin === u && h.source === f.contentWindow) {
|
|
471
|
-
const g = `${
|
|
471
|
+
const g = `${e}_oidc_tokens:`, w = `${e}_oidc_error:`, S = h.data;
|
|
472
472
|
if (S && typeof S == "string" && !_) {
|
|
473
473
|
if (S.startsWith(g)) {
|
|
474
474
|
const T = JSON.parse(h.data.replace(g, ""));
|
|
475
|
-
|
|
475
|
+
n(m.silentLoginAsync_end, {}), f.remove(), _ = !0, d(T);
|
|
476
476
|
} else if (S.startsWith(w)) {
|
|
477
477
|
const T = JSON.parse(h.data.replace(w, ""));
|
|
478
|
-
|
|
478
|
+
n(m.silentLoginAsync_error, T), f.remove(), _ = !0, l(new Error("oidc_" + T.error));
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
};
|
|
483
|
-
const y =
|
|
483
|
+
const y = s.silent_login_timeout;
|
|
484
484
|
setTimeout(() => {
|
|
485
|
-
_ || (
|
|
485
|
+
_ || (n(m.silentLoginAsync_error, { reason: "timeout" }), f.remove(), _ = !0, l(new Error("timeout")));
|
|
486
486
|
}, y);
|
|
487
487
|
} catch (_) {
|
|
488
|
-
f.remove(),
|
|
488
|
+
f.remove(), n(m.silentLoginAsync_error, _), l(_);
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
} catch (r) {
|
|
492
|
-
throw
|
|
492
|
+
throw n(m.silentLoginAsync_error, r), r;
|
|
493
493
|
}
|
|
494
|
-
},
|
|
494
|
+
}, Ke = (e, s, n, t, o) => (i = null, r = void 0) => {
|
|
495
495
|
i = { ...i };
|
|
496
|
-
const c = (u, f, d) => ie(
|
|
496
|
+
const c = (u, f, d) => ie(s, n, t.bind(o))(u, f, d);
|
|
497
497
|
return (async () => {
|
|
498
498
|
o.timeoutId && J.clearTimeout(o.timeoutId);
|
|
499
499
|
let u;
|
|
500
500
|
i && "state" in i && (u = i.state, delete i.state);
|
|
501
501
|
try {
|
|
502
|
-
const f =
|
|
502
|
+
const f = n.extras ? { ...n.extras, ...i } : i, d = await c({
|
|
503
503
|
...f,
|
|
504
504
|
prompt: "none"
|
|
505
505
|
}, u, r);
|
|
@@ -509,35 +509,35 @@ const M = (n, e, s, t = null) => {
|
|
|
509
509
|
return f;
|
|
510
510
|
}
|
|
511
511
|
})();
|
|
512
|
-
},
|
|
513
|
-
const c = (a, u = void 0, f = void 0) => ie(
|
|
512
|
+
}, Ue = (e, s, n) => (t, o, i, r = !1) => {
|
|
513
|
+
const c = (a, u = void 0, f = void 0) => ie(e.configurationName, n, e.publishEvent.bind(e))(a, u, f);
|
|
514
514
|
return new Promise((a, u) => {
|
|
515
|
-
if (
|
|
515
|
+
if (n.silent_login_uri && n.silent_redirect_uri && n.monitor_session && t && i && !r) {
|
|
516
516
|
const f = () => {
|
|
517
|
-
|
|
518
|
-
const d =
|
|
517
|
+
e.checkSessionIFrame.stop();
|
|
518
|
+
const d = e.tokens;
|
|
519
519
|
if (d === null)
|
|
520
520
|
return;
|
|
521
521
|
const l = d.idToken, _ = d.idTokenPayload;
|
|
522
522
|
return c({
|
|
523
523
|
prompt: "none",
|
|
524
524
|
id_token_hint: l,
|
|
525
|
-
scope:
|
|
525
|
+
scope: n.scope || "openid"
|
|
526
526
|
}).then((y) => {
|
|
527
527
|
const h = y.tokens.idTokenPayload;
|
|
528
528
|
if (_.sub === h.sub) {
|
|
529
529
|
const g = y.sessionState;
|
|
530
|
-
|
|
530
|
+
e.checkSessionIFrame.start(y.sessionState), _.sid === h.sid ? console.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:", g) : console.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:", g);
|
|
531
531
|
} else
|
|
532
532
|
console.debug("SessionMonitor._callback: Different subject signed into OP:", h.sub);
|
|
533
533
|
}).catch(async (y) => {
|
|
534
534
|
console.warn("SessionMonitor._callback: Silent login failed, logging out other tabs:", y);
|
|
535
|
-
for (const [h, g] of Object.entries(
|
|
536
|
-
await g.logoutOtherTabAsync(
|
|
535
|
+
for (const [h, g] of Object.entries(s))
|
|
536
|
+
await g.logoutOtherTabAsync(n.client_id, _.sub);
|
|
537
537
|
});
|
|
538
538
|
};
|
|
539
|
-
|
|
540
|
-
|
|
539
|
+
e.checkSessionIFrame = new Oe(f, o, t), e.checkSessionIFrame.load().then(() => {
|
|
540
|
+
e.checkSessionIFrame.start(i), a(e.checkSessionIFrame);
|
|
541
541
|
}).catch((d) => {
|
|
542
542
|
u(d);
|
|
543
543
|
});
|
|
@@ -545,100 +545,100 @@ const M = (n, e, s, t = null) => {
|
|
|
545
545
|
a(null);
|
|
546
546
|
});
|
|
547
547
|
};
|
|
548
|
-
var
|
|
549
|
-
for (var H = 0,
|
|
548
|
+
var Fe = Be, C = [], fe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
549
|
+
for (var H = 0, Ve = fe.length; H < Ve; ++H)
|
|
550
550
|
C[H] = fe[H];
|
|
551
|
-
function
|
|
552
|
-
return C[
|
|
551
|
+
function Me(e) {
|
|
552
|
+
return C[e >> 18 & 63] + C[e >> 12 & 63] + C[e >> 6 & 63] + C[e & 63];
|
|
553
553
|
}
|
|
554
|
-
function
|
|
555
|
-
for (var t, o = [], i =
|
|
556
|
-
t = (
|
|
554
|
+
function Je(e, s, n) {
|
|
555
|
+
for (var t, o = [], i = s; i < n; i += 3)
|
|
556
|
+
t = (e[i] << 16 & 16711680) + (e[i + 1] << 8 & 65280) + (e[i + 2] & 255), o.push(Me(t));
|
|
557
557
|
return o.join("");
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
for (var
|
|
561
|
-
o.push(
|
|
562
|
-
return t === 1 ? (
|
|
563
|
-
C[
|
|
564
|
-
)) : t === 2 && (
|
|
565
|
-
C[
|
|
559
|
+
function Be(e) {
|
|
560
|
+
for (var s, n = e.length, t = n % 3, o = [], i = 16383, r = 0, c = n - t; r < c; r += i)
|
|
561
|
+
o.push(Je(e, r, r + i > c ? c : r + i));
|
|
562
|
+
return t === 1 ? (s = e[n - 1], o.push(
|
|
563
|
+
C[s >> 2] + C[s << 4 & 63] + "=="
|
|
564
|
+
)) : t === 2 && (s = (e[n - 2] << 8) + e[n - 1], o.push(
|
|
565
|
+
C[s >> 10] + C[s >> 4 & 63] + C[s << 2 & 63] + "="
|
|
566
566
|
)), o.join("");
|
|
567
567
|
}
|
|
568
|
-
const
|
|
569
|
-
const
|
|
570
|
-
return { hasCrypto:
|
|
571
|
-
}, Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
|
572
|
-
const
|
|
573
|
-
for (let
|
|
574
|
-
const t = n
|
|
575
|
-
|
|
576
|
-
}
|
|
577
|
-
return
|
|
578
|
-
}, je = (
|
|
579
|
-
const
|
|
580
|
-
if (
|
|
581
|
-
window.crypto.getRandomValues(
|
|
568
|
+
const pe = () => {
|
|
569
|
+
const e = typeof window < "u" && !!window.crypto, s = e && !!window.crypto.subtle;
|
|
570
|
+
return { hasCrypto: e, hasSubtleCrypto: s };
|
|
571
|
+
}, Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", He = (e) => {
|
|
572
|
+
const s = [];
|
|
573
|
+
for (let n = 0; n < e.byteLength; n += 1) {
|
|
574
|
+
const t = e[n] % Z.length;
|
|
575
|
+
s.push(Z[t]);
|
|
576
|
+
}
|
|
577
|
+
return s.join("");
|
|
578
|
+
}, je = (e) => Fe(new Uint8Array(e)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""), ee = (e) => {
|
|
579
|
+
const s = new Uint8Array(e), { hasCrypto: n } = pe();
|
|
580
|
+
if (n)
|
|
581
|
+
window.crypto.getRandomValues(s);
|
|
582
582
|
else
|
|
583
|
-
for (let t = 0; t <
|
|
584
|
-
|
|
585
|
-
return
|
|
583
|
+
for (let t = 0; t < e; t += 1)
|
|
584
|
+
s[t] = Math.random() * Z.length | 0;
|
|
585
|
+
return He(s);
|
|
586
586
|
};
|
|
587
|
-
function
|
|
588
|
-
const
|
|
589
|
-
for (let t = 0; t <
|
|
590
|
-
|
|
591
|
-
return
|
|
587
|
+
function qe(e) {
|
|
588
|
+
const s = new ArrayBuffer(e.length), n = new Uint8Array(s);
|
|
589
|
+
for (let t = 0; t < e.length; t++)
|
|
590
|
+
n[t] = e.charCodeAt(t);
|
|
591
|
+
return n;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
594
|
-
return new Promise((
|
|
595
|
-
crypto.subtle.digest("SHA-256",
|
|
593
|
+
function we(e) {
|
|
594
|
+
return new Promise((s, n) => {
|
|
595
|
+
crypto.subtle.digest("SHA-256", qe(e)).then((t) => s(je(new Uint8Array(t))), (t) => n(t));
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
|
-
const
|
|
599
|
-
if (
|
|
598
|
+
const Ge = (e) => {
|
|
599
|
+
if (e.length < 43 || e.length > 128)
|
|
600
600
|
return Promise.reject(new Error("Invalid code length."));
|
|
601
|
-
const { hasSubtleCrypto:
|
|
602
|
-
return
|
|
603
|
-
}, $ = {},
|
|
604
|
-
if (!$[
|
|
605
|
-
const o =
|
|
606
|
-
o && ($[
|
|
607
|
-
}
|
|
608
|
-
const t = 1e3 *
|
|
609
|
-
return $[
|
|
610
|
-
},
|
|
601
|
+
const { hasSubtleCrypto: s } = pe();
|
|
602
|
+
return s ? we(e) : Promise.reject(new Error("window.crypto.subtle is unavailable."));
|
|
603
|
+
}, $ = {}, Ye = (e, s = window.sessionStorage, n) => {
|
|
604
|
+
if (!$[e] && s) {
|
|
605
|
+
const o = s.getItem(e);
|
|
606
|
+
o && ($[e] = JSON.parse(o));
|
|
607
|
+
}
|
|
608
|
+
const t = 1e3 * n;
|
|
609
|
+
return $[e] && $[e].timestamp + t > Date.now() ? $[e].result : null;
|
|
610
|
+
}, Xe = (e, s, n = window.sessionStorage) => {
|
|
611
611
|
const t = Date.now();
|
|
612
|
-
$[
|
|
613
|
-
},
|
|
614
|
-
const i = `${
|
|
612
|
+
$[e] = { result: s, timestamp: t }, n && n.setItem(e, JSON.stringify({ result: s, timestamp: t }));
|
|
613
|
+
}, ze = 60 * 60, Qe = (e) => async (s, n = ze, t = window.sessionStorage, o = 1e4) => {
|
|
614
|
+
const i = `${s}/.well-known/openid-configuration`, r = `oidc.server:${s}`, c = Ye(r, t, n);
|
|
615
615
|
if (c)
|
|
616
|
-
return new
|
|
617
|
-
const a = await B(
|
|
616
|
+
return new ne(c);
|
|
617
|
+
const a = await B(e)(i, {}, o);
|
|
618
618
|
if (a.status !== 200)
|
|
619
619
|
return null;
|
|
620
620
|
const u = await a.json();
|
|
621
|
-
return
|
|
622
|
-
}, B = (
|
|
621
|
+
return Xe(r, u, t), new ne(u);
|
|
622
|
+
}, B = (e) => async (s, n = {}, t = 1e4, o = 0) => {
|
|
623
623
|
let i;
|
|
624
624
|
try {
|
|
625
625
|
const r = new AbortController();
|
|
626
|
-
setTimeout(() => r.abort(), t), i = await
|
|
626
|
+
setTimeout(() => r.abort(), t), i = await e(s, { ...n, signal: r.signal });
|
|
627
627
|
} catch (r) {
|
|
628
628
|
if (r.name === "AbortError" || r.message === "Network request failed") {
|
|
629
629
|
if (o <= 1)
|
|
630
|
-
return await B(
|
|
630
|
+
return await B(e)(s, n, t, o + 1);
|
|
631
631
|
throw r;
|
|
632
632
|
} else
|
|
633
633
|
throw console.error(r.message), r;
|
|
634
634
|
}
|
|
635
635
|
return i;
|
|
636
|
-
},
|
|
636
|
+
}, se = {
|
|
637
637
|
refresh_token: "refresh_token",
|
|
638
638
|
access_token: "access_token"
|
|
639
|
-
}, _e = (
|
|
639
|
+
}, _e = (e) => async (s, n, t = se.refresh_token, o, i = 1e4) => {
|
|
640
640
|
const r = {
|
|
641
|
-
token:
|
|
641
|
+
token: n,
|
|
642
642
|
token_type_hint: t,
|
|
643
643
|
client_id: o
|
|
644
644
|
}, c = [];
|
|
@@ -647,7 +647,7 @@ const Ye = (n) => {
|
|
|
647
647
|
c.push(`${d}=${l}`);
|
|
648
648
|
}
|
|
649
649
|
const a = c.join("&");
|
|
650
|
-
return (await B(
|
|
650
|
+
return (await B(e)(s, {
|
|
651
651
|
method: "POST",
|
|
652
652
|
headers: {
|
|
653
653
|
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
|
|
@@ -656,15 +656,15 @@ const Ye = (n) => {
|
|
|
656
656
|
}, i)).status !== 200 ? { success: !1 } : {
|
|
657
657
|
success: !0
|
|
658
658
|
};
|
|
659
|
-
},
|
|
659
|
+
}, Ze = (e) => async (s, n, t, o, i = {}, r, c = 1e4) => {
|
|
660
660
|
for (const [_, y] of Object.entries(t))
|
|
661
|
-
|
|
661
|
+
n[_] === void 0 && (n[_] = y);
|
|
662
662
|
const a = [];
|
|
663
|
-
for (const _ in
|
|
664
|
-
const y = encodeURIComponent(_), h = encodeURIComponent(
|
|
663
|
+
for (const _ in n) {
|
|
664
|
+
const y = encodeURIComponent(_), h = encodeURIComponent(n[_]);
|
|
665
665
|
a.push(`${y}=${h}`);
|
|
666
666
|
}
|
|
667
|
-
const u = a.join("&"), f = await B(
|
|
667
|
+
const u = a.join("&"), f = await B(e)(s, {
|
|
668
668
|
method: "POST",
|
|
669
669
|
headers: {
|
|
670
670
|
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
|
@@ -676,28 +676,28 @@ const Ye = (n) => {
|
|
|
676
676
|
return { success: !1, status: f.status, demonstratingProofOfPossessionNonce: null };
|
|
677
677
|
const d = await f.json();
|
|
678
678
|
let l = null;
|
|
679
|
-
return f.headers.has(
|
|
679
|
+
return f.headers.has(q) && (l = f.headers.get(q)), {
|
|
680
680
|
success: !0,
|
|
681
681
|
data: oe(d, o, r),
|
|
682
682
|
demonstratingProofOfPossessionNonce: l
|
|
683
683
|
};
|
|
684
|
-
},
|
|
684
|
+
}, es = (e, s) => async (n, t) => {
|
|
685
685
|
t = t ? { ...t } : {};
|
|
686
|
-
const o = ee(128), i = await
|
|
687
|
-
await
|
|
686
|
+
const o = ee(128), i = await Ge(o);
|
|
687
|
+
await e.setCodeVerifierAsync(o), await e.setStateAsync(t.state), t.code_challenge = i, t.code_challenge_method = "S256";
|
|
688
688
|
let r = "";
|
|
689
689
|
if (t)
|
|
690
690
|
for (const [c, a] of Object.entries(t))
|
|
691
691
|
r === "" ? r += "?" : r += "&", r += `${c}=${encodeURIComponent(a)}`;
|
|
692
|
-
|
|
693
|
-
},
|
|
694
|
-
|
|
692
|
+
s.open(`${n}${r}`);
|
|
693
|
+
}, q = "DPoP-Nonce", ss = (e) => async (s, n, t, o, i = 1e4) => {
|
|
694
|
+
n = n ? { ...n } : {}, n.code_verifier = await e.getCodeVerifierAsync();
|
|
695
695
|
const r = [];
|
|
696
|
-
for (const d in
|
|
697
|
-
const l = encodeURIComponent(d), _ = encodeURIComponent(
|
|
696
|
+
for (const d in n) {
|
|
697
|
+
const l = encodeURIComponent(d), _ = encodeURIComponent(n[d]);
|
|
698
698
|
r.push(`${l}=${_}`);
|
|
699
699
|
}
|
|
700
|
-
const c = r.join("&"), a = await B(fetch)(
|
|
700
|
+
const c = r.join("&"), a = await B(fetch)(s, {
|
|
701
701
|
method: "POST",
|
|
702
702
|
headers: {
|
|
703
703
|
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
|
@@ -705,79 +705,79 @@ const Ye = (n) => {
|
|
|
705
705
|
},
|
|
706
706
|
body: c
|
|
707
707
|
}, i);
|
|
708
|
-
if (await Promise.all([
|
|
708
|
+
if (await Promise.all([e.setCodeVerifierAsync(null), e.setStateAsync(null)]), a.status !== 200)
|
|
709
709
|
return { success: !1, status: a.status };
|
|
710
710
|
let u = null;
|
|
711
|
-
a.headers.has(
|
|
711
|
+
a.headers.has(q) && (u = a.headers.get(q));
|
|
712
712
|
const f = await a.json();
|
|
713
713
|
return {
|
|
714
714
|
success: !0,
|
|
715
715
|
data: {
|
|
716
|
-
state:
|
|
716
|
+
state: n.state,
|
|
717
717
|
tokens: oe(f, null, o),
|
|
718
718
|
demonstratingProofOfPossessionNonce: u
|
|
719
719
|
}
|
|
720
720
|
};
|
|
721
|
-
},
|
|
722
|
-
const
|
|
721
|
+
}, Ae = (e) => {
|
|
722
|
+
const s = e.match(
|
|
723
723
|
// eslint-disable-next-line no-useless-escape
|
|
724
724
|
/^([a-z][\w-]+\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/
|
|
725
725
|
);
|
|
726
|
-
if (!
|
|
726
|
+
if (!s)
|
|
727
727
|
throw new Error("Invalid URL");
|
|
728
|
-
let
|
|
728
|
+
let n = s[6], t = s[7];
|
|
729
729
|
if (t) {
|
|
730
730
|
const o = t.split("?");
|
|
731
|
-
o.length === 2 && (t = o[0],
|
|
732
|
-
}
|
|
733
|
-
return
|
|
734
|
-
href:
|
|
735
|
-
protocol:
|
|
736
|
-
host:
|
|
737
|
-
hostname:
|
|
738
|
-
port:
|
|
739
|
-
path:
|
|
740
|
-
search:
|
|
731
|
+
o.length === 2 && (t = o[0], n = o[1]);
|
|
732
|
+
}
|
|
733
|
+
return n.startsWith("?") && (n = n.slice(1)), s && {
|
|
734
|
+
href: e,
|
|
735
|
+
protocol: s[1],
|
|
736
|
+
host: s[2],
|
|
737
|
+
hostname: s[3],
|
|
738
|
+
port: s[4],
|
|
739
|
+
path: s[5],
|
|
740
|
+
search: n,
|
|
741
741
|
hash: t
|
|
742
742
|
};
|
|
743
|
-
},
|
|
744
|
-
const
|
|
745
|
-
let { path:
|
|
746
|
-
|
|
747
|
-
let { hash: t } =
|
|
748
|
-
return t === "#_=_" && (t = ""), t && (
|
|
749
|
-
}, G = (
|
|
750
|
-
const
|
|
751
|
-
return
|
|
752
|
-
},
|
|
753
|
-
const
|
|
754
|
-
let
|
|
755
|
-
const i =
|
|
743
|
+
}, Cs = (e) => {
|
|
744
|
+
const s = Ae(e);
|
|
745
|
+
let { path: n } = s;
|
|
746
|
+
n.endsWith("/") && (n = n.slice(0, -1));
|
|
747
|
+
let { hash: t } = s;
|
|
748
|
+
return t === "#_=_" && (t = ""), t && (n += t), n;
|
|
749
|
+
}, G = (e) => {
|
|
750
|
+
const s = Ae(e), { search: n } = s;
|
|
751
|
+
return ns(n);
|
|
752
|
+
}, ns = (e) => {
|
|
753
|
+
const s = {};
|
|
754
|
+
let n, t, o;
|
|
755
|
+
const i = e.split("&");
|
|
756
756
|
for (t = 0, o = i.length; t < o; t++)
|
|
757
|
-
|
|
758
|
-
return
|
|
757
|
+
n = i[t].split("="), s[decodeURIComponent(n[0])] = decodeURIComponent(n[1]);
|
|
758
|
+
return s;
|
|
759
759
|
};
|
|
760
|
-
function
|
|
761
|
-
return new TextEncoder().encode(
|
|
760
|
+
function Se(e) {
|
|
761
|
+
return new TextEncoder().encode(e);
|
|
762
762
|
}
|
|
763
|
-
function
|
|
764
|
-
return btoa(
|
|
763
|
+
function ve(e) {
|
|
764
|
+
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+/g, "");
|
|
765
765
|
}
|
|
766
|
-
function
|
|
767
|
-
return encodeURIComponent(
|
|
766
|
+
function ts(e) {
|
|
767
|
+
return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function(t, o) {
|
|
768
768
|
return String.fromCharCode(parseInt(o, 16));
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
|
-
function
|
|
772
|
-
let
|
|
773
|
-
return
|
|
774
|
-
|
|
775
|
-
}),
|
|
771
|
+
function Te(e) {
|
|
772
|
+
let s = "";
|
|
773
|
+
return e.forEach(function(n) {
|
|
774
|
+
s += String.fromCharCode(n);
|
|
775
|
+
}), ve(s);
|
|
776
776
|
}
|
|
777
|
-
function he(
|
|
778
|
-
return
|
|
777
|
+
function he(e) {
|
|
778
|
+
return ve(ts(e));
|
|
779
779
|
}
|
|
780
|
-
const
|
|
780
|
+
const os = {
|
|
781
781
|
importKeyAlgorithm: {
|
|
782
782
|
name: "ECDSA",
|
|
783
783
|
namedCurve: "P-256",
|
|
@@ -790,13 +790,13 @@ const rn = {
|
|
|
790
790
|
},
|
|
791
791
|
digestAlgorithm: { name: "SHA-256" },
|
|
792
792
|
jwtHeaderAlgorithm: "ES256"
|
|
793
|
-
},
|
|
794
|
-
switch (
|
|
793
|
+
}, is = async (e, s, n, t, o = "dpop+jwt") => {
|
|
794
|
+
switch (e = Object.assign({}, e), s.typ = o, s.alg = t.jwtHeaderAlgorithm, s.alg) {
|
|
795
795
|
case "ES256":
|
|
796
|
-
|
|
796
|
+
s.jwk = { kty: e.kty, crv: e.crv, x: e.x, y: e.y };
|
|
797
797
|
break;
|
|
798
798
|
case "RS256":
|
|
799
|
-
|
|
799
|
+
s.jwk = { kty: e.kty, n: e.n, e: e.e, kid: s.kid };
|
|
800
800
|
break;
|
|
801
801
|
default:
|
|
802
802
|
throw new Error("Unknown or not implemented JWS algorithm");
|
|
@@ -804,99 +804,96 @@ const rn = {
|
|
|
804
804
|
const i = {
|
|
805
805
|
// @ts-ignore
|
|
806
806
|
// JWT "headers" really means JWS "protected headers"
|
|
807
|
-
protected: he(JSON.stringify(
|
|
807
|
+
protected: he(JSON.stringify(s)),
|
|
808
808
|
// @ts-ignore
|
|
809
809
|
// JWT "claims" are really a JSON-defined JWS "payload"
|
|
810
|
-
payload: he(JSON.stringify(
|
|
811
|
-
}, r = t.importKeyAlgorithm, c = !0, a = ["sign"], u = await window.crypto.subtle.importKey("jwk",
|
|
812
|
-
return i.signature =
|
|
810
|
+
payload: he(JSON.stringify(n))
|
|
811
|
+
}, r = t.importKeyAlgorithm, c = !0, a = ["sign"], u = await window.crypto.subtle.importKey("jwk", e, r, c, a), f = Se(`${i.protected}.${i.payload}`), d = t.signAlgorithm, l = await window.crypto.subtle.sign(d, u, f);
|
|
812
|
+
return i.signature = Te(new Uint8Array(l)), `${i.protected}.${i.payload}.${i.signature}`;
|
|
813
813
|
};
|
|
814
|
-
var
|
|
815
|
-
const
|
|
816
|
-
const
|
|
814
|
+
var rs = { sign: is };
|
|
815
|
+
const as = async (e) => {
|
|
816
|
+
const s = e, n = !0, t = ["sign", "verify"], o = await window.crypto.subtle.generateKey(s, n, t);
|
|
817
817
|
return await window.crypto.subtle.exportKey("jwk", o.privateKey);
|
|
818
|
-
},
|
|
819
|
-
const
|
|
820
|
-
return delete
|
|
821
|
-
},
|
|
822
|
-
generate:
|
|
823
|
-
neuter:
|
|
824
|
-
},
|
|
825
|
-
let
|
|
826
|
-
switch (
|
|
818
|
+
}, cs = (e) => {
|
|
819
|
+
const s = Object.assign({}, e);
|
|
820
|
+
return delete s.d, s.key_ops = ["verify"], s;
|
|
821
|
+
}, ls = {
|
|
822
|
+
generate: as,
|
|
823
|
+
neuter: cs
|
|
824
|
+
}, us = async (e, s) => {
|
|
825
|
+
let n;
|
|
826
|
+
switch (e.kty) {
|
|
827
827
|
case "EC":
|
|
828
|
-
|
|
828
|
+
n = '{"crv":"CRV","kty":"EC","x":"X","y":"Y"}'.replace("CRV", e.crv).replace("X", e.x).replace("Y", e.y);
|
|
829
829
|
break;
|
|
830
830
|
case "RSA":
|
|
831
|
-
|
|
831
|
+
n = '{"e":"E","kty":"RSA","n":"N"}'.replace("E", e.e).replace("N", e.n);
|
|
832
832
|
break;
|
|
833
833
|
default:
|
|
834
834
|
throw new Error("Unknown or not implemented JWK type");
|
|
835
835
|
}
|
|
836
|
-
const t = await window.crypto.subtle.digest(
|
|
837
|
-
return
|
|
836
|
+
const t = await window.crypto.subtle.digest(s, Se(n));
|
|
837
|
+
return Te(new Uint8Array(t));
|
|
838
838
|
};
|
|
839
|
-
var
|
|
840
|
-
const
|
|
841
|
-
const e = await ye.generate(n);
|
|
842
|
-
return console.info("Private Key:", JSON.stringify(e)), console.info("Public Key:", JSON.stringify(ye.neuter(e))), e;
|
|
843
|
-
}, Pe = (n) => async (e, s = "POST", t, o = {}) => {
|
|
839
|
+
var ds = { thumbprint: us };
|
|
840
|
+
const fs = async (e) => await ls.generate(e), be = (e) => async (s, n = "POST", t, o = {}) => {
|
|
844
841
|
const i = {
|
|
845
842
|
// https://www.rfc-editor.org/rfc/rfc9449.html#name-concept
|
|
846
|
-
jti: btoa(
|
|
847
|
-
htm:
|
|
843
|
+
jti: btoa(_s()),
|
|
844
|
+
htm: n,
|
|
848
845
|
htu: t,
|
|
849
846
|
iat: Math.round(Date.now() / 1e3),
|
|
850
847
|
...o
|
|
851
|
-
}, r = await
|
|
852
|
-
return await
|
|
853
|
-
},
|
|
854
|
-
const
|
|
855
|
-
let
|
|
848
|
+
}, r = await ds.thumbprint(s, e.digestAlgorithm);
|
|
849
|
+
return await rs.sign(s, { kid: r }, i, e);
|
|
850
|
+
}, _s = () => {
|
|
851
|
+
const e = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx", s = "0123456789abcdef";
|
|
852
|
+
let n = 0, t = "";
|
|
856
853
|
for (let o = 0; o < 36; o++)
|
|
857
|
-
|
|
854
|
+
e[o] !== "-" && e[o] !== "4" && (n = Math.random() * 16 | 0), e[o] === "x" ? t += s[n] : e[o] === "y" ? (n &= 3, n |= 8, t += s[n]) : t += e[o];
|
|
858
855
|
return t;
|
|
859
|
-
},
|
|
856
|
+
}, hs = (e, s, n, t, o) => (i = void 0, r = null, c = !1, a = void 0) => {
|
|
860
857
|
const u = r;
|
|
861
858
|
return r = { ...r }, (async () => {
|
|
862
859
|
const d = i || o.getPath();
|
|
863
|
-
if ("state" in r || (r.state = ee(16)),
|
|
860
|
+
if ("state" in r || (r.state = ee(16)), n(m.loginAsync_begin, {}), r)
|
|
864
861
|
for (const l of Object.keys(r))
|
|
865
862
|
l.endsWith(":token_request") && delete r[l];
|
|
866
863
|
try {
|
|
867
|
-
const l = c ?
|
|
868
|
-
a || (a =
|
|
869
|
-
const _ =
|
|
864
|
+
const l = c ? s.silent_redirect_uri : s.redirect_uri;
|
|
865
|
+
a || (a = s.scope);
|
|
866
|
+
const _ = s.extras ? { ...s.extras, ...r } : r;
|
|
870
867
|
_.nonce || (_.nonce = ee(12));
|
|
871
|
-
const y = { nonce: _.nonce }, h = await E(
|
|
868
|
+
const y = { nonce: _.nonce }, h = await E(s, e), g = await t(s.authority, s.authority_configuration);
|
|
872
869
|
let w;
|
|
873
870
|
if (h)
|
|
874
|
-
h.setLoginParams({ callbackPath: d, extras: u }), await h.initAsync(g, "loginAsync",
|
|
871
|
+
h.setLoginParams({ callbackPath: d, extras: u }), await h.initAsync(g, "loginAsync", s), await h.setNonceAsync(y), h.startKeepAliveServiceWorker(), w = h;
|
|
875
872
|
else {
|
|
876
|
-
const T = I(
|
|
873
|
+
const T = I(e, s.storage ?? sessionStorage);
|
|
877
874
|
T.setLoginParams({ callbackPath: d, extras: u }), await T.setNonceAsync(y), w = T;
|
|
878
875
|
}
|
|
879
876
|
const S = {
|
|
880
|
-
client_id:
|
|
877
|
+
client_id: s.client_id,
|
|
881
878
|
redirect_uri: l,
|
|
882
879
|
scope: a,
|
|
883
880
|
response_type: "code",
|
|
884
881
|
..._
|
|
885
882
|
};
|
|
886
|
-
await
|
|
883
|
+
await es(w, o)(g.authorizationEndpoint, S);
|
|
887
884
|
} catch (l) {
|
|
888
|
-
throw
|
|
885
|
+
throw n(m.loginAsync_error, l), l;
|
|
889
886
|
}
|
|
890
887
|
})();
|
|
891
|
-
},
|
|
888
|
+
}, ys = (e) => async (s = !1) => {
|
|
892
889
|
try {
|
|
893
|
-
|
|
894
|
-
const
|
|
890
|
+
e.publishEvent(m.loginCallbackAsync_begin, {});
|
|
891
|
+
const n = e.configuration, t = n.client_id, o = s ? n.silent_redirect_uri : n.redirect_uri, i = n.authority, r = n.token_request_timeout, c = await e.initAsync(i, n.authority_configuration), a = e.location.getCurrentHref(), f = G(a).session_state, d = await E(n, e.configurationName);
|
|
895
892
|
let l, _, y, h;
|
|
896
893
|
if (d)
|
|
897
|
-
await d.initAsync(c, "loginCallbackAsync",
|
|
894
|
+
await d.initAsync(c, "loginCallbackAsync", n), await d.setSessionStateAsync(f), _ = await d.getNonceAsync(), y = d.getLoginParams(), h = await d.getStateAsync(), d.startKeepAliveServiceWorker(), l = d;
|
|
898
895
|
else {
|
|
899
|
-
const v = I(
|
|
896
|
+
const v = I(e.configurationName, n.storage ?? sessionStorage);
|
|
900
897
|
await v.setSessionStateAsync(f), _ = await v.getNonceAsync(), y = v.getLoginParams(), h = await v.getStateAsync(), l = v;
|
|
901
898
|
}
|
|
902
899
|
const g = G(a);
|
|
@@ -909,25 +906,25 @@ const _n = async (n) => {
|
|
|
909
906
|
const w = {
|
|
910
907
|
code: g.code,
|
|
911
908
|
grant_type: "authorization_code",
|
|
912
|
-
client_id:
|
|
909
|
+
client_id: n.client_id,
|
|
913
910
|
redirect_uri: o
|
|
914
911
|
}, S = {};
|
|
915
|
-
if (
|
|
916
|
-
for (const [v, W] of Object.entries(
|
|
912
|
+
if (n.token_request_extras)
|
|
913
|
+
for (const [v, W] of Object.entries(n.token_request_extras))
|
|
917
914
|
S[v] = W;
|
|
918
915
|
if (y && y.extras)
|
|
919
916
|
for (const [v, W] of Object.entries(y.extras))
|
|
920
917
|
v.endsWith(":token_request") && (S[v.replace(":token_request", "")] = W);
|
|
921
918
|
const T = c.tokenEndpoint, U = {};
|
|
922
|
-
if (
|
|
923
|
-
const v = await
|
|
924
|
-
d ? await d.setDemonstratingProofOfPossessionJwkAsync(v) : await I(
|
|
919
|
+
if (n.demonstrating_proof_of_possession) {
|
|
920
|
+
const v = await fs(n.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm);
|
|
921
|
+
d ? await d.setDemonstratingProofOfPossessionJwkAsync(v) : await I(e.configurationName, n.storage).setDemonstratingProofOfPossessionJwkAsync(v), U.DPoP = await be(n.demonstrating_proof_of_possession_configuration)(v, "POST", T);
|
|
925
922
|
}
|
|
926
|
-
const p = await
|
|
923
|
+
const p = await ss(l)(
|
|
927
924
|
T,
|
|
928
925
|
{ ...w, ...S },
|
|
929
926
|
U,
|
|
930
|
-
|
|
927
|
+
e.configuration.token_renew_mode,
|
|
931
928
|
r
|
|
932
929
|
);
|
|
933
930
|
if (!p.success)
|
|
@@ -936,7 +933,7 @@ const _n = async (n) => {
|
|
|
936
933
|
const A = p.data.tokens, O = p.data.demonstratingProofOfPossessionNonce;
|
|
937
934
|
if (p.data.state !== S.state)
|
|
938
935
|
throw new Error("state is not valid");
|
|
939
|
-
const { isValid: N, reason: P } =
|
|
936
|
+
const { isValid: N, reason: P } = ge(A, _.nonce, c);
|
|
940
937
|
if (!N)
|
|
941
938
|
throw new Error(`Tokens are not OpenID valid, reason: ${P}`);
|
|
942
939
|
if (d) {
|
|
@@ -946,44 +943,44 @@ const _n = async (n) => {
|
|
|
946
943
|
throw new Error("Demonstration of proof of possession require Access token not hidden by service worker");
|
|
947
944
|
}
|
|
948
945
|
if (d)
|
|
949
|
-
await d.initAsync(o, "syncTokensAsync",
|
|
946
|
+
await d.initAsync(o, "syncTokensAsync", n), k = d.getLoginParams(), O && await d.setDemonstratingProofOfPossessionNonce(O);
|
|
950
947
|
else {
|
|
951
|
-
const v = I(
|
|
948
|
+
const v = I(e.configurationName, n.storage);
|
|
952
949
|
k = v.getLoginParams(), O && await v.setDemonstratingProofOfPossessionNonce(O);
|
|
953
950
|
}
|
|
954
|
-
return await
|
|
951
|
+
return await e.startCheckSessionAsync(c.checkSessionIframe, t, f, s), e.publishEvent(m.loginCallbackAsync_end, {}), {
|
|
955
952
|
tokens: A,
|
|
956
953
|
state: "request.state",
|
|
957
954
|
callbackPath: k.callbackPath
|
|
958
955
|
};
|
|
959
|
-
} catch (
|
|
960
|
-
throw console.error(
|
|
956
|
+
} catch (n) {
|
|
957
|
+
throw console.error(n), e.publishEvent(m.loginCallbackAsync_error, n), n;
|
|
961
958
|
}
|
|
962
|
-
},
|
|
959
|
+
}, ye = {
|
|
963
960
|
access_token: "access_token",
|
|
964
961
|
refresh_token: "refresh_token"
|
|
965
|
-
},
|
|
966
|
-
J.clearTimeout(
|
|
967
|
-
const
|
|
968
|
-
|
|
969
|
-
},
|
|
970
|
-
const c =
|
|
962
|
+
}, gs = (e) => async (s) => {
|
|
963
|
+
J.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
|
|
964
|
+
const n = await E(e.configuration, e.configurationName);
|
|
965
|
+
n ? await n.clearAsync(s) : await I(e.configurationName, e.configuration.storage).clearAsync(s), e.tokens = null, e.userInfo = null;
|
|
966
|
+
}, ks = (e, s, n, t, o) => async (i = void 0, r = null) => {
|
|
967
|
+
const c = e.configuration, a = await e.initAsync(c.authority, c.authority_configuration);
|
|
971
968
|
i && typeof i != "string" && (i = void 0, t.warn("callbackPathOrUrl path is not a string"));
|
|
972
969
|
const u = i ?? o.getPath();
|
|
973
970
|
let f = !1;
|
|
974
971
|
i && (f = i.includes("https://") || i.includes("http://"));
|
|
975
|
-
const d = f ? i : o.getOrigin() + u, l =
|
|
972
|
+
const d = f ? i : o.getOrigin() + u, l = e.tokens ? e.tokens.idToken : "";
|
|
976
973
|
try {
|
|
977
974
|
const y = a.revocationEndpoint;
|
|
978
975
|
if (y) {
|
|
979
|
-
const h = [], g =
|
|
980
|
-
if (g && c.logout_tokens_to_invalidate.includes(
|
|
981
|
-
const S = _e(
|
|
976
|
+
const h = [], g = e.tokens ? e.tokens.accessToken : null;
|
|
977
|
+
if (g && c.logout_tokens_to_invalidate.includes(ye.access_token)) {
|
|
978
|
+
const S = _e(n)(y, g, se.access_token, c.client_id);
|
|
982
979
|
h.push(S);
|
|
983
980
|
}
|
|
984
|
-
const w =
|
|
985
|
-
if (w && c.logout_tokens_to_invalidate.includes(
|
|
986
|
-
const S = _e(
|
|
981
|
+
const w = e.tokens ? e.tokens.refreshToken : null;
|
|
982
|
+
if (w && c.logout_tokens_to_invalidate.includes(ye.refresh_token)) {
|
|
983
|
+
const S = _e(n)(y, w, se.refresh_token, c.client_id);
|
|
987
984
|
h.push(S);
|
|
988
985
|
}
|
|
989
986
|
h.length > 0 && await Promise.all(h);
|
|
@@ -991,10 +988,10 @@ const _n = async (n) => {
|
|
|
991
988
|
} catch (y) {
|
|
992
989
|
t.warn("logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error"), t.warn(y);
|
|
993
990
|
}
|
|
994
|
-
const _ =
|
|
995
|
-
await
|
|
996
|
-
for (const [y, h] of Object.entries(
|
|
997
|
-
h !==
|
|
991
|
+
const _ = e.tokens && e.tokens.idTokenPayload ? e.tokens.idTokenPayload.sub : null;
|
|
992
|
+
await e.destroyAsync("LOGGED_OUT");
|
|
993
|
+
for (const [y, h] of Object.entries(s))
|
|
994
|
+
h !== e && await e.logoutSameTabAsync(e.configuration.client_id, _);
|
|
998
995
|
if (a.endSessionEndpoint) {
|
|
999
996
|
r || (r = {
|
|
1000
997
|
id_token_hint: l
|
|
@@ -1006,29 +1003,29 @@ const _n = async (n) => {
|
|
|
1006
1003
|
o.open(`${a.endSessionEndpoint}${y}`);
|
|
1007
1004
|
} else
|
|
1008
1005
|
o.reload();
|
|
1009
|
-
},
|
|
1010
|
-
if (
|
|
1011
|
-
return
|
|
1012
|
-
for (;
|
|
1006
|
+
}, ms = (e) => async (s = !1) => {
|
|
1007
|
+
if (e.userInfo != null && !s)
|
|
1008
|
+
return e.userInfo;
|
|
1009
|
+
for (; e.tokens && !Q(e.tokens); )
|
|
1013
1010
|
await R({ milliseconds: 200 });
|
|
1014
|
-
if (!
|
|
1011
|
+
if (!e.tokens)
|
|
1015
1012
|
return null;
|
|
1016
|
-
const
|
|
1017
|
-
if (!
|
|
1013
|
+
const n = e.tokens.accessToken;
|
|
1014
|
+
if (!n)
|
|
1018
1015
|
return null;
|
|
1019
|
-
const t =
|
|
1016
|
+
const t = e.configuration, i = (await e.initAsync(t.authority, t.authority_configuration)).userInfoEndpoint, c = await (async (a) => {
|
|
1020
1017
|
const u = await fetch(i, {
|
|
1021
1018
|
headers: {
|
|
1022
1019
|
authorization: `Bearer ${a}`
|
|
1023
1020
|
}
|
|
1024
1021
|
});
|
|
1025
1022
|
return u.status !== 200 ? null : u.json();
|
|
1026
|
-
})(
|
|
1027
|
-
return
|
|
1023
|
+
})(n);
|
|
1024
|
+
return e.userInfo = c, c;
|
|
1028
1025
|
};
|
|
1029
1026
|
class Y {
|
|
1030
|
-
open(
|
|
1031
|
-
window.open(
|
|
1027
|
+
open(s) {
|
|
1028
|
+
window.open(s, "_self");
|
|
1032
1029
|
}
|
|
1033
1030
|
reload() {
|
|
1034
1031
|
window.location.reload();
|
|
@@ -1037,15 +1034,15 @@ class Y {
|
|
|
1037
1034
|
return window.location.href;
|
|
1038
1035
|
}
|
|
1039
1036
|
getPath() {
|
|
1040
|
-
const
|
|
1041
|
-
return
|
|
1037
|
+
const s = window.location;
|
|
1038
|
+
return s.pathname + (s.search || "") + (s.hash || "");
|
|
1042
1039
|
}
|
|
1043
1040
|
getOrigin() {
|
|
1044
1041
|
return window.origin;
|
|
1045
1042
|
}
|
|
1046
1043
|
}
|
|
1047
|
-
const
|
|
1048
|
-
const
|
|
1044
|
+
const ps = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), ws = (e) => {
|
|
1045
|
+
const s = e.appVersion, n = e.userAgent, t = "-";
|
|
1049
1046
|
let o = t;
|
|
1050
1047
|
const i = [
|
|
1051
1048
|
{ s: "Windows 10", r: /(Windows 10.0|Windows NT 10.0)/ },
|
|
@@ -1078,7 +1075,7 @@ const wn = (n) => !!(n.os === "iOS" && n.osVersion.startsWith("12") || n.os ===
|
|
|
1078
1075
|
];
|
|
1079
1076
|
for (const c in i) {
|
|
1080
1077
|
const a = i[c];
|
|
1081
|
-
if (a.r.test(
|
|
1078
|
+
if (a.r.test(n)) {
|
|
1082
1079
|
o = a.s;
|
|
1083
1080
|
break;
|
|
1084
1081
|
}
|
|
@@ -1088,10 +1085,10 @@ const wn = (n) => !!(n.os === "iOS" && n.osVersion.startsWith("12") || n.os ===
|
|
|
1088
1085
|
case "Mac OS":
|
|
1089
1086
|
case "Mac OS X":
|
|
1090
1087
|
case "Android":
|
|
1091
|
-
r = /(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\d]+)/.exec(
|
|
1088
|
+
r = /(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\d]+)/.exec(n)[1];
|
|
1092
1089
|
break;
|
|
1093
1090
|
case "iOS": {
|
|
1094
|
-
const c = /OS (\d+)_(\d+)_?(\d+)?/.exec(
|
|
1091
|
+
const c = /OS (\d+)_(\d+)_?(\d+)?/.exec(s);
|
|
1095
1092
|
c != null && c.length > 2 && (r = c[1] + "." + c[2] + "." + (parseInt(c[3]) | 0));
|
|
1096
1093
|
break;
|
|
1097
1094
|
}
|
|
@@ -1101,191 +1098,191 @@ const wn = (n) => !!(n.os === "iOS" && n.osVersion.startsWith("12") || n.os ===
|
|
|
1101
1098
|
osVersion: r
|
|
1102
1099
|
};
|
|
1103
1100
|
};
|
|
1104
|
-
function
|
|
1105
|
-
const
|
|
1106
|
-
let
|
|
1107
|
-
if (/trident/i.test(
|
|
1108
|
-
return
|
|
1109
|
-
if (
|
|
1110
|
-
let t =
|
|
1101
|
+
function As() {
|
|
1102
|
+
const e = navigator.userAgent;
|
|
1103
|
+
let s, n = e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
|
1104
|
+
if (/trident/i.test(n[1]))
|
|
1105
|
+
return s = /\brv[ :]+(\d+)/g.exec(e) || [], { name: "ie", version: s[1] || "" };
|
|
1106
|
+
if (n[1] === "Chrome" && (s = e.match(/\bOPR|Edge\/(\d+)/), s != null)) {
|
|
1107
|
+
let t = s[1];
|
|
1111
1108
|
if (!t) {
|
|
1112
|
-
const o =
|
|
1109
|
+
const o = e.split(s[0] + "/");
|
|
1113
1110
|
o.length > 1 && (t = o[1]);
|
|
1114
1111
|
}
|
|
1115
1112
|
return { name: "opera", version: t };
|
|
1116
1113
|
}
|
|
1117
|
-
return
|
|
1118
|
-
name:
|
|
1119
|
-
version:
|
|
1114
|
+
return n = n[2] ? [n[1], n[2]] : [navigator.appName, navigator.appVersion, "-?"], (s = e.match(/version\/(\d+)/i)) != null && n.splice(1, 1, s[1]), {
|
|
1115
|
+
name: n[0].toLowerCase(),
|
|
1116
|
+
version: n[1]
|
|
1120
1117
|
};
|
|
1121
1118
|
}
|
|
1122
|
-
const
|
|
1123
|
-
const { name:
|
|
1124
|
-
if (
|
|
1119
|
+
const Ss = () => {
|
|
1120
|
+
const { name: e, version: s } = As();
|
|
1121
|
+
if (e === "chrome" && parseInt(s) <= 70 || e === "opera" && (!s || parseInt(s.split(".")[0]) < 80) || e === "ie")
|
|
1125
1122
|
return !1;
|
|
1126
|
-
const
|
|
1127
|
-
return !
|
|
1128
|
-
},
|
|
1129
|
-
let
|
|
1130
|
-
if (
|
|
1123
|
+
const n = ws(navigator);
|
|
1124
|
+
return !ps(n);
|
|
1125
|
+
}, vs = async (e) => {
|
|
1126
|
+
let s;
|
|
1127
|
+
if (e.tokens != null)
|
|
1131
1128
|
return !1;
|
|
1132
|
-
|
|
1129
|
+
e.publishEvent(m.tryKeepExistingSessionAsync_begin, {});
|
|
1133
1130
|
try {
|
|
1134
|
-
const
|
|
1135
|
-
if (
|
|
1136
|
-
const { tokens: o } = await
|
|
1131
|
+
const n = e.configuration, t = await e.initAsync(n.authority, n.authority_configuration);
|
|
1132
|
+
if (s = await E(n, e.configurationName), s) {
|
|
1133
|
+
const { tokens: o } = await s.initAsync(t, "tryKeepExistingSessionAsync", n);
|
|
1137
1134
|
if (o) {
|
|
1138
|
-
|
|
1139
|
-
const i =
|
|
1140
|
-
|
|
1141
|
-
const r = await
|
|
1142
|
-
return await
|
|
1135
|
+
s.startKeepAliveServiceWorker(), e.tokens = o;
|
|
1136
|
+
const i = s.getLoginParams(e.configurationName);
|
|
1137
|
+
e.timeoutId = M(e, e.tokens.refreshToken, e.tokens.expiresAt, i.extras);
|
|
1138
|
+
const r = await s.getSessionStateAsync();
|
|
1139
|
+
return await e.startCheckSessionAsync(t.check_session_iframe, n.client_id, r), e.publishEvent(m.tryKeepExistingSessionAsync_end, {
|
|
1143
1140
|
success: !0,
|
|
1144
1141
|
message: "tokens inside ServiceWorker are valid"
|
|
1145
1142
|
}), !0;
|
|
1146
1143
|
}
|
|
1147
|
-
|
|
1144
|
+
e.publishEvent(m.tryKeepExistingSessionAsync_end, {
|
|
1148
1145
|
success: !1,
|
|
1149
1146
|
message: "no exiting session found"
|
|
1150
1147
|
});
|
|
1151
1148
|
} else {
|
|
1152
|
-
|
|
1149
|
+
n.service_worker_relative_url && e.publishEvent(m.service_worker_not_supported_by_browser, {
|
|
1153
1150
|
message: "service worker is not supported by this browser"
|
|
1154
1151
|
});
|
|
1155
|
-
const o = I(
|
|
1152
|
+
const o = I(e.configurationName, n.storage ?? sessionStorage), { tokens: i } = await o.initAsync();
|
|
1156
1153
|
if (i) {
|
|
1157
|
-
|
|
1154
|
+
e.tokens = te(i, null, n.token_renew_mode);
|
|
1158
1155
|
const r = o.getLoginParams();
|
|
1159
|
-
|
|
1156
|
+
e.timeoutId = M(e, i.refreshToken, e.tokens.expiresAt, r.extras);
|
|
1160
1157
|
const c = await o.getSessionStateAsync();
|
|
1161
|
-
return await
|
|
1158
|
+
return await e.startCheckSessionAsync(t.check_session_iframe, n.client_id, c), e.publishEvent(m.tryKeepExistingSessionAsync_end, {
|
|
1162
1159
|
success: !0,
|
|
1163
1160
|
message: "tokens inside storage are valid"
|
|
1164
1161
|
}), !0;
|
|
1165
1162
|
}
|
|
1166
1163
|
}
|
|
1167
|
-
return
|
|
1164
|
+
return e.publishEvent(m.tryKeepExistingSessionAsync_end, {
|
|
1168
1165
|
success: !1,
|
|
1169
|
-
message:
|
|
1166
|
+
message: s ? "service worker sessions not retrieved" : "session storage sessions not retrieved"
|
|
1170
1167
|
}), !1;
|
|
1171
|
-
} catch (
|
|
1172
|
-
return console.error(
|
|
1168
|
+
} catch (n) {
|
|
1169
|
+
return console.error(n), s && await s.clearAsync(), e.publishEvent(m.tryKeepExistingSessionAsync_error, "tokens inside ServiceWorker are invalid"), !1;
|
|
1173
1170
|
}
|
|
1174
|
-
},
|
|
1175
|
-
class
|
|
1176
|
-
constructor(
|
|
1177
|
-
this.authorizationEndpoint =
|
|
1171
|
+
}, Ts = () => fetch;
|
|
1172
|
+
class ne {
|
|
1173
|
+
constructor(s) {
|
|
1174
|
+
this.authorizationEndpoint = s.authorization_endpoint, this.tokenEndpoint = s.token_endpoint, this.revocationEndpoint = s.revocation_endpoint, this.userInfoEndpoint = s.userinfo_endpoint, this.checkSessionIframe = s.check_session_iframe, this.issuer = s.issuer, this.endSessionEndpoint = s.end_session_endpoint;
|
|
1178
1175
|
}
|
|
1179
1176
|
}
|
|
1180
|
-
const x = {},
|
|
1181
|
-
const { parsedTokens:
|
|
1182
|
-
return
|
|
1183
|
-
},
|
|
1184
|
-
constructor(
|
|
1177
|
+
const x = {}, bs = (e, s = new Y()) => (n, t = "default") => (x[t] || (x[t] = new K(n, t, e, s)), x[t]), Ps = async (e) => {
|
|
1178
|
+
const { parsedTokens: s, callbackPath: n } = await e.loginCallbackAsync();
|
|
1179
|
+
return e.timeoutId = M(e, s.refreshToken, s.expiresAt), { callbackPath: n };
|
|
1180
|
+
}, Os = (e) => Math.floor(Math.random() * e), re = class F {
|
|
1181
|
+
constructor(s, n = "default", t, o = new Y()) {
|
|
1185
1182
|
this.initPromise = null, this.tryKeepExistingSessionPromise = null, this.loginPromise = null, this.loginCallbackPromise = null, this.loginCallbackWithAutoTokensRenewPromise = null, this.userInfoPromise = null, this.renewTokensPromise = null, this.logoutPromise = null;
|
|
1186
|
-
let i =
|
|
1187
|
-
|
|
1188
|
-
let r =
|
|
1183
|
+
let i = s.silent_login_uri;
|
|
1184
|
+
s.silent_redirect_uri && !s.silent_login_uri && (i = `${s.silent_redirect_uri.replace("-callback", "").replace("callback", "")}-login`);
|
|
1185
|
+
let r = s.refresh_time_before_tokens_expiration_in_second ?? 120;
|
|
1189
1186
|
r > 60 && (r = r - Math.floor(Math.random() * 40)), this.location = o ?? new Y();
|
|
1190
|
-
const c =
|
|
1187
|
+
const c = s.service_worker_update_require_callback ?? De(this.location);
|
|
1191
1188
|
this.configuration = {
|
|
1192
|
-
...
|
|
1189
|
+
...s,
|
|
1193
1190
|
silent_login_uri: i,
|
|
1194
|
-
monitor_session:
|
|
1191
|
+
monitor_session: s.monitor_session ?? !1,
|
|
1195
1192
|
refresh_time_before_tokens_expiration_in_second: r,
|
|
1196
|
-
silent_login_timeout:
|
|
1197
|
-
token_renew_mode:
|
|
1198
|
-
demonstrating_proof_of_possession:
|
|
1199
|
-
authority_timeout_wellknowurl_in_millisecond:
|
|
1200
|
-
logout_tokens_to_invalidate:
|
|
1193
|
+
silent_login_timeout: s.silent_login_timeout ?? 12e3,
|
|
1194
|
+
token_renew_mode: s.token_renew_mode ?? z.access_token_or_id_token_invalid,
|
|
1195
|
+
demonstrating_proof_of_possession: s.demonstrating_proof_of_possession ?? !1,
|
|
1196
|
+
authority_timeout_wellknowurl_in_millisecond: s.authority_timeout_wellknowurl_in_millisecond ?? 1e4,
|
|
1197
|
+
logout_tokens_to_invalidate: s.logout_tokens_to_invalidate ?? ["access_token", "refresh_token"],
|
|
1201
1198
|
service_worker_update_require_callback: c,
|
|
1202
|
-
service_worker_activate:
|
|
1203
|
-
demonstrating_proof_of_possession_configuration:
|
|
1204
|
-
}, this.getFetch = t ??
|
|
1199
|
+
service_worker_activate: s.service_worker_activate ?? Ss,
|
|
1200
|
+
demonstrating_proof_of_possession_configuration: s.demonstrating_proof_of_possession_configuration ?? os
|
|
1201
|
+
}, this.getFetch = t ?? Ts, this.configurationName = n, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.synchroniseTokensAsync.bind(this), this.loginCallbackWithAutoTokensRenewAsync.bind(this), this.initAsync.bind(this), this.loginCallbackAsync.bind(this), this.subscribeEvents.bind(this), this.removeEventSubscription.bind(this), this.publishEvent.bind(this), this.destroyAsync.bind(this), this.logoutAsync.bind(this), this.renewTokensAsync.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
|
|
1205
1202
|
}
|
|
1206
|
-
subscribeEvents(
|
|
1207
|
-
const
|
|
1208
|
-
return this.events.push({ id:
|
|
1203
|
+
subscribeEvents(s) {
|
|
1204
|
+
const n = Os(9999999999999).toString();
|
|
1205
|
+
return this.events.push({ id: n, func: s }), n;
|
|
1209
1206
|
}
|
|
1210
|
-
removeEventSubscription(
|
|
1211
|
-
const
|
|
1212
|
-
this.events =
|
|
1207
|
+
removeEventSubscription(s) {
|
|
1208
|
+
const n = this.events.filter((t) => t.id !== s);
|
|
1209
|
+
this.events = n;
|
|
1213
1210
|
}
|
|
1214
|
-
publishEvent(
|
|
1211
|
+
publishEvent(s, n) {
|
|
1215
1212
|
this.events.forEach((t) => {
|
|
1216
|
-
t.func(
|
|
1213
|
+
t.func(s, n);
|
|
1217
1214
|
});
|
|
1218
1215
|
}
|
|
1219
|
-
static get(
|
|
1220
|
-
const
|
|
1221
|
-
if (!Object.prototype.hasOwnProperty.call(x,
|
|
1216
|
+
static get(s = "default") {
|
|
1217
|
+
const n = typeof process > "u";
|
|
1218
|
+
if (!Object.prototype.hasOwnProperty.call(x, s) && n)
|
|
1222
1219
|
throw Error(`OIDC library does seem initialized.
|
|
1223
|
-
Please checkout that you are using OIDC hook inside a <OidcProvider configurationName="${
|
|
1224
|
-
return x[
|
|
1220
|
+
Please checkout that you are using OIDC hook inside a <OidcProvider configurationName="${s}"></OidcProvider> compoment.`);
|
|
1221
|
+
return x[s];
|
|
1225
1222
|
}
|
|
1226
1223
|
_silentLoginCallbackFromIFrame() {
|
|
1227
1224
|
if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
|
|
1228
|
-
const
|
|
1229
|
-
window.parent.postMessage(`${this.configurationName}_oidc_tokens:${JSON.stringify({ tokens: this.tokens, sessionState:
|
|
1225
|
+
const s = this.location, n = G(s.getCurrentHref());
|
|
1226
|
+
window.parent.postMessage(`${this.configurationName}_oidc_tokens:${JSON.stringify({ tokens: this.tokens, sessionState: n.session_state })}`, s.getOrigin());
|
|
1230
1227
|
}
|
|
1231
1228
|
}
|
|
1232
1229
|
_silentLoginErrorCallbackFromIFrame() {
|
|
1233
1230
|
if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
|
|
1234
|
-
const
|
|
1235
|
-
window.parent.postMessage(`${this.configurationName}_oidc_error:${JSON.stringify({ error:
|
|
1231
|
+
const s = this.location, n = G(s.getCurrentHref());
|
|
1232
|
+
window.parent.postMessage(`${this.configurationName}_oidc_error:${JSON.stringify({ error: n.error })}`, s.getOrigin());
|
|
1236
1233
|
}
|
|
1237
1234
|
}
|
|
1238
1235
|
async silentLoginCallbackAsync() {
|
|
1239
1236
|
try {
|
|
1240
1237
|
await this.loginCallbackAsync(!0), this._silentLoginCallbackFromIFrame();
|
|
1241
|
-
} catch (
|
|
1242
|
-
console.error(
|
|
1238
|
+
} catch (s) {
|
|
1239
|
+
console.error(s), this._silentLoginErrorCallbackFromIFrame();
|
|
1243
1240
|
}
|
|
1244
1241
|
}
|
|
1245
|
-
async initAsync(
|
|
1242
|
+
async initAsync(s, n) {
|
|
1246
1243
|
if (this.initPromise !== null)
|
|
1247
1244
|
return this.initPromise;
|
|
1248
1245
|
const t = async () => {
|
|
1249
|
-
if (
|
|
1250
|
-
return new
|
|
1251
|
-
authorization_endpoint:
|
|
1252
|
-
end_session_endpoint:
|
|
1253
|
-
revocation_endpoint:
|
|
1254
|
-
token_endpoint:
|
|
1255
|
-
userinfo_endpoint:
|
|
1256
|
-
check_session_iframe:
|
|
1257
|
-
issuer:
|
|
1246
|
+
if (n != null)
|
|
1247
|
+
return new ne({
|
|
1248
|
+
authorization_endpoint: n.authorization_endpoint,
|
|
1249
|
+
end_session_endpoint: n.end_session_endpoint,
|
|
1250
|
+
revocation_endpoint: n.revocation_endpoint,
|
|
1251
|
+
token_endpoint: n.token_endpoint,
|
|
1252
|
+
userinfo_endpoint: n.userinfo_endpoint,
|
|
1253
|
+
check_session_iframe: n.check_session_iframe,
|
|
1254
|
+
issuer: n.issuer
|
|
1258
1255
|
});
|
|
1259
1256
|
const i = await E(this.configuration, this.configurationName) ? window.localStorage : null;
|
|
1260
|
-
return await
|
|
1257
|
+
return await Qe(this.getFetch())(s, this.configuration.authority_time_cache_wellknowurl_in_second ?? 60 * 60, i, this.configuration.authority_timeout_wellknowurl_in_millisecond);
|
|
1261
1258
|
};
|
|
1262
1259
|
return this.initPromise = t(), this.initPromise.then((o) => (this.initPromise = null, o));
|
|
1263
1260
|
}
|
|
1264
1261
|
async tryKeepExistingSessionAsync() {
|
|
1265
|
-
return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise =
|
|
1262
|
+
return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = vs(this), this.tryKeepExistingSessionPromise.then((s) => (this.tryKeepExistingSessionPromise = null, s)));
|
|
1266
1263
|
}
|
|
1267
|
-
async startCheckSessionAsync(
|
|
1268
|
-
await
|
|
1264
|
+
async startCheckSessionAsync(s, n, t, o = !1) {
|
|
1265
|
+
await Ue(this, x, this.configuration)(s, n, t, o);
|
|
1269
1266
|
}
|
|
1270
|
-
async loginAsync(
|
|
1271
|
-
return this.loginPromise !== null ? this.loginPromise : i ?
|
|
1267
|
+
async loginAsync(s = void 0, n = null, t = !1, o = void 0, i = !1) {
|
|
1268
|
+
return this.loginPromise !== null ? this.loginPromise : i ? Ke(window, this.configurationName, this.configuration, this.publishEvent.bind(this), this)(n, o) : (this.loginPromise = hs(this.configurationName, this.configuration, this.publishEvent.bind(this), this.initAsync.bind(this), this.location)(s, n, t, o), this.loginPromise.then((r) => (this.loginPromise = null, r)));
|
|
1272
1269
|
}
|
|
1273
|
-
async loginCallbackAsync(
|
|
1270
|
+
async loginCallbackAsync(s = !1) {
|
|
1274
1271
|
if (this.loginCallbackPromise !== null)
|
|
1275
1272
|
return this.loginCallbackPromise;
|
|
1276
|
-
const
|
|
1277
|
-
const t = await
|
|
1273
|
+
const n = async () => {
|
|
1274
|
+
const t = await ys(this)(s), o = t.tokens;
|
|
1278
1275
|
return this.tokens = o, await E(this.configuration, this.configurationName) || I(this.configurationName, this.configuration.storage).setTokens(o), this.publishEvent(F.eventNames.token_aquired, o), { parsedTokens: o, state: t.state, callbackPath: t.callbackPath };
|
|
1279
1276
|
};
|
|
1280
|
-
return this.loginCallbackPromise =
|
|
1277
|
+
return this.loginCallbackPromise = n(), this.loginCallbackPromise.then((t) => (this.loginCallbackPromise = null, t));
|
|
1281
1278
|
}
|
|
1282
|
-
async synchroniseTokensAsync(
|
|
1279
|
+
async synchroniseTokensAsync(s, n = 0, t = !1, o = null, i) {
|
|
1283
1280
|
for (; !navigator.onLine && document.hidden; )
|
|
1284
1281
|
await R({ milliseconds: 1e3 }), this.publishEvent(m.refreshTokensAsync, { message: "wait because navigator is offline and hidden" });
|
|
1285
1282
|
let r = 6;
|
|
1286
1283
|
for (; !navigator.onLine && r > 0; )
|
|
1287
1284
|
await R({ milliseconds: 1e3 }), r--, this.publishEvent(m.refreshTokensAsync, { message: `wait because navigator is offline try ${r}` });
|
|
1288
|
-
const a = document.hidden ?
|
|
1285
|
+
const a = document.hidden ? n : n + 1;
|
|
1289
1286
|
o || (o = {});
|
|
1290
1287
|
const u = this.configuration, f = (l, _, y = null) => ie(this.configurationName, this.configuration, this.publishEvent.bind(this))(l, _, y), d = async () => {
|
|
1291
1288
|
try {
|
|
@@ -1305,10 +1302,10 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1305
1302
|
}
|
|
1306
1303
|
return this.publishEvent(m.refreshTokensAsync_error, { message: "refresh token silent return" }), await this.synchroniseTokensAsync(null, a, t, o, i);
|
|
1307
1304
|
};
|
|
1308
|
-
if (
|
|
1305
|
+
if (n > 4)
|
|
1309
1306
|
return i(null), this.publishEvent(m.refreshTokensAsync_error, { message: "refresh token" }), { tokens: null, status: "SESSION_LOST" };
|
|
1310
1307
|
try {
|
|
1311
|
-
const { status: l, tokens: _, nonce: y } = await
|
|
1308
|
+
const { status: l, tokens: _, nonce: y } = await Re(this)(u, this.configurationName, this.tokens, t);
|
|
1312
1309
|
switch (l) {
|
|
1313
1310
|
case D.SESSION_LOST:
|
|
1314
1311
|
return i(null), this.publishEvent(m.refreshTokensAsync_error, { message: "refresh token session lost" }), { tokens: null, status: "SESSION_LOST" };
|
|
@@ -1321,9 +1318,9 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1321
1318
|
case D.LOGOUT_FROM_ANOTHER_TAB:
|
|
1322
1319
|
return i(null), this.publishEvent(m.logout_from_another_tab, { status: "session syncTokensAsync" }), { tokens: null, status: "LOGGED_OUT" };
|
|
1323
1320
|
case D.REQUIRE_SYNC_TOKENS:
|
|
1324
|
-
return this.publishEvent(m.refreshTokensAsync_begin, { refreshToken:
|
|
1321
|
+
return this.publishEvent(m.refreshTokensAsync_begin, { refreshToken: s, status: l, tryNumber: n }), await d();
|
|
1325
1322
|
default: {
|
|
1326
|
-
if (this.publishEvent(m.refreshTokensAsync_begin, { refreshToken:
|
|
1323
|
+
if (this.publishEvent(m.refreshTokensAsync_begin, { refreshToken: s, status: l, tryNumber: n }), !s)
|
|
1327
1324
|
return await d();
|
|
1328
1325
|
const h = u.client_id, g = u.redirect_uri, w = u.authority, T = { ...u.token_request_extras ? u.token_request_extras : {} };
|
|
1329
1326
|
for (const [p, k] of Object.entries(o))
|
|
@@ -1336,7 +1333,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1336
1333
|
refresh_token: _.refreshToken
|
|
1337
1334
|
}, k = await this.initAsync(w, u.authority_configuration), A = document.hidden ? 1e4 : 3e4 * 10, O = k.tokenEndpoint, N = {};
|
|
1338
1335
|
u.demonstrating_proof_of_possession && (N.DPoP = await this.generateDemonstrationOfProofOfPossessionAsync(_.accessToken, O, "POST"));
|
|
1339
|
-
const P = await
|
|
1336
|
+
const P = await Ze(this.getFetch())(
|
|
1340
1337
|
O,
|
|
1341
1338
|
p,
|
|
1342
1339
|
T,
|
|
@@ -1346,7 +1343,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1346
1343
|
A
|
|
1347
1344
|
);
|
|
1348
1345
|
if (P.success) {
|
|
1349
|
-
const { isValid: v, reason: W } =
|
|
1346
|
+
const { isValid: v, reason: W } = ge(P.data, y.nonce, k);
|
|
1350
1347
|
if (!v)
|
|
1351
1348
|
return i(null), this.publishEvent(m.refreshTokensAsync_error, { message: `refresh token return not valid tokens, reason: ${W}` }), { tokens: null, status: "SESSION_LOST" };
|
|
1352
1349
|
if (i(P.data), P.demonstratingProofOfPossessionNonce) {
|
|
@@ -1358,16 +1355,16 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1358
1355
|
return this.publishEvent(m.refreshTokensAsync_silent_error, {
|
|
1359
1356
|
message: "bad request",
|
|
1360
1357
|
tokenResponse: P
|
|
1361
|
-
}), await this.synchroniseTokensAsync(
|
|
1358
|
+
}), await this.synchroniseTokensAsync(s, a, t, o, i);
|
|
1362
1359
|
})();
|
|
1363
1360
|
}
|
|
1364
1361
|
}
|
|
1365
1362
|
} catch (l) {
|
|
1366
|
-
return console.error(l), this.publishEvent(m.refreshTokensAsync_silent_error, { message: "exception", exception: l.message }), this.synchroniseTokensAsync(
|
|
1363
|
+
return console.error(l), this.publishEvent(m.refreshTokensAsync_silent_error, { message: "exception", exception: l.message }), this.synchroniseTokensAsync(s, a, t, o, i);
|
|
1367
1364
|
}
|
|
1368
1365
|
}
|
|
1369
|
-
async generateDemonstrationOfProofOfPossessionAsync(
|
|
1370
|
-
const o = this.configuration, i = { ath: await
|
|
1366
|
+
async generateDemonstrationOfProofOfPossessionAsync(s, n, t) {
|
|
1367
|
+
const o = this.configuration, i = { ath: await we(s) }, r = await E(o, this.configurationName);
|
|
1371
1368
|
let c, a;
|
|
1372
1369
|
if (r)
|
|
1373
1370
|
c = await r.getDemonstratingProofOfPossessionNonce(), a = await r.getDemonstratingProofOfPossessionJwkAsync();
|
|
@@ -1375,42 +1372,42 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1375
1372
|
const u = I(this.configurationName, o.storage);
|
|
1376
1373
|
a = await u.getDemonstratingProofOfPossessionJwkAsync(), c = await u.getDemonstratingProofOfPossessionNonce();
|
|
1377
1374
|
}
|
|
1378
|
-
return c && (i.nonce = c), await
|
|
1375
|
+
return c && (i.nonce = c), await be(o.demonstrating_proof_of_possession_configuration)(a, t, n, i);
|
|
1379
1376
|
}
|
|
1380
1377
|
loginCallbackWithAutoTokensRenewAsync() {
|
|
1381
|
-
return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise =
|
|
1378
|
+
return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise = Ps(this), this.loginCallbackWithAutoTokensRenewPromise.then((s) => (this.loginCallbackWithAutoTokensRenewPromise = null, s)));
|
|
1382
1379
|
}
|
|
1383
|
-
userInfoAsync(
|
|
1384
|
-
return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise =
|
|
1380
|
+
userInfoAsync(s = !1) {
|
|
1381
|
+
return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise = ms(this)(s), this.userInfoPromise.then((n) => (this.userInfoPromise = null, n)));
|
|
1385
1382
|
}
|
|
1386
|
-
async renewTokensAsync(
|
|
1383
|
+
async renewTokensAsync(s = null) {
|
|
1387
1384
|
if (this.renewTokensPromise !== null)
|
|
1388
1385
|
return this.renewTokensPromise;
|
|
1389
1386
|
if (this.timeoutId)
|
|
1390
|
-
return J.clearTimeout(this.timeoutId), this.renewTokensPromise =
|
|
1387
|
+
return J.clearTimeout(this.timeoutId), this.renewTokensPromise = me(this, this.tokens.refreshToken, !0, s), this.renewTokensPromise.then((n) => (this.renewTokensPromise = null, n));
|
|
1391
1388
|
}
|
|
1392
|
-
async destroyAsync(
|
|
1393
|
-
return await
|
|
1389
|
+
async destroyAsync(s) {
|
|
1390
|
+
return await gs(this)(s);
|
|
1394
1391
|
}
|
|
1395
|
-
async logoutSameTabAsync(
|
|
1396
|
-
this.configuration.monitor_session && this.configuration.client_id ===
|
|
1392
|
+
async logoutSameTabAsync(s, n) {
|
|
1393
|
+
this.configuration.monitor_session && this.configuration.client_id === s && n && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === n && (this.publishEvent(m.logout_from_same_tab, { message: n }), await this.destroyAsync("LOGGED_OUT"));
|
|
1397
1394
|
}
|
|
1398
|
-
async logoutOtherTabAsync(
|
|
1399
|
-
this.configuration.monitor_session && this.configuration.client_id ===
|
|
1395
|
+
async logoutOtherTabAsync(s, n) {
|
|
1396
|
+
this.configuration.monitor_session && this.configuration.client_id === s && n && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === n && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(m.logout_from_another_tab, { message: "SessionMonitor", sub: n }));
|
|
1400
1397
|
}
|
|
1401
|
-
async logoutAsync(
|
|
1402
|
-
return this.logoutPromise ? this.logoutPromise : (this.logoutPromise =
|
|
1398
|
+
async logoutAsync(s = void 0, n = null) {
|
|
1399
|
+
return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = ks(this, x, this.getFetch(), console, this.location)(s, n), this.logoutPromise.then((t) => (this.logoutPromise = null, t)));
|
|
1403
1400
|
}
|
|
1404
1401
|
};
|
|
1405
|
-
re.getOrCreate = (
|
|
1402
|
+
re.getOrCreate = (e, s) => (n, t = "default") => bs(e, s)(n, t);
|
|
1406
1403
|
re.eventNames = m;
|
|
1407
1404
|
let K = re;
|
|
1408
|
-
const
|
|
1405
|
+
const Es = (e, s) => async (...n) => {
|
|
1409
1406
|
var l;
|
|
1410
|
-
const [t, o, ...i] =
|
|
1407
|
+
const [t, o, ...i] = n, r = o ? { ...o } : { method: "GET" };
|
|
1411
1408
|
let c = new Headers();
|
|
1412
1409
|
r.headers && (c = r.headers instanceof Headers ? r.headers : new Headers(r.headers));
|
|
1413
|
-
const a =
|
|
1410
|
+
const a = s, u = await a.getValidTokenAsync(), f = (l = u == null ? void 0 : u.tokens) == null ? void 0 : l.accessToken;
|
|
1414
1411
|
if (c.has("Accept") || c.set("Accept", "application/json"), f) {
|
|
1415
1412
|
if (a.configuration.demonstrating_proof_of_possession) {
|
|
1416
1413
|
const _ = await a.generateDemonstrationOfProofOfPossessionAsync(f, t.toString(), r.method);
|
|
@@ -1420,37 +1417,37 @@ const In = (n, e) => async (...s) => {
|
|
|
1420
1417
|
r.credentials || (r.credentials = "same-origin");
|
|
1421
1418
|
}
|
|
1422
1419
|
const d = { ...r, headers: c };
|
|
1423
|
-
return await
|
|
1424
|
-
}, X = class
|
|
1425
|
-
constructor(
|
|
1426
|
-
this._oidc =
|
|
1420
|
+
return await e(t, d, ...i);
|
|
1421
|
+
}, X = class Pe {
|
|
1422
|
+
constructor(s) {
|
|
1423
|
+
this._oidc = s;
|
|
1427
1424
|
}
|
|
1428
|
-
subscribeEvents(
|
|
1429
|
-
return this._oidc.subscribeEvents(
|
|
1425
|
+
subscribeEvents(s) {
|
|
1426
|
+
return this._oidc.subscribeEvents(s);
|
|
1430
1427
|
}
|
|
1431
|
-
removeEventSubscription(
|
|
1432
|
-
this._oidc.removeEventSubscription(
|
|
1428
|
+
removeEventSubscription(s) {
|
|
1429
|
+
this._oidc.removeEventSubscription(s);
|
|
1433
1430
|
}
|
|
1434
|
-
publishEvent(
|
|
1435
|
-
this._oidc.publishEvent(
|
|
1431
|
+
publishEvent(s, n) {
|
|
1432
|
+
this._oidc.publishEvent(s, n);
|
|
1436
1433
|
}
|
|
1437
|
-
static get(
|
|
1438
|
-
return new
|
|
1434
|
+
static get(s = "default") {
|
|
1435
|
+
return new Pe(K.get(s));
|
|
1439
1436
|
}
|
|
1440
1437
|
tryKeepExistingSessionAsync() {
|
|
1441
1438
|
return this._oidc.tryKeepExistingSessionAsync();
|
|
1442
1439
|
}
|
|
1443
|
-
loginAsync(
|
|
1444
|
-
return this._oidc.loginAsync(
|
|
1440
|
+
loginAsync(s = void 0, n = null, t = !1, o = void 0, i = !1) {
|
|
1441
|
+
return this._oidc.loginAsync(s, n, t, o, i);
|
|
1445
1442
|
}
|
|
1446
|
-
logoutAsync(
|
|
1447
|
-
return this._oidc.logoutAsync(
|
|
1443
|
+
logoutAsync(s = void 0, n = null) {
|
|
1444
|
+
return this._oidc.logoutAsync(s, n);
|
|
1448
1445
|
}
|
|
1449
1446
|
silentLoginCallbackAsync() {
|
|
1450
1447
|
return this._oidc.silentLoginCallbackAsync();
|
|
1451
1448
|
}
|
|
1452
|
-
renewTokensAsync(
|
|
1453
|
-
return this._oidc.renewTokensAsync(
|
|
1449
|
+
renewTokensAsync(s = null) {
|
|
1450
|
+
return this._oidc.renewTokensAsync(s);
|
|
1454
1451
|
}
|
|
1455
1452
|
loginCallbackAsync() {
|
|
1456
1453
|
return this._oidc.loginCallbackWithAutoTokensRenewAsync();
|
|
@@ -1461,27 +1458,27 @@ const In = (n, e) => async (...s) => {
|
|
|
1461
1458
|
get configuration() {
|
|
1462
1459
|
return this._oidc.configuration;
|
|
1463
1460
|
}
|
|
1464
|
-
async generateDemonstrationOfProofOfPossessionAsync(
|
|
1465
|
-
return this._oidc.generateDemonstrationOfProofOfPossessionAsync(
|
|
1461
|
+
async generateDemonstrationOfProofOfPossessionAsync(s, n, t) {
|
|
1462
|
+
return this._oidc.generateDemonstrationOfProofOfPossessionAsync(s, n, t);
|
|
1466
1463
|
}
|
|
1467
|
-
async getValidTokenAsync(
|
|
1468
|
-
return
|
|
1464
|
+
async getValidTokenAsync(s = 200, n = 50) {
|
|
1465
|
+
return xe(this._oidc, s, n);
|
|
1469
1466
|
}
|
|
1470
|
-
fetchWithTokens(
|
|
1471
|
-
return
|
|
1467
|
+
fetchWithTokens(s) {
|
|
1468
|
+
return Es(s, this);
|
|
1472
1469
|
}
|
|
1473
|
-
async userInfoAsync(
|
|
1474
|
-
return this._oidc.userInfoAsync(
|
|
1470
|
+
async userInfoAsync(s = !1) {
|
|
1471
|
+
return this._oidc.userInfoAsync(s);
|
|
1475
1472
|
}
|
|
1476
1473
|
};
|
|
1477
|
-
X.getOrCreate = (
|
|
1474
|
+
X.getOrCreate = (e, s = new Y()) => (n, t = "default") => new X(K.getOrCreate(e, s)(n, t));
|
|
1478
1475
|
X.eventNames = K.eventNames;
|
|
1479
|
-
let
|
|
1476
|
+
let Ns = X;
|
|
1480
1477
|
export {
|
|
1481
|
-
|
|
1478
|
+
Ns as OidcClient,
|
|
1482
1479
|
Y as OidcLocation,
|
|
1483
1480
|
z as TokenRenewMode,
|
|
1484
|
-
|
|
1481
|
+
Ts as getFetchDefault,
|
|
1485
1482
|
G as getParseQueryStringFromLocation,
|
|
1486
|
-
|
|
1483
|
+
Cs as getPath
|
|
1487
1484
|
};
|