@axa-fr/oidc-client 7.26.3 → 7.26.4
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 +860 -793
- package/dist/index.umd.cjs +2 -2
- package/dist/initWorker.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/initWorker.ts +146 -31
- package/src/version.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -16,12 +16,12 @@ class j {
|
|
|
16
16
|
return window.origin;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
const de = 2e3,
|
|
19
|
+
const de = 2e3, $ = console;
|
|
20
20
|
class De {
|
|
21
|
-
constructor(n,
|
|
22
|
-
this._callback = n, this._client_id =
|
|
23
|
-
const r =
|
|
24
|
-
this._frame_origin =
|
|
21
|
+
constructor(n, t, s, o = de, i = !0) {
|
|
22
|
+
this._callback = n, this._client_id = t, this._url = s, this._interval = o || de, this._stopOnError = i;
|
|
23
|
+
const r = s.indexOf("/", s.indexOf("//") + 2);
|
|
24
|
+
this._frame_origin = s.substring(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 = s;
|
|
25
25
|
}
|
|
26
26
|
load() {
|
|
27
27
|
return new Promise((n) => {
|
|
@@ -31,20 +31,20 @@ class De {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
_message(n) {
|
|
34
|
-
n.origin === this._frame_origin && n.source === this._frame.contentWindow && (n.data === "error" ? (
|
|
34
|
+
n.origin === this._frame_origin && n.source === this._frame.contentWindow && (n.data === "error" ? ($.error("CheckSessionIFrame: error message from check session op iframe"), this._stopOnError && this.stop()) : n.data === "changed" ? ($.debug(n), $.debug("CheckSessionIFrame: changed message from check session op iframe"), this.stop(), this._callback()) : $.debug("CheckSessionIFrame: " + n.data + " message from check session op iframe"));
|
|
35
35
|
}
|
|
36
36
|
start(n) {
|
|
37
|
-
|
|
38
|
-
const
|
|
37
|
+
$.debug("CheckSessionIFrame.start :" + n), this.stop();
|
|
38
|
+
const t = () => {
|
|
39
39
|
this._frame.contentWindow.postMessage(
|
|
40
40
|
this._client_id + " " + n,
|
|
41
41
|
this._frame_origin
|
|
42
42
|
);
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
t(), this._timer = window.setInterval(t, this._interval);
|
|
45
45
|
}
|
|
46
46
|
stop() {
|
|
47
|
-
this._timer && (
|
|
47
|
+
this._timer && ($.debug("CheckSessionIFrame.stop"), window.clearInterval(this._timer), this._timer = null);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
const p = {
|
|
@@ -77,52 +77,52 @@ const p = {
|
|
|
77
77
|
syncTokensAsync_error: "syncTokensAsync_error",
|
|
78
78
|
tokensInvalidAndWaitingActionsToRefresh: "tokensInvalidAndWaitingActionsToRefresh"
|
|
79
79
|
}, N = (e, n = sessionStorage) => {
|
|
80
|
-
const
|
|
80
|
+
const t = (h) => (n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: h }), delete n[`oidc.${e}.userInfo`], Promise.resolve()), s = async () => {
|
|
81
81
|
if (!n[`oidc.${e}`])
|
|
82
82
|
return n[`oidc.${e}`] = JSON.stringify({ tokens: null, status: null }), { tokens: null, status: null };
|
|
83
|
-
const
|
|
84
|
-
return Promise.resolve({ tokens:
|
|
85
|
-
}, o = (
|
|
86
|
-
n[`oidc.${e}`] = JSON.stringify({ tokens:
|
|
87
|
-
}, i = async (
|
|
88
|
-
n[`oidc.session_state.${e}`] =
|
|
89
|
-
}, r = async () => n[`oidc.session_state.${e}`], a = (
|
|
90
|
-
n[`oidc.nonce.${e}`] =
|
|
91
|
-
}, c = (
|
|
92
|
-
n[`oidc.jwk.${e}`] = JSON.stringify(
|
|
93
|
-
},
|
|
94
|
-
n[`oidc.dpop_nonce.${e}`] =
|
|
95
|
-
}, d = () => n[`oidc.dpop_nonce.${e}`],
|
|
83
|
+
const h = JSON.parse(n[`oidc.${e}`]);
|
|
84
|
+
return Promise.resolve({ tokens: h.tokens, status: h.status });
|
|
85
|
+
}, o = (h) => {
|
|
86
|
+
n[`oidc.${e}`] = JSON.stringify({ tokens: h });
|
|
87
|
+
}, i = async (h) => {
|
|
88
|
+
n[`oidc.session_state.${e}`] = h;
|
|
89
|
+
}, r = async () => n[`oidc.session_state.${e}`], a = (h) => {
|
|
90
|
+
n[`oidc.nonce.${e}`] = h.nonce;
|
|
91
|
+
}, c = (h) => {
|
|
92
|
+
n[`oidc.jwk.${e}`] = JSON.stringify(h);
|
|
93
|
+
}, f = () => JSON.parse(n[`oidc.jwk.${e}`]), u = async () => ({ nonce: n[`oidc.nonce.${e}`] }), l = async (h) => {
|
|
94
|
+
n[`oidc.dpop_nonce.${e}`] = h;
|
|
95
|
+
}, d = () => n[`oidc.dpop_nonce.${e}`], _ = () => n[`oidc.${e}`] ? JSON.stringify({ tokens: JSON.parse(n[`oidc.${e}`]).tokens }) : null, w = {};
|
|
96
96
|
return {
|
|
97
|
-
clearAsync:
|
|
98
|
-
initAsync:
|
|
97
|
+
clearAsync: t,
|
|
98
|
+
initAsync: s,
|
|
99
99
|
setTokens: o,
|
|
100
|
-
getTokens:
|
|
100
|
+
getTokens: _,
|
|
101
101
|
setSessionStateAsync: i,
|
|
102
102
|
getSessionStateAsync: r,
|
|
103
103
|
setNonceAsync: a,
|
|
104
|
-
getNonceAsync:
|
|
105
|
-
setLoginParams: (
|
|
106
|
-
|
|
104
|
+
getNonceAsync: u,
|
|
105
|
+
setLoginParams: (h) => {
|
|
106
|
+
w[e] = h, n[`oidc.login.${e}`] = JSON.stringify(h);
|
|
107
107
|
},
|
|
108
108
|
getLoginParams: () => {
|
|
109
|
-
const
|
|
110
|
-
return
|
|
109
|
+
const h = n[`oidc.login.${e}`];
|
|
110
|
+
return h ? (w[e] || (w[e] = JSON.parse(h)), w[e]) : (console.warn(
|
|
111
111
|
`storage[oidc.login.${e}] is empty, you should have an bad OIDC or code configuration somewhere.`
|
|
112
112
|
), null);
|
|
113
113
|
},
|
|
114
114
|
getStateAsync: async () => n[`oidc.state.${e}`],
|
|
115
|
-
setStateAsync: async (
|
|
116
|
-
n[`oidc.state.${e}`] =
|
|
115
|
+
setStateAsync: async (h) => {
|
|
116
|
+
n[`oidc.state.${e}`] = h;
|
|
117
117
|
},
|
|
118
118
|
getCodeVerifierAsync: async () => n[`oidc.code_verifier.${e}`],
|
|
119
|
-
setCodeVerifierAsync: async (
|
|
120
|
-
n[`oidc.code_verifier.${e}`] =
|
|
119
|
+
setCodeVerifierAsync: async (h) => {
|
|
120
|
+
n[`oidc.code_verifier.${e}`] = h;
|
|
121
121
|
},
|
|
122
122
|
setDemonstratingProofOfPossessionNonce: l,
|
|
123
123
|
getDemonstratingProofOfPossessionNonce: d,
|
|
124
124
|
setDemonstratingProofOfPossessionJwkAsync: c,
|
|
125
|
-
getDemonstratingProofOfPossessionJwkAsync:
|
|
125
|
+
getDemonstratingProofOfPossessionJwkAsync: f
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
128
|
var B = /* @__PURE__ */ ((e) => (e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e))(B || {});
|
|
@@ -135,50 +135,50 @@ const Re = (e) => decodeURIComponent(
|
|
|
135
135
|
console.warn(n);
|
|
136
136
|
}
|
|
137
137
|
return null;
|
|
138
|
-
}, Ke = (e, n) => e.split(n).length - 1,
|
|
138
|
+
}, Ke = (e, n) => e.split(n).length - 1, Z = {
|
|
139
139
|
access_token_or_id_token_invalid: "access_token_or_id_token_invalid",
|
|
140
140
|
access_token_invalid: "access_token_invalid",
|
|
141
141
|
id_token_invalid: "id_token_invalid"
|
|
142
142
|
};
|
|
143
|
-
function Ue(e, n,
|
|
143
|
+
function Ue(e, n, t) {
|
|
144
144
|
if (e.issuedAt) {
|
|
145
145
|
if (typeof e.issuedAt == "string")
|
|
146
146
|
return parseInt(e.issuedAt, 10);
|
|
147
|
-
} else return n && n.iat ? n.iat :
|
|
147
|
+
} else return n && n.iat ? n.iat : t && t.iat ? t.iat : (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
148
148
|
return e.issuedAt;
|
|
149
149
|
}
|
|
150
|
-
const
|
|
150
|
+
const ie = (e, n = null, t) => {
|
|
151
151
|
if (!e)
|
|
152
152
|
return null;
|
|
153
|
-
let
|
|
153
|
+
let s;
|
|
154
154
|
const o = typeof e.expiresIn == "string" ? parseInt(e.expiresIn, 10) : e.expiresIn;
|
|
155
|
-
e.accessTokenPayload !== void 0 ?
|
|
155
|
+
e.accessTokenPayload !== void 0 ? s = e.accessTokenPayload : s = he(e.accessToken);
|
|
156
156
|
let i;
|
|
157
157
|
n != null && "idToken" in n && !("idToken" in e) ? i = n.idToken : i = e.idToken;
|
|
158
|
-
const r = e.idTokenPayload ? e.idTokenPayload : he(i), a = r && r.exp ? r.exp : Number.MAX_VALUE, c =
|
|
159
|
-
e.issuedAt = Ue(e,
|
|
160
|
-
let
|
|
161
|
-
e.expiresAt ?
|
|
162
|
-
const
|
|
158
|
+
const r = e.idTokenPayload ? e.idTokenPayload : he(i), a = r && r.exp ? r.exp : Number.MAX_VALUE, c = s && s.exp ? s.exp : e.issuedAt + o;
|
|
159
|
+
e.issuedAt = Ue(e, s, r);
|
|
160
|
+
let f;
|
|
161
|
+
e.expiresAt ? f = e.expiresAt : t === Z.access_token_invalid ? f = c : t === Z.id_token_invalid ? f = a : f = a < c ? a : c;
|
|
162
|
+
const u = {
|
|
163
163
|
...e,
|
|
164
164
|
idTokenPayload: r,
|
|
165
|
-
accessTokenPayload:
|
|
166
|
-
expiresAt:
|
|
165
|
+
accessTokenPayload: s,
|
|
166
|
+
expiresAt: f,
|
|
167
167
|
idToken: i
|
|
168
168
|
};
|
|
169
169
|
if (n != null && "refreshToken" in n && !("refreshToken" in e)) {
|
|
170
170
|
const l = n.refreshToken;
|
|
171
|
-
return { ...
|
|
171
|
+
return { ...u, refreshToken: l };
|
|
172
172
|
}
|
|
173
|
-
return
|
|
174
|
-
},
|
|
173
|
+
return u;
|
|
174
|
+
}, re = (e, n, t) => {
|
|
175
175
|
if (!e)
|
|
176
176
|
return null;
|
|
177
177
|
if (!e.issued_at) {
|
|
178
178
|
const o = (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
179
179
|
e.issued_at = o;
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const s = {
|
|
182
182
|
accessToken: e.access_token,
|
|
183
183
|
expiresIn: e.expires_in,
|
|
184
184
|
idToken: e.id_token,
|
|
@@ -186,57 +186,57 @@ const oe = (e, n = null, s) => {
|
|
|
186
186
|
tokenType: e.token_type,
|
|
187
187
|
issuedAt: e.issued_at
|
|
188
188
|
};
|
|
189
|
-
return "refresh_token" in e && (
|
|
190
|
-
},
|
|
191
|
-
const
|
|
192
|
-
return Math.round(
|
|
193
|
-
}, Ve = (e, n = 0) => e ?
|
|
194
|
-
let
|
|
189
|
+
return "refresh_token" in e && (s.refreshToken = e.refresh_token), e.accessTokenPayload !== void 0 && (s.accessTokenPayload = e.accessTokenPayload), e.idTokenPayload !== void 0 && (s.idTokenPayload = e.idTokenPayload), ie(s, n, t);
|
|
190
|
+
}, F = (e, n) => {
|
|
191
|
+
const t = (/* @__PURE__ */ new Date()).getTime() / 1e3, s = n - t;
|
|
192
|
+
return Math.round(s - e);
|
|
193
|
+
}, Ve = (e, n = 0) => e ? F(n, e.expiresAt) > 0 : !1, Ae = async (e, n = 200, t = 50) => {
|
|
194
|
+
let s = t, o = await e.syncTokensInfoAsync();
|
|
195
195
|
for (; [
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
].includes(o) &&
|
|
196
|
+
E.REQUIRE_SYNC_TOKENS,
|
|
197
|
+
E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID,
|
|
198
|
+
E.TOKENS_INVALID
|
|
199
|
+
].includes(o) && s > 0; ) {
|
|
200
200
|
if (e.configuration.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted) {
|
|
201
201
|
await e.renewTokensAsync({});
|
|
202
202
|
break;
|
|
203
203
|
} else
|
|
204
|
-
await
|
|
205
|
-
|
|
204
|
+
await ae({ milliseconds: n });
|
|
205
|
+
s = s - 1, o = await e.syncTokensInfoAsync();
|
|
206
206
|
}
|
|
207
207
|
return {
|
|
208
208
|
isTokensValid: Ve(e.getTokens()),
|
|
209
209
|
tokens: e.getTokens(),
|
|
210
|
-
numberWaited:
|
|
210
|
+
numberWaited: s - t
|
|
211
211
|
};
|
|
212
|
-
}, Se = (e, n,
|
|
212
|
+
}, Se = (e, n, t) => {
|
|
213
213
|
if (e.idTokenPayload) {
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
214
|
+
const s = e.idTokenPayload;
|
|
215
|
+
if (t.issuer !== s.iss)
|
|
216
216
|
return {
|
|
217
217
|
isValid: !1,
|
|
218
|
-
reason: `Issuer does not match (oidcServerConfiguration issuer) ${
|
|
218
|
+
reason: `Issuer does not match (oidcServerConfiguration issuer) ${t.issuer} !== (idTokenPayload issuer) ${s.iss}`
|
|
219
219
|
};
|
|
220
220
|
const o = (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
221
|
-
if (
|
|
221
|
+
if (s.exp && s.exp < o)
|
|
222
222
|
return {
|
|
223
223
|
isValid: !1,
|
|
224
|
-
reason: `Token expired (idTokenPayload exp) ${
|
|
224
|
+
reason: `Token expired (idTokenPayload exp) ${s.exp} < (currentTimeUnixSecond) ${o}`
|
|
225
225
|
};
|
|
226
226
|
const i = 3600 * 24 * 7;
|
|
227
|
-
if (
|
|
227
|
+
if (s.iat && s.iat + i < o)
|
|
228
228
|
return {
|
|
229
229
|
isValid: !1,
|
|
230
|
-
reason: `Token is used from too long time (idTokenPayload iat + timeInSevenDays) ${
|
|
230
|
+
reason: `Token is used from too long time (idTokenPayload iat + timeInSevenDays) ${s.iat + i} < (currentTimeUnixSecond) ${o}`
|
|
231
231
|
};
|
|
232
|
-
if (
|
|
232
|
+
if (s.nonce && s.nonce !== n)
|
|
233
233
|
return {
|
|
234
234
|
isValid: !1,
|
|
235
|
-
reason: `Nonce does not match (idTokenPayload nonce) ${
|
|
235
|
+
reason: `Nonce does not match (idTokenPayload nonce) ${s.nonce} !== (nonce) ${n}`
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
return { isValid: !0, reason: "" };
|
|
239
|
-
},
|
|
239
|
+
}, D = (function() {
|
|
240
240
|
const e = typeof window > "u" ? global : window;
|
|
241
241
|
return {
|
|
242
242
|
setTimeout: setTimeout.bind(e),
|
|
@@ -244,176 +244,243 @@ const oe = (e, n = null, s) => {
|
|
|
244
244
|
setInterval: setInterval.bind(e),
|
|
245
245
|
clearInterval: clearInterval.bind(e)
|
|
246
246
|
};
|
|
247
|
-
})(),
|
|
248
|
-
let ge = null,
|
|
249
|
-
const
|
|
247
|
+
})(), X = "7.26.4";
|
|
248
|
+
let ge = null, q;
|
|
249
|
+
const ae = ({ milliseconds: e }) => new Promise((n) => D.setTimeout(n, e)), Te = (e = "/") => {
|
|
250
250
|
try {
|
|
251
|
-
|
|
251
|
+
q = new AbortController(), fetch(
|
|
252
252
|
`${e}OidcKeepAliveServiceWorker.json?minSleepSeconds=150`,
|
|
253
|
-
{ signal:
|
|
254
|
-
).catch((
|
|
255
|
-
console.log(
|
|
256
|
-
}),
|
|
253
|
+
{ signal: q.signal }
|
|
254
|
+
).catch((s) => {
|
|
255
|
+
console.log(s);
|
|
256
|
+
}), ae({ milliseconds: 150 * 1e3 }).then(
|
|
257
|
+
() => Te(e)
|
|
258
|
+
);
|
|
257
259
|
} catch (n) {
|
|
258
260
|
console.log(n);
|
|
259
261
|
}
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
+
}, z = () => {
|
|
263
|
+
q && q.abort();
|
|
262
264
|
}, ve = (e) => {
|
|
263
|
-
const n =
|
|
264
|
-
if (
|
|
265
|
-
return n;
|
|
265
|
+
const n = `oidc.tabId.${e}`, t = sessionStorage.getItem(n);
|
|
266
|
+
if (t) return t;
|
|
266
267
|
const s = globalThis.crypto.randomUUID();
|
|
267
|
-
return sessionStorage.setItem(
|
|
268
|
-
},
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
268
|
+
return sessionStorage.setItem(n, s), s;
|
|
269
|
+
}, Fe = 5e3, Me = (e) => navigator.serviceWorker.controller ?? e.active ?? e.waiting ?? e.installing ?? null, O = (e, n) => (t) => {
|
|
270
|
+
const s = n?.timeoutMs ?? Fe;
|
|
271
|
+
return new Promise((o, i) => {
|
|
272
|
+
const r = Me(e);
|
|
273
|
+
if (!r) {
|
|
274
|
+
i(
|
|
275
|
+
new Error(
|
|
276
|
+
"Service worker target not available (controller/active/waiting/installing missing)"
|
|
277
|
+
)
|
|
278
|
+
);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const a = new MessageChannel();
|
|
282
|
+
let c = null;
|
|
283
|
+
const f = () => {
|
|
284
|
+
try {
|
|
285
|
+
c != null && (D.clearTimeout(c), c = null), a.port1.onmessage = null, a.port1.close(), a.port2.close();
|
|
286
|
+
} catch (u) {
|
|
287
|
+
console.error(u);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
c = D.setTimeout(() => {
|
|
291
|
+
f(), i(
|
|
292
|
+
new Error(`Service worker did not respond within ${s}ms (type=${t?.type})`)
|
|
293
|
+
);
|
|
294
|
+
}, s), a.port1.onmessage = (u) => {
|
|
295
|
+
f(), u?.data?.error ? i(u.data.error) : o(u.data);
|
|
296
|
+
};
|
|
297
|
+
try {
|
|
298
|
+
const u = t?.configurationName;
|
|
299
|
+
r.postMessage({ ...t, tabId: ve(u ?? "default") }, [
|
|
300
|
+
a.port2
|
|
301
|
+
]);
|
|
302
|
+
} catch (u) {
|
|
303
|
+
f(), i(u);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}, Be = async (e) => navigator.serviceWorker.controller ? navigator.serviceWorker.controller : new Promise((n) => {
|
|
307
|
+
let t = !1;
|
|
308
|
+
const s = () => {
|
|
309
|
+
t || (t = !0, navigator.serviceWorker.removeEventListener("controllerchange", s), n(navigator.serviceWorker.controller ?? null));
|
|
310
|
+
};
|
|
311
|
+
navigator.serviceWorker.addEventListener("controllerchange", s), D.setTimeout(() => {
|
|
312
|
+
t || (t = !0, navigator.serviceWorker.removeEventListener("controllerchange", s), n(navigator.serviceWorker.controller ?? null));
|
|
313
|
+
}, e);
|
|
275
314
|
}), C = async (e, n) => {
|
|
276
|
-
const
|
|
277
|
-
if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !
|
|
315
|
+
const t = e.service_worker_relative_url;
|
|
316
|
+
if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !t || e.service_worker_activate() === !1)
|
|
278
317
|
return null;
|
|
279
|
-
const
|
|
318
|
+
const s = `${t}?v=${X}`;
|
|
280
319
|
let o = null;
|
|
281
|
-
e.service_worker_register ? o = await e.service_worker_register(
|
|
320
|
+
e.service_worker_register ? o = await e.service_worker_register(t) : o = await navigator.serviceWorker.register(s, {
|
|
282
321
|
updateViaCache: "none"
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
322
|
+
});
|
|
323
|
+
try {
|
|
324
|
+
await o.update();
|
|
325
|
+
} catch (k) {
|
|
326
|
+
console.error(k);
|
|
327
|
+
}
|
|
328
|
+
o.addEventListener("updatefound", () => {
|
|
329
|
+
const k = o.installing;
|
|
330
|
+
z(), k?.addEventListener("statechange", async () => {
|
|
331
|
+
if (k.state === "installed" && navigator.serviceWorker.controller) {
|
|
332
|
+
z(), console.log("New SW waiting – SKIP_WAITING");
|
|
333
|
+
try {
|
|
334
|
+
await O(o, { timeoutMs: 8e3 })({
|
|
335
|
+
type: "SKIP_WAITING",
|
|
336
|
+
configurationName: n,
|
|
337
|
+
data: null
|
|
338
|
+
});
|
|
339
|
+
} catch (b) {
|
|
340
|
+
console.warn("SKIP_WAITING failed", b);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
287
343
|
});
|
|
288
|
-
})
|
|
289
|
-
|
|
344
|
+
});
|
|
345
|
+
const i = `oidc.sw.controllerchange.reloaded.${n}`;
|
|
346
|
+
navigator.serviceWorker.addEventListener("controllerchange", () => {
|
|
347
|
+
try {
|
|
348
|
+
if (sessionStorage.getItem(i) === "1") return;
|
|
349
|
+
sessionStorage.setItem(i, "1");
|
|
350
|
+
} catch {
|
|
351
|
+
}
|
|
352
|
+
console.log("SW controller changed – reloading page"), z(), window.location.reload();
|
|
290
353
|
});
|
|
291
354
|
try {
|
|
292
|
-
await navigator.serviceWorker.ready, navigator.serviceWorker.controller || await
|
|
293
|
-
|
|
294
|
-
|
|
355
|
+
await navigator.serviceWorker.ready, navigator.serviceWorker.controller || (await O(o, { timeoutMs: 8e3 })({
|
|
356
|
+
type: "claim",
|
|
357
|
+
configurationName: n,
|
|
358
|
+
data: null
|
|
359
|
+
}), await Be(2e3));
|
|
360
|
+
} catch (k) {
|
|
361
|
+
return console.warn(`Failed init ServiceWorker ${k?.toString?.() ?? String(k)}`), null;
|
|
295
362
|
}
|
|
296
|
-
const
|
|
297
|
-
const
|
|
363
|
+
const r = async (k) => O(o)({ type: "clear", data: { status: k }, configurationName: n }), a = async (k, b, m) => {
|
|
364
|
+
const W = await O(o)({
|
|
298
365
|
type: "init",
|
|
299
366
|
data: {
|
|
300
|
-
oidcServerConfiguration:
|
|
301
|
-
where:
|
|
367
|
+
oidcServerConfiguration: k,
|
|
368
|
+
where: b,
|
|
302
369
|
oidcConfiguration: {
|
|
303
|
-
token_renew_mode:
|
|
304
|
-
service_worker_convert_all_requests_to_cors:
|
|
370
|
+
token_renew_mode: m.token_renew_mode,
|
|
371
|
+
service_worker_convert_all_requests_to_cors: m.service_worker_convert_all_requests_to_cors
|
|
305
372
|
}
|
|
306
373
|
},
|
|
307
374
|
configurationName: n
|
|
308
|
-
}),
|
|
309
|
-
return
|
|
310
|
-
`Service worker ${
|
|
375
|
+
}), V = W.version;
|
|
376
|
+
return V !== X && console.warn(
|
|
377
|
+
`Service worker ${V} version mismatch with js client version ${X}, unregistering and reloading`
|
|
311
378
|
), {
|
|
312
|
-
tokens:
|
|
313
|
-
status:
|
|
379
|
+
tokens: re(W.tokens, null, m.token_renew_mode),
|
|
380
|
+
status: W.status
|
|
314
381
|
};
|
|
315
|
-
},
|
|
316
|
-
ge == null && (ge = "not_null", Te(
|
|
317
|
-
},
|
|
382
|
+
}, c = (k = "/") => {
|
|
383
|
+
ge == null && (ge = "not_null", Te(k));
|
|
384
|
+
}, f = (k) => O(o)({
|
|
318
385
|
type: "setSessionState",
|
|
319
|
-
data: { sessionState:
|
|
386
|
+
data: { sessionState: k },
|
|
320
387
|
configurationName: n
|
|
321
|
-
}),
|
|
388
|
+
}), u = async () => (await O(o)({
|
|
322
389
|
type: "getSessionState",
|
|
323
390
|
data: null,
|
|
324
391
|
configurationName: n
|
|
325
|
-
})).sessionState,
|
|
392
|
+
})).sessionState, l = (k) => (sessionStorage[`oidc.nonce.${n}`] = k.nonce, O(o)({
|
|
326
393
|
type: "setNonce",
|
|
327
|
-
data: { nonce:
|
|
394
|
+
data: { nonce: k },
|
|
328
395
|
configurationName: n
|
|
329
|
-
})),
|
|
330
|
-
let
|
|
396
|
+
})), d = async (k = !0) => {
|
|
397
|
+
let m = (await O(o)({
|
|
331
398
|
type: "getNonce",
|
|
332
399
|
data: null,
|
|
333
400
|
configurationName: n
|
|
334
401
|
})).nonce;
|
|
335
|
-
return
|
|
336
|
-
},
|
|
337
|
-
|
|
338
|
-
},
|
|
339
|
-
const
|
|
340
|
-
return
|
|
341
|
-
},
|
|
342
|
-
await
|
|
402
|
+
return m || (m = sessionStorage[`oidc.nonce.${n}`], console.warn("nonce not found in service worker, using sessionStorage"), k && (await l(m), m = (await d(!1)).nonce)), { nonce: m };
|
|
403
|
+
}, _ = {}, w = (k) => {
|
|
404
|
+
_[n] = k, localStorage[`oidc.login.${n}`] = JSON.stringify(k);
|
|
405
|
+
}, A = () => {
|
|
406
|
+
const k = localStorage[`oidc.login.${n}`];
|
|
407
|
+
return _[n] || (_[n] = JSON.parse(k)), _[n];
|
|
408
|
+
}, g = async (k) => {
|
|
409
|
+
await O(o)({
|
|
343
410
|
type: "setDemonstratingProofOfPossessionNonce",
|
|
344
|
-
data: { demonstratingProofOfPossessionNonce:
|
|
411
|
+
data: { demonstratingProofOfPossessionNonce: k },
|
|
345
412
|
configurationName: n
|
|
346
413
|
});
|
|
347
|
-
}, y = async () => (await
|
|
414
|
+
}, y = async () => (await O(o)({
|
|
348
415
|
type: "getDemonstratingProofOfPossessionNonce",
|
|
349
416
|
data: null,
|
|
350
417
|
configurationName: n
|
|
351
|
-
})).demonstratingProofOfPossessionNonce,
|
|
352
|
-
const
|
|
353
|
-
await
|
|
418
|
+
})).demonstratingProofOfPossessionNonce, S = async (k) => {
|
|
419
|
+
const b = JSON.stringify(k);
|
|
420
|
+
await O(o)({
|
|
354
421
|
type: "setDemonstratingProofOfPossessionJwk",
|
|
355
|
-
data: { demonstratingProofOfPossessionJwkJson:
|
|
422
|
+
data: { demonstratingProofOfPossessionJwkJson: b },
|
|
356
423
|
configurationName: n
|
|
357
424
|
});
|
|
358
|
-
},
|
|
359
|
-
const
|
|
425
|
+
}, T = async () => {
|
|
426
|
+
const k = await O(o)({
|
|
360
427
|
type: "getDemonstratingProofOfPossessionJwk",
|
|
361
428
|
data: null,
|
|
362
429
|
configurationName: n
|
|
363
430
|
});
|
|
364
|
-
return
|
|
365
|
-
},
|
|
366
|
-
let
|
|
431
|
+
return k.demonstratingProofOfPossessionJwkJson ? JSON.parse(k.demonstratingProofOfPossessionJwkJson) : null;
|
|
432
|
+
}, v = async (k = !0) => {
|
|
433
|
+
let m = (await O(o)({
|
|
367
434
|
type: "getState",
|
|
368
435
|
data: null,
|
|
369
436
|
configurationName: n
|
|
370
437
|
})).state;
|
|
371
|
-
return
|
|
372
|
-
},
|
|
438
|
+
return m || (m = sessionStorage[`oidc.state.${n}`], console.warn("state not found in service worker, using sessionStorage"), k && (await h(m), m = await v(!1))), m;
|
|
439
|
+
}, h = async (k) => (sessionStorage[`oidc.state.${n}`] = k, O(o)({
|
|
373
440
|
type: "setState",
|
|
374
|
-
data: { state:
|
|
441
|
+
data: { state: k },
|
|
375
442
|
configurationName: n
|
|
376
|
-
})),
|
|
377
|
-
let
|
|
443
|
+
})), P = async (k = !0) => {
|
|
444
|
+
let m = (await O(o)({
|
|
378
445
|
type: "getCodeVerifier",
|
|
379
446
|
data: null,
|
|
380
447
|
configurationName: n
|
|
381
448
|
})).codeVerifier;
|
|
382
|
-
return
|
|
383
|
-
},
|
|
449
|
+
return m || (m = sessionStorage[`oidc.code_verifier.${n}`], console.warn("codeVerifier not found in service worker, using sessionStorage"), k && (await x(m), m = await P(!1))), m;
|
|
450
|
+
}, x = async (k) => (sessionStorage[`oidc.code_verifier.${n}`] = k, O(o)({
|
|
384
451
|
type: "setCodeVerifier",
|
|
385
|
-
data: { codeVerifier:
|
|
452
|
+
data: { codeVerifier: k },
|
|
386
453
|
configurationName: n
|
|
387
454
|
}));
|
|
388
455
|
return {
|
|
389
|
-
clearAsync:
|
|
390
|
-
initAsync:
|
|
391
|
-
startKeepAliveServiceWorker: () =>
|
|
392
|
-
setSessionStateAsync:
|
|
393
|
-
getSessionStateAsync:
|
|
394
|
-
setNonceAsync:
|
|
395
|
-
getNonceAsync:
|
|
396
|
-
setLoginParams:
|
|
397
|
-
getLoginParams:
|
|
398
|
-
getStateAsync:
|
|
399
|
-
setStateAsync:
|
|
400
|
-
getCodeVerifierAsync:
|
|
401
|
-
setCodeVerifierAsync:
|
|
402
|
-
setDemonstratingProofOfPossessionNonce:
|
|
456
|
+
clearAsync: r,
|
|
457
|
+
initAsync: a,
|
|
458
|
+
startKeepAliveServiceWorker: () => c(e.service_worker_keep_alive_path),
|
|
459
|
+
setSessionStateAsync: f,
|
|
460
|
+
getSessionStateAsync: u,
|
|
461
|
+
setNonceAsync: l,
|
|
462
|
+
getNonceAsync: d,
|
|
463
|
+
setLoginParams: w,
|
|
464
|
+
getLoginParams: A,
|
|
465
|
+
getStateAsync: v,
|
|
466
|
+
setStateAsync: h,
|
|
467
|
+
getCodeVerifierAsync: P,
|
|
468
|
+
setCodeVerifierAsync: x,
|
|
469
|
+
setDemonstratingProofOfPossessionNonce: g,
|
|
403
470
|
getDemonstratingProofOfPossessionNonce: y,
|
|
404
|
-
setDemonstratingProofOfPossessionJwkAsync:
|
|
405
|
-
getDemonstratingProofOfPossessionJwkAsync:
|
|
471
|
+
setDemonstratingProofOfPossessionJwkAsync: S,
|
|
472
|
+
getDemonstratingProofOfPossessionJwkAsync: T
|
|
406
473
|
};
|
|
407
|
-
},
|
|
408
|
-
if (
|
|
474
|
+
}, K = {}, Je = (e, n = window.sessionStorage, t) => {
|
|
475
|
+
if (!K[e] && n) {
|
|
409
476
|
const o = n.getItem(e);
|
|
410
|
-
o && (
|
|
477
|
+
o && (K[e] = JSON.parse(o));
|
|
411
478
|
}
|
|
412
|
-
const
|
|
413
|
-
return
|
|
414
|
-
},
|
|
415
|
-
const
|
|
416
|
-
|
|
479
|
+
const s = 1e3 * t;
|
|
480
|
+
return K[e] && K[e].timestamp + s > Date.now() ? K[e].result : null;
|
|
481
|
+
}, He = (e, n, t = window.sessionStorage) => {
|
|
482
|
+
const s = Date.now();
|
|
483
|
+
K[e] = { result: n, timestamp: s }, t && t.setItem(e, JSON.stringify({ result: n, timestamp: s }));
|
|
417
484
|
};
|
|
418
485
|
function Ee(e) {
|
|
419
486
|
return new TextEncoder().encode(e);
|
|
@@ -421,21 +488,21 @@ function Ee(e) {
|
|
|
421
488
|
function Oe(e) {
|
|
422
489
|
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+/g, "");
|
|
423
490
|
}
|
|
424
|
-
function
|
|
425
|
-
return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function(
|
|
426
|
-
return String.fromCharCode(parseInt(
|
|
491
|
+
function Ge(e) {
|
|
492
|
+
return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, function(t, s) {
|
|
493
|
+
return String.fromCharCode(parseInt(s, 16));
|
|
427
494
|
});
|
|
428
495
|
}
|
|
429
|
-
const
|
|
496
|
+
const ce = (e) => {
|
|
430
497
|
let n = "";
|
|
431
|
-
return e.forEach(function(
|
|
432
|
-
n += String.fromCharCode(
|
|
498
|
+
return e.forEach(function(t) {
|
|
499
|
+
n += String.fromCharCode(t);
|
|
433
500
|
}), Oe(n);
|
|
434
501
|
};
|
|
435
502
|
function ye(e) {
|
|
436
|
-
return Oe(
|
|
503
|
+
return Oe(Ge(e));
|
|
437
504
|
}
|
|
438
|
-
const
|
|
505
|
+
const je = {
|
|
439
506
|
importKeyAlgorithm: {
|
|
440
507
|
name: "ECDSA",
|
|
441
508
|
namedCurve: "P-256",
|
|
@@ -448,13 +515,13 @@ const Je = {
|
|
|
448
515
|
},
|
|
449
516
|
digestAlgorithm: { name: "SHA-256" },
|
|
450
517
|
jwtHeaderAlgorithm: "ES256"
|
|
451
|
-
},
|
|
452
|
-
switch (n = Object.assign({}, n),
|
|
518
|
+
}, qe = (e) => async (n, t, s, o, i = "dpop+jwt") => {
|
|
519
|
+
switch (n = Object.assign({}, n), t.typ = i, t.alg = o.jwtHeaderAlgorithm, t.alg) {
|
|
453
520
|
case "ES256":
|
|
454
|
-
|
|
521
|
+
t.jwk = { kty: n.kty, crv: n.crv, x: n.x, y: n.y };
|
|
455
522
|
break;
|
|
456
523
|
case "RS256":
|
|
457
|
-
|
|
524
|
+
t.jwk = { kty: n.kty, n: n.n, e: n.e, kid: t.kid };
|
|
458
525
|
break;
|
|
459
526
|
default:
|
|
460
527
|
throw new Error("Unknown or not implemented JWS algorithm");
|
|
@@ -462,159 +529,159 @@ const Je = {
|
|
|
462
529
|
const r = {
|
|
463
530
|
// @ts-ignore
|
|
464
531
|
// JWT "headers" really means JWS "protected headers"
|
|
465
|
-
protected: ye(JSON.stringify(
|
|
532
|
+
protected: ye(JSON.stringify(t)),
|
|
466
533
|
// @ts-ignore
|
|
467
534
|
// JWT "claims" are really a JSON-defined JWS "payload"
|
|
468
|
-
payload: ye(JSON.stringify(
|
|
469
|
-
}, a = o.importKeyAlgorithm, c = !0,
|
|
470
|
-
return r.signature =
|
|
471
|
-
},
|
|
472
|
-
const
|
|
535
|
+
payload: ye(JSON.stringify(s))
|
|
536
|
+
}, a = o.importKeyAlgorithm, c = !0, f = ["sign"], u = await e.crypto.subtle.importKey("jwk", n, a, c, f), l = Ee(`${r.protected}.${r.payload}`), d = o.signAlgorithm, _ = await e.crypto.subtle.sign(d, u, l);
|
|
537
|
+
return r.signature = ce(new Uint8Array(_)), `${r.protected}.${r.payload}.${r.signature}`;
|
|
538
|
+
}, Ye = { sign: qe }, Xe = (e) => async (n) => {
|
|
539
|
+
const t = n, s = !0, o = ["sign", "verify"], i = await e.crypto.subtle.generateKey(t, s, o);
|
|
473
540
|
return await e.crypto.subtle.exportKey("jwk", i.privateKey);
|
|
474
|
-
},
|
|
541
|
+
}, ze = (e) => {
|
|
475
542
|
const n = Object.assign({}, e);
|
|
476
543
|
return delete n.d, n.key_ops = ["verify"], n;
|
|
477
|
-
},
|
|
478
|
-
generate:
|
|
479
|
-
neuter:
|
|
480
|
-
},
|
|
481
|
-
let
|
|
544
|
+
}, Qe = {
|
|
545
|
+
generate: Xe,
|
|
546
|
+
neuter: ze
|
|
547
|
+
}, Ze = (e) => async (n, t) => {
|
|
548
|
+
let s;
|
|
482
549
|
switch (n.kty) {
|
|
483
550
|
case "EC":
|
|
484
|
-
|
|
551
|
+
s = '{"crv":"CRV","kty":"EC","x":"X","y":"Y"}'.replace("CRV", n.crv).replace("X", n.x).replace("Y", n.y);
|
|
485
552
|
break;
|
|
486
553
|
case "RSA":
|
|
487
|
-
|
|
554
|
+
s = '{"e":"E","kty":"RSA","n":"N"}'.replace("E", n.e).replace("N", n.n);
|
|
488
555
|
break;
|
|
489
556
|
default:
|
|
490
557
|
throw new Error("Unknown or not implemented JWK type");
|
|
491
558
|
}
|
|
492
|
-
const o = await e.crypto.subtle.digest(
|
|
493
|
-
return
|
|
494
|
-
},
|
|
559
|
+
const o = await e.crypto.subtle.digest(t, Ee(s));
|
|
560
|
+
return ce(new Uint8Array(o));
|
|
561
|
+
}, en = { thumbprint: Ze }, nn = (e) => async (n) => await Qe.generate(e)(n), be = (e) => (n) => async (t, s = "POST", o, i = {}) => {
|
|
495
562
|
const r = {
|
|
496
563
|
// https://www.rfc-editor.org/rfc/rfc9449.html#name-concept
|
|
497
|
-
jti: btoa(
|
|
498
|
-
htm:
|
|
564
|
+
jti: btoa(tn()),
|
|
565
|
+
htm: s,
|
|
499
566
|
htu: o,
|
|
500
567
|
iat: Math.round(Date.now() / 1e3),
|
|
501
568
|
...i
|
|
502
|
-
}, a = await
|
|
503
|
-
|
|
569
|
+
}, a = await en.thumbprint(e)(
|
|
570
|
+
t,
|
|
504
571
|
n.digestAlgorithm
|
|
505
572
|
);
|
|
506
|
-
return await
|
|
507
|
-
|
|
573
|
+
return await Ye.sign(e)(
|
|
574
|
+
t,
|
|
508
575
|
{ kid: a },
|
|
509
576
|
r,
|
|
510
577
|
n
|
|
511
578
|
);
|
|
512
|
-
},
|
|
579
|
+
}, tn = () => {
|
|
513
580
|
const e = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx", n = "0123456789abcdef";
|
|
514
|
-
let
|
|
581
|
+
let t = 0, s = "";
|
|
515
582
|
for (let o = 0; o < 36; o++)
|
|
516
|
-
e[o] !== "-" && e[o] !== "4" && (
|
|
517
|
-
return
|
|
583
|
+
e[o] !== "-" && e[o] !== "4" && (t = Math.random() * 16 | 0), e[o] === "x" ? s += n[t] : e[o] === "y" ? (t &= 3, t |= 8, s += n[t]) : s += e[o];
|
|
584
|
+
return s;
|
|
518
585
|
}, Pe = () => {
|
|
519
586
|
const e = typeof window < "u" && !!window.crypto, n = e && !!window.crypto.subtle;
|
|
520
587
|
return { hasCrypto: e, hasSubtleCrypto: n };
|
|
521
|
-
},
|
|
588
|
+
}, ee = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", sn = (e) => {
|
|
522
589
|
const n = [];
|
|
523
|
-
for (let
|
|
524
|
-
const
|
|
525
|
-
n.push(
|
|
590
|
+
for (let t = 0; t < e.byteLength; t += 1) {
|
|
591
|
+
const s = e[t] % ee.length;
|
|
592
|
+
n.push(ee[s]);
|
|
526
593
|
}
|
|
527
594
|
return n.join("");
|
|
528
|
-
},
|
|
529
|
-
const n = new Uint8Array(e), { hasCrypto:
|
|
530
|
-
if (
|
|
595
|
+
}, ne = (e) => {
|
|
596
|
+
const n = new Uint8Array(e), { hasCrypto: t } = Pe();
|
|
597
|
+
if (t)
|
|
531
598
|
window.crypto.getRandomValues(n);
|
|
532
599
|
else
|
|
533
|
-
for (let
|
|
534
|
-
n[
|
|
535
|
-
return
|
|
600
|
+
for (let s = 0; s < e; s += 1)
|
|
601
|
+
n[s] = Math.random() * ee.length | 0;
|
|
602
|
+
return sn(n);
|
|
536
603
|
};
|
|
537
|
-
function
|
|
538
|
-
const n = new ArrayBuffer(e.length),
|
|
539
|
-
for (let
|
|
540
|
-
s
|
|
541
|
-
return
|
|
604
|
+
function on(e) {
|
|
605
|
+
const n = new ArrayBuffer(e.length), t = new Uint8Array(n);
|
|
606
|
+
for (let s = 0; s < e.length; s++)
|
|
607
|
+
t[s] = e.charCodeAt(s);
|
|
608
|
+
return t;
|
|
542
609
|
}
|
|
543
610
|
function Ie(e) {
|
|
544
|
-
return new Promise((n,
|
|
545
|
-
crypto.subtle.digest("SHA-256",
|
|
546
|
-
(
|
|
547
|
-
(
|
|
611
|
+
return new Promise((n, t) => {
|
|
612
|
+
crypto.subtle.digest("SHA-256", on(e)).then(
|
|
613
|
+
(s) => n(ce(new Uint8Array(s))),
|
|
614
|
+
(s) => t(s)
|
|
548
615
|
);
|
|
549
616
|
});
|
|
550
617
|
}
|
|
551
|
-
const
|
|
618
|
+
const rn = (e) => {
|
|
552
619
|
if (e.length < 43 || e.length > 128)
|
|
553
620
|
return Promise.reject(new Error("Invalid code length."));
|
|
554
621
|
const { hasSubtleCrypto: n } = Pe();
|
|
555
622
|
return n ? Ie(e) : Promise.reject(new Error("window.crypto.subtle is unavailable."));
|
|
556
|
-
},
|
|
557
|
-
const i = `${n}/.well-known/openid-configuration`, r = `oidc.server:${n}`, a =
|
|
623
|
+
}, an = 3600, cn = (e) => async (n, t = an, s = window.sessionStorage, o = 1e4) => {
|
|
624
|
+
const i = `${n}/.well-known/openid-configuration`, r = `oidc.server:${n}`, a = Je(r, s, t);
|
|
558
625
|
if (a)
|
|
559
|
-
return new
|
|
560
|
-
const c = await
|
|
626
|
+
return new oe(a);
|
|
627
|
+
const c = await H(e)(i, {}, o);
|
|
561
628
|
if (c.status !== 200)
|
|
562
629
|
return null;
|
|
563
|
-
const
|
|
564
|
-
return
|
|
565
|
-
},
|
|
630
|
+
const f = await c.json();
|
|
631
|
+
return He(r, f, s), new oe(f);
|
|
632
|
+
}, H = (e) => async (n, t = {}, s = 1e4, o = 0) => {
|
|
566
633
|
let i;
|
|
567
634
|
try {
|
|
568
635
|
const r = new AbortController();
|
|
569
|
-
setTimeout(() => r.abort(),
|
|
636
|
+
setTimeout(() => r.abort(), s), i = await e(n, { ...t, signal: r.signal });
|
|
570
637
|
} catch (r) {
|
|
571
638
|
if (r.name === "AbortError" || r.message === "Network request failed") {
|
|
572
639
|
if (o <= 1)
|
|
573
|
-
return await
|
|
640
|
+
return await H(e)(n, t, s, o + 1);
|
|
574
641
|
throw r;
|
|
575
642
|
} else
|
|
576
643
|
throw console.error(r.message), r;
|
|
577
644
|
}
|
|
578
645
|
return i;
|
|
579
|
-
},
|
|
646
|
+
}, te = {
|
|
580
647
|
refresh_token: "refresh_token",
|
|
581
648
|
access_token: "access_token"
|
|
582
|
-
}, ke = (e) => async (n,
|
|
649
|
+
}, ke = (e) => async (n, t, s = te.refresh_token, o, i = {}, r = 1e4) => {
|
|
583
650
|
const a = {
|
|
584
|
-
token:
|
|
585
|
-
token_type_hint:
|
|
651
|
+
token: t,
|
|
652
|
+
token_type_hint: s,
|
|
586
653
|
client_id: o
|
|
587
654
|
};
|
|
588
655
|
for (const [l, d] of Object.entries(i))
|
|
589
656
|
a[l] === void 0 && (a[l] = d);
|
|
590
657
|
const c = [];
|
|
591
658
|
for (const l in a) {
|
|
592
|
-
const d = encodeURIComponent(l),
|
|
593
|
-
c.push(`${d}=${
|
|
659
|
+
const d = encodeURIComponent(l), _ = encodeURIComponent(a[l]);
|
|
660
|
+
c.push(`${d}=${_}`);
|
|
594
661
|
}
|
|
595
|
-
const
|
|
596
|
-
return (await
|
|
662
|
+
const f = c.join("&");
|
|
663
|
+
return (await H(e)(
|
|
597
664
|
n,
|
|
598
665
|
{
|
|
599
666
|
method: "POST",
|
|
600
667
|
headers: {
|
|
601
668
|
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
|
|
602
669
|
},
|
|
603
|
-
body:
|
|
670
|
+
body: f
|
|
604
671
|
},
|
|
605
672
|
r
|
|
606
673
|
)).status !== 200 ? { success: !1 } : {
|
|
607
674
|
success: !0
|
|
608
675
|
};
|
|
609
|
-
},
|
|
610
|
-
for (const [
|
|
611
|
-
|
|
676
|
+
}, ln = (e) => async (n, t, s, o, i = {}, r, a = 1e4) => {
|
|
677
|
+
for (const [_, w] of Object.entries(s))
|
|
678
|
+
t[_] === void 0 && (t[_] = w);
|
|
612
679
|
const c = [];
|
|
613
|
-
for (const
|
|
614
|
-
const
|
|
615
|
-
c.push(`${
|
|
680
|
+
for (const _ in t) {
|
|
681
|
+
const w = encodeURIComponent(_), A = encodeURIComponent(t[_]);
|
|
682
|
+
c.push(`${w}=${A}`);
|
|
616
683
|
}
|
|
617
|
-
const
|
|
684
|
+
const f = c.join("&"), u = await H(e)(
|
|
618
685
|
n,
|
|
619
686
|
{
|
|
620
687
|
method: "POST",
|
|
@@ -622,49 +689,49 @@ const sn = (e) => {
|
|
|
622
689
|
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
|
623
690
|
...i
|
|
624
691
|
},
|
|
625
|
-
body:
|
|
692
|
+
body: f
|
|
626
693
|
},
|
|
627
694
|
a
|
|
628
695
|
);
|
|
629
|
-
if (
|
|
696
|
+
if (u.status !== 200)
|
|
630
697
|
return {
|
|
631
698
|
success: !1,
|
|
632
|
-
status:
|
|
699
|
+
status: u.status,
|
|
633
700
|
demonstratingProofOfPossessionNonce: null
|
|
634
701
|
};
|
|
635
|
-
const l = await
|
|
702
|
+
const l = await u.json();
|
|
636
703
|
let d = null;
|
|
637
|
-
return
|
|
638
|
-
|
|
704
|
+
return u.headers.has(Y) && (d = u.headers.get(
|
|
705
|
+
Y
|
|
639
706
|
)), {
|
|
640
707
|
success: !0,
|
|
641
|
-
status:
|
|
642
|
-
data:
|
|
708
|
+
status: u.status,
|
|
709
|
+
data: re(l, o, r),
|
|
643
710
|
demonstratingProofOfPossessionNonce: d
|
|
644
711
|
};
|
|
645
|
-
},
|
|
646
|
-
|
|
647
|
-
const o =
|
|
648
|
-
await e.setCodeVerifierAsync(o), await e.setStateAsync(
|
|
712
|
+
}, un = (e, n) => async (t, s) => {
|
|
713
|
+
s = s ? { ...s } : {};
|
|
714
|
+
const o = ne(128), i = await rn(o);
|
|
715
|
+
await e.setCodeVerifierAsync(o), await e.setStateAsync(s.state), s.code_challenge = i, s.code_challenge_method = "S256";
|
|
649
716
|
let r = "";
|
|
650
|
-
if (
|
|
651
|
-
for (const [a, c] of Object.entries(
|
|
717
|
+
if (s)
|
|
718
|
+
for (const [a, c] of Object.entries(s))
|
|
652
719
|
r === "" ? r += "?" : r += "&", r += `${a}=${encodeURIComponent(c)}`;
|
|
653
|
-
n.open(`${
|
|
654
|
-
},
|
|
655
|
-
|
|
720
|
+
n.open(`${t}${r}`);
|
|
721
|
+
}, Y = "DPoP-Nonce", _n = (e) => async (n, t, s, o, i = 1e4) => {
|
|
722
|
+
t = t ? { ...t } : {}, t.code_verifier = await e.getCodeVerifierAsync();
|
|
656
723
|
const r = [];
|
|
657
|
-
for (const l in
|
|
658
|
-
const d = encodeURIComponent(l),
|
|
659
|
-
r.push(`${d}=${
|
|
724
|
+
for (const l in t) {
|
|
725
|
+
const d = encodeURIComponent(l), _ = encodeURIComponent(t[l]);
|
|
726
|
+
r.push(`${d}=${_}`);
|
|
660
727
|
}
|
|
661
|
-
const a = r.join("&"), c = await
|
|
728
|
+
const a = r.join("&"), c = await H(fetch)(
|
|
662
729
|
n,
|
|
663
730
|
{
|
|
664
731
|
method: "POST",
|
|
665
732
|
headers: {
|
|
666
733
|
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
|
|
667
|
-
...
|
|
734
|
+
...s
|
|
668
735
|
},
|
|
669
736
|
body: a
|
|
670
737
|
},
|
|
@@ -672,60 +739,60 @@ const sn = (e) => {
|
|
|
672
739
|
);
|
|
673
740
|
if (await Promise.all([e.setCodeVerifierAsync(null), e.setStateAsync(null)]), c.status !== 200)
|
|
674
741
|
return { success: !1, status: c.status };
|
|
675
|
-
let
|
|
676
|
-
c.headers.has(
|
|
677
|
-
|
|
742
|
+
let f = null;
|
|
743
|
+
c.headers.has(Y) && (f = c.headers.get(
|
|
744
|
+
Y
|
|
678
745
|
));
|
|
679
|
-
const
|
|
746
|
+
const u = await c.json();
|
|
680
747
|
return {
|
|
681
748
|
success: !0,
|
|
682
749
|
data: {
|
|
683
|
-
state:
|
|
684
|
-
tokens:
|
|
685
|
-
demonstratingProofOfPossessionNonce:
|
|
750
|
+
state: t.state,
|
|
751
|
+
tokens: re(u, null, o),
|
|
752
|
+
demonstratingProofOfPossessionNonce: f
|
|
686
753
|
}
|
|
687
754
|
};
|
|
688
755
|
};
|
|
689
|
-
async function me(e, n,
|
|
756
|
+
async function me(e, n, t, s = null) {
|
|
690
757
|
const o = (c) => {
|
|
691
758
|
e.tokens = c;
|
|
692
|
-
}, { tokens: i, status: r } = await
|
|
759
|
+
}, { tokens: i, status: r } = await G(e)(
|
|
693
760
|
o,
|
|
694
761
|
0,
|
|
695
762
|
0,
|
|
696
763
|
n,
|
|
697
|
-
|
|
698
|
-
|
|
764
|
+
t,
|
|
765
|
+
s
|
|
699
766
|
);
|
|
700
767
|
return await C(e.configuration, e.configurationName) || N(e.configurationName, e.configuration.storage).setTokens(e.tokens), e.tokens ? i : (await e.destroyAsync(r), null);
|
|
701
768
|
}
|
|
702
|
-
async function Ne(e, n = !1,
|
|
769
|
+
async function Ne(e, n = !1, t = null, s = null) {
|
|
703
770
|
const o = e.configuration, i = `${o.client_id}_${e.configurationName}_${o.authority}`;
|
|
704
771
|
let r;
|
|
705
772
|
const a = await C(e.configuration, e.configurationName);
|
|
706
773
|
if (o?.storage === window?.sessionStorage && !a || !navigator.locks)
|
|
707
|
-
r = await me(e, n,
|
|
774
|
+
r = await me(e, n, t, s);
|
|
708
775
|
else {
|
|
709
776
|
let c = "retry";
|
|
710
777
|
for (; c === "retry"; )
|
|
711
778
|
c = await navigator.locks.request(
|
|
712
779
|
i,
|
|
713
780
|
{ ifAvailable: !0 },
|
|
714
|
-
async (
|
|
781
|
+
async (f) => f ? await me(e, n, t, s) : (e.publishEvent(L.eventNames.syncTokensAsync_lock_not_available, {
|
|
715
782
|
lock: "lock not available"
|
|
716
783
|
}), "retry")
|
|
717
784
|
);
|
|
718
785
|
r = c;
|
|
719
786
|
}
|
|
720
|
-
return r ? (e.timeoutId && (e.timeoutId =
|
|
787
|
+
return r ? (e.timeoutId && (e.timeoutId = J(e, e.tokens.expiresAt, t, s)), e.tokens) : null;
|
|
721
788
|
}
|
|
722
|
-
const
|
|
789
|
+
const J = (e, n, t = null, s = null) => {
|
|
723
790
|
const o = e.configuration.refresh_time_before_tokens_expiration_in_second;
|
|
724
|
-
return e.timeoutId &&
|
|
725
|
-
const r = { timeLeft:
|
|
726
|
-
e.publishEvent(
|
|
791
|
+
return e.timeoutId && D.clearTimeout(e.timeoutId), D.setTimeout(async () => {
|
|
792
|
+
const r = { timeLeft: F(o, n) };
|
|
793
|
+
e.publishEvent(L.eventNames.token_timer, r), await Ne(e, !1, t, s);
|
|
727
794
|
}, 1e3);
|
|
728
|
-
},
|
|
795
|
+
}, E = {
|
|
729
796
|
FORCE_REFRESH: "FORCE_REFRESH",
|
|
730
797
|
SESSION_LOST: "SESSION_LOST",
|
|
731
798
|
NOT_CONNECTED: "NOT_CONNECTED",
|
|
@@ -735,15 +802,15 @@ const M = (e, n, s = null, t = null) => {
|
|
|
735
802
|
LOGOUT_FROM_ANOTHER_TAB: "LOGOUT_FROM_ANOTHER_TAB",
|
|
736
803
|
REQUIRE_SYNC_TOKENS: "REQUIRE_SYNC_TOKENS",
|
|
737
804
|
TOKENS_INVALID: "TOKENS_INVALID"
|
|
738
|
-
},
|
|
805
|
+
}, le = (e) => async (n, t, s, o = !1) => {
|
|
739
806
|
const i = { nonce: null };
|
|
740
|
-
if (!
|
|
741
|
-
return { tokens: null, status:
|
|
807
|
+
if (!s)
|
|
808
|
+
return { tokens: null, status: E.NOT_CONNECTED, nonce: i };
|
|
742
809
|
let r = i;
|
|
743
810
|
const a = await e.initAsync(
|
|
744
811
|
n.authority,
|
|
745
812
|
n.authority_configuration
|
|
746
|
-
), c = await C(n,
|
|
813
|
+
), c = await C(n, t);
|
|
747
814
|
if (c) {
|
|
748
815
|
const { status: l, tokens: d } = await c.initAsync(
|
|
749
816
|
a,
|
|
@@ -753,92 +820,92 @@ const M = (e, n, s = null, t = null) => {
|
|
|
753
820
|
if (l === "LOGGED_OUT")
|
|
754
821
|
return {
|
|
755
822
|
tokens: null,
|
|
756
|
-
status:
|
|
823
|
+
status: E.LOGOUT_FROM_ANOTHER_TAB,
|
|
757
824
|
nonce: i
|
|
758
825
|
};
|
|
759
826
|
if (l === "SESSIONS_LOST")
|
|
760
|
-
return { tokens: null, status:
|
|
827
|
+
return { tokens: null, status: E.SESSION_LOST, nonce: i };
|
|
761
828
|
if (!l || !d)
|
|
762
829
|
return {
|
|
763
830
|
tokens: null,
|
|
764
|
-
status:
|
|
831
|
+
status: E.REQUIRE_SYNC_TOKENS,
|
|
765
832
|
nonce: i
|
|
766
833
|
};
|
|
767
|
-
if (d.issuedAt !==
|
|
768
|
-
const
|
|
834
|
+
if (d.issuedAt !== s.issuedAt) {
|
|
835
|
+
const w = F(
|
|
769
836
|
n.refresh_time_before_tokens_expiration_in_second,
|
|
770
837
|
d.expiresAt
|
|
771
|
-
) > 0 ?
|
|
772
|
-
return { tokens: d, status:
|
|
838
|
+
) > 0 ? E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, A = await c.getNonceAsync();
|
|
839
|
+
return { tokens: d, status: w, nonce: A };
|
|
773
840
|
}
|
|
774
841
|
r = await c.getNonceAsync();
|
|
775
842
|
} else {
|
|
776
|
-
const l = N(
|
|
777
|
-
let { tokens:
|
|
778
|
-
const { status:
|
|
779
|
-
if (
|
|
780
|
-
if (
|
|
781
|
-
return { tokens: null, status:
|
|
782
|
-
if (
|
|
783
|
-
const
|
|
843
|
+
const l = N(t, n.storage ?? sessionStorage), d = await l.initAsync();
|
|
844
|
+
let { tokens: _ } = d;
|
|
845
|
+
const { status: w } = d;
|
|
846
|
+
if (_ && (_ = ie(_, e.tokens, n.token_renew_mode)), _) {
|
|
847
|
+
if (w === "SESSIONS_LOST")
|
|
848
|
+
return { tokens: null, status: E.SESSION_LOST, nonce: i };
|
|
849
|
+
if (_.issuedAt !== s.issuedAt) {
|
|
850
|
+
const g = F(
|
|
784
851
|
n.refresh_time_before_tokens_expiration_in_second,
|
|
785
|
-
|
|
786
|
-
) > 0 ?
|
|
787
|
-
return { tokens:
|
|
852
|
+
_.expiresAt
|
|
853
|
+
) > 0 ? E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID : E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_INVALID, y = await l.getNonceAsync();
|
|
854
|
+
return { tokens: _, status: g, nonce: y };
|
|
788
855
|
}
|
|
789
856
|
} else return {
|
|
790
857
|
tokens: null,
|
|
791
|
-
status:
|
|
858
|
+
status: E.LOGOUT_FROM_ANOTHER_TAB,
|
|
792
859
|
nonce: i
|
|
793
860
|
};
|
|
794
861
|
r = await l.getNonceAsync();
|
|
795
862
|
}
|
|
796
|
-
const
|
|
863
|
+
const u = F(
|
|
797
864
|
n.refresh_time_before_tokens_expiration_in_second,
|
|
798
|
-
|
|
865
|
+
s.expiresAt
|
|
799
866
|
) > 0 ? "TOKENS_VALID" : "TOKENS_INVALID";
|
|
800
|
-
return o ? { tokens:
|
|
801
|
-
},
|
|
867
|
+
return o ? { tokens: s, status: "FORCE_REFRESH", nonce: r } : { tokens: s, status: u, nonce: r };
|
|
868
|
+
}, G = (e) => async (n, t = 0, s = 0, o = !1, i = null, r = null) => {
|
|
802
869
|
if (!navigator.onLine && document.hidden)
|
|
803
870
|
return { tokens: e.tokens, status: "GIVE_UP" };
|
|
804
871
|
let a = 6;
|
|
805
|
-
const c = o ? 2 : 5,
|
|
872
|
+
const c = o ? 2 : 5, f = 5;
|
|
806
873
|
for (; !navigator.onLine && a > 0; )
|
|
807
|
-
await
|
|
874
|
+
await ae({ milliseconds: 1e3 }), a--, e.publishEvent(p.refreshTokensAsync, {
|
|
808
875
|
message: `wait because navigator is offline try ${a}`
|
|
809
876
|
});
|
|
810
|
-
const
|
|
811
|
-
if (
|
|
877
|
+
const u = document.hidden, l = u ? t : t + 1, d = u ? s + 1 : s;
|
|
878
|
+
if (t >= c || s >= f)
|
|
812
879
|
return n(null), e.publishEvent(p.refreshTokensAsync_error, { message: "refresh token" }), { tokens: null, status: "SESSION_LOST" };
|
|
813
880
|
i || (i = {});
|
|
814
|
-
const
|
|
881
|
+
const _ = e.configuration, w = (g, y = null, S = null) => ue(
|
|
815
882
|
e.configurationName,
|
|
816
883
|
e.configuration,
|
|
817
884
|
e.publishEvent.bind(e)
|
|
818
|
-
)(
|
|
885
|
+
)(g, y, S), A = async () => {
|
|
819
886
|
try {
|
|
820
|
-
let
|
|
821
|
-
const
|
|
822
|
-
|
|
823
|
-
const
|
|
824
|
-
if (
|
|
825
|
-
for (const [
|
|
826
|
-
|
|
887
|
+
let g;
|
|
888
|
+
const y = await C(_, e.configurationName);
|
|
889
|
+
y ? g = y.getLoginParams() : g = N(e.configurationName, _.storage).getLoginParams();
|
|
890
|
+
const S = {};
|
|
891
|
+
if (g && g.extras)
|
|
892
|
+
for (const [v, h] of Object.entries(g.extras))
|
|
893
|
+
S[v] = h;
|
|
827
894
|
if (i)
|
|
828
|
-
for (const [
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
const
|
|
832
|
-
return
|
|
895
|
+
for (const [v, h] of Object.entries(i))
|
|
896
|
+
S[v] = h;
|
|
897
|
+
S.prompt = "none", r && (S.scope = r);
|
|
898
|
+
const T = await w(S);
|
|
899
|
+
return T ? T.error ? (n(null), e.publishEvent(p.refreshTokensAsync_error, {
|
|
833
900
|
message: "refresh token silent"
|
|
834
|
-
}), { tokens: null, status: "SESSION_LOST" }) : (n(
|
|
901
|
+
}), { tokens: null, status: "SESSION_LOST" }) : (n(T.tokens), e.publishEvent(L.eventNames.token_renewed, {}), { tokens: T.tokens, status: "LOGGED" }) : (n(null), e.publishEvent(p.refreshTokensAsync_error, {
|
|
835
902
|
message: "refresh token silent not active"
|
|
836
903
|
}), { tokens: null, status: "SESSION_LOST" });
|
|
837
|
-
} catch (
|
|
838
|
-
return console.error(
|
|
904
|
+
} catch (g) {
|
|
905
|
+
return console.error(g), e.publishEvent(p.refreshTokensAsync_silent_error, {
|
|
839
906
|
message: "exceptionSilent",
|
|
840
|
-
exception:
|
|
841
|
-
}), await
|
|
907
|
+
exception: g.message
|
|
908
|
+
}), await G(e)(
|
|
842
909
|
n,
|
|
843
910
|
l,
|
|
844
911
|
d,
|
|
@@ -849,96 +916,96 @@ const M = (e, n, s = null, t = null) => {
|
|
|
849
916
|
}
|
|
850
917
|
};
|
|
851
918
|
try {
|
|
852
|
-
const { status:
|
|
853
|
-
|
|
919
|
+
const { status: g, tokens: y, nonce: S } = await le(e)(
|
|
920
|
+
_,
|
|
854
921
|
e.configurationName,
|
|
855
922
|
e.tokens,
|
|
856
923
|
o
|
|
857
924
|
);
|
|
858
|
-
switch (
|
|
859
|
-
case
|
|
925
|
+
switch (g) {
|
|
926
|
+
case E.SESSION_LOST:
|
|
860
927
|
return n(null), e.publishEvent(p.refreshTokensAsync_error, {
|
|
861
928
|
message: "refresh token session lost"
|
|
862
929
|
}), { tokens: null, status: "SESSION_LOST" };
|
|
863
|
-
case
|
|
930
|
+
case E.NOT_CONNECTED:
|
|
864
931
|
return n(null), { tokens: null, status: null };
|
|
865
|
-
case
|
|
866
|
-
return n(
|
|
867
|
-
case
|
|
868
|
-
return n(
|
|
932
|
+
case E.TOKENS_VALID:
|
|
933
|
+
return n(y), { tokens: y, status: "LOGGED_IN" };
|
|
934
|
+
case E.TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID:
|
|
935
|
+
return n(y), e.publishEvent(L.eventNames.token_renewed, {
|
|
869
936
|
reason: "TOKEN_UPDATED_BY_ANOTHER_TAB_TOKENS_VALID"
|
|
870
|
-
}), { tokens:
|
|
871
|
-
case
|
|
937
|
+
}), { tokens: y, status: "LOGGED_IN" };
|
|
938
|
+
case E.LOGOUT_FROM_ANOTHER_TAB:
|
|
872
939
|
return n(null), e.publishEvent(p.logout_from_another_tab, {
|
|
873
940
|
status: "session syncTokensAsync"
|
|
874
941
|
}), { tokens: null, status: "LOGGED_OUT" };
|
|
875
|
-
case
|
|
876
|
-
return
|
|
942
|
+
case E.REQUIRE_SYNC_TOKENS:
|
|
943
|
+
return _.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted && !o ? (e.publishEvent(p.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" }) : (e.publishEvent(p.refreshTokensAsync_begin, { tryNumber: t }), await A());
|
|
877
944
|
default: {
|
|
878
|
-
if (
|
|
945
|
+
if (_.token_automatic_renew_mode == B.AutomaticOnlyWhenFetchExecuted && E.FORCE_REFRESH !== g)
|
|
879
946
|
return e.publishEvent(p.tokensInvalidAndWaitingActionsToRefresh, {}), { tokens: e.tokens, status: "GIVE_UP" };
|
|
880
947
|
if (e.publishEvent(p.refreshTokensAsync_begin, {
|
|
881
|
-
refreshToken:
|
|
882
|
-
status:
|
|
883
|
-
tryNumber:
|
|
884
|
-
backgroundTry:
|
|
885
|
-
}), !
|
|
886
|
-
return await
|
|
887
|
-
const
|
|
888
|
-
for (const [
|
|
889
|
-
|
|
948
|
+
refreshToken: y.refreshToken,
|
|
949
|
+
status: g,
|
|
950
|
+
tryNumber: t,
|
|
951
|
+
backgroundTry: s
|
|
952
|
+
}), !y.refreshToken)
|
|
953
|
+
return await A();
|
|
954
|
+
const T = _.client_id, v = _.redirect_uri, h = _.authority, x = { ..._.token_request_extras ? _.token_request_extras : {} };
|
|
955
|
+
for (const [b, m] of Object.entries(i))
|
|
956
|
+
b.endsWith(":token_request") && (x[b.replace(":token_request", "")] = m);
|
|
890
957
|
return await (async () => {
|
|
891
|
-
const
|
|
892
|
-
client_id:
|
|
893
|
-
redirect_uri:
|
|
958
|
+
const b = {
|
|
959
|
+
client_id: T,
|
|
960
|
+
redirect_uri: v,
|
|
894
961
|
grant_type: "refresh_token",
|
|
895
|
-
refresh_token:
|
|
896
|
-
},
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
), W = document.hidden ? 1e4 : 3e4 * 10,
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
962
|
+
refresh_token: y.refreshToken
|
|
963
|
+
}, m = await e.initAsync(
|
|
964
|
+
h,
|
|
965
|
+
_.authority_configuration
|
|
966
|
+
), W = document.hidden ? 1e4 : 3e4 * 10, V = m.tokenEndpoint, _e = {};
|
|
967
|
+
_.demonstrating_proof_of_possession && (_e.DPoP = await e.generateDemonstrationOfProofOfPossessionAsync(
|
|
968
|
+
y.accessToken,
|
|
969
|
+
V,
|
|
903
970
|
"POST"
|
|
904
971
|
));
|
|
905
|
-
const I = await
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
972
|
+
const I = await ln(e.getFetch())(
|
|
973
|
+
V,
|
|
974
|
+
b,
|
|
975
|
+
x,
|
|
976
|
+
y,
|
|
910
977
|
_e,
|
|
911
|
-
|
|
978
|
+
_.token_renew_mode,
|
|
912
979
|
W
|
|
913
980
|
);
|
|
914
981
|
if (I.success) {
|
|
915
|
-
const { isValid:
|
|
982
|
+
const { isValid: We, reason: Le } = Se(
|
|
916
983
|
I.data,
|
|
917
|
-
|
|
918
|
-
|
|
984
|
+
S.nonce,
|
|
985
|
+
m
|
|
919
986
|
);
|
|
920
|
-
if (!
|
|
987
|
+
if (!We)
|
|
921
988
|
return n(null), e.publishEvent(p.refreshTokensAsync_error, {
|
|
922
|
-
message: `refresh token return not valid tokens, reason: ${
|
|
989
|
+
message: `refresh token return not valid tokens, reason: ${Le}`
|
|
923
990
|
}), { tokens: null, status: "SESSION_LOST" };
|
|
924
991
|
if (n(I.data), I.demonstratingProofOfPossessionNonce) {
|
|
925
|
-
const fe = await C(
|
|
992
|
+
const fe = await C(_, e.configurationName);
|
|
926
993
|
fe ? await fe.setDemonstratingProofOfPossessionNonce(
|
|
927
994
|
I.demonstratingProofOfPossessionNonce
|
|
928
|
-
) : await N(e.configurationName,
|
|
995
|
+
) : await N(e.configurationName, _.storage).setDemonstratingProofOfPossessionNonce(
|
|
929
996
|
I.demonstratingProofOfPossessionNonce
|
|
930
997
|
);
|
|
931
998
|
}
|
|
932
999
|
return e.publishEvent(p.refreshTokensAsync_end, {
|
|
933
1000
|
success: I.success
|
|
934
|
-
}), e.publishEvent(
|
|
1001
|
+
}), e.publishEvent(L.eventNames.token_renewed, { reason: "REFRESH_TOKEN" }), { tokens: I.data, status: "LOGGED_IN" };
|
|
935
1002
|
} else
|
|
936
1003
|
return e.publishEvent(p.refreshTokensAsync_silent_error, {
|
|
937
1004
|
message: "bad request",
|
|
938
1005
|
tokenResponse: I
|
|
939
1006
|
}), I.status >= 400 && I.status < 500 ? (n(null), e.publishEvent(p.refreshTokensAsync_error, {
|
|
940
1007
|
message: `session lost: ${I.status}`
|
|
941
|
-
}), { tokens: null, status: "SESSION_LOST" }) : await
|
|
1008
|
+
}), { tokens: null, status: "SESSION_LOST" }) : await G(e)(
|
|
942
1009
|
n,
|
|
943
1010
|
l,
|
|
944
1011
|
d,
|
|
@@ -949,153 +1016,153 @@ const M = (e, n, s = null, t = null) => {
|
|
|
949
1016
|
})();
|
|
950
1017
|
}
|
|
951
1018
|
}
|
|
952
|
-
} catch (
|
|
953
|
-
return console.error(
|
|
1019
|
+
} catch (g) {
|
|
1020
|
+
return console.error(g), e.publishEvent(p.refreshTokensAsync_silent_error, {
|
|
954
1021
|
message: "exception",
|
|
955
|
-
exception:
|
|
956
|
-
}), new Promise((
|
|
1022
|
+
exception: g.message
|
|
1023
|
+
}), new Promise((y, S) => {
|
|
957
1024
|
setTimeout(() => {
|
|
958
|
-
|
|
1025
|
+
G(e)(
|
|
959
1026
|
n,
|
|
960
1027
|
l,
|
|
961
1028
|
d,
|
|
962
1029
|
o,
|
|
963
1030
|
i,
|
|
964
1031
|
r
|
|
965
|
-
).then(
|
|
1032
|
+
).then(y).catch(S);
|
|
966
1033
|
}, 1e3);
|
|
967
1034
|
});
|
|
968
1035
|
}
|
|
969
|
-
},
|
|
1036
|
+
}, ue = (e, n, t) => (s = null, o = null, i = null) => {
|
|
970
1037
|
if (!n.silent_redirect_uri || !n.silent_login_uri)
|
|
971
1038
|
return Promise.resolve(null);
|
|
972
1039
|
try {
|
|
973
|
-
|
|
1040
|
+
t(p.silentLoginAsync_begin, {});
|
|
974
1041
|
let r = "";
|
|
975
|
-
if (o && (
|
|
976
|
-
for (const [l, d] of Object.entries(
|
|
1042
|
+
if (o && (s == null && (s = {}), s.state = o), i != null && (s == null && (s = {}), s.scope = i), s != null)
|
|
1043
|
+
for (const [l, d] of Object.entries(s))
|
|
977
1044
|
r === "" ? r = `?${encodeURIComponent(l)}=${encodeURIComponent(d)}` : r += `&${encodeURIComponent(l)}=${encodeURIComponent(d)}`;
|
|
978
|
-
const a = n.silent_login_uri + r, c = a.indexOf("/", a.indexOf("//") + 2),
|
|
979
|
-
return
|
|
980
|
-
let
|
|
981
|
-
const
|
|
982
|
-
window.removeEventListener("message",
|
|
983
|
-
},
|
|
984
|
-
if (
|
|
985
|
-
const
|
|
986
|
-
if (
|
|
987
|
-
if (
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
} else if (
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
} else if (
|
|
994
|
-
const
|
|
995
|
-
|
|
1045
|
+
const a = n.silent_login_uri + r, c = a.indexOf("/", a.indexOf("//") + 2), f = a.substring(0, c), u = document.createElement("iframe");
|
|
1046
|
+
return u.width = "0px", u.height = "0px", u.id = `${e}_oidc_iframe`, u.setAttribute("src", a), u.style.display = "none", document.body.appendChild(u), new Promise((l, d) => {
|
|
1047
|
+
let _ = !1;
|
|
1048
|
+
const w = () => {
|
|
1049
|
+
window.removeEventListener("message", A), u.remove(), _ = !0;
|
|
1050
|
+
}, A = (g) => {
|
|
1051
|
+
if (g.origin === f && g.source === u.contentWindow) {
|
|
1052
|
+
const y = `${e}_oidc_tokens:`, S = `${e}_oidc_error:`, T = `${e}_oidc_exception:`, v = g.data;
|
|
1053
|
+
if (v && typeof v == "string" && !_) {
|
|
1054
|
+
if (v.startsWith(y)) {
|
|
1055
|
+
const h = JSON.parse(g.data.replace(y, ""));
|
|
1056
|
+
t(p.silentLoginAsync_end, {}), l(h), w();
|
|
1057
|
+
} else if (v.startsWith(S)) {
|
|
1058
|
+
const h = JSON.parse(g.data.replace(S, ""));
|
|
1059
|
+
t(p.silentLoginAsync_error, h), l({ error: "oidc_" + h.error, tokens: null, sessionState: null }), w();
|
|
1060
|
+
} else if (v.startsWith(T)) {
|
|
1061
|
+
const h = JSON.parse(g.data.replace(T, ""));
|
|
1062
|
+
t(p.silentLoginAsync_error, h), d(new Error(h.error)), w();
|
|
996
1063
|
}
|
|
997
1064
|
}
|
|
998
1065
|
}
|
|
999
1066
|
};
|
|
1000
1067
|
try {
|
|
1001
|
-
window.addEventListener("message",
|
|
1002
|
-
const
|
|
1068
|
+
window.addEventListener("message", A);
|
|
1069
|
+
const g = n.silent_login_timeout;
|
|
1003
1070
|
setTimeout(() => {
|
|
1004
|
-
|
|
1005
|
-
},
|
|
1006
|
-
} catch (
|
|
1007
|
-
|
|
1071
|
+
_ || (w(), t(p.silentLoginAsync_error, { reason: "timeout" }), d(new Error("timeout")));
|
|
1072
|
+
}, g);
|
|
1073
|
+
} catch (g) {
|
|
1074
|
+
w(), t(p.silentLoginAsync_error, g), d(g);
|
|
1008
1075
|
}
|
|
1009
1076
|
});
|
|
1010
1077
|
} catch (r) {
|
|
1011
|
-
throw
|
|
1078
|
+
throw t(p.silentLoginAsync_error, r), r;
|
|
1012
1079
|
}
|
|
1013
|
-
},
|
|
1080
|
+
}, fn = (e, n, t, s, o) => (i = null, r = void 0) => {
|
|
1014
1081
|
i = { ...i };
|
|
1015
|
-
const a = (
|
|
1016
|
-
_,
|
|
1082
|
+
const a = (f, u, l) => ue(n, t, s.bind(o))(
|
|
1017
1083
|
f,
|
|
1084
|
+
u,
|
|
1018
1085
|
l
|
|
1019
1086
|
);
|
|
1020
1087
|
return (async () => {
|
|
1021
|
-
o.timeoutId &&
|
|
1022
|
-
let
|
|
1023
|
-
i && "state" in i && (
|
|
1088
|
+
o.timeoutId && D.clearTimeout(o.timeoutId);
|
|
1089
|
+
let f;
|
|
1090
|
+
i && "state" in i && (f = i.state, delete i.state);
|
|
1024
1091
|
try {
|
|
1025
|
-
const
|
|
1092
|
+
const u = t.extras ? { ...t.extras, ...i } : i, l = await a(
|
|
1026
1093
|
{
|
|
1027
|
-
...
|
|
1094
|
+
...u,
|
|
1028
1095
|
prompt: "none"
|
|
1029
1096
|
},
|
|
1030
|
-
|
|
1097
|
+
f,
|
|
1031
1098
|
r
|
|
1032
1099
|
);
|
|
1033
1100
|
if (l)
|
|
1034
|
-
return o.tokens = l.tokens,
|
|
1035
|
-
} catch (
|
|
1036
|
-
return
|
|
1101
|
+
return o.tokens = l.tokens, s(p.token_acquired, {}), o.timeoutId = J(o, o.tokens.expiresAt, i, r), {};
|
|
1102
|
+
} catch (u) {
|
|
1103
|
+
return u;
|
|
1037
1104
|
}
|
|
1038
1105
|
})();
|
|
1039
|
-
},
|
|
1040
|
-
const a = (c,
|
|
1106
|
+
}, dn = (e, n, t) => (s, o, i, r = !1) => {
|
|
1107
|
+
const a = (c, f = void 0, u = void 0) => ue(e.configurationName, t, e.publishEvent.bind(e))(
|
|
1041
1108
|
c,
|
|
1042
|
-
|
|
1043
|
-
|
|
1109
|
+
f,
|
|
1110
|
+
u
|
|
1044
1111
|
);
|
|
1045
|
-
return new Promise((c,
|
|
1046
|
-
if (
|
|
1047
|
-
const
|
|
1112
|
+
return new Promise((c, f) => {
|
|
1113
|
+
if (t.silent_login_uri && t.silent_redirect_uri && t.monitor_session && s && i && !r) {
|
|
1114
|
+
const u = () => {
|
|
1048
1115
|
e.checkSessionIFrame.stop();
|
|
1049
1116
|
const l = e.tokens;
|
|
1050
1117
|
if (l === null)
|
|
1051
1118
|
return;
|
|
1052
|
-
const d = l.idToken,
|
|
1119
|
+
const d = l.idToken, _ = l.idTokenPayload;
|
|
1053
1120
|
return a({
|
|
1054
1121
|
prompt: "none",
|
|
1055
1122
|
id_token_hint: d,
|
|
1056
|
-
scope:
|
|
1057
|
-
}).then((
|
|
1058
|
-
if (
|
|
1059
|
-
throw new Error(
|
|
1060
|
-
const
|
|
1061
|
-
if (
|
|
1062
|
-
const
|
|
1063
|
-
e.checkSessionIFrame.start(
|
|
1123
|
+
scope: t.scope || "openid"
|
|
1124
|
+
}).then((w) => {
|
|
1125
|
+
if (w.error)
|
|
1126
|
+
throw new Error(w.error);
|
|
1127
|
+
const A = w.tokens.idTokenPayload;
|
|
1128
|
+
if (_.sub === A.sub) {
|
|
1129
|
+
const g = w.sessionState;
|
|
1130
|
+
e.checkSessionIFrame.start(w.sessionState), _.sid === A.sid ? console.debug(
|
|
1064
1131
|
"SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",
|
|
1065
|
-
|
|
1132
|
+
g
|
|
1066
1133
|
) : console.debug(
|
|
1067
1134
|
"SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",
|
|
1068
|
-
|
|
1135
|
+
g
|
|
1069
1136
|
);
|
|
1070
1137
|
} else
|
|
1071
1138
|
console.debug(
|
|
1072
1139
|
"SessionMonitor._callback: Different subject signed into OP:",
|
|
1073
|
-
|
|
1140
|
+
A.sub
|
|
1074
1141
|
);
|
|
1075
|
-
}).catch(async (
|
|
1142
|
+
}).catch(async (w) => {
|
|
1076
1143
|
console.warn(
|
|
1077
1144
|
"SessionMonitor._callback: Silent login failed, logging out other tabs:",
|
|
1078
|
-
|
|
1145
|
+
w
|
|
1079
1146
|
);
|
|
1080
|
-
for (const [,
|
|
1081
|
-
await
|
|
1147
|
+
for (const [, A] of Object.entries(n))
|
|
1148
|
+
await A.logoutOtherTabAsync(t.client_id, _.sub);
|
|
1082
1149
|
});
|
|
1083
1150
|
};
|
|
1084
1151
|
e.checkSessionIFrame = new De(
|
|
1085
|
-
|
|
1152
|
+
u,
|
|
1086
1153
|
o,
|
|
1087
|
-
|
|
1154
|
+
s
|
|
1088
1155
|
), e.checkSessionIFrame.load().then(() => {
|
|
1089
1156
|
e.checkSessionIFrame.start(i), c(e.checkSessionIFrame);
|
|
1090
1157
|
}).catch((l) => {
|
|
1091
|
-
|
|
1158
|
+
f(l);
|
|
1092
1159
|
});
|
|
1093
1160
|
} else
|
|
1094
1161
|
c(null);
|
|
1095
1162
|
});
|
|
1096
|
-
},
|
|
1097
|
-
const n = e.appVersion,
|
|
1098
|
-
let o =
|
|
1163
|
+
}, hn = (e) => !!(e.os === "iOS" && e.osVersion.startsWith("12") || e.os === "Mac OS X" && e.osVersion.startsWith("10_15_6")), gn = (e) => {
|
|
1164
|
+
const n = e.appVersion, t = e.userAgent, s = "-";
|
|
1165
|
+
let o = s;
|
|
1099
1166
|
const i = [
|
|
1100
1167
|
{ s: "Windows 10", r: /(Windows 10.0|Windows NT 10.0)/ },
|
|
1101
1168
|
{ s: "Windows 8.1", r: /(Windows 8.1|Windows NT 6.3)/ },
|
|
@@ -1130,17 +1197,17 @@ const M = (e, n, s = null, t = null) => {
|
|
|
1130
1197
|
];
|
|
1131
1198
|
for (const a in i) {
|
|
1132
1199
|
const c = i[a];
|
|
1133
|
-
if (c.r.test(
|
|
1200
|
+
if (c.r.test(t)) {
|
|
1134
1201
|
o = c.s;
|
|
1135
1202
|
break;
|
|
1136
1203
|
}
|
|
1137
1204
|
}
|
|
1138
|
-
let r =
|
|
1205
|
+
let r = s;
|
|
1139
1206
|
switch (/Windows/.test(o) && (r = /Windows (.*)/.exec(o)[1], o = "Windows"), o) {
|
|
1140
1207
|
case "Mac OS":
|
|
1141
1208
|
case "Mac OS X":
|
|
1142
1209
|
case "Android":
|
|
1143
|
-
r = /(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\d]+)/.exec(
|
|
1210
|
+
r = /(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([._\d]+)/.exec(t)[1];
|
|
1144
1211
|
break;
|
|
1145
1212
|
case "iOS": {
|
|
1146
1213
|
const a = /OS (\d+)_(\d+)_?(\d+)?/.exec(n);
|
|
@@ -1153,50 +1220,50 @@ const M = (e, n, s = null, t = null) => {
|
|
|
1153
1220
|
osVersion: r
|
|
1154
1221
|
};
|
|
1155
1222
|
};
|
|
1156
|
-
function
|
|
1223
|
+
function yn() {
|
|
1157
1224
|
const e = navigator.userAgent;
|
|
1158
|
-
let n,
|
|
1159
|
-
if (/trident/i.test(
|
|
1225
|
+
let n, t = e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
|
1226
|
+
if (/trident/i.test(t[1]))
|
|
1160
1227
|
return n = /\brv[ :]+(\d+)/g.exec(e) || [], { name: "ie", version: n[1] || "" };
|
|
1161
|
-
if (
|
|
1162
|
-
let
|
|
1163
|
-
if (!
|
|
1228
|
+
if (t[1] === "Chrome" && (n = e.match(/\bOPR|Edge\/(\d+)/), n != null)) {
|
|
1229
|
+
let s = n[1];
|
|
1230
|
+
if (!s) {
|
|
1164
1231
|
const o = e.split(n[0] + "/");
|
|
1165
|
-
o.length > 1 && (
|
|
1232
|
+
o.length > 1 && (s = o[1]);
|
|
1166
1233
|
}
|
|
1167
|
-
return { name: "opera", version:
|
|
1234
|
+
return { name: "opera", version: s };
|
|
1168
1235
|
}
|
|
1169
|
-
return
|
|
1170
|
-
name:
|
|
1171
|
-
version:
|
|
1236
|
+
return t = t[2] ? [t[1], t[2]] : [navigator.appName, navigator.appVersion, "-?"], (n = e.match(/version\/(\d+)/i)) != null && t.splice(1, 1, n[1]), {
|
|
1237
|
+
name: t[0].toLowerCase(),
|
|
1238
|
+
version: t[1]
|
|
1172
1239
|
};
|
|
1173
1240
|
}
|
|
1174
|
-
const
|
|
1175
|
-
const { name: e, version: n } =
|
|
1241
|
+
const kn = () => {
|
|
1242
|
+
const { name: e, version: n } = yn();
|
|
1176
1243
|
if (e === "chrome" && parseInt(n) <= 70 || e === "opera" && (!n || parseInt(n.split(".")[0]) < 80) || e === "ie")
|
|
1177
1244
|
return !1;
|
|
1178
|
-
const
|
|
1179
|
-
return !
|
|
1180
|
-
},
|
|
1245
|
+
const t = gn(navigator);
|
|
1246
|
+
return !hn(t);
|
|
1247
|
+
}, mn = async (e) => {
|
|
1181
1248
|
let n;
|
|
1182
1249
|
if (e.tokens != null)
|
|
1183
1250
|
return !1;
|
|
1184
1251
|
e.publishEvent(p.tryKeepExistingSessionAsync_begin, {});
|
|
1185
1252
|
try {
|
|
1186
|
-
const
|
|
1187
|
-
|
|
1188
|
-
|
|
1253
|
+
const t = e.configuration, s = await e.initAsync(
|
|
1254
|
+
t.authority,
|
|
1255
|
+
t.authority_configuration
|
|
1189
1256
|
);
|
|
1190
|
-
if (n = await C(
|
|
1257
|
+
if (n = await C(t, e.configurationName), n) {
|
|
1191
1258
|
const { tokens: o } = await n.initAsync(
|
|
1192
|
-
|
|
1259
|
+
s,
|
|
1193
1260
|
"tryKeepExistingSessionAsync",
|
|
1194
|
-
|
|
1261
|
+
t
|
|
1195
1262
|
);
|
|
1196
1263
|
if (o) {
|
|
1197
1264
|
n.startKeepAliveServiceWorker(), e.tokens = o;
|
|
1198
1265
|
const i = n.getLoginParams(e.configurationName);
|
|
1199
|
-
e.timeoutId =
|
|
1266
|
+
e.timeoutId = J(
|
|
1200
1267
|
e,
|
|
1201
1268
|
e.tokens.expiresAt,
|
|
1202
1269
|
i.extras,
|
|
@@ -1204,10 +1271,10 @@ const hn = () => {
|
|
|
1204
1271
|
);
|
|
1205
1272
|
const r = await n.getSessionStateAsync();
|
|
1206
1273
|
return await e.startCheckSessionAsync(
|
|
1207
|
-
|
|
1208
|
-
|
|
1274
|
+
s.checkSessionIframe,
|
|
1275
|
+
t.client_id,
|
|
1209
1276
|
r
|
|
1210
|
-
),
|
|
1277
|
+
), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(p.tryKeepExistingSessionAsync_end, {
|
|
1211
1278
|
success: !0,
|
|
1212
1279
|
message: "tokens inside ServiceWorker are valid"
|
|
1213
1280
|
}), !0;
|
|
@@ -1217,14 +1284,14 @@ const hn = () => {
|
|
|
1217
1284
|
message: "no exiting session found"
|
|
1218
1285
|
});
|
|
1219
1286
|
} else {
|
|
1220
|
-
|
|
1287
|
+
t.service_worker_relative_url && e.publishEvent(p.service_worker_not_supported_by_browser, {
|
|
1221
1288
|
message: "service worker is not supported by this browser"
|
|
1222
1289
|
});
|
|
1223
|
-
const o = N(e.configurationName,
|
|
1290
|
+
const o = N(e.configurationName, t.storage ?? sessionStorage), { tokens: i } = await o.initAsync();
|
|
1224
1291
|
if (i) {
|
|
1225
|
-
e.tokens =
|
|
1292
|
+
e.tokens = ie(i, null, t.token_renew_mode);
|
|
1226
1293
|
const r = o.getLoginParams();
|
|
1227
|
-
e.timeoutId =
|
|
1294
|
+
e.timeoutId = J(
|
|
1228
1295
|
e,
|
|
1229
1296
|
e.tokens.expiresAt,
|
|
1230
1297
|
r.extras,
|
|
@@ -1232,10 +1299,10 @@ const hn = () => {
|
|
|
1232
1299
|
);
|
|
1233
1300
|
const a = await o.getSessionStateAsync();
|
|
1234
1301
|
return await e.startCheckSessionAsync(
|
|
1235
|
-
|
|
1236
|
-
|
|
1302
|
+
s.checkSessionIframe,
|
|
1303
|
+
t.client_id,
|
|
1237
1304
|
a
|
|
1238
|
-
),
|
|
1305
|
+
), t.preload_user_info && await e.userInfoAsync(), e.publishEvent(p.tryKeepExistingSessionAsync_end, {
|
|
1239
1306
|
success: !0,
|
|
1240
1307
|
message: "tokens inside storage are valid"
|
|
1241
1308
|
}), !0;
|
|
@@ -1245,8 +1312,8 @@ const hn = () => {
|
|
|
1245
1312
|
success: !1,
|
|
1246
1313
|
message: n ? "service worker sessions not retrieved" : "session storage sessions not retrieved"
|
|
1247
1314
|
}), !1;
|
|
1248
|
-
} catch (
|
|
1249
|
-
return console.error(
|
|
1315
|
+
} catch (t) {
|
|
1316
|
+
return console.error(t), n && await n.clearAsync(), e.publishEvent(
|
|
1250
1317
|
p.tryKeepExistingSessionAsync_error,
|
|
1251
1318
|
"tokens inside ServiceWorker are invalid"
|
|
1252
1319
|
), !1;
|
|
@@ -1258,324 +1325,324 @@ const hn = () => {
|
|
|
1258
1325
|
);
|
|
1259
1326
|
if (!n)
|
|
1260
1327
|
throw new Error("Invalid URL");
|
|
1261
|
-
let
|
|
1262
|
-
if (
|
|
1263
|
-
const o =
|
|
1264
|
-
o.length === 2 && (
|
|
1328
|
+
let t = n[6], s = n[7];
|
|
1329
|
+
if (s) {
|
|
1330
|
+
const o = s.split("?");
|
|
1331
|
+
o.length === 2 && (s = o[0], t = o[1]);
|
|
1265
1332
|
}
|
|
1266
|
-
return
|
|
1333
|
+
return t.startsWith("?") && (t = t.slice(1)), n && {
|
|
1267
1334
|
href: e,
|
|
1268
1335
|
protocol: n[1],
|
|
1269
1336
|
host: n[2],
|
|
1270
1337
|
hostname: n[3],
|
|
1271
1338
|
port: n[4],
|
|
1272
1339
|
path: n[5],
|
|
1273
|
-
search:
|
|
1274
|
-
hash:
|
|
1340
|
+
search: t,
|
|
1341
|
+
hash: s
|
|
1275
1342
|
};
|
|
1276
|
-
},
|
|
1343
|
+
}, Cn = (e) => {
|
|
1277
1344
|
const n = Ce(e);
|
|
1278
|
-
let { path:
|
|
1279
|
-
|
|
1280
|
-
let { hash:
|
|
1281
|
-
return
|
|
1345
|
+
let { path: t } = n;
|
|
1346
|
+
t.endsWith("/") && (t = t.slice(0, -1));
|
|
1347
|
+
let { hash: s } = n;
|
|
1348
|
+
return s === "#_=_" && (s = ""), s && (t += s), t;
|
|
1282
1349
|
}, se = (e) => {
|
|
1283
|
-
const n = Ce(e), { search:
|
|
1284
|
-
return
|
|
1285
|
-
},
|
|
1350
|
+
const n = Ce(e), { search: t } = n;
|
|
1351
|
+
return wn(t);
|
|
1352
|
+
}, wn = (e) => {
|
|
1286
1353
|
const n = {};
|
|
1287
|
-
let
|
|
1354
|
+
let t, s, o;
|
|
1288
1355
|
const i = e.split("&");
|
|
1289
|
-
for (
|
|
1290
|
-
|
|
1356
|
+
for (s = 0, o = i.length; s < o; s++)
|
|
1357
|
+
t = i[s].split("="), n[decodeURIComponent(t[0])] = decodeURIComponent(t[1]);
|
|
1291
1358
|
return n;
|
|
1292
|
-
},
|
|
1293
|
-
const
|
|
1359
|
+
}, pn = (e, n, t, s, o) => (i = void 0, r = null, a = !1, c = void 0) => {
|
|
1360
|
+
const f = r;
|
|
1294
1361
|
return r = { ...r }, (async () => {
|
|
1295
1362
|
const l = i || o.getPath();
|
|
1296
|
-
if ("state" in r || (r.state =
|
|
1363
|
+
if ("state" in r || (r.state = ne(16)), t(p.loginAsync_begin, {}), r)
|
|
1297
1364
|
for (const d of Object.keys(r))
|
|
1298
1365
|
d.endsWith(":token_request") && delete r[d];
|
|
1299
1366
|
try {
|
|
1300
1367
|
const d = a ? n.silent_redirect_uri : n.redirect_uri;
|
|
1301
1368
|
c || (c = n.scope);
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1304
|
-
const
|
|
1369
|
+
const _ = n.extras ? { ...n.extras, ...r } : r;
|
|
1370
|
+
_.nonce || (_.nonce = ne(12));
|
|
1371
|
+
const w = { nonce: _.nonce }, A = await C(n, e), g = await s(
|
|
1305
1372
|
n.authority,
|
|
1306
1373
|
n.authority_configuration
|
|
1307
1374
|
);
|
|
1308
|
-
let
|
|
1309
|
-
if (
|
|
1310
|
-
|
|
1375
|
+
let y;
|
|
1376
|
+
if (A)
|
|
1377
|
+
A.setLoginParams({ callbackPath: l, extras: f, scope: c }), await A.initAsync(g, "loginAsync", n), await A.setNonceAsync(w), A.startKeepAliveServiceWorker(), y = A;
|
|
1311
1378
|
else {
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1379
|
+
const T = N(e, n.storage ?? sessionStorage);
|
|
1380
|
+
T.setLoginParams({ callbackPath: l, extras: f, scope: c }), await T.setNonceAsync(w), y = T;
|
|
1314
1381
|
}
|
|
1315
|
-
const
|
|
1382
|
+
const S = {
|
|
1316
1383
|
client_id: n.client_id,
|
|
1317
1384
|
redirect_uri: d,
|
|
1318
1385
|
scope: c,
|
|
1319
1386
|
response_type: "code",
|
|
1320
|
-
...
|
|
1387
|
+
..._
|
|
1321
1388
|
};
|
|
1322
|
-
await
|
|
1323
|
-
|
|
1324
|
-
|
|
1389
|
+
await un(y, o)(
|
|
1390
|
+
g.authorizationEndpoint,
|
|
1391
|
+
S
|
|
1325
1392
|
);
|
|
1326
1393
|
} catch (d) {
|
|
1327
|
-
throw
|
|
1394
|
+
throw t(p.loginAsync_error, d), d;
|
|
1328
1395
|
}
|
|
1329
1396
|
})();
|
|
1330
|
-
},
|
|
1397
|
+
}, An = (e) => async (n = !1) => {
|
|
1331
1398
|
try {
|
|
1332
1399
|
e.publishEvent(p.loginCallbackAsync_begin, {});
|
|
1333
|
-
const
|
|
1400
|
+
const t = e.configuration, s = t.client_id, o = n ? t.silent_redirect_uri : t.redirect_uri, i = t.authority, r = t.token_request_timeout, a = await e.initAsync(
|
|
1334
1401
|
i,
|
|
1335
|
-
|
|
1336
|
-
), c = e.location.getCurrentHref(),
|
|
1337
|
-
let d,
|
|
1402
|
+
t.authority_configuration
|
|
1403
|
+
), c = e.location.getCurrentHref(), f = se(c), u = f.session_state, l = await C(t, e.configurationName);
|
|
1404
|
+
let d, _, w, A;
|
|
1338
1405
|
if (l)
|
|
1339
|
-
await l.initAsync(a, "loginCallbackAsync",
|
|
1406
|
+
await l.initAsync(a, "loginCallbackAsync", t), await l.setSessionStateAsync(u), _ = await l.getNonceAsync(), w = l.getLoginParams(), A = await l.getStateAsync(), l.startKeepAliveServiceWorker(), d = l;
|
|
1340
1407
|
else {
|
|
1341
|
-
const
|
|
1408
|
+
const m = N(
|
|
1342
1409
|
e.configurationName,
|
|
1343
|
-
|
|
1410
|
+
t.storage ?? sessionStorage
|
|
1344
1411
|
);
|
|
1345
|
-
await
|
|
1412
|
+
await m.setSessionStateAsync(u), _ = await m.getNonceAsync(), w = m.getLoginParams(), A = await m.getStateAsync(), d = m;
|
|
1346
1413
|
}
|
|
1347
|
-
if (
|
|
1414
|
+
if (f.error || f.error_description)
|
|
1348
1415
|
throw new Error(
|
|
1349
|
-
`Error from OIDC server: ${
|
|
1416
|
+
`Error from OIDC server: ${f.error} - ${f.error_description}`
|
|
1350
1417
|
);
|
|
1351
|
-
if (
|
|
1418
|
+
if (f.iss && f.iss !== a.issuer)
|
|
1352
1419
|
throw console.error(), new Error(
|
|
1353
|
-
`Issuer not valid (expected: ${a.issuer}, received: ${
|
|
1420
|
+
`Issuer not valid (expected: ${a.issuer}, received: ${f.iss})`
|
|
1354
1421
|
);
|
|
1355
|
-
if (
|
|
1356
|
-
throw new Error(`State not valid (expected: ${
|
|
1357
|
-
const
|
|
1358
|
-
code:
|
|
1422
|
+
if (f.state && f.state !== A)
|
|
1423
|
+
throw new Error(`State not valid (expected: ${A}, received: ${f.state})`);
|
|
1424
|
+
const g = {
|
|
1425
|
+
code: f.code,
|
|
1359
1426
|
grant_type: "authorization_code",
|
|
1360
|
-
client_id:
|
|
1427
|
+
client_id: t.client_id,
|
|
1361
1428
|
redirect_uri: o
|
|
1362
|
-
},
|
|
1363
|
-
if (
|
|
1364
|
-
for (const [
|
|
1365
|
-
|
|
1366
|
-
if (
|
|
1367
|
-
for (const [
|
|
1368
|
-
|
|
1369
|
-
const
|
|
1370
|
-
if (
|
|
1429
|
+
}, y = {};
|
|
1430
|
+
if (t.token_request_extras)
|
|
1431
|
+
for (const [m, W] of Object.entries(t.token_request_extras))
|
|
1432
|
+
y[m] = W;
|
|
1433
|
+
if (w?.extras)
|
|
1434
|
+
for (const [m, W] of Object.entries(w.extras))
|
|
1435
|
+
m.endsWith(":token_request") && (y[m.replace(":token_request", "")] = W);
|
|
1436
|
+
const S = a.tokenEndpoint, T = {};
|
|
1437
|
+
if (t.demonstrating_proof_of_possession)
|
|
1371
1438
|
if (l)
|
|
1372
|
-
|
|
1439
|
+
T.DPoP = `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${e.configurationName}`;
|
|
1373
1440
|
else {
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1441
|
+
const m = await nn(window)(
|
|
1442
|
+
t.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm
|
|
1376
1443
|
);
|
|
1377
|
-
await N(e.configurationName,
|
|
1378
|
-
|
|
1379
|
-
)(
|
|
1444
|
+
await N(e.configurationName, t.storage).setDemonstratingProofOfPossessionJwkAsync(m), T.DPoP = await be(window)(
|
|
1445
|
+
t.demonstrating_proof_of_possession_configuration
|
|
1446
|
+
)(m, "POST", S);
|
|
1380
1447
|
}
|
|
1381
|
-
const
|
|
1382
|
-
A,
|
|
1383
|
-
{ ...y, ...k },
|
|
1448
|
+
const v = await _n(d)(
|
|
1384
1449
|
S,
|
|
1450
|
+
{ ...g, ...y },
|
|
1451
|
+
T,
|
|
1385
1452
|
e.configuration.token_renew_mode,
|
|
1386
1453
|
r
|
|
1387
1454
|
);
|
|
1388
|
-
if (!
|
|
1455
|
+
if (!v.success)
|
|
1389
1456
|
throw new Error("Token request failed");
|
|
1390
|
-
let
|
|
1391
|
-
const P =
|
|
1392
|
-
if (
|
|
1457
|
+
let h;
|
|
1458
|
+
const P = v.data.tokens, x = v.data.demonstratingProofOfPossessionNonce;
|
|
1459
|
+
if (v.data.state !== y.state)
|
|
1393
1460
|
throw new Error("state is not valid");
|
|
1394
|
-
const { isValid:
|
|
1461
|
+
const { isValid: k, reason: b } = Se(
|
|
1395
1462
|
P,
|
|
1396
|
-
|
|
1463
|
+
_.nonce,
|
|
1397
1464
|
a
|
|
1398
1465
|
);
|
|
1399
|
-
if (!
|
|
1400
|
-
throw new Error(`Tokens are not OpenID valid, reason: ${
|
|
1466
|
+
if (!k)
|
|
1467
|
+
throw new Error(`Tokens are not OpenID valid, reason: ${b}`);
|
|
1401
1468
|
if (l) {
|
|
1402
1469
|
if (P.refreshToken && !P.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
|
|
1403
1470
|
throw new Error("Refresh token should be hidden by service worker");
|
|
1404
|
-
if (
|
|
1471
|
+
if (x && P?.accessToken.includes("SECURED_BY_OIDC_SERVICE_WORKER"))
|
|
1405
1472
|
throw new Error(
|
|
1406
1473
|
"Demonstration of proof of possession require Access token not hidden by service worker"
|
|
1407
1474
|
);
|
|
1408
1475
|
}
|
|
1409
1476
|
if (l)
|
|
1410
|
-
await l.initAsync(a, "syncTokensAsync",
|
|
1411
|
-
|
|
1477
|
+
await l.initAsync(a, "syncTokensAsync", t), h = l.getLoginParams(), x && await l.setDemonstratingProofOfPossessionNonce(
|
|
1478
|
+
x
|
|
1412
1479
|
);
|
|
1413
1480
|
else {
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1481
|
+
const m = N(e.configurationName, t.storage);
|
|
1482
|
+
h = m.getLoginParams(), x && await m.setDemonstratingProofOfPossessionNonce(x);
|
|
1416
1483
|
}
|
|
1417
1484
|
return await e.startCheckSessionAsync(
|
|
1418
1485
|
a.checkSessionIframe,
|
|
1419
|
-
|
|
1420
|
-
|
|
1486
|
+
s,
|
|
1487
|
+
u,
|
|
1421
1488
|
n
|
|
1422
1489
|
), e.publishEvent(p.loginCallbackAsync_end, {}), {
|
|
1423
1490
|
tokens: P,
|
|
1424
1491
|
state: "request.state",
|
|
1425
|
-
callbackPath:
|
|
1426
|
-
scope:
|
|
1427
|
-
extras:
|
|
1492
|
+
callbackPath: h.callbackPath,
|
|
1493
|
+
scope: f.scope,
|
|
1494
|
+
extras: h.extras
|
|
1428
1495
|
};
|
|
1429
|
-
} catch (
|
|
1430
|
-
throw console.error(
|
|
1496
|
+
} catch (t) {
|
|
1497
|
+
throw console.error(t), e.publishEvent(p.loginCallbackAsync_error, t), t;
|
|
1431
1498
|
}
|
|
1432
|
-
},
|
|
1499
|
+
}, we = {
|
|
1433
1500
|
access_token: "access_token",
|
|
1434
1501
|
refresh_token: "refresh_token"
|
|
1435
|
-
},
|
|
1436
|
-
const
|
|
1502
|
+
}, Q = (e, n) => {
|
|
1503
|
+
const t = {};
|
|
1437
1504
|
if (e) {
|
|
1438
|
-
for (const [
|
|
1439
|
-
if (
|
|
1440
|
-
const i =
|
|
1441
|
-
|
|
1505
|
+
for (const [s, o] of Object.entries(e))
|
|
1506
|
+
if (s.endsWith(n)) {
|
|
1507
|
+
const i = s.replace(n, "");
|
|
1508
|
+
t[i] = o;
|
|
1442
1509
|
}
|
|
1443
|
-
return
|
|
1510
|
+
return t;
|
|
1444
1511
|
}
|
|
1445
|
-
return
|
|
1446
|
-
},
|
|
1512
|
+
return t;
|
|
1513
|
+
}, Sn = (e) => {
|
|
1447
1514
|
const n = {};
|
|
1448
1515
|
if (e) {
|
|
1449
|
-
for (const [
|
|
1450
|
-
|
|
1516
|
+
for (const [t, s] of Object.entries(e))
|
|
1517
|
+
t.includes(":") || (n[t] = s);
|
|
1451
1518
|
return n;
|
|
1452
1519
|
}
|
|
1453
1520
|
return n;
|
|
1454
|
-
},
|
|
1455
|
-
|
|
1456
|
-
const
|
|
1457
|
-
|
|
1458
|
-
},
|
|
1521
|
+
}, Tn = (e) => async (n) => {
|
|
1522
|
+
D.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
|
|
1523
|
+
const t = await C(e.configuration, e.configurationName);
|
|
1524
|
+
t ? await t.clearAsync(n) : await N(e.configurationName, e.configuration.storage).clearAsync(n), e.tokens = null, e.userInfo = null;
|
|
1525
|
+
}, vn = (e, n, t, s, o) => async (i = void 0, r = null) => {
|
|
1459
1526
|
const a = e.configuration, c = await e.initAsync(
|
|
1460
1527
|
a.authority,
|
|
1461
1528
|
a.authority_configuration
|
|
1462
1529
|
);
|
|
1463
|
-
i && typeof i != "string" && (i = void 0,
|
|
1464
|
-
const
|
|
1465
|
-
let
|
|
1466
|
-
i && (
|
|
1467
|
-
const l =
|
|
1530
|
+
i && typeof i != "string" && (i = void 0, s.warn("callbackPathOrUrl path is not a string"));
|
|
1531
|
+
const f = i ?? o.getPath();
|
|
1532
|
+
let u = !1;
|
|
1533
|
+
i && (u = i.includes("https://") || i.includes("http://"));
|
|
1534
|
+
const l = u ? i : o.getOrigin() + f, d = e.tokens ? e.tokens.idToken : "";
|
|
1468
1535
|
try {
|
|
1469
|
-
const
|
|
1470
|
-
if (
|
|
1471
|
-
const
|
|
1472
|
-
if (
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1536
|
+
const y = c.revocationEndpoint;
|
|
1537
|
+
if (y) {
|
|
1538
|
+
const S = [], T = e.tokens ? e.tokens.accessToken : null;
|
|
1539
|
+
if (T && a.logout_tokens_to_invalidate.includes(we.access_token)) {
|
|
1540
|
+
const h = Q(r, ":revoke_access_token"), P = ke(t)(
|
|
1541
|
+
y,
|
|
1542
|
+
T,
|
|
1543
|
+
te.access_token,
|
|
1477
1544
|
a.client_id,
|
|
1478
|
-
|
|
1545
|
+
h
|
|
1479
1546
|
);
|
|
1480
|
-
|
|
1547
|
+
S.push(P);
|
|
1481
1548
|
}
|
|
1482
|
-
const
|
|
1483
|
-
if (
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1549
|
+
const v = e.tokens ? e.tokens.refreshToken : null;
|
|
1550
|
+
if (v && a.logout_tokens_to_invalidate.includes(we.refresh_token)) {
|
|
1551
|
+
const h = Q(r, ":revoke_refresh_token"), P = ke(t)(
|
|
1552
|
+
y,
|
|
1553
|
+
v,
|
|
1554
|
+
te.refresh_token,
|
|
1488
1555
|
a.client_id,
|
|
1489
|
-
|
|
1556
|
+
h
|
|
1490
1557
|
);
|
|
1491
|
-
|
|
1558
|
+
S.push(P);
|
|
1492
1559
|
}
|
|
1493
|
-
|
|
1560
|
+
S.length > 0 && await Promise.all(S);
|
|
1494
1561
|
}
|
|
1495
|
-
} catch (
|
|
1496
|
-
|
|
1562
|
+
} catch (y) {
|
|
1563
|
+
s.warn(
|
|
1497
1564
|
"logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error"
|
|
1498
|
-
),
|
|
1565
|
+
), s.warn(y);
|
|
1499
1566
|
}
|
|
1500
|
-
const
|
|
1567
|
+
const _ = e.tokens?.idTokenPayload?.sub ?? null;
|
|
1501
1568
|
await e.destroyAsync("LOGGED_OUT");
|
|
1502
|
-
for (const [,
|
|
1503
|
-
|
|
1504
|
-
const
|
|
1505
|
-
if (
|
|
1569
|
+
for (const [, y] of Object.entries(n))
|
|
1570
|
+
y !== e ? await e.logoutSameTabAsync(e.configuration.client_id, _) : e.publishEvent(p.logout_from_same_tab, {});
|
|
1571
|
+
const w = Q(r, ":oidc");
|
|
1572
|
+
if (w && w.no_reload === "true")
|
|
1506
1573
|
return;
|
|
1507
|
-
const
|
|
1574
|
+
const g = Sn(r);
|
|
1508
1575
|
if (c.endSessionEndpoint) {
|
|
1509
|
-
"id_token_hint" in
|
|
1510
|
-
let
|
|
1511
|
-
for (const [
|
|
1512
|
-
|
|
1513
|
-
o.open(`${c.endSessionEndpoint}${
|
|
1576
|
+
"id_token_hint" in g || (g.id_token_hint = d), !("post_logout_redirect_uri" in g) && i !== null && (g.post_logout_redirect_uri = l);
|
|
1577
|
+
let y = "";
|
|
1578
|
+
for (const [S, T] of Object.entries(g))
|
|
1579
|
+
T != null && (y === "" ? y += "?" : y += "&", y += `${S}=${encodeURIComponent(T)}`);
|
|
1580
|
+
o.open(`${c.endSessionEndpoint}${y}`);
|
|
1514
1581
|
} else
|
|
1515
1582
|
o.reload();
|
|
1516
|
-
}, xe = (e, n,
|
|
1517
|
-
const [o, i, ...r] =
|
|
1583
|
+
}, xe = (e, n, t = !1) => async (...s) => {
|
|
1584
|
+
const [o, i, ...r] = s, a = i ? { ...i } : { method: "GET" };
|
|
1518
1585
|
let c = new Headers();
|
|
1519
1586
|
a.headers && (c = a.headers instanceof Headers ? a.headers : new Headers(a.headers));
|
|
1520
|
-
const
|
|
1587
|
+
const f = {
|
|
1521
1588
|
getTokens: () => n.tokens,
|
|
1522
1589
|
configuration: {
|
|
1523
1590
|
token_automatic_renew_mode: n.configuration.token_automatic_renew_mode,
|
|
1524
1591
|
refresh_time_before_tokens_expiration_in_second: n.configuration.refresh_time_before_tokens_expiration_in_second
|
|
1525
1592
|
},
|
|
1526
1593
|
syncTokensInfoAsync: async () => {
|
|
1527
|
-
const { status:
|
|
1594
|
+
const { status: _ } = await le(n)(
|
|
1528
1595
|
n.configuration,
|
|
1529
1596
|
n.configurationName,
|
|
1530
1597
|
n.tokens,
|
|
1531
1598
|
!1
|
|
1532
1599
|
);
|
|
1533
|
-
return
|
|
1600
|
+
return _;
|
|
1534
1601
|
},
|
|
1535
1602
|
renewTokensAsync: n.renewTokensAsync.bind(n)
|
|
1536
|
-
}, l = (await Ae(
|
|
1603
|
+
}, l = (await Ae(f))?.tokens?.accessToken;
|
|
1537
1604
|
if (c.has("Accept") || c.set("Accept", "application/json"), l) {
|
|
1538
|
-
if (n.configuration.demonstrating_proof_of_possession &&
|
|
1539
|
-
const
|
|
1605
|
+
if (n.configuration.demonstrating_proof_of_possession && t) {
|
|
1606
|
+
const _ = await n.generateDemonstrationOfProofOfPossessionAsync(
|
|
1540
1607
|
l,
|
|
1541
1608
|
o.toString(),
|
|
1542
1609
|
a.method
|
|
1543
1610
|
);
|
|
1544
|
-
c.set("Authorization", `DPoP ${l}`), c.set("DPoP",
|
|
1611
|
+
c.set("Authorization", `DPoP ${l}`), c.set("DPoP", _);
|
|
1545
1612
|
} else
|
|
1546
1613
|
c.set("Authorization", `Bearer ${l}`);
|
|
1547
1614
|
a.credentials || (a.credentials = "same-origin");
|
|
1548
1615
|
}
|
|
1549
1616
|
const d = { ...a, headers: c };
|
|
1550
1617
|
return await e(o, d, ...r);
|
|
1551
|
-
},
|
|
1618
|
+
}, En = (e) => async (n = !1, t = !1) => {
|
|
1552
1619
|
if (e.userInfo != null && !n)
|
|
1553
1620
|
return e.userInfo;
|
|
1554
|
-
const
|
|
1555
|
-
if (
|
|
1556
|
-
return e.userInfo = JSON.parse(
|
|
1621
|
+
const s = !n && e.configuration.storage?.getItem(`oidc.${e.configurationName}.userInfo`);
|
|
1622
|
+
if (s)
|
|
1623
|
+
return e.userInfo = JSON.parse(s), e.userInfo;
|
|
1557
1624
|
const o = e.configuration, r = (await e.initAsync(
|
|
1558
1625
|
o.authority,
|
|
1559
1626
|
o.authority_configuration
|
|
1560
1627
|
)).userInfoEndpoint, c = await (async () => {
|
|
1561
|
-
const
|
|
1562
|
-
return
|
|
1628
|
+
const u = await xe(fetch, e, t)(r);
|
|
1629
|
+
return u.status !== 200 ? null : u.json();
|
|
1563
1630
|
})();
|
|
1564
1631
|
return e.userInfo = c, c && e.configuration.storage?.setItem(
|
|
1565
1632
|
`oidc.${e.configurationName}.userInfo`,
|
|
1566
1633
|
JSON.stringify(c)
|
|
1567
1634
|
), c;
|
|
1568
|
-
},
|
|
1569
|
-
class
|
|
1635
|
+
}, On = () => fetch;
|
|
1636
|
+
class oe {
|
|
1570
1637
|
constructor(n) {
|
|
1571
1638
|
this.authorizationEndpoint = n.authorization_endpoint, this.tokenEndpoint = n.token_endpoint, this.revocationEndpoint = n.revocation_endpoint, this.userInfoEndpoint = n.userinfo_endpoint, this.checkSessionIframe = n.check_session_iframe, this.issuer = n.issuer, this.endSessionEndpoint = n.end_session_endpoint;
|
|
1572
1639
|
}
|
|
1573
1640
|
}
|
|
1574
|
-
const
|
|
1575
|
-
const { parsedTokens: n, callbackPath:
|
|
1576
|
-
return e.timeoutId =
|
|
1577
|
-
},
|
|
1578
|
-
constructor(n,
|
|
1641
|
+
const R = {}, bn = (e, n = new j()) => (t, s = "default") => (R[s] || (R[s] = new L(t, s, e, n)), R[s]), Pn = async (e) => {
|
|
1642
|
+
const { parsedTokens: n, callbackPath: t, extras: s, scope: o } = await e.loginCallbackAsync();
|
|
1643
|
+
return e.timeoutId = J(e, n.expiresAt, s, o), { callbackPath: t };
|
|
1644
|
+
}, In = (e) => Math.floor(Math.random() * e), M = class M {
|
|
1645
|
+
constructor(n, t = "default", s, o = new j()) {
|
|
1579
1646
|
this.initPromise = null, this.tryKeepExistingSessionPromise = null, this.loginPromise = null, this.loginCallbackPromise = null, this.loginCallbackWithAutoTokensRenewPromise = null, this.userInfoPromise = null, this.renewTokensPromise = null, this.logoutPromise = null;
|
|
1580
1647
|
let i = n.silent_login_uri;
|
|
1581
1648
|
n.silent_redirect_uri && !n.silent_login_uri && (i = `${n.silent_redirect_uri.replace("-callback", "").replace("callback", "")}-login`);
|
|
@@ -1587,56 +1654,56 @@ const D = {}, vn = (e, n = new j()) => (s, t = "default") => (D[t] || (D[t] = ne
|
|
|
1587
1654
|
monitor_session: n.monitor_session ?? !1,
|
|
1588
1655
|
refresh_time_before_tokens_expiration_in_second: r,
|
|
1589
1656
|
silent_login_timeout: n.silent_login_timeout ?? 12e3,
|
|
1590
|
-
token_renew_mode: n.token_renew_mode ??
|
|
1657
|
+
token_renew_mode: n.token_renew_mode ?? Z.access_token_or_id_token_invalid,
|
|
1591
1658
|
demonstrating_proof_of_possession: n.demonstrating_proof_of_possession ?? !1,
|
|
1592
1659
|
authority_timeout_wellknowurl_in_millisecond: n.authority_timeout_wellknowurl_in_millisecond ?? 1e4,
|
|
1593
1660
|
logout_tokens_to_invalidate: n.logout_tokens_to_invalidate ?? [
|
|
1594
1661
|
"access_token",
|
|
1595
1662
|
"refresh_token"
|
|
1596
1663
|
],
|
|
1597
|
-
service_worker_activate: n.service_worker_activate ??
|
|
1598
|
-
demonstrating_proof_of_possession_configuration: n.demonstrating_proof_of_possession_configuration ??
|
|
1664
|
+
service_worker_activate: n.service_worker_activate ?? kn,
|
|
1665
|
+
demonstrating_proof_of_possession_configuration: n.demonstrating_proof_of_possession_configuration ?? je,
|
|
1599
1666
|
preload_user_info: n.preload_user_info ?? !1
|
|
1600
|
-
}, this.getFetch =
|
|
1667
|
+
}, this.getFetch = s ?? On, this.configurationName = t, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, 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);
|
|
1601
1668
|
}
|
|
1602
1669
|
subscribeEvents(n) {
|
|
1603
|
-
const
|
|
1604
|
-
return this.events.push({ id:
|
|
1670
|
+
const t = In(9999999999999).toString();
|
|
1671
|
+
return this.events.push({ id: t, func: n }), t;
|
|
1605
1672
|
}
|
|
1606
1673
|
removeEventSubscription(n) {
|
|
1607
|
-
const
|
|
1608
|
-
this.events =
|
|
1674
|
+
const t = this.events.filter((s) => s.id !== n);
|
|
1675
|
+
this.events = t;
|
|
1609
1676
|
}
|
|
1610
|
-
publishEvent(n,
|
|
1611
|
-
this.events.forEach((
|
|
1612
|
-
|
|
1677
|
+
publishEvent(n, t) {
|
|
1678
|
+
this.events.forEach((s) => {
|
|
1679
|
+
s.func(n, t);
|
|
1613
1680
|
});
|
|
1614
1681
|
}
|
|
1615
1682
|
static get(n = "default") {
|
|
1616
|
-
const
|
|
1617
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
1683
|
+
const t = typeof process > "u";
|
|
1684
|
+
if (!Object.prototype.hasOwnProperty.call(R, n) && t)
|
|
1618
1685
|
throw Error(`OIDC library does seem initialized.
|
|
1619
1686
|
Please checkout that you are using OIDC hook inside a <OidcProvider configurationName="${n}"></OidcProvider> component.`);
|
|
1620
|
-
return
|
|
1687
|
+
return R[n];
|
|
1621
1688
|
}
|
|
1622
1689
|
_silentLoginCallbackFromIFrame() {
|
|
1623
1690
|
if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
|
|
1624
|
-
const n = this.location,
|
|
1691
|
+
const n = this.location, t = se(n.getCurrentHref());
|
|
1625
1692
|
window.parent.postMessage(
|
|
1626
|
-
`${this.configurationName}_oidc_tokens:${JSON.stringify({ tokens: this.tokens, sessionState:
|
|
1693
|
+
`${this.configurationName}_oidc_tokens:${JSON.stringify({ tokens: this.tokens, sessionState: t.session_state })}`,
|
|
1627
1694
|
n.getOrigin()
|
|
1628
1695
|
);
|
|
1629
1696
|
}
|
|
1630
1697
|
}
|
|
1631
1698
|
_silentLoginErrorCallbackFromIFrame(n = null) {
|
|
1632
1699
|
if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1635
|
-
`${this.configurationName}_oidc_error:${JSON.stringify({ error:
|
|
1636
|
-
|
|
1700
|
+
const t = this.location, s = se(t.getCurrentHref());
|
|
1701
|
+
s.error ? window.parent.postMessage(
|
|
1702
|
+
`${this.configurationName}_oidc_error:${JSON.stringify({ error: s.error })}`,
|
|
1703
|
+
t.getOrigin()
|
|
1637
1704
|
) : window.parent.postMessage(
|
|
1638
1705
|
`${this.configurationName}_oidc_exception:${JSON.stringify({ error: n == null ? "" : n.toString() })}`,
|
|
1639
|
-
|
|
1706
|
+
t.getOrigin()
|
|
1640
1707
|
);
|
|
1641
1708
|
}
|
|
1642
1709
|
}
|
|
@@ -1647,133 +1714,133 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1647
1714
|
console.error(n), this._silentLoginErrorCallbackFromIFrame(n);
|
|
1648
1715
|
}
|
|
1649
1716
|
}
|
|
1650
|
-
async initAsync(n,
|
|
1717
|
+
async initAsync(n, t) {
|
|
1651
1718
|
if (this.initPromise !== null)
|
|
1652
1719
|
return this.initPromise;
|
|
1653
|
-
const
|
|
1654
|
-
if (
|
|
1655
|
-
return new
|
|
1656
|
-
authorization_endpoint:
|
|
1657
|
-
end_session_endpoint:
|
|
1658
|
-
revocation_endpoint:
|
|
1659
|
-
token_endpoint:
|
|
1660
|
-
userinfo_endpoint:
|
|
1661
|
-
check_session_iframe:
|
|
1662
|
-
issuer:
|
|
1720
|
+
const s = async () => {
|
|
1721
|
+
if (t != null)
|
|
1722
|
+
return new oe({
|
|
1723
|
+
authorization_endpoint: t.authorization_endpoint,
|
|
1724
|
+
end_session_endpoint: t.end_session_endpoint,
|
|
1725
|
+
revocation_endpoint: t.revocation_endpoint,
|
|
1726
|
+
token_endpoint: t.token_endpoint,
|
|
1727
|
+
userinfo_endpoint: t.userinfo_endpoint,
|
|
1728
|
+
check_session_iframe: t.check_session_iframe,
|
|
1729
|
+
issuer: t.issuer
|
|
1663
1730
|
});
|
|
1664
1731
|
const i = await C(this.configuration, this.configurationName) ? this.configuration.storage || window.sessionStorage : this.configuration.storage;
|
|
1665
|
-
return await
|
|
1732
|
+
return await cn(this.getFetch())(
|
|
1666
1733
|
n,
|
|
1667
1734
|
this.configuration.authority_time_cache_wellknowurl_in_second ?? 3600,
|
|
1668
1735
|
i,
|
|
1669
1736
|
this.configuration.authority_timeout_wellknowurl_in_millisecond
|
|
1670
1737
|
);
|
|
1671
1738
|
};
|
|
1672
|
-
return this.initPromise =
|
|
1739
|
+
return this.initPromise = s(), this.initPromise.finally(() => {
|
|
1673
1740
|
this.initPromise = null;
|
|
1674
1741
|
});
|
|
1675
1742
|
}
|
|
1676
1743
|
async tryKeepExistingSessionAsync() {
|
|
1677
|
-
return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise =
|
|
1744
|
+
return this.tryKeepExistingSessionPromise !== null ? this.tryKeepExistingSessionPromise : (this.tryKeepExistingSessionPromise = mn(this), this.tryKeepExistingSessionPromise.finally(() => {
|
|
1678
1745
|
this.tryKeepExistingSessionPromise = null;
|
|
1679
1746
|
}));
|
|
1680
1747
|
}
|
|
1681
|
-
async startCheckSessionAsync(n,
|
|
1682
|
-
await
|
|
1748
|
+
async startCheckSessionAsync(n, t, s, o = !1) {
|
|
1749
|
+
await dn(this, R, this.configuration)(
|
|
1683
1750
|
n,
|
|
1684
|
-
s,
|
|
1685
1751
|
t,
|
|
1752
|
+
s,
|
|
1686
1753
|
o
|
|
1687
1754
|
);
|
|
1688
1755
|
}
|
|
1689
|
-
async loginAsync(n = void 0,
|
|
1690
|
-
return this.logoutPromise && await this.logoutPromise, this.loginPromise !== null ? this.loginPromise : (i ? this.loginPromise =
|
|
1756
|
+
async loginAsync(n = void 0, t = null, s = !1, o = void 0, i = !1) {
|
|
1757
|
+
return this.logoutPromise && await this.logoutPromise, this.loginPromise !== null ? this.loginPromise : (i ? this.loginPromise = fn(
|
|
1691
1758
|
window,
|
|
1692
1759
|
this.configurationName,
|
|
1693
1760
|
this.configuration,
|
|
1694
1761
|
this.publishEvent.bind(this),
|
|
1695
1762
|
this
|
|
1696
|
-
)(
|
|
1763
|
+
)(t, o) : this.loginPromise = pn(
|
|
1697
1764
|
this.configurationName,
|
|
1698
1765
|
this.configuration,
|
|
1699
1766
|
this.publishEvent.bind(this),
|
|
1700
1767
|
this.initAsync.bind(this),
|
|
1701
1768
|
this.location
|
|
1702
|
-
)(n,
|
|
1769
|
+
)(n, t, s, o), this.loginPromise.finally(() => {
|
|
1703
1770
|
this.loginPromise = null;
|
|
1704
1771
|
}));
|
|
1705
1772
|
}
|
|
1706
1773
|
async loginCallbackAsync(n = !1) {
|
|
1707
1774
|
if (this.loginCallbackPromise !== null)
|
|
1708
1775
|
return this.loginCallbackPromise;
|
|
1709
|
-
const
|
|
1710
|
-
const
|
|
1711
|
-
return this.tokens = o, await C(this.configuration, this.configurationName) || N(this.configurationName, this.configuration.storage).setTokens(o), this.publishEvent(
|
|
1776
|
+
const t = async () => {
|
|
1777
|
+
const s = await An(this)(n), o = s.tokens;
|
|
1778
|
+
return this.tokens = o, await C(this.configuration, this.configurationName) || N(this.configurationName, this.configuration.storage).setTokens(o), this.publishEvent(M.eventNames.token_acquired, o), this.configuration.preload_user_info && await this.userInfoAsync(), {
|
|
1712
1779
|
parsedTokens: o,
|
|
1713
|
-
state:
|
|
1714
|
-
callbackPath:
|
|
1715
|
-
scope:
|
|
1716
|
-
extras:
|
|
1780
|
+
state: s.state,
|
|
1781
|
+
callbackPath: s.callbackPath,
|
|
1782
|
+
scope: s.scope,
|
|
1783
|
+
extras: s.extras
|
|
1717
1784
|
};
|
|
1718
1785
|
};
|
|
1719
|
-
return this.loginCallbackPromise =
|
|
1786
|
+
return this.loginCallbackPromise = t(), this.loginCallbackPromise.finally(() => {
|
|
1720
1787
|
this.loginCallbackPromise = null;
|
|
1721
1788
|
});
|
|
1722
1789
|
}
|
|
1723
|
-
async generateDemonstrationOfProofOfPossessionAsync(n,
|
|
1790
|
+
async generateDemonstrationOfProofOfPossessionAsync(n, t, s, o = {}) {
|
|
1724
1791
|
const i = this.configuration, r = {
|
|
1725
1792
|
ath: await Ie(n),
|
|
1726
1793
|
...o
|
|
1727
1794
|
};
|
|
1728
1795
|
if (await C(i, this.configurationName))
|
|
1729
1796
|
return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${ve(this.configurationName)}`;
|
|
1730
|
-
const c = N(this.configurationName, i.storage),
|
|
1731
|
-
return
|
|
1797
|
+
const c = N(this.configurationName, i.storage), f = await c.getDemonstratingProofOfPossessionJwkAsync(), u = c.getDemonstratingProofOfPossessionNonce();
|
|
1798
|
+
return u && (r.nonce = u), await be(window)(
|
|
1732
1799
|
i.demonstrating_proof_of_possession_configuration
|
|
1733
|
-
)(
|
|
1800
|
+
)(f, s, t, r);
|
|
1734
1801
|
}
|
|
1735
1802
|
loginCallbackWithAutoTokensRenewAsync() {
|
|
1736
|
-
return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise =
|
|
1803
|
+
return this.loginCallbackWithAutoTokensRenewPromise !== null ? this.loginCallbackWithAutoTokensRenewPromise : (this.loginCallbackWithAutoTokensRenewPromise = Pn(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
|
|
1737
1804
|
this.loginCallbackWithAutoTokensRenewPromise = null;
|
|
1738
1805
|
}));
|
|
1739
1806
|
}
|
|
1740
|
-
userInfoAsync(n = !1,
|
|
1741
|
-
return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise =
|
|
1807
|
+
userInfoAsync(n = !1, t = !1) {
|
|
1808
|
+
return this.userInfoPromise !== null ? this.userInfoPromise : (this.userInfoPromise = En(this)(n, t), this.userInfoPromise.finally(() => {
|
|
1742
1809
|
this.userInfoPromise = null;
|
|
1743
1810
|
}));
|
|
1744
1811
|
}
|
|
1745
|
-
async renewTokensAsync(n = null,
|
|
1812
|
+
async renewTokensAsync(n = null, t = null) {
|
|
1746
1813
|
if (this.renewTokensPromise !== null)
|
|
1747
1814
|
return this.renewTokensPromise;
|
|
1748
1815
|
if (this.timeoutId)
|
|
1749
|
-
return
|
|
1816
|
+
return D.clearTimeout(this.timeoutId), this.renewTokensPromise = Ne(this, !0, n, t), this.renewTokensPromise.finally(() => {
|
|
1750
1817
|
this.renewTokensPromise = null;
|
|
1751
1818
|
});
|
|
1752
1819
|
}
|
|
1753
1820
|
async destroyAsync(n) {
|
|
1754
|
-
return await
|
|
1821
|
+
return await Tn(this)(n);
|
|
1755
1822
|
}
|
|
1756
|
-
async logoutSameTabAsync(n,
|
|
1757
|
-
this.configuration.monitor_session && this.configuration.client_id === n &&
|
|
1823
|
+
async logoutSameTabAsync(n, t) {
|
|
1824
|
+
this.configuration.monitor_session && this.configuration.client_id === n && t && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === t && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(p.logout_from_same_tab, { mmessage: "SessionMonitor", sub: t }));
|
|
1758
1825
|
}
|
|
1759
|
-
async logoutOtherTabAsync(n,
|
|
1760
|
-
this.configuration.monitor_session && this.configuration.client_id === n &&
|
|
1826
|
+
async logoutOtherTabAsync(n, t) {
|
|
1827
|
+
this.configuration.monitor_session && this.configuration.client_id === n && t && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === t && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(p.logout_from_another_tab, { message: "SessionMonitor", sub: t }));
|
|
1761
1828
|
}
|
|
1762
|
-
async logoutAsync(n = void 0,
|
|
1763
|
-
return this.logoutPromise ? this.logoutPromise : (this.logoutPromise =
|
|
1829
|
+
async logoutAsync(n = void 0, t = null) {
|
|
1830
|
+
return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = vn(
|
|
1764
1831
|
this,
|
|
1765
|
-
|
|
1832
|
+
R,
|
|
1766
1833
|
this.getFetch(),
|
|
1767
1834
|
console,
|
|
1768
1835
|
this.location
|
|
1769
|
-
)(n,
|
|
1836
|
+
)(n, t), this.logoutPromise.finally(() => {
|
|
1770
1837
|
this.logoutPromise = null;
|
|
1771
1838
|
}));
|
|
1772
1839
|
}
|
|
1773
1840
|
};
|
|
1774
|
-
|
|
1775
|
-
let
|
|
1776
|
-
const
|
|
1841
|
+
M.getOrCreate = (n, t) => (s, o = "default") => bn(n, t)(s, o), M.eventNames = p;
|
|
1842
|
+
let L = M;
|
|
1843
|
+
const U = class U {
|
|
1777
1844
|
constructor(n) {
|
|
1778
1845
|
this._oidc = n;
|
|
1779
1846
|
}
|
|
@@ -1783,26 +1850,26 @@ const K = class K {
|
|
|
1783
1850
|
removeEventSubscription(n) {
|
|
1784
1851
|
this._oidc.removeEventSubscription(n);
|
|
1785
1852
|
}
|
|
1786
|
-
publishEvent(n,
|
|
1787
|
-
this._oidc.publishEvent(n,
|
|
1853
|
+
publishEvent(n, t) {
|
|
1854
|
+
this._oidc.publishEvent(n, t);
|
|
1788
1855
|
}
|
|
1789
1856
|
static get(n = "default") {
|
|
1790
|
-
return new
|
|
1857
|
+
return new U(L.get(n));
|
|
1791
1858
|
}
|
|
1792
1859
|
tryKeepExistingSessionAsync() {
|
|
1793
1860
|
return this._oidc.tryKeepExistingSessionAsync();
|
|
1794
1861
|
}
|
|
1795
|
-
loginAsync(n = void 0,
|
|
1796
|
-
return this._oidc.loginAsync(n,
|
|
1862
|
+
loginAsync(n = void 0, t = null, s = !1, o = void 0, i = !1) {
|
|
1863
|
+
return this._oidc.loginAsync(n, t, s, o, i);
|
|
1797
1864
|
}
|
|
1798
|
-
logoutAsync(n = void 0,
|
|
1799
|
-
return this._oidc.logoutAsync(n,
|
|
1865
|
+
logoutAsync(n = void 0, t = null) {
|
|
1866
|
+
return this._oidc.logoutAsync(n, t);
|
|
1800
1867
|
}
|
|
1801
1868
|
silentLoginCallbackAsync() {
|
|
1802
1869
|
return this._oidc.silentLoginCallbackAsync();
|
|
1803
1870
|
}
|
|
1804
|
-
renewTokensAsync(n = null,
|
|
1805
|
-
return this._oidc.renewTokensAsync(n,
|
|
1871
|
+
renewTokensAsync(n = null, t = null) {
|
|
1872
|
+
return this._oidc.renewTokensAsync(n, t);
|
|
1806
1873
|
}
|
|
1807
1874
|
loginCallbackAsync() {
|
|
1808
1875
|
return this._oidc.loginCallbackWithAutoTokensRenewAsync();
|
|
@@ -1813,52 +1880,52 @@ const K = class K {
|
|
|
1813
1880
|
get configuration() {
|
|
1814
1881
|
return this._oidc.configuration;
|
|
1815
1882
|
}
|
|
1816
|
-
async generateDemonstrationOfProofOfPossessionAsync(n,
|
|
1883
|
+
async generateDemonstrationOfProofOfPossessionAsync(n, t, s, o = {}) {
|
|
1817
1884
|
return this._oidc.generateDemonstrationOfProofOfPossessionAsync(
|
|
1818
1885
|
n,
|
|
1819
|
-
s,
|
|
1820
1886
|
t,
|
|
1887
|
+
s,
|
|
1821
1888
|
o
|
|
1822
1889
|
);
|
|
1823
1890
|
}
|
|
1824
|
-
async getValidTokenAsync(n = 200,
|
|
1825
|
-
const
|
|
1826
|
-
getTokens: () =>
|
|
1891
|
+
async getValidTokenAsync(n = 200, t = 50) {
|
|
1892
|
+
const s = this._oidc, o = {
|
|
1893
|
+
getTokens: () => s.tokens,
|
|
1827
1894
|
configuration: {
|
|
1828
|
-
token_automatic_renew_mode:
|
|
1829
|
-
refresh_time_before_tokens_expiration_in_second:
|
|
1895
|
+
token_automatic_renew_mode: s.configuration.token_automatic_renew_mode,
|
|
1896
|
+
refresh_time_before_tokens_expiration_in_second: s.configuration.refresh_time_before_tokens_expiration_in_second
|
|
1830
1897
|
},
|
|
1831
1898
|
syncTokensInfoAsync: async () => {
|
|
1832
|
-
const { status: i } = await
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1899
|
+
const { status: i } = await le(s)(
|
|
1900
|
+
s.configuration,
|
|
1901
|
+
s.configurationName,
|
|
1902
|
+
s.tokens,
|
|
1836
1903
|
!1
|
|
1837
1904
|
);
|
|
1838
1905
|
return i;
|
|
1839
1906
|
},
|
|
1840
|
-
renewTokensAsync:
|
|
1907
|
+
renewTokensAsync: s.renewTokensAsync.bind(s)
|
|
1841
1908
|
};
|
|
1842
|
-
return Ae(o, n,
|
|
1909
|
+
return Ae(o, n, t);
|
|
1843
1910
|
}
|
|
1844
|
-
fetchWithTokens(n,
|
|
1845
|
-
return xe(n, this._oidc,
|
|
1911
|
+
fetchWithTokens(n, t = !1) {
|
|
1912
|
+
return xe(n, this._oidc, t);
|
|
1846
1913
|
}
|
|
1847
|
-
async userInfoAsync(n = !1,
|
|
1848
|
-
return this._oidc.userInfoAsync(n,
|
|
1914
|
+
async userInfoAsync(n = !1, t = !1) {
|
|
1915
|
+
return this._oidc.userInfoAsync(n, t);
|
|
1849
1916
|
}
|
|
1850
1917
|
userInfo() {
|
|
1851
1918
|
return this._oidc.userInfo;
|
|
1852
1919
|
}
|
|
1853
1920
|
};
|
|
1854
|
-
|
|
1855
|
-
let
|
|
1921
|
+
U.getOrCreate = (n, t = new j()) => (s, o = "default") => new U(L.getOrCreate(n, t)(s, o)), U.eventNames = L.eventNames;
|
|
1922
|
+
let pe = U;
|
|
1856
1923
|
export {
|
|
1857
|
-
|
|
1924
|
+
pe as OidcClient,
|
|
1858
1925
|
j as OidcLocation,
|
|
1859
1926
|
B as TokenAutomaticRenewMode,
|
|
1860
|
-
|
|
1861
|
-
|
|
1927
|
+
Z as TokenRenewMode,
|
|
1928
|
+
On as getFetchDefault,
|
|
1862
1929
|
se as getParseQueryStringFromLocation,
|
|
1863
|
-
|
|
1930
|
+
Cn as getPath
|
|
1864
1931
|
};
|