@auth0/auth0-spa-js 2.18.0 → 2.18.2
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/auth0-spa-js.development.js +330 -296
- package/dist/auth0-spa-js.development.js.map +1 -1
- package/dist/auth0-spa-js.production.esm.js +1 -1
- package/dist/auth0-spa-js.production.esm.js.map +1 -1
- package/dist/auth0-spa-js.production.js +1 -1
- package/dist/auth0-spa-js.production.js.map +1 -1
- package/dist/auth0-spa-js.worker.development.js +71 -21
- package/dist/auth0-spa-js.worker.development.js.map +1 -1
- package/dist/auth0-spa-js.worker.production.js +1 -1
- package/dist/auth0-spa-js.worker.production.js.map +1 -1
- package/dist/lib/auth0-spa-js.cjs.js +353 -316
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/Auth0Client.d.ts +439 -439
- package/dist/typings/Auth0Client.utils.d.ts +90 -90
- package/dist/typings/MyAccountApiClient.d.ts +92 -92
- package/dist/typings/TokenExchange.d.ts +77 -77
- package/dist/typings/api.d.ts +2 -2
- package/dist/typings/cache/cache-localstorage.d.ts +7 -7
- package/dist/typings/cache/cache-manager.d.ts +56 -56
- package/dist/typings/cache/cache-memory.d.ts +4 -4
- package/dist/typings/cache/index.d.ts +4 -4
- package/dist/typings/cache/key-manifest.d.ts +12 -12
- package/dist/typings/cache/shared.d.ts +68 -68
- package/dist/typings/constants.d.ts +58 -58
- package/dist/typings/dpop/dpop.d.ts +17 -17
- package/dist/typings/dpop/storage.d.ts +27 -27
- package/dist/typings/dpop/utils.d.ts +15 -15
- package/dist/typings/errors.d.ts +96 -96
- package/dist/typings/fetcher.d.ts +54 -54
- package/dist/typings/global.d.ts +819 -819
- package/dist/typings/http.d.ts +5 -5
- package/dist/typings/index.d.ts +24 -23
- package/dist/typings/jwt.d.ts +21 -21
- package/dist/typings/lock.d.ts +32 -32
- package/dist/typings/mfa/MfaApiClient.d.ts +225 -225
- package/dist/typings/mfa/MfaContextManager.d.ts +79 -79
- package/dist/typings/mfa/constants.d.ts +23 -23
- package/dist/typings/mfa/errors.d.ts +117 -117
- package/dist/typings/mfa/index.d.ts +4 -4
- package/dist/typings/mfa/types.d.ts +181 -181
- package/dist/typings/mfa/utils.d.ts +23 -23
- package/dist/typings/promise-utils.d.ts +2 -2
- package/dist/typings/scope.d.ts +35 -35
- package/dist/typings/storage.d.ts +26 -26
- package/dist/typings/transaction-manager.d.ts +33 -33
- package/dist/typings/utils.d.ts +36 -36
- package/dist/typings/version.d.ts +2 -2
- package/dist/typings/worker/token.worker.d.ts +1 -1
- package/dist/typings/worker/worker.types.d.ts +15 -15
- package/dist/typings/worker/worker.utils.d.ts +7 -7
- package/package.json +6 -4
- package/src/Auth0Client.ts +10 -7
- package/src/index.ts +6 -3
- package/src/utils.ts +2 -1
- package/src/version.ts +1 -1
|
@@ -3,19 +3,145 @@
|
|
|
3
3
|
factory(global.auth0 = {}));
|
|
4
4
|
})(this, function(exports) {
|
|
5
5
|
"use strict";
|
|
6
|
-
function
|
|
6
|
+
function _OverloadYield(e, d) {
|
|
7
|
+
this.v = e, this.k = d;
|
|
8
|
+
}
|
|
9
|
+
function _assertClassBrand(e, t, n) {
|
|
10
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
11
|
+
throw new TypeError("Private element is not present on this object");
|
|
12
|
+
}
|
|
13
|
+
function _awaitAsyncGenerator(e) {
|
|
14
|
+
return new _OverloadYield(e, 0);
|
|
15
|
+
}
|
|
16
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
17
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
18
|
+
}
|
|
19
|
+
function _classPrivateFieldGet2(s, a) {
|
|
20
|
+
return s.get(_assertClassBrand(s, a));
|
|
21
|
+
}
|
|
22
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
23
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
24
|
+
}
|
|
25
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
26
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
27
|
+
}
|
|
28
|
+
function _classPrivateMethodInitSpec(e, a) {
|
|
29
|
+
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
30
|
+
}
|
|
31
|
+
function _defineProperty(e, r, t) {
|
|
32
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
33
|
+
value: t,
|
|
34
|
+
enumerable: !0,
|
|
35
|
+
configurable: !0,
|
|
36
|
+
writable: !0
|
|
37
|
+
}) : e[r] = t, e;
|
|
38
|
+
}
|
|
39
|
+
function ownKeys(e, r) {
|
|
40
|
+
var t = Object.keys(e);
|
|
41
|
+
if (Object.getOwnPropertySymbols) {
|
|
42
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
43
|
+
r && (o = o.filter(function(r) {
|
|
44
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
45
|
+
})), t.push.apply(t, o);
|
|
46
|
+
}
|
|
47
|
+
return t;
|
|
48
|
+
}
|
|
49
|
+
function _objectSpread2(e) {
|
|
50
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
51
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
52
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
53
|
+
_defineProperty(e, r, t[r]);
|
|
54
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
55
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return e;
|
|
59
|
+
}
|
|
60
|
+
function _objectWithoutProperties(e, t) {
|
|
61
|
+
if (null == e) return {};
|
|
62
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
63
|
+
if (Object.getOwnPropertySymbols) {
|
|
64
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
65
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
66
|
+
}
|
|
67
|
+
return i;
|
|
68
|
+
}
|
|
69
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
70
|
+
if (null == r) return {};
|
|
7
71
|
var t = {};
|
|
8
|
-
for (var
|
|
9
|
-
|
|
10
|
-
|
|
72
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
73
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
74
|
+
t[n] = r[n];
|
|
11
75
|
}
|
|
12
76
|
return t;
|
|
13
77
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
78
|
+
function _toPrimitive(t, r) {
|
|
79
|
+
if ("object" != typeof t || !t) return t;
|
|
80
|
+
var e = t[Symbol.toPrimitive];
|
|
81
|
+
if (void 0 !== e) {
|
|
82
|
+
var i = e.call(t, r || "default");
|
|
83
|
+
if ("object" != typeof i) return i;
|
|
84
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
85
|
+
}
|
|
86
|
+
return ("string" === r ? String : Number)(t);
|
|
87
|
+
}
|
|
88
|
+
function _toPropertyKey(t) {
|
|
89
|
+
var i = _toPrimitive(t, "string");
|
|
90
|
+
return "symbol" == typeof i ? i : i + "";
|
|
91
|
+
}
|
|
92
|
+
function _wrapAsyncGenerator(e) {
|
|
93
|
+
return function() {
|
|
94
|
+
return new AsyncGenerator(e.apply(this, arguments));
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function AsyncGenerator(e) {
|
|
98
|
+
var t, n;
|
|
99
|
+
function resume(t, n) {
|
|
100
|
+
try {
|
|
101
|
+
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
|
|
102
|
+
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
103
|
+
if (u) {
|
|
104
|
+
var i = "return" === t && o.k ? t : "next";
|
|
105
|
+
if (!o.k || n.done) return resume(i, n);
|
|
106
|
+
n = e[i](n).value;
|
|
107
|
+
}
|
|
108
|
+
settle(!!r.done, n);
|
|
109
|
+
}, function(e) {
|
|
110
|
+
resume("throw", e);
|
|
111
|
+
});
|
|
112
|
+
} catch (e) {
|
|
113
|
+
settle(2, e);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function settle(e, r) {
|
|
117
|
+
2 === e ? t.reject(r) : t.resolve({
|
|
118
|
+
value: r,
|
|
119
|
+
done: e
|
|
120
|
+
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
121
|
+
}
|
|
122
|
+
this._invoke = function(e, r) {
|
|
123
|
+
return new Promise(function(o, u) {
|
|
124
|
+
var i = {
|
|
125
|
+
key: e,
|
|
126
|
+
arg: r,
|
|
127
|
+
resolve: o,
|
|
128
|
+
reject: u,
|
|
129
|
+
next: null
|
|
130
|
+
};
|
|
131
|
+
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
132
|
+
});
|
|
133
|
+
}, "function" != typeof e.return && (this.return = void 0);
|
|
134
|
+
}
|
|
135
|
+
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
136
|
+
return this;
|
|
137
|
+
}, AsyncGenerator.prototype.next = function(e) {
|
|
138
|
+
return this._invoke("next", e);
|
|
139
|
+
}, AsyncGenerator.prototype.throw = function(e) {
|
|
140
|
+
return this._invoke("throw", e);
|
|
141
|
+
}, AsyncGenerator.prototype.return = function(e) {
|
|
142
|
+
return this._invoke("return", e);
|
|
17
143
|
};
|
|
18
|
-
var version = "2.18.
|
|
144
|
+
var version = "2.18.2";
|
|
19
145
|
const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
|
|
20
146
|
const DEFAULT_POPUP_CONFIG_OPTIONS = {
|
|
21
147
|
timeoutInSeconds: DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
|
|
@@ -128,6 +254,7 @@
|
|
|
128
254
|
let exclude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
129
255
|
return value && !exclude.includes(value) ? value : "";
|
|
130
256
|
}
|
|
257
|
+
const _excluded$5 = [ "clientId" ];
|
|
131
258
|
const parseAuthenticationResult = queryString => {
|
|
132
259
|
if (queryString.indexOf("#") > -1) {
|
|
133
260
|
queryString = queryString.substring(0, queryString.indexOf("#"));
|
|
@@ -183,7 +310,7 @@
|
|
|
183
310
|
const top = window.screenY + (window.innerHeight - height) / 2;
|
|
184
311
|
return window.open(url, "auth0:authorize:popup", "left=".concat(left, ",top=").concat(top, ",width=").concat(width, ",height=").concat(height, ",resizable,scrollbars=yes,status=1"));
|
|
185
312
|
};
|
|
186
|
-
const runPopup = config => new Promise((resolve, reject) => {
|
|
313
|
+
const runPopup = (config, eventOrigin) => new Promise((resolve, reject) => {
|
|
187
314
|
let _popupEventListener;
|
|
188
315
|
const popupTimer = setInterval(() => {
|
|
189
316
|
if (config.popup && config.popup.closed) {
|
|
@@ -199,6 +326,7 @@
|
|
|
199
326
|
window.removeEventListener("message", _popupEventListener, false);
|
|
200
327
|
}, (config.timeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS) * 1e3);
|
|
201
328
|
_popupEventListener = function popupEventListener(e) {
|
|
329
|
+
if (e.origin !== eventOrigin) return;
|
|
202
330
|
if (!e.data || e.data.type !== "authorization_response") {
|
|
203
331
|
return;
|
|
204
332
|
}
|
|
@@ -231,7 +359,7 @@
|
|
|
231
359
|
return random;
|
|
232
360
|
};
|
|
233
361
|
const encode$2 = value => btoa(value);
|
|
234
|
-
const stripUndefined = params => Object.keys(params).filter(k => typeof params[k] !== "undefined").reduce((acc, key) =>
|
|
362
|
+
const stripUndefined = params => Object.keys(params).filter(k => typeof params[k] !== "undefined").reduce((acc, key) => _objectSpread2(_objectSpread2({}, acc), {}, {
|
|
235
363
|
[key]: params[key]
|
|
236
364
|
}), {});
|
|
237
365
|
const ALLOWED_AUTH0CLIENT_PROPERTIES = [ {
|
|
@@ -257,9 +385,9 @@
|
|
|
257
385
|
return acc;
|
|
258
386
|
}, {});
|
|
259
387
|
};
|
|
260
|
-
const createQueryParams =
|
|
261
|
-
|
|
262
|
-
return new URLSearchParams(stripUndefined(
|
|
388
|
+
const createQueryParams = _ref => {
|
|
389
|
+
let {clientId: client_id} = _ref, params = _objectWithoutProperties(_ref, _excluded$5);
|
|
390
|
+
return new URLSearchParams(stripUndefined(_objectSpread2({
|
|
263
391
|
client_id: client_id
|
|
264
392
|
}, params))).toString();
|
|
265
393
|
};
|
|
@@ -309,8 +437,8 @@
|
|
|
309
437
|
}
|
|
310
438
|
return parseInt(value, 10) || undefined;
|
|
311
439
|
};
|
|
312
|
-
const fromEntries = iterable => [ ...iterable ].reduce((obj,
|
|
313
|
-
let [key, val] =
|
|
440
|
+
const fromEntries = iterable => [ ...iterable ].reduce((obj, _ref2) => {
|
|
441
|
+
let [key, val] = _ref2;
|
|
314
442
|
obj[key] = val;
|
|
315
443
|
return obj;
|
|
316
444
|
}, {});
|
|
@@ -850,7 +978,7 @@
|
|
|
850
978
|
}
|
|
851
979
|
class LegacyLockManager {
|
|
852
980
|
constructor() {
|
|
853
|
-
this
|
|
981
|
+
_defineProperty(this, "activeLocks", new Set);
|
|
854
982
|
this.lock = new _default;
|
|
855
983
|
this.pagehideHandler = () => {
|
|
856
984
|
this.activeLocks.forEach(key => this.lock.releaseLock(key));
|
|
@@ -882,8 +1010,8 @@
|
|
|
882
1010
|
}
|
|
883
1011
|
}
|
|
884
1012
|
function isWebLocksSupported() {
|
|
885
|
-
var
|
|
886
|
-
return typeof navigator !== "undefined" && typeof ((
|
|
1013
|
+
var _navigator$locks;
|
|
1014
|
+
return typeof navigator !== "undefined" && typeof ((_navigator$locks = navigator.locks) === null || _navigator$locks === void 0 ? void 0 : _navigator$locks.request) === "function";
|
|
887
1015
|
}
|
|
888
1016
|
function createLockManager() {
|
|
889
1017
|
return isWebLocksSupported() ? new WebLocksApiManager : new LegacyLockManager;
|
|
@@ -1217,6 +1345,7 @@
|
|
|
1217
1345
|
};
|
|
1218
1346
|
to.postMessage(message, [ messageChannel.port2 ]);
|
|
1219
1347
|
});
|
|
1348
|
+
const _excluded$4 = [ "error", "error_description" ];
|
|
1220
1349
|
const createAbortController = () => new AbortController;
|
|
1221
1350
|
const dofetch = async (fetchUrl, fetchOptions) => {
|
|
1222
1351
|
const response = await fetch(fetchUrl, fetchOptions);
|
|
@@ -1266,7 +1395,7 @@
|
|
|
1266
1395
|
method: options.method || "GET",
|
|
1267
1396
|
nonce: await dpop.getNonce()
|
|
1268
1397
|
});
|
|
1269
|
-
options.headers =
|
|
1398
|
+
options.headers = _objectSpread2(_objectSpread2({}, options.headers), {}, {
|
|
1270
1399
|
dpop: dpopProof
|
|
1271
1400
|
});
|
|
1272
1401
|
}
|
|
@@ -1284,7 +1413,7 @@
|
|
|
1284
1413
|
if (fetchError) {
|
|
1285
1414
|
throw fetchError;
|
|
1286
1415
|
}
|
|
1287
|
-
const
|
|
1416
|
+
const {json: {error: error, error_description: error_description}, headers: headers, ok: ok} = response, data = _objectWithoutProperties(response.json, _excluded$4);
|
|
1288
1417
|
let newDpopNonce;
|
|
1289
1418
|
if (dpop) {
|
|
1290
1419
|
newDpopNonce = headers[DPOP_NONCE_HEADER];
|
|
@@ -1310,11 +1439,12 @@
|
|
|
1310
1439
|
}
|
|
1311
1440
|
return data;
|
|
1312
1441
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1442
|
+
const _excluded$3 = [ "baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData", "useMrrt", "dpop" ];
|
|
1443
|
+
async function oauthToken(_ref, worker) {
|
|
1444
|
+
let {baseUrl: baseUrl, timeout: timeout, audience: audience, scope: scope, auth0Client: auth0Client, useFormData: useFormData, useMrrt: useMrrt, dpop: dpop} = _ref, options = _objectWithoutProperties(_ref, _excluded$3);
|
|
1315
1445
|
const isTokenExchange = options.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange";
|
|
1316
1446
|
const refreshWithMrrt = options.grant_type === "refresh_token" && useMrrt;
|
|
1317
|
-
const allParams =
|
|
1447
|
+
const allParams = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, options), isTokenExchange && audience && {
|
|
1318
1448
|
audience: audience
|
|
1319
1449
|
}), isTokenExchange && scope && {
|
|
1320
1450
|
scope: scope
|
|
@@ -1423,7 +1553,7 @@
|
|
|
1423
1553
|
}
|
|
1424
1554
|
class InMemoryCache {
|
|
1425
1555
|
constructor() {
|
|
1426
|
-
this
|
|
1556
|
+
_defineProperty(this, "enclosedCache", function() {
|
|
1427
1557
|
let cache = {};
|
|
1428
1558
|
return {
|
|
1429
1559
|
set(key, entry) {
|
|
@@ -1443,7 +1573,7 @@
|
|
|
1443
1573
|
return Object.keys(cache);
|
|
1444
1574
|
}
|
|
1445
1575
|
};
|
|
1446
|
-
}();
|
|
1576
|
+
}());
|
|
1447
1577
|
}
|
|
1448
1578
|
}
|
|
1449
1579
|
const DEFAULT_EXPIRY_ADJUSTMENT_SECONDS = 0;
|
|
@@ -1454,13 +1584,13 @@
|
|
|
1454
1584
|
this.nowProvider = nowProvider || DEFAULT_NOW_PROVIDER;
|
|
1455
1585
|
}
|
|
1456
1586
|
async setIdToken(clientId, idToken, decodedToken) {
|
|
1457
|
-
var
|
|
1587
|
+
var _this$keyManifest;
|
|
1458
1588
|
const cacheKey = this.getIdTokenCacheKey(clientId);
|
|
1459
1589
|
await this.cache.set(cacheKey, {
|
|
1460
1590
|
id_token: idToken,
|
|
1461
1591
|
decodedToken: decodedToken
|
|
1462
1592
|
});
|
|
1463
|
-
await ((
|
|
1593
|
+
await ((_this$keyManifest = this.keyManifest) === null || _this$keyManifest === void 0 ? void 0 : _this$keyManifest.add(cacheKey));
|
|
1464
1594
|
}
|
|
1465
1595
|
async getIdToken(cacheKey) {
|
|
1466
1596
|
const entry = await this.cache.get(this.getIdTokenCacheKey(cacheKey.clientId));
|
|
@@ -1489,7 +1619,6 @@
|
|
|
1489
1619
|
let expiryAdjustmentSeconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_EXPIRY_ADJUSTMENT_SECONDS;
|
|
1490
1620
|
let useMrrt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1491
1621
|
let cacheMode = arguments.length > 3 ? arguments[3] : undefined;
|
|
1492
|
-
var _a;
|
|
1493
1622
|
let wrappedEntry = await this.cache.get(cacheKey.toKey());
|
|
1494
1623
|
if (!wrappedEntry) {
|
|
1495
1624
|
const keys = await this.getCacheKeys();
|
|
@@ -1508,11 +1637,12 @@
|
|
|
1508
1637
|
const now = await this.nowProvider();
|
|
1509
1638
|
const nowSeconds = Math.floor(now / 1e3);
|
|
1510
1639
|
if (wrappedEntry.expiresAt - expiryAdjustmentSeconds < nowSeconds) {
|
|
1640
|
+
var _this$keyManifest2;
|
|
1511
1641
|
if (wrappedEntry.body.refresh_token) {
|
|
1512
1642
|
return this.modifiedCachedEntry(wrappedEntry, cacheKey);
|
|
1513
1643
|
}
|
|
1514
1644
|
await this.cache.remove(cacheKey.toKey());
|
|
1515
|
-
await ((
|
|
1645
|
+
await ((_this$keyManifest2 = this.keyManifest) === null || _this$keyManifest2 === void 0 ? void 0 : _this$keyManifest2.remove(cacheKey.toKey()));
|
|
1516
1646
|
return;
|
|
1517
1647
|
}
|
|
1518
1648
|
return wrappedEntry.body;
|
|
@@ -1531,7 +1661,7 @@
|
|
|
1531
1661
|
};
|
|
1532
1662
|
}
|
|
1533
1663
|
async set(entry) {
|
|
1534
|
-
var
|
|
1664
|
+
var _this$keyManifest3;
|
|
1535
1665
|
const cacheKey = new CacheKey({
|
|
1536
1666
|
clientId: entry.client_id,
|
|
1537
1667
|
scope: entry.scope,
|
|
@@ -1539,7 +1669,7 @@
|
|
|
1539
1669
|
});
|
|
1540
1670
|
const wrappedEntry = await this.wrapCacheEntry(entry);
|
|
1541
1671
|
await this.cache.set(cacheKey.toKey(), wrappedEntry);
|
|
1542
|
-
await ((
|
|
1672
|
+
await ((_this$keyManifest3 = this.keyManifest) === null || _this$keyManifest3 === void 0 ? void 0 : _this$keyManifest3.add(cacheKey.toKey()));
|
|
1543
1673
|
}
|
|
1544
1674
|
async remove(client_id, audience, scope) {
|
|
1545
1675
|
const cacheKey = new CacheKey({
|
|
@@ -1550,14 +1680,14 @@
|
|
|
1550
1680
|
await this.cache.remove(cacheKey.toKey());
|
|
1551
1681
|
}
|
|
1552
1682
|
async clear(clientId) {
|
|
1553
|
-
var
|
|
1683
|
+
var _this$keyManifest4;
|
|
1554
1684
|
const keys = await this.getCacheKeys();
|
|
1555
1685
|
if (!keys) return;
|
|
1556
1686
|
await keys.filter(key => clientId ? key.includes(clientId) : true).reduce(async (memo, key) => {
|
|
1557
1687
|
await memo;
|
|
1558
1688
|
await this.cache.remove(key);
|
|
1559
1689
|
}, Promise.resolve());
|
|
1560
|
-
await ((
|
|
1690
|
+
await ((_this$keyManifest4 = this.keyManifest) === null || _this$keyManifest4 === void 0 ? void 0 : _this$keyManifest4.clear());
|
|
1561
1691
|
}
|
|
1562
1692
|
async wrapCacheEntry(entry) {
|
|
1563
1693
|
const now = await this.nowProvider();
|
|
@@ -1568,9 +1698,9 @@
|
|
|
1568
1698
|
};
|
|
1569
1699
|
}
|
|
1570
1700
|
async getCacheKeys() {
|
|
1571
|
-
var _a;
|
|
1572
1701
|
if (this.keyManifest) {
|
|
1573
|
-
|
|
1702
|
+
var _await$this$keyManife;
|
|
1703
|
+
return (_await$this$keyManife = await this.keyManifest.get()) === null || _await$this$keyManife === void 0 ? void 0 : _await$this$keyManife.keys;
|
|
1574
1704
|
} else if (this.cache.allKeys) {
|
|
1575
1705
|
return this.cache.allKeys();
|
|
1576
1706
|
}
|
|
@@ -1582,21 +1712,21 @@
|
|
|
1582
1712
|
}
|
|
1583
1713
|
matchExistingCacheKey(keyToMatch, allKeys) {
|
|
1584
1714
|
return allKeys.filter(key => {
|
|
1585
|
-
var
|
|
1715
|
+
var _keyToMatch$scope;
|
|
1586
1716
|
const cacheKey = CacheKey.fromKey(key);
|
|
1587
1717
|
const scopeSet = new Set(cacheKey.scope && cacheKey.scope.split(" "));
|
|
1588
|
-
const scopesToMatch = ((
|
|
1718
|
+
const scopesToMatch = ((_keyToMatch$scope = keyToMatch.scope) === null || _keyToMatch$scope === void 0 ? void 0 : _keyToMatch$scope.split(" ")) || [];
|
|
1589
1719
|
const hasAllScopes = cacheKey.scope && scopesToMatch.reduce((acc, current) => acc && scopeSet.has(current), true);
|
|
1590
1720
|
return cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId && cacheKey.audience === keyToMatch.audience && hasAllScopes;
|
|
1591
1721
|
})[0];
|
|
1592
1722
|
}
|
|
1593
1723
|
async getEntryWithRefreshToken(keyToMatch, allKeys) {
|
|
1594
|
-
var _a;
|
|
1595
1724
|
for (const key of allKeys) {
|
|
1596
1725
|
const cacheKey = CacheKey.fromKey(key);
|
|
1597
1726
|
if (cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId) {
|
|
1727
|
+
var _cachedEntry$body;
|
|
1598
1728
|
const cachedEntry = await this.cache.get(key);
|
|
1599
|
-
if (
|
|
1729
|
+
if (cachedEntry !== null && cachedEntry !== void 0 && (_cachedEntry$body = cachedEntry.body) !== null && _cachedEntry$body !== void 0 && _cachedEntry$body.refresh_token) {
|
|
1600
1730
|
return this.modifiedCachedEntry(cachedEntry, keyToMatch);
|
|
1601
1731
|
}
|
|
1602
1732
|
}
|
|
@@ -1604,12 +1734,12 @@
|
|
|
1604
1734
|
return undefined;
|
|
1605
1735
|
}
|
|
1606
1736
|
async updateEntry(oldRefreshToken, newRefreshToken) {
|
|
1607
|
-
var _a;
|
|
1608
1737
|
const allKeys = await this.getCacheKeys();
|
|
1609
1738
|
if (!allKeys) return;
|
|
1610
1739
|
for (const key of allKeys) {
|
|
1740
|
+
var _entry$body;
|
|
1611
1741
|
const entry = await this.cache.get(key);
|
|
1612
|
-
if ((
|
|
1742
|
+
if ((entry === null || entry === void 0 || (_entry$body = entry.body) === null || _entry$body === void 0 ? void 0 : _entry$body.refresh_token) === oldRefreshToken) {
|
|
1613
1743
|
entry.body.refresh_token = newRefreshToken;
|
|
1614
1744
|
await this.cache.set(key, entry);
|
|
1615
1745
|
}
|
|
@@ -1845,17 +1975,17 @@
|
|
|
1845
1975
|
sameSite: "none"
|
|
1846
1976
|
};
|
|
1847
1977
|
}
|
|
1848
|
-
if (options
|
|
1978
|
+
if (options !== null && options !== void 0 && options.daysUntilExpire) {
|
|
1849
1979
|
cookieAttributes.expires = options.daysUntilExpire;
|
|
1850
1980
|
}
|
|
1851
|
-
if (options
|
|
1981
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
1852
1982
|
cookieAttributes.domain = options.cookieDomain;
|
|
1853
1983
|
}
|
|
1854
1984
|
set_1(key, JSON.stringify(value), cookieAttributes);
|
|
1855
1985
|
},
|
|
1856
1986
|
remove(key, options) {
|
|
1857
1987
|
let cookieAttributes = {};
|
|
1858
|
-
if (options
|
|
1988
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
1859
1989
|
cookieAttributes.domain = options.cookieDomain;
|
|
1860
1990
|
}
|
|
1861
1991
|
remove_1(key, cookieAttributes);
|
|
@@ -1877,10 +2007,10 @@
|
|
|
1877
2007
|
secure: true
|
|
1878
2008
|
};
|
|
1879
2009
|
}
|
|
1880
|
-
if (options
|
|
2010
|
+
if (options !== null && options !== void 0 && options.daysUntilExpire) {
|
|
1881
2011
|
cookieAttributes.expires = options.daysUntilExpire;
|
|
1882
2012
|
}
|
|
1883
|
-
if (options
|
|
2013
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
1884
2014
|
cookieAttributes.domain = options.cookieDomain;
|
|
1885
2015
|
}
|
|
1886
2016
|
set_1("".concat(LEGACY_PREFIX).concat(key), JSON.stringify(value), cookieAttributes);
|
|
@@ -1888,7 +2018,7 @@
|
|
|
1888
2018
|
},
|
|
1889
2019
|
remove(key, options) {
|
|
1890
2020
|
let cookieAttributes = {};
|
|
1891
|
-
if (options
|
|
2021
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
1892
2022
|
cookieAttributes.domain = options.cookieDomain;
|
|
1893
2023
|
}
|
|
1894
2024
|
remove_1(key, cookieAttributes);
|
|
@@ -1914,11 +2044,11 @@
|
|
|
1914
2044
|
sessionStorage.removeItem(key);
|
|
1915
2045
|
}
|
|
1916
2046
|
};
|
|
1917
|
-
|
|
1918
|
-
(function(ResponseType) {
|
|
2047
|
+
let ResponseType = function(ResponseType) {
|
|
1919
2048
|
ResponseType["Code"] = "code";
|
|
1920
2049
|
ResponseType["ConnectCode"] = "connect_code";
|
|
1921
|
-
|
|
2050
|
+
return ResponseType;
|
|
2051
|
+
}({});
|
|
1922
2052
|
class User {}
|
|
1923
2053
|
function decodeBase64$1(base64, enableUnicode) {
|
|
1924
2054
|
var binaryString = atob(base64);
|
|
@@ -1949,7 +2079,7 @@
|
|
|
1949
2079
|
return new Worker(url, options);
|
|
1950
2080
|
};
|
|
1951
2081
|
}
|
|
1952
|
-
var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBjbGFzcyBHZW5lcmljRXJyb3IgZXh0ZW5kcyBFcnJvciB7CiAgICAgICAgY29uc3RydWN0b3IoZXJyb3IsIGVycm9yX2Rlc2NyaXB0aW9uKSB7CiAgICAgICAgICAgIHN1cGVyKGVycm9yX2Rlc2NyaXB0aW9uKTsKICAgICAgICAgICAgdGhpcy5lcnJvciA9IGVycm9yOwogICAgICAgICAgICB0aGlzLmVycm9yX2Rlc2NyaXB0aW9uID0gZXJyb3JfZGVzY3JpcHRpb247CiAgICAgICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZih0aGlzLCBHZW5lcmljRX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xldCBoZWFkZXJzID0ge307CiAgICAgICAgbGV0IGpzb247CiAgICAgICAgbGV0IHJlZnJlc2hUb2tlbjsKICAgICAgICBjb25zdCB7YXVkaWVuY2U6IGF1ZGllbmNlLCBzY29wZTogc2NvcGV9ID0gYXV0aCB8fCB7fTsKICAgICAgICB0cnkgewogICAgICAgICAgICBjb25zdCBib2R5ID0gdXNlRm9ybURhdGEgPyBmb3JtRGF0YVRvT2JqZWN0KGZldGNoT3B0aW9ucy5ib2R5KSA6IEpTT04ucGFyc2UoZmV0Y2hPcHRpb25zLmJvZHkpOwogICAgICAgICAgICBpZiAoIWJvZHkucmVmcmVzaF90b2tlbiAmJiBib2R5LmdyYW50X3R5cGUgPT09ICJyZWZyZXNoX3Rva2VuIikgewogICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gZ2V0UmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBpZiAoIXJlZnJlc2hUb2tlbiAmJiB1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgY29uc3QgbGF0ZXN0UmVmcmVzaFRva2VuID0gcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXTsKICAgICAgICAgICAgICAgICAgICBjb25zdCBpc0Rvd25zY29waW5nID0gY2hlY2tEb3duc2NvcGluZyhzY29wZSwgYXVkaWVuY2UpOwogICAgICAgICAgICAgICAgICAgIGlmIChsYXRlc3RSZWZyZXNoVG9rZW4gJiYgIWlzRG93bnNjb3BpbmcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gbGF0ZXN0UmVmcmVzaFRva2VuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghcmVmcmVzaFRva2VuKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE1pc3NpbmdSZWZyZXNoVG9rZW5FcnJvcihhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLmJvZHkgPSB1c2VGb3JtRGF0YSA/IGNyZWF0ZVF1ZXJ5UGFyYW1zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgYm9keSksIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKSA6IEpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgYm9keSksIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZXQgYWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICBpZiAodHlwZW9mIEFib3J0Q29udHJvbGxlciA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICAgICAgYWJvcnRDb250cm9sbGVyID0gbmV3IEFib3J0Q29udHJvbGxlcjsKICAgICAgICAgICAgICAgIGZldGNoT3B0aW9ucy5zaWduYWwgPSBhYm9ydENvbnRyb2xsZXIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCByZXNwb25zZTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgUHJvbWlzZS5yYWNlKFsgd2FpdCh0aW1lb3V0KSwgZmV0Y2goZmV0Y2hVcmwsIE9iamVjdC5hc3NpZ24oe30sIGZldGNoT3B0aW9ucykpIF0pOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCciCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXJzID0gZnJvbUVudHJpZXMocmVzcG9uc2UuaGVhZGVycyk7CiAgICAgICAgICAgIGpzb24gPSBhd2FpdCByZXNwb25zZS5qc29uKCk7CiAgICAgICAgICAgIGlmIChqc29uLnJlZnJlc2hfdG9rZW4pIHsKICAgICAgICAgICAgICAgIGlmICh1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXSA9IGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgICAgICAgICB1cGRhdGVSZWZyZXNoVG9rZW5zKHJlZnJlc2hUb2tlbiwganNvbi5yZWZyZXNoX3Rva2VuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUb2tlbihqc29uLnJlZnJlc2hfdG9rZW4sIGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBkZWxldGUganNvbi5yZWZyZXNoX3Rva2VuOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZGVsZXRlUmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogcmVzcG9uc2Uub2ssCiAgICAgICAgICAgICAgICBqc29uOiBqc29uLAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIG9rOiBmYWxzZSwKICAgICAgICAgICAgICAgIGpzb246IHsKICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IuZXJyb3IsCiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzCiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgIH07CiAgICB7CiAgICAgICAgYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIG1lc3NhZ2VIYW5kbGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
|
|
2082
|
+
var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBmdW5jdGlvbiBfZGVmaW5lUHJvcGVydHkoZSwgciwgdCkgewogICAgICAgIHJldHVybiAociA9IF90b1Byb3BlcnR5S2V5KHIpKSBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIsIHsKICAgICAgICAgICAgdmFsdWU6IHQsCiAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICB9KSA6IGVbcl0gPSB0LCBlOwogICAgfQogICAgZnVuY3Rpb24gb3duS2V5cyhlLCByKSB7CiAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICB2YXIgbyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgIHIgJiYgKG8gPSBvLmZpbHRlcihmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCByKS5lbnVtZXJhYmxlOwogICAgICAgICAgICB9KSksIHQucHVzaC5hcHBseSh0LCBvKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHQ7CiAgICB9CiAgICBmdW5jdGlvbiBfb2JqZWN0U3ByZWFkMihlKSB7CiAgICAgICAgZm9yICh2YXIgciA9IDE7IHIgPCBhcmd1bWVudHMubGVuZ3RoOyByKyspIHsKICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9IGFyZ3VtZW50c1tyXSA/IGFyZ3VtZW50c1tyXSA6IHt9OwogICAgICAgICAgICByICUgMiA/IG93bktleXMoT2JqZWN0KHQpLCAhMCkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBfZGVmaW5lUHJvcGVydHkoZSwgciwgdFtyXSk7CiAgICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhlLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyh0KSkgOiBvd25LZXlzKE9iamVjdCh0KSkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgciwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LCByKSk7CiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllcyhlLCB0KSB7CiAgICAgICAgaWYgKG51bGwgPT0gZSkgcmV0dXJuIHt9OwogICAgICAgIHZhciBvLCByLCBpID0gX29iamVjdFdpdGhvdXRQcm9wZXJ0aWVzTG9vc2UoZSwgdCk7CiAgICAgICAgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpIHsKICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpOwogICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgbi5sZW5ndGg7IHIrKykgbyA9IG5bcl0sIC0xID09PSB0LmluZGV4T2YobykgJiYge30ucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLCBvKSAmJiAoaVtvXSA9IGVbb10pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gaTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllc0xvb3NlKHIsIGUpIHsKICAgICAgICBpZiAobnVsbCA9PSByKSByZXR1cm4ge307CiAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICBmb3IgKHZhciBuIGluIHIpIGlmICh7fS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHIsIG4pKSB7CiAgICAgICAgICAgIGlmICgtMSAhPT0gZS5pbmRleE9mKG4pKSBjb250aW51ZTsKICAgICAgICAgICAgdFtuXSA9IHJbbl07CiAgICAgICAgfQogICAgICAgIHJldHVybiB0OwogICAgfQogICAgZnVuY3Rpb24gX3RvUHJpbWl0aXZlKHQsIHIpIHsKICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIHQgfHwgIXQpIHJldHVybiB0OwogICAgICAgIHZhciBlID0gdFtTeW1ib2wudG9QcmltaXRpdmVdOwogICAgICAgIGlmICh2b2lkIDAgIT09IGUpIHsKICAgICAgICAgICAgdmFyIGkgPSBlLmNhbGwodCwgciB8fCAiZGVmYXVsdCIpOwogICAgICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIGkpIHJldHVybiBpO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AgIGNvbnN0IHthdWRpZW5jZTogYXVkaWVuY2UsIHNjb3BlOiBzY29wZX0gPSBhdXRoIHx8IHt9OwogICAgICAgIHRyeSB7CiAgICAgICAgICAgIGNvbnN0IGJvZHkgPSB1c2VGb3JtRGF0YSA/IGZvcm1EYXRhVG9PYmplY3QoZmV0Y2hPcHRpb25zLmJvZHkpIDogSlNPTi5wYXJzZShmZXRjaE9wdGlvbnMuYm9keSk7CiAgICAgICAgICAgIGlmICghYm9keS5yZWZyZXNoX3Rva2VuICYmIGJvZHkuZ3JhbnRfdHlwZSA9PT0gInJlZnJlc2hfdG9rZW4iKSB7CiAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4gPSBnZXRSZWZyZXNoVG9rZW4oYXVkaWVuY2UsIHNjb3BlKTsKICAgICAgICAgICAgICAgIGlmICghcmVmcmVzaFRva2VuICYmIHVzZU1ycnQpIHsKICAgICAgICAgICAgICAgICAgICBjb25zdCBsYXRlc3RSZWZyZXNoVG9rZW4gPSByZWZyZXNoVG9rZW5zWyJsYXRlc3RfcmVmcmVzaF90b2tlbiJdOwogICAgICAgICAgICAgICAgICAgIGNvbnN0IGlzRG93bnNjb3BpbmcgPSBjaGVja0Rvd25zY29waW5nKHNjb3BlLCBhdWRpZW5jZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGxhdGVzdFJlZnJlc2hUb2tlbiAmJiAhaXNEb3duc2NvcGluZykgewogICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4gPSBsYXRlc3RSZWZyZXNoVG9rZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCFyZWZyZXNoVG9rZW4pIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTWlzc2luZ1JlZnJlc2hUb2tlbkVycm9yKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmZXRjaE9wdGlvbnMuYm9keSA9IHVzZUZvcm1EYXRhID8gY3JlYXRlUXVlcnlQYXJhbXMoX29iamVjdFNwcmVhZDIoX29iamVjdFNwcmVhZDIoe30sIGJvZHkpLCB7fSwgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHJlZnJlc2hUb2tlbgogICAgICAgICAgICAgICAgfSkpIDogSlNPTi5zdHJpbmdpZnkoX29iamVjdFNwcmVhZDIoX29iamVjdFNwcmVhZDIoe30sIGJvZHkpLCB7fSwgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHJlZnJlc2hUb2tlbgogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCBhYm9ydENvbnRyb2xsZXI7CiAgICAgICAgICAgIGlmICh0eXBlb2YgQWJvcnRDb250cm9sbGVyID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICBhYm9ydENvbnRyb2xsZXIgPSBuZXcgQWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLnNpZ25hbCA9IGFib3J0Q29udHJvbGxlci5zaWduYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbGV0IHJlc3BvbnNlOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBQcm9taXNlLnJhY2UoWyB3YWl0KHRpbWVvdXQpLCBmZXRjaChmZXRjaFVybCwgX29iamVjdFNwcmVhZDIoe30sIGZldGNoT3B0aW9ucykpIF0pOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCciCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXJzID0gZnJvbUVudHJpZXMocmVzcG9uc2UuaGVhZGVycyk7CiAgICAgICAgICAgIGpzb24gPSBhd2FpdCByZXNwb25zZS5qc29uKCk7CiAgICAgICAgICAgIGlmIChqc29uLnJlZnJlc2hfdG9rZW4pIHsKICAgICAgICAgICAgICAgIGlmICh1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXSA9IGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgICAgICAgICB1cGRhdGVSZWZyZXNoVG9rZW5zKHJlZnJlc2hUb2tlbiwganNvbi5yZWZyZXNoX3Rva2VuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUb2tlbihqc29uLnJlZnJlc2hfdG9rZW4sIGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBkZWxldGUganNvbi5yZWZyZXNoX3Rva2VuOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZGVsZXRlUmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogcmVzcG9uc2Uub2ssCiAgICAgICAgICAgICAgICBqc29uOiBqc29uLAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIG9rOiBmYWxzZSwKICAgICAgICAgICAgICAgIGpzb246IHsKICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IuZXJyb3IsCiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzCiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgIH07CiAgICB7CiAgICAgICAgYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIG1lc3NhZ2VIYW5kbGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
|
|
1953
2083
|
const singlePromiseMap = {};
|
|
1954
2084
|
const singlePromise = (cb, key) => {
|
|
1955
2085
|
let promise = singlePromiseMap[key];
|
|
@@ -1969,8 +2099,8 @@
|
|
|
1969
2099
|
this.manifestKey = this.createManifestKeyFrom(this.clientId);
|
|
1970
2100
|
}
|
|
1971
2101
|
async add(key) {
|
|
1972
|
-
var
|
|
1973
|
-
const keys = new Set(((
|
|
2102
|
+
var _await$this$cache$get;
|
|
2103
|
+
const keys = new Set(((_await$this$cache$get = await this.cache.get(this.manifestKey)) === null || _await$this$cache$get === void 0 ? void 0 : _await$this$cache$get.keys) || []);
|
|
1974
2104
|
keys.add(key);
|
|
1975
2105
|
await this.cache.set(this.manifestKey, {
|
|
1976
2106
|
keys: [ ...keys ]
|
|
@@ -1999,6 +2129,7 @@
|
|
|
1999
2129
|
return "".concat(CACHE_KEY_PREFIX, "::").concat(clientId);
|
|
2000
2130
|
}
|
|
2001
2131
|
}
|
|
2132
|
+
const _excluded$2 = [ "openUrl", "onRedirect" ];
|
|
2002
2133
|
const GET_TOKEN_SILENTLY_LOCK_KEY = "auth0.lock.getTokenSilently";
|
|
2003
2134
|
const GET_TOKEN_FROM_IFRAME_LOCK_KEY = "auth0.lock.getTokenFromIFrame";
|
|
2004
2135
|
const buildGetTokenSilentlyLockKey = (clientId, audience) => "".concat(GET_TOKEN_SILENTLY_LOCK_KEY, ".").concat(clientId, ".").concat(audience);
|
|
@@ -2011,9 +2142,9 @@
|
|
|
2011
2142
|
localstorage: () => new LocalStorageCache
|
|
2012
2143
|
};
|
|
2013
2144
|
const cacheFactory = location => cacheLocationBuilders[location];
|
|
2014
|
-
const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, nonce, code_challenge, redirect_uri, response_mode, thumbprint) =>
|
|
2145
|
+
const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, nonce, code_challenge, redirect_uri, response_mode, thumbprint) => _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2015
2146
|
client_id: clientOptions.clientId
|
|
2016
|
-
}, clientOptions.authorizationParams), authorizationParams), {
|
|
2147
|
+
}, clientOptions.authorizationParams), authorizationParams), {}, {
|
|
2017
2148
|
scope: scopesToRequest(scope, authorizationParams.scope, authorizationParams.audience),
|
|
2018
2149
|
response_type: "code",
|
|
2019
2150
|
response_mode: response_mode || "query",
|
|
@@ -2025,8 +2156,8 @@
|
|
|
2025
2156
|
dpop_jkt: thumbprint
|
|
2026
2157
|
});
|
|
2027
2158
|
const patchOpenUrlWithOnRedirect = options => {
|
|
2028
|
-
const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions =
|
|
2029
|
-
const result =
|
|
2159
|
+
const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions = _objectWithoutProperties(options, _excluded$2);
|
|
2160
|
+
const result = _objectSpread2(_objectSpread2({}, originalOptions), {}, {
|
|
2030
2161
|
openUrl: openUrl === false || openUrl ? openUrl : onRedirect
|
|
2031
2162
|
});
|
|
2032
2163
|
return result;
|
|
@@ -2043,13 +2174,13 @@
|
|
|
2043
2174
|
return missingScopes.join(",");
|
|
2044
2175
|
};
|
|
2045
2176
|
const getScopeToRequest = (useMrrt, authorizationParams, cachedAudience, cachedScope) => {
|
|
2046
|
-
var _a;
|
|
2047
2177
|
if (useMrrt && cachedAudience && cachedScope) {
|
|
2178
|
+
var _authorizationParams$;
|
|
2048
2179
|
if (authorizationParams.audience !== cachedAudience) {
|
|
2049
2180
|
return authorizationParams.scope;
|
|
2050
2181
|
}
|
|
2051
2182
|
const cachedScopes = cachedScope.split(" ");
|
|
2052
|
-
const newScopes = ((
|
|
2183
|
+
const newScopes = ((_authorizationParams$ = authorizationParams.scope) === null || _authorizationParams$ === void 0 ? void 0 : _authorizationParams$.split(" ")) || [];
|
|
2053
2184
|
const newScopesAreIncluded = newScopes.every(scope => cachedScopes.includes(scope));
|
|
2054
2185
|
return cachedScopes.length >= newScopes.length && newScopesAreIncluded ? cachedScope : authorizationParams.scope;
|
|
2055
2186
|
}
|
|
@@ -2123,7 +2254,7 @@
|
|
|
2123
2254
|
}
|
|
2124
2255
|
async deleteBy(table, predicate) {
|
|
2125
2256
|
const allKeys = await this.executeDbRequest(table, "readonly", table => table.getAllKeys());
|
|
2126
|
-
allKeys === null || allKeys === void 0
|
|
2257
|
+
allKeys === null || allKeys === void 0 || allKeys.filter(predicate).map(k => this.executeDbRequest(table, "readwrite", table => table.delete(k)));
|
|
2127
2258
|
}
|
|
2128
2259
|
deleteByClientId(table, clientId) {
|
|
2129
2260
|
return this.deleteBy(table, k => typeof k === "string" && k.startsWith("".concat(clientId, "::")));
|
|
@@ -2155,7 +2286,7 @@
|
|
|
2155
2286
|
}
|
|
2156
2287
|
async generateProof(params) {
|
|
2157
2288
|
const keyPair = await this.getOrGenerateKeyPair();
|
|
2158
|
-
return generateProof(
|
|
2289
|
+
return generateProof(_objectSpread2({
|
|
2159
2290
|
keyPair: keyPair
|
|
2160
2291
|
}, params));
|
|
2161
2292
|
}
|
|
@@ -2167,15 +2298,15 @@
|
|
|
2167
2298
|
await Promise.all([ this.storage.clearNonces(), this.storage.clearKeyPairs() ]);
|
|
2168
2299
|
}
|
|
2169
2300
|
}
|
|
2170
|
-
var TokenType
|
|
2171
|
-
(function(TokenType) {
|
|
2301
|
+
var TokenType = function(TokenType) {
|
|
2172
2302
|
TokenType["Bearer"] = "Bearer";
|
|
2173
2303
|
TokenType["DPoP"] = "DPoP";
|
|
2174
|
-
|
|
2304
|
+
return TokenType;
|
|
2305
|
+
}(TokenType || {});
|
|
2175
2306
|
class Fetcher {
|
|
2176
2307
|
constructor(config, hooks) {
|
|
2177
2308
|
this.hooks = hooks;
|
|
2178
|
-
this.config =
|
|
2309
|
+
this.config = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
2179
2310
|
fetch: config.fetch || (typeof window === "undefined" ? fetch : window.fetch.bind(window))
|
|
2180
2311
|
});
|
|
2181
2312
|
}
|
|
@@ -2283,7 +2414,7 @@
|
|
|
2283
2414
|
}
|
|
2284
2415
|
fetchWithAuth(info, init, authParams) {
|
|
2285
2416
|
const callbacks = {
|
|
2286
|
-
onUseDpopNonceError: () => this.internalFetchWithAuth(info, init,
|
|
2417
|
+
onUseDpopNonceError: () => this.internalFetchWithAuth(info, init, _objectSpread2(_objectSpread2({}, callbacks), {}, {
|
|
2287
2418
|
onUseDpopNonceError: undefined
|
|
2288
2419
|
}), authParams)
|
|
2289
2420
|
};
|
|
@@ -2376,7 +2507,7 @@
|
|
|
2376
2507
|
};
|
|
2377
2508
|
function getAuthJsEnrollParams(params) {
|
|
2378
2509
|
const mapping = FACTOR_MAPPING[params.factorType];
|
|
2379
|
-
return
|
|
2510
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2380
2511
|
mfaToken: params.mfaToken,
|
|
2381
2512
|
authenticatorTypes: mapping.authenticatorTypes
|
|
2382
2513
|
}, mapping.oobChannels && {
|
|
@@ -2399,144 +2530,6 @@
|
|
|
2399
2530
|
}
|
|
2400
2531
|
return undefined;
|
|
2401
2532
|
}
|
|
2402
|
-
function _OverloadYield(e, d) {
|
|
2403
|
-
this.v = e, this.k = d;
|
|
2404
|
-
}
|
|
2405
|
-
function _assertClassBrand(e, t, n) {
|
|
2406
|
-
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
2407
|
-
throw new TypeError("Private element is not present on this object");
|
|
2408
|
-
}
|
|
2409
|
-
function _awaitAsyncGenerator(e) {
|
|
2410
|
-
return new _OverloadYield(e, 0);
|
|
2411
|
-
}
|
|
2412
|
-
function _checkPrivateRedeclaration(e, t) {
|
|
2413
|
-
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
2414
|
-
}
|
|
2415
|
-
function _classPrivateFieldGet2(s, a) {
|
|
2416
|
-
return s.get(_assertClassBrand(s, a));
|
|
2417
|
-
}
|
|
2418
|
-
function _classPrivateFieldInitSpec(e, t, a) {
|
|
2419
|
-
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
2420
|
-
}
|
|
2421
|
-
function _classPrivateFieldSet2(s, a, r) {
|
|
2422
|
-
return s.set(_assertClassBrand(s, a), r), r;
|
|
2423
|
-
}
|
|
2424
|
-
function _classPrivateMethodInitSpec(e, a) {
|
|
2425
|
-
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
2426
|
-
}
|
|
2427
|
-
function _defineProperty(e, r, t) {
|
|
2428
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
2429
|
-
value: t,
|
|
2430
|
-
enumerable: !0,
|
|
2431
|
-
configurable: !0,
|
|
2432
|
-
writable: !0
|
|
2433
|
-
}) : e[r] = t, e;
|
|
2434
|
-
}
|
|
2435
|
-
function ownKeys(e, r) {
|
|
2436
|
-
var t = Object.keys(e);
|
|
2437
|
-
if (Object.getOwnPropertySymbols) {
|
|
2438
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
2439
|
-
r && (o = o.filter(function(r) {
|
|
2440
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
2441
|
-
})), t.push.apply(t, o);
|
|
2442
|
-
}
|
|
2443
|
-
return t;
|
|
2444
|
-
}
|
|
2445
|
-
function _objectSpread2(e) {
|
|
2446
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
2447
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
2448
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
2449
|
-
_defineProperty(e, r, t[r]);
|
|
2450
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
2451
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
2452
|
-
});
|
|
2453
|
-
}
|
|
2454
|
-
return e;
|
|
2455
|
-
}
|
|
2456
|
-
function _objectWithoutProperties(e, t) {
|
|
2457
|
-
if (null == e) return {};
|
|
2458
|
-
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
2459
|
-
if (Object.getOwnPropertySymbols) {
|
|
2460
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
2461
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
2462
|
-
}
|
|
2463
|
-
return i;
|
|
2464
|
-
}
|
|
2465
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
2466
|
-
if (null == r) return {};
|
|
2467
|
-
var t = {};
|
|
2468
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2469
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
2470
|
-
t[n] = r[n];
|
|
2471
|
-
}
|
|
2472
|
-
return t;
|
|
2473
|
-
}
|
|
2474
|
-
function _toPrimitive(t, r) {
|
|
2475
|
-
if ("object" != typeof t || !t) return t;
|
|
2476
|
-
var e = t[Symbol.toPrimitive];
|
|
2477
|
-
if (void 0 !== e) {
|
|
2478
|
-
var i = e.call(t, r || "default");
|
|
2479
|
-
if ("object" != typeof i) return i;
|
|
2480
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2481
|
-
}
|
|
2482
|
-
return ("string" === r ? String : Number)(t);
|
|
2483
|
-
}
|
|
2484
|
-
function _toPropertyKey(t) {
|
|
2485
|
-
var i = _toPrimitive(t, "string");
|
|
2486
|
-
return "symbol" == typeof i ? i : i + "";
|
|
2487
|
-
}
|
|
2488
|
-
function _wrapAsyncGenerator(e) {
|
|
2489
|
-
return function() {
|
|
2490
|
-
return new AsyncGenerator(e.apply(this, arguments));
|
|
2491
|
-
};
|
|
2492
|
-
}
|
|
2493
|
-
function AsyncGenerator(e) {
|
|
2494
|
-
var t, n;
|
|
2495
|
-
function resume(t, n) {
|
|
2496
|
-
try {
|
|
2497
|
-
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
|
|
2498
|
-
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
2499
|
-
if (u) {
|
|
2500
|
-
var i = "return" === t && o.k ? t : "next";
|
|
2501
|
-
if (!o.k || n.done) return resume(i, n);
|
|
2502
|
-
n = e[i](n).value;
|
|
2503
|
-
}
|
|
2504
|
-
settle(!!r.done, n);
|
|
2505
|
-
}, function(e) {
|
|
2506
|
-
resume("throw", e);
|
|
2507
|
-
});
|
|
2508
|
-
} catch (e) {
|
|
2509
|
-
settle(2, e);
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
|
-
function settle(e, r) {
|
|
2513
|
-
2 === e ? t.reject(r) : t.resolve({
|
|
2514
|
-
value: r,
|
|
2515
|
-
done: e
|
|
2516
|
-
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
2517
|
-
}
|
|
2518
|
-
this._invoke = function(e, r) {
|
|
2519
|
-
return new Promise(function(o, u) {
|
|
2520
|
-
var i = {
|
|
2521
|
-
key: e,
|
|
2522
|
-
arg: r,
|
|
2523
|
-
resolve: o,
|
|
2524
|
-
reject: u,
|
|
2525
|
-
next: null
|
|
2526
|
-
};
|
|
2527
|
-
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
2528
|
-
});
|
|
2529
|
-
}, "function" != typeof e.return && (this.return = void 0);
|
|
2530
|
-
}
|
|
2531
|
-
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
2532
|
-
return this;
|
|
2533
|
-
}, AsyncGenerator.prototype.next = function(e) {
|
|
2534
|
-
return this._invoke("next", e);
|
|
2535
|
-
}, AsyncGenerator.prototype.throw = function(e) {
|
|
2536
|
-
return this._invoke("throw", e);
|
|
2537
|
-
}, AsyncGenerator.prototype.return = function(e) {
|
|
2538
|
-
return this._invoke("return", e);
|
|
2539
|
-
};
|
|
2540
2533
|
var _navigator$userAgent$2, _navigator$userAgent$$2;
|
|
2541
2534
|
let USER_AGENT$2;
|
|
2542
2535
|
if (typeof navigator === "undefined" || !((_navigator$userAgent$2 = navigator.userAgent) !== null && _navigator$userAgent$2 !== void 0 && (_navigator$userAgent$$2 = _navigator$userAgent$2.startsWith) !== null && _navigator$userAgent$$2 !== void 0 && _navigator$userAgent$$2.call(_navigator$userAgent$2, "Mozilla/5.0 "))) {
|
|
@@ -6492,7 +6485,7 @@
|
|
|
6492
6485
|
});
|
|
6493
6486
|
return remoteJWKSet;
|
|
6494
6487
|
}
|
|
6495
|
-
const _excluded = [ "mfaToken" ], _excluded2 = [ "mfaToken" ];
|
|
6488
|
+
const _excluded$1 = [ "mfaToken" ], _excluded2$1 = [ "mfaToken" ];
|
|
6496
6489
|
var _baseUrl, _clientId, _customFetch, _entries, _ttlMs, _maxEntries, _configuration, _serverMetadata, _clientAuthPromise, _options, _customFetch2, _jwks, _discoveryCache, _inFlightDiscovery, _jwksCache, _Class9_brand;
|
|
6497
6490
|
var NotSupportedError = class NotSupportedError extends Error {
|
|
6498
6491
|
constructor(code, message) {
|
|
@@ -6533,6 +6526,12 @@
|
|
|
6533
6526
|
this.name = "TokenByRefreshTokenError";
|
|
6534
6527
|
}
|
|
6535
6528
|
};
|
|
6529
|
+
var TokenByPasswordError = class extends ApiError {
|
|
6530
|
+
constructor(message, cause) {
|
|
6531
|
+
super("token_by_password_error", message, cause);
|
|
6532
|
+
this.name = "TokenByPasswordError";
|
|
6533
|
+
}
|
|
6534
|
+
};
|
|
6536
6535
|
var TokenForConnectionError = class extends ApiError {
|
|
6537
6536
|
constructor(message, cause) {
|
|
6538
6537
|
super("token_for_connection_error", message, cause);
|
|
@@ -6706,7 +6705,7 @@
|
|
|
6706
6705
|
}
|
|
6707
6706
|
async enrollAuthenticator(options) {
|
|
6708
6707
|
const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/associate");
|
|
6709
|
-
const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded);
|
|
6708
|
+
const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded$1);
|
|
6710
6709
|
const apiParams = {
|
|
6711
6710
|
authenticator_types: sdkParams.authenticatorTypes
|
|
6712
6711
|
};
|
|
@@ -6751,7 +6750,7 @@
|
|
|
6751
6750
|
}
|
|
6752
6751
|
async challengeAuthenticator(options) {
|
|
6753
6752
|
const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/challenge");
|
|
6754
|
-
const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2);
|
|
6753
|
+
const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2$1);
|
|
6755
6754
|
const body = {
|
|
6756
6755
|
mfa_token: mfaToken,
|
|
6757
6756
|
client_id: _classPrivateFieldGet2(_clientId, this),
|
|
@@ -6806,7 +6805,7 @@
|
|
|
6806
6805
|
return {
|
|
6807
6806
|
enabled: true,
|
|
6808
6807
|
name: (_config$name = config === null || config === void 0 ? void 0 : config.name) !== null && _config$name !== void 0 ? _config$name : "@auth0/auth0-auth-js",
|
|
6809
|
-
version: (_config$version = config === null || config === void 0 ? void 0 : config.version) !== null && _config$version !== void 0 ? _config$version : "1.
|
|
6808
|
+
version: (_config$version = config === null || config === void 0 ? void 0 : config.version) !== null && _config$version !== void 0 ? _config$version : "1.6.0"
|
|
6810
6809
|
};
|
|
6811
6810
|
}
|
|
6812
6811
|
var TokenResponse = class _TokenResponse {
|
|
@@ -7155,6 +7154,38 @@
|
|
|
7155
7154
|
throw new TokenByRefreshTokenError("The access token has expired and there was an error while trying to refresh it.", e);
|
|
7156
7155
|
}
|
|
7157
7156
|
}
|
|
7157
|
+
async getTokenByPassword(options) {
|
|
7158
|
+
const {configuration: configuration} = await _assertClassBrand(_Class9_brand, this, _discover).call(this);
|
|
7159
|
+
const params = new URLSearchParams({
|
|
7160
|
+
username: options.username,
|
|
7161
|
+
password: options.password
|
|
7162
|
+
});
|
|
7163
|
+
if (options.audience) {
|
|
7164
|
+
params.append("audience", options.audience);
|
|
7165
|
+
}
|
|
7166
|
+
if (options.scope) {
|
|
7167
|
+
params.append("scope", options.scope);
|
|
7168
|
+
}
|
|
7169
|
+
if (options.realm) {
|
|
7170
|
+
params.append("realm", options.realm);
|
|
7171
|
+
}
|
|
7172
|
+
let requestConfig = configuration;
|
|
7173
|
+
if (options.auth0ForwardedFor) {
|
|
7174
|
+
const clientAuth = await _assertClassBrand(_Class9_brand, this, _getClientAuth).call(this);
|
|
7175
|
+
requestConfig = new Configuration(configuration.serverMetadata(), _classPrivateFieldGet2(_options, this).clientId, _classPrivateFieldGet2(_options, this).clientSecret, clientAuth);
|
|
7176
|
+
requestConfig[customFetch$1] = (url, init) => _classPrivateFieldGet2(_customFetch2, this).call(this, url, _objectSpread2(_objectSpread2({}, init), {}, {
|
|
7177
|
+
headers: _objectSpread2(_objectSpread2({}, init.headers), {}, {
|
|
7178
|
+
"auth0-forwarded-for": options.auth0ForwardedFor
|
|
7179
|
+
})
|
|
7180
|
+
}));
|
|
7181
|
+
}
|
|
7182
|
+
try {
|
|
7183
|
+
const tokenEndpointResponse = await genericGrantRequest(requestConfig, "password", params);
|
|
7184
|
+
return TokenResponse.fromTokenEndpointResponse(tokenEndpointResponse);
|
|
7185
|
+
} catch (e) {
|
|
7186
|
+
throw new TokenByPasswordError("There was an error while trying to request a token.", e);
|
|
7187
|
+
}
|
|
7188
|
+
}
|
|
7158
7189
|
async getTokenByClientCredentials(options) {
|
|
7159
7190
|
const {configuration: configuration} = await _assertClassBrand(_Class9_brand, this, _discover).call(this);
|
|
7160
7191
|
try {
|
|
@@ -7439,12 +7470,12 @@
|
|
|
7439
7470
|
class MfaContextManager {
|
|
7440
7471
|
constructor() {
|
|
7441
7472
|
let ttlMs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_TTL_MS;
|
|
7442
|
-
this
|
|
7473
|
+
_defineProperty(this, "contexts", new Map);
|
|
7443
7474
|
this.ttlMs = ttlMs;
|
|
7444
7475
|
}
|
|
7445
7476
|
set(mfaToken, context) {
|
|
7446
7477
|
this.cleanup();
|
|
7447
|
-
this.contexts.set(mfaToken,
|
|
7478
|
+
this.contexts.set(mfaToken, _objectSpread2(_objectSpread2({}, context), {}, {
|
|
7448
7479
|
createdAt: Date.now()
|
|
7449
7480
|
}));
|
|
7450
7481
|
}
|
|
@@ -7488,9 +7519,9 @@
|
|
|
7488
7519
|
});
|
|
7489
7520
|
}
|
|
7490
7521
|
async getAuthenticators(mfaToken) {
|
|
7491
|
-
var
|
|
7522
|
+
var _context$mfaRequireme;
|
|
7492
7523
|
const context = this.contextManager.get(mfaToken);
|
|
7493
|
-
if (!(
|
|
7524
|
+
if (!(context !== null && context !== void 0 && (_context$mfaRequireme = context.mfaRequirements) !== null && _context$mfaRequireme !== void 0 && _context$mfaRequireme.challenge) || context.mfaRequirements.challenge.length === 0) {
|
|
7494
7525
|
throw new MfaListAuthenticatorsError("invalid_request", "challengeType is required and must contain at least one challenge type, please check mfa_required error payload");
|
|
7495
7526
|
}
|
|
7496
7527
|
const challengeTypes = context.mfaRequirements.challenge.map(c => c.type);
|
|
@@ -7504,25 +7535,25 @@
|
|
|
7504
7535
|
});
|
|
7505
7536
|
} catch (error) {
|
|
7506
7537
|
if (error instanceof MfaListAuthenticatorsError$1) {
|
|
7507
|
-
|
|
7538
|
+
var _error$cause;
|
|
7539
|
+
throw new MfaListAuthenticatorsError((_error$cause = error.cause) === null || _error$cause === void 0 ? void 0 : _error$cause.error, error.message);
|
|
7508
7540
|
}
|
|
7509
7541
|
throw error;
|
|
7510
7542
|
}
|
|
7511
7543
|
}
|
|
7512
7544
|
async enroll(params) {
|
|
7513
|
-
var _a;
|
|
7514
7545
|
const authJsParams = getAuthJsEnrollParams(params);
|
|
7515
7546
|
try {
|
|
7516
7547
|
return await this.authJsMfaClient.enrollAuthenticator(authJsParams);
|
|
7517
7548
|
} catch (error) {
|
|
7518
7549
|
if (error instanceof MfaEnrollmentError$1) {
|
|
7519
|
-
|
|
7550
|
+
var _error$cause2;
|
|
7551
|
+
throw new MfaEnrollmentError((_error$cause2 = error.cause) === null || _error$cause2 === void 0 ? void 0 : _error$cause2.error, error.message);
|
|
7520
7552
|
}
|
|
7521
7553
|
throw error;
|
|
7522
7554
|
}
|
|
7523
7555
|
}
|
|
7524
7556
|
async challenge(params) {
|
|
7525
|
-
var _a;
|
|
7526
7557
|
try {
|
|
7527
7558
|
const authJsParams = {
|
|
7528
7559
|
challengeType: params.challengeType,
|
|
@@ -7534,7 +7565,8 @@
|
|
|
7534
7565
|
return await this.authJsMfaClient.challengeAuthenticator(authJsParams);
|
|
7535
7566
|
} catch (error) {
|
|
7536
7567
|
if (error instanceof MfaChallengeError$1) {
|
|
7537
|
-
|
|
7568
|
+
var _error$cause3;
|
|
7569
|
+
throw new MfaChallengeError((_error$cause3 = error.cause) === null || _error$cause3 === void 0 ? void 0 : _error$cause3.error, error.message);
|
|
7538
7570
|
}
|
|
7539
7571
|
throw error;
|
|
7540
7572
|
}
|
|
@@ -7583,18 +7615,19 @@
|
|
|
7583
7615
|
}
|
|
7584
7616
|
}
|
|
7585
7617
|
}
|
|
7618
|
+
const _excluded = [ "openUrl", "fragment", "appState" ], _excluded2 = [ "url" ], _excluded3 = [ "cacheMode" ], _excluded4 = [ "federated" ], _excluded5 = [ "openUrl" ], _excluded6 = [ "id_token", "decodedToken" ], _excluded7 = [ "mfaToken" ];
|
|
7586
7619
|
class Auth0Client {
|
|
7587
7620
|
constructor(options) {
|
|
7588
|
-
this
|
|
7589
|
-
this
|
|
7621
|
+
_defineProperty(this, "userCache", (new InMemoryCache).enclosedCache);
|
|
7622
|
+
_defineProperty(this, "defaultOptions", {
|
|
7590
7623
|
authorizationParams: {
|
|
7591
7624
|
scope: DEFAULT_SCOPE
|
|
7592
7625
|
},
|
|
7593
7626
|
useRefreshTokensFallback: false,
|
|
7594
7627
|
useFormData: true
|
|
7595
|
-
};
|
|
7596
|
-
this.options =
|
|
7597
|
-
authorizationParams:
|
|
7628
|
+
});
|
|
7629
|
+
this.options = _objectSpread2(_objectSpread2(_objectSpread2({}, this.defaultOptions), options), {}, {
|
|
7630
|
+
authorizationParams: _objectSpread2(_objectSpread2({}, this.defaultOptions.authorizationParams), options.authorizationParams)
|
|
7598
7631
|
});
|
|
7599
7632
|
typeof window !== "undefined" && validateCrypto();
|
|
7600
7633
|
this.lockManager = getLockManager();
|
|
@@ -7626,9 +7659,9 @@
|
|
|
7626
7659
|
this.domainUrl = getDomain(this.options.domain);
|
|
7627
7660
|
this.tokenIssuer = getTokenIssuer(this.options.issuer, this.domainUrl);
|
|
7628
7661
|
const myAccountApiIdentifier = "".concat(this.domainUrl, "/me/");
|
|
7629
|
-
const myAccountFetcher = this.createFetcher(
|
|
7662
|
+
const myAccountFetcher = this.createFetcher(_objectSpread2(_objectSpread2({}, this.options.useDpop && {
|
|
7630
7663
|
dpopNonceId: "__auth0_my_account_api__"
|
|
7631
|
-
}), {
|
|
7664
|
+
}), {}, {
|
|
7632
7665
|
getAccessToken: () => this.getTokenSilently({
|
|
7633
7666
|
authorizationParams: {
|
|
7634
7667
|
scope: "create:me:connected_accounts",
|
|
@@ -7702,7 +7735,7 @@
|
|
|
7702
7735
|
url.searchParams.delete(paramName);
|
|
7703
7736
|
window.history.replaceState({}, "", url.toString());
|
|
7704
7737
|
}
|
|
7705
|
-
} catch (
|
|
7738
|
+
} catch (_unused) {}
|
|
7706
7739
|
}
|
|
7707
7740
|
_applySessionTransferToken(authorizationParams) {
|
|
7708
7741
|
const paramName = this.options.sessionTransferTokenQueryParamName;
|
|
@@ -7712,18 +7745,18 @@
|
|
|
7712
7745
|
const token = this._extractSessionTransferToken(paramName);
|
|
7713
7746
|
if (!token) return authorizationParams;
|
|
7714
7747
|
this._clearSessionTransferTokenFromUrl(paramName);
|
|
7715
|
-
return
|
|
7748
|
+
return _objectSpread2(_objectSpread2({}, authorizationParams), {}, {
|
|
7716
7749
|
session_transfer_token: token
|
|
7717
7750
|
});
|
|
7718
7751
|
}
|
|
7719
7752
|
async _prepareAuthorizeUrl(authorizationParams, authorizeOptions, fallbackRedirectUri) {
|
|
7720
|
-
var
|
|
7753
|
+
var _this$dpop;
|
|
7721
7754
|
const state = encode$2(createRandomString());
|
|
7722
7755
|
const nonce = encode$2(createRandomString());
|
|
7723
7756
|
const code_verifier = createRandomString();
|
|
7724
7757
|
const code_challengeBuffer = await sha256(code_verifier);
|
|
7725
7758
|
const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
|
|
7726
|
-
const thumbprint = await ((
|
|
7759
|
+
const thumbprint = await ((_this$dpop = this.dpop) === null || _this$dpop === void 0 ? void 0 : _this$dpop.calculateThumbprint());
|
|
7727
7760
|
const params = getAuthorizeParams(this.options, this.scope, authorizationParams, state, nonce, code_challenge, authorizationParams.redirect_uri || this.options.authorizationParams.redirect_uri || fallbackRedirectUri, authorizeOptions === null || authorizeOptions === void 0 ? void 0 : authorizeOptions.response_mode, thumbprint);
|
|
7728
7761
|
const url = this._authorizeUrl(params);
|
|
7729
7762
|
return {
|
|
@@ -7737,7 +7770,7 @@
|
|
|
7737
7770
|
};
|
|
7738
7771
|
}
|
|
7739
7772
|
async loginWithPopup(options, config) {
|
|
7740
|
-
var
|
|
7773
|
+
var _options$authorizatio;
|
|
7741
7774
|
options = options || {};
|
|
7742
7775
|
config = config || {};
|
|
7743
7776
|
if (!config.popup) {
|
|
@@ -7751,13 +7784,13 @@
|
|
|
7751
7784
|
response_mode: "web_message"
|
|
7752
7785
|
}, window.location.origin);
|
|
7753
7786
|
config.popup.location.href = params.url;
|
|
7754
|
-
const codeResult = await runPopup(
|
|
7787
|
+
const codeResult = await runPopup(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
7755
7788
|
timeoutInSeconds: config.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
|
|
7756
|
-
}));
|
|
7789
|
+
}), new URL(params.url).origin);
|
|
7757
7790
|
if (params.state !== codeResult.state) {
|
|
7758
7791
|
throw new GenericError("state_mismatch", "Invalid state");
|
|
7759
7792
|
}
|
|
7760
|
-
const organization = ((
|
|
7793
|
+
const organization = ((_options$authorizatio = options.authorizationParams) === null || _options$authorizatio === void 0 ? void 0 : _options$authorizatio.organization) || this.options.authorizationParams.organization;
|
|
7761
7794
|
await this._requestToken({
|
|
7762
7795
|
audience: params.audience,
|
|
7763
7796
|
scope: params.scope,
|
|
@@ -7771,26 +7804,26 @@
|
|
|
7771
7804
|
});
|
|
7772
7805
|
}
|
|
7773
7806
|
async getUser() {
|
|
7774
|
-
var
|
|
7807
|
+
var _cache$decodedToken;
|
|
7775
7808
|
const cache = await this._getIdTokenFromCache();
|
|
7776
|
-
return
|
|
7809
|
+
return cache === null || cache === void 0 || (_cache$decodedToken = cache.decodedToken) === null || _cache$decodedToken === void 0 ? void 0 : _cache$decodedToken.user;
|
|
7777
7810
|
}
|
|
7778
7811
|
async getIdTokenClaims() {
|
|
7779
|
-
var
|
|
7812
|
+
var _cache$decodedToken2;
|
|
7780
7813
|
const cache = await this._getIdTokenFromCache();
|
|
7781
|
-
return
|
|
7814
|
+
return cache === null || cache === void 0 || (_cache$decodedToken2 = cache.decodedToken) === null || _cache$decodedToken2 === void 0 ? void 0 : _cache$decodedToken2.claims;
|
|
7782
7815
|
}
|
|
7783
7816
|
async loginWithRedirect() {
|
|
7817
|
+
var _urlOptions$authoriza;
|
|
7784
7818
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7785
|
-
|
|
7786
|
-
const
|
|
7787
|
-
const organization = ((_a = urlOptions.authorizationParams) === null || _a === void 0 ? void 0 : _a.organization) || this.options.authorizationParams.organization;
|
|
7819
|
+
const _patchOpenUrlWithOnRe = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl, fragment: fragment, appState: appState} = _patchOpenUrlWithOnRe, urlOptions = _objectWithoutProperties(_patchOpenUrlWithOnRe, _excluded);
|
|
7820
|
+
const organization = ((_urlOptions$authoriza = urlOptions.authorizationParams) === null || _urlOptions$authoriza === void 0 ? void 0 : _urlOptions$authoriza.organization) || this.options.authorizationParams.organization;
|
|
7788
7821
|
const authorizationParams = this._applySessionTransferToken(urlOptions.authorizationParams || {});
|
|
7789
|
-
const
|
|
7790
|
-
this.transactionManager.create(
|
|
7822
|
+
const _await$this$_prepareA = await this._prepareAuthorizeUrl(authorizationParams), {url: url} = _await$this$_prepareA, transaction = _objectWithoutProperties(_await$this$_prepareA, _excluded2);
|
|
7823
|
+
this.transactionManager.create(_objectSpread2(_objectSpread2({}, transaction), {}, {
|
|
7791
7824
|
appState: appState,
|
|
7792
|
-
response_type:
|
|
7793
|
-
}
|
|
7825
|
+
response_type: ResponseType.Code
|
|
7826
|
+
}, organization && {
|
|
7794
7827
|
organization: organization
|
|
7795
7828
|
}));
|
|
7796
7829
|
const urlWithFragment = fragment ? "".concat(url, "#").concat(fragment) : url;
|
|
@@ -7812,7 +7845,7 @@
|
|
|
7812
7845
|
}
|
|
7813
7846
|
this.transactionManager.remove();
|
|
7814
7847
|
const authenticationResult = parseAuthenticationResult(queryStringFragments.join(""));
|
|
7815
|
-
if (transaction.response_type ===
|
|
7848
|
+
if (transaction.response_type === ResponseType.ConnectCode) {
|
|
7816
7849
|
return this._handleConnectAccountRedirectCallback(authenticationResult, transaction);
|
|
7817
7850
|
}
|
|
7818
7851
|
return this._handleLoginRedirectCallback(authenticationResult, transaction);
|
|
@@ -7828,7 +7861,7 @@
|
|
|
7828
7861
|
const organization = transaction.organization;
|
|
7829
7862
|
const nonceIn = transaction.nonce;
|
|
7830
7863
|
const redirect_uri = transaction.redirect_uri;
|
|
7831
|
-
await this._requestToken(
|
|
7864
|
+
await this._requestToken(_objectSpread2({
|
|
7832
7865
|
audience: transaction.audience,
|
|
7833
7866
|
scope: transaction.scope,
|
|
7834
7867
|
code_verifier: transaction.code_verifier,
|
|
@@ -7842,7 +7875,7 @@
|
|
|
7842
7875
|
});
|
|
7843
7876
|
return {
|
|
7844
7877
|
appState: transaction.appState,
|
|
7845
|
-
response_type:
|
|
7878
|
+
response_type: ResponseType.Code
|
|
7846
7879
|
};
|
|
7847
7880
|
}
|
|
7848
7881
|
async _handleConnectAccountRedirectCallback(connectResult, transaction) {
|
|
@@ -7862,9 +7895,9 @@
|
|
|
7862
7895
|
redirect_uri: transaction.redirect_uri,
|
|
7863
7896
|
code_verifier: transaction.code_verifier
|
|
7864
7897
|
});
|
|
7865
|
-
return
|
|
7898
|
+
return _objectSpread2(_objectSpread2({}, data), {}, {
|
|
7866
7899
|
appState: transaction.appState,
|
|
7867
|
-
response_type:
|
|
7900
|
+
response_type: ResponseType.ConnectCode
|
|
7868
7901
|
});
|
|
7869
7902
|
}
|
|
7870
7903
|
async checkSession(options) {
|
|
@@ -7884,20 +7917,20 @@
|
|
|
7884
7917
|
} catch (_) {}
|
|
7885
7918
|
}
|
|
7886
7919
|
async getTokenSilently() {
|
|
7920
|
+
var _options$authorizatio2, _options$authorizatio3;
|
|
7887
7921
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7888
|
-
|
|
7889
|
-
const localOptions = Object.assign(Object.assign({
|
|
7922
|
+
const localOptions = _objectSpread2(_objectSpread2({
|
|
7890
7923
|
cacheMode: "on"
|
|
7891
|
-
}, options), {
|
|
7892
|
-
authorizationParams:
|
|
7893
|
-
scope: scopesToRequest(this.scope, (
|
|
7924
|
+
}, options), {}, {
|
|
7925
|
+
authorizationParams: _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.authorizationParams), options.authorizationParams), {}, {
|
|
7926
|
+
scope: scopesToRequest(this.scope, (_options$authorizatio2 = options.authorizationParams) === null || _options$authorizatio2 === void 0 ? void 0 : _options$authorizatio2.scope, ((_options$authorizatio3 = options.authorizationParams) === null || _options$authorizatio3 === void 0 ? void 0 : _options$authorizatio3.audience) || this.options.authorizationParams.audience)
|
|
7894
7927
|
})
|
|
7895
7928
|
});
|
|
7896
7929
|
const result = await singlePromise(() => this._getTokenSilently(localOptions), "".concat(this.options.clientId, "::").concat(localOptions.authorizationParams.audience, "::").concat(localOptions.authorizationParams.scope));
|
|
7897
7930
|
return options.detailedResponse ? result : result === null || result === void 0 ? void 0 : result.access_token;
|
|
7898
7931
|
}
|
|
7899
7932
|
async _getTokenSilently(options) {
|
|
7900
|
-
const {cacheMode: cacheMode} = options, getTokenOptions =
|
|
7933
|
+
const {cacheMode: cacheMode} = options, getTokenOptions = _objectWithoutProperties(options, _excluded3);
|
|
7901
7934
|
if (cacheMode !== "off") {
|
|
7902
7935
|
const entry = await this._getEntryFromCache({
|
|
7903
7936
|
scope: getTokenOptions.authorizationParams.scope,
|
|
@@ -7927,13 +7960,13 @@
|
|
|
7927
7960
|
}
|
|
7928
7961
|
const authResult = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(getTokenOptions) : await this._getTokenFromIFrame(getTokenOptions);
|
|
7929
7962
|
const {id_token: id_token, token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = authResult;
|
|
7930
|
-
return
|
|
7963
|
+
return _objectSpread2(_objectSpread2({
|
|
7931
7964
|
id_token: id_token,
|
|
7932
7965
|
token_type: token_type,
|
|
7933
7966
|
access_token: access_token
|
|
7934
7967
|
}, oauthTokenScope ? {
|
|
7935
7968
|
scope: oauthTokenScope
|
|
7936
|
-
} : null), {
|
|
7969
|
+
} : null), {}, {
|
|
7937
7970
|
expires_in: expires_in
|
|
7938
7971
|
});
|
|
7939
7972
|
});
|
|
@@ -7969,15 +8002,15 @@
|
|
|
7969
8002
|
}
|
|
7970
8003
|
}
|
|
7971
8004
|
async getTokenWithPopup() {
|
|
8005
|
+
var _options$authorizatio4, _options$authorizatio5;
|
|
7972
8006
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7973
8007
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
scope: scopesToRequest(this.scope, (_a = options.authorizationParams) === null || _a === void 0 ? void 0 : _a.scope, ((_b = options.authorizationParams) === null || _b === void 0 ? void 0 : _b.audience) || this.options.authorizationParams.audience)
|
|
8008
|
+
const localOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
8009
|
+
authorizationParams: _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.authorizationParams), options.authorizationParams), {}, {
|
|
8010
|
+
scope: scopesToRequest(this.scope, (_options$authorizatio4 = options.authorizationParams) === null || _options$authorizatio4 === void 0 ? void 0 : _options$authorizatio4.scope, ((_options$authorizatio5 = options.authorizationParams) === null || _options$authorizatio5 === void 0 ? void 0 : _options$authorizatio5.audience) || this.options.authorizationParams.audience)
|
|
7978
8011
|
})
|
|
7979
8012
|
});
|
|
7980
|
-
config =
|
|
8013
|
+
config = _objectSpread2(_objectSpread2({}, DEFAULT_POPUP_CONFIG_OPTIONS), config);
|
|
7981
8014
|
await this.loginWithPopup(localOptions, config);
|
|
7982
8015
|
const cache = await this.cacheManager.get(new CacheKey({
|
|
7983
8016
|
scope: localOptions.authorizationParams.scope,
|
|
@@ -7996,17 +8029,17 @@
|
|
|
7996
8029
|
} else {
|
|
7997
8030
|
delete options.clientId;
|
|
7998
8031
|
}
|
|
7999
|
-
const
|
|
8032
|
+
const _ref = options.logoutParams || {}, {federated: federated} = _ref, logoutOptions = _objectWithoutProperties(_ref, _excluded4);
|
|
8000
8033
|
const federatedQuery = federated ? "&federated" : "";
|
|
8001
|
-
const url = this._url("/v2/logout?".concat(createQueryParams(
|
|
8034
|
+
const url = this._url("/v2/logout?".concat(createQueryParams(_objectSpread2({
|
|
8002
8035
|
clientId: options.clientId
|
|
8003
8036
|
}, logoutOptions))));
|
|
8004
8037
|
return url + federatedQuery;
|
|
8005
8038
|
}
|
|
8006
8039
|
async logout() {
|
|
8040
|
+
var _this$dpop2;
|
|
8007
8041
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8008
|
-
|
|
8009
|
-
const _b = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _b, logoutOptions = __rest(_b, [ "openUrl" ]);
|
|
8042
|
+
const _patchOpenUrlWithOnRe2 = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _patchOpenUrlWithOnRe2, logoutOptions = _objectWithoutProperties(_patchOpenUrlWithOnRe2, _excluded5);
|
|
8010
8043
|
if (options.clientId === null) {
|
|
8011
8044
|
await this.cacheManager.clear();
|
|
8012
8045
|
} else {
|
|
@@ -8019,7 +8052,7 @@
|
|
|
8019
8052
|
cookieDomain: this.options.cookieDomain
|
|
8020
8053
|
});
|
|
8021
8054
|
this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
|
|
8022
|
-
await ((
|
|
8055
|
+
await ((_this$dpop2 = this.dpop) === null || _this$dpop2 === void 0 ? void 0 : _this$dpop2.clear());
|
|
8023
8056
|
const url = this._buildLogoutUrl(logoutOptions);
|
|
8024
8057
|
if (openUrl) {
|
|
8025
8058
|
await openUrl(url);
|
|
@@ -8031,7 +8064,7 @@
|
|
|
8031
8064
|
const iframeLockKey = buildIframeLockKey(this.options.clientId);
|
|
8032
8065
|
try {
|
|
8033
8066
|
return await this.lockManager.runWithLock(iframeLockKey, 5e3, async () => {
|
|
8034
|
-
const params =
|
|
8067
|
+
const params = _objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
|
|
8035
8068
|
prompt: "none"
|
|
8036
8069
|
});
|
|
8037
8070
|
const orgHint = this.cookieStorage.get(this.orgHintCookieName);
|
|
@@ -8048,14 +8081,14 @@
|
|
|
8048
8081
|
let eventOrigin;
|
|
8049
8082
|
try {
|
|
8050
8083
|
eventOrigin = new URL(this.domainUrl).origin;
|
|
8051
|
-
} catch (
|
|
8084
|
+
} catch (_unused2) {
|
|
8052
8085
|
eventOrigin = this.domainUrl;
|
|
8053
8086
|
}
|
|
8054
8087
|
const codeResult = await runIframe(url, eventOrigin, authorizeTimeout);
|
|
8055
8088
|
if (stateIn !== codeResult.state) {
|
|
8056
8089
|
throw new GenericError("state_mismatch", "Invalid state");
|
|
8057
8090
|
}
|
|
8058
|
-
const tokenResult = await this._requestToken(
|
|
8091
|
+
const tokenResult = await this._requestToken(_objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
|
|
8059
8092
|
code_verifier: code_verifier,
|
|
8060
8093
|
code: codeResult.code,
|
|
8061
8094
|
grant_type: "authorization_code",
|
|
@@ -8065,7 +8098,7 @@
|
|
|
8065
8098
|
nonceIn: nonceIn,
|
|
8066
8099
|
organization: params.organization
|
|
8067
8100
|
});
|
|
8068
|
-
return
|
|
8101
|
+
return _objectSpread2(_objectSpread2({}, tokenResult), {}, {
|
|
8069
8102
|
scope: scope,
|
|
8070
8103
|
oauthTokenScope: tokenResult.scope,
|
|
8071
8104
|
audience: audience
|
|
@@ -8084,7 +8117,6 @@
|
|
|
8084
8117
|
}
|
|
8085
8118
|
}
|
|
8086
8119
|
async _getTokenUsingRefreshToken(options) {
|
|
8087
|
-
var _a, _b;
|
|
8088
8120
|
const cache = await this.cacheManager.get(new CacheKey({
|
|
8089
8121
|
scope: options.authorizationParams.scope,
|
|
8090
8122
|
audience: options.authorizationParams.audience || DEFAULT_AUDIENCE,
|
|
@@ -8100,16 +8132,16 @@
|
|
|
8100
8132
|
const timeout = typeof options.timeoutInSeconds === "number" ? options.timeoutInSeconds * 1e3 : null;
|
|
8101
8133
|
const scopesToRequest = getScopeToRequest(this.options.useMrrt, options.authorizationParams, cache === null || cache === void 0 ? void 0 : cache.audience, cache === null || cache === void 0 ? void 0 : cache.scope);
|
|
8102
8134
|
try {
|
|
8103
|
-
const tokenResult = await this._requestToken(
|
|
8135
|
+
const tokenResult = await this._requestToken(_objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
|
|
8104
8136
|
grant_type: "refresh_token",
|
|
8105
8137
|
refresh_token: cache && cache.refresh_token,
|
|
8106
8138
|
redirect_uri: redirect_uri
|
|
8107
|
-
}
|
|
8139
|
+
}, timeout && {
|
|
8108
8140
|
timeout: timeout
|
|
8109
8141
|
}), {
|
|
8110
8142
|
scopesToRequest: scopesToRequest
|
|
8111
8143
|
});
|
|
8112
|
-
if (tokenResult.refresh_token &&
|
|
8144
|
+
if (tokenResult.refresh_token && cache !== null && cache !== void 0 && cache.refresh_token) {
|
|
8113
8145
|
await this.cacheManager.updateEntry(cache.refresh_token, tokenResult.refresh_token);
|
|
8114
8146
|
}
|
|
8115
8147
|
if (this.options.useMrrt) {
|
|
@@ -8126,7 +8158,7 @@
|
|
|
8126
8158
|
}
|
|
8127
8159
|
}
|
|
8128
8160
|
}
|
|
8129
|
-
return
|
|
8161
|
+
return _objectSpread2(_objectSpread2({}, tokenResult), {}, {
|
|
8130
8162
|
scope: options.authorizationParams.scope,
|
|
8131
8163
|
oauthTokenScope: tokenResult.scope,
|
|
8132
8164
|
audience: options.authorizationParams.audience || DEFAULT_AUDIENCE
|
|
@@ -8144,13 +8176,14 @@
|
|
|
8144
8176
|
}
|
|
8145
8177
|
}
|
|
8146
8178
|
if (e instanceof MfaRequiredError) {
|
|
8147
|
-
|
|
8179
|
+
var _options$authorizatio6, _options$authorizatio7;
|
|
8180
|
+
this.mfa.setMFAAuthDetails(e.mfa_token, (_options$authorizatio6 = options.authorizationParams) === null || _options$authorizatio6 === void 0 ? void 0 : _options$authorizatio6.scope, (_options$authorizatio7 = options.authorizationParams) === null || _options$authorizatio7 === void 0 ? void 0 : _options$authorizatio7.audience, e.mfa_requirements);
|
|
8148
8181
|
}
|
|
8149
8182
|
throw e;
|
|
8150
8183
|
}
|
|
8151
8184
|
}
|
|
8152
8185
|
async _saveEntryInCache(entry) {
|
|
8153
|
-
const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken =
|
|
8186
|
+
const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken = _objectWithoutProperties(entry, _excluded6);
|
|
8154
8187
|
this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, {
|
|
8155
8188
|
id_token: id_token,
|
|
8156
8189
|
decodedToken: decodedToken
|
|
@@ -8173,8 +8206,8 @@
|
|
|
8173
8206
|
this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, cache);
|
|
8174
8207
|
return cache;
|
|
8175
8208
|
}
|
|
8176
|
-
async _getEntryFromCache(
|
|
8177
|
-
let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} =
|
|
8209
|
+
async _getEntryFromCache(_ref2) {
|
|
8210
|
+
let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} = _ref2;
|
|
8178
8211
|
const entry = await this.cacheManager.get(new CacheKey({
|
|
8179
8212
|
scope: scope,
|
|
8180
8213
|
audience: audience,
|
|
@@ -8183,21 +8216,20 @@
|
|
|
8183
8216
|
if (entry && entry.access_token) {
|
|
8184
8217
|
const {token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = entry;
|
|
8185
8218
|
const cache = await this._getIdTokenFromCache();
|
|
8186
|
-
return cache &&
|
|
8219
|
+
return cache && _objectSpread2(_objectSpread2({
|
|
8187
8220
|
id_token: cache.id_token,
|
|
8188
8221
|
token_type: token_type ? token_type : "Bearer",
|
|
8189
8222
|
access_token: access_token
|
|
8190
8223
|
}, oauthTokenScope ? {
|
|
8191
8224
|
scope: oauthTokenScope
|
|
8192
|
-
} : null), {
|
|
8225
|
+
} : null), {}, {
|
|
8193
8226
|
expires_in: expires_in
|
|
8194
8227
|
});
|
|
8195
8228
|
}
|
|
8196
8229
|
}
|
|
8197
8230
|
async _requestToken(options, additionalParameters) {
|
|
8198
|
-
var _a, _b;
|
|
8199
8231
|
const {nonceIn: nonceIn, organization: organization, scopesToRequest: scopesToRequest} = additionalParameters || {};
|
|
8200
|
-
const authResult = await oauthToken(
|
|
8232
|
+
const authResult = await oauthToken(_objectSpread2(_objectSpread2({
|
|
8201
8233
|
baseUrl: this.domainUrl,
|
|
8202
8234
|
client_id: this.options.clientId,
|
|
8203
8235
|
auth0Client: this.options.auth0Client,
|
|
@@ -8205,24 +8237,25 @@
|
|
|
8205
8237
|
timeout: this.httpTimeoutMs,
|
|
8206
8238
|
useMrrt: this.options.useMrrt,
|
|
8207
8239
|
dpop: this.dpop
|
|
8208
|
-
}, options), {
|
|
8240
|
+
}, options), {}, {
|
|
8209
8241
|
scope: scopesToRequest || options.scope
|
|
8210
8242
|
}), this.worker);
|
|
8211
8243
|
const decodedToken = await this._verifyIdToken(authResult.id_token, nonceIn, organization);
|
|
8212
8244
|
if (options.grant_type === "authorization_code") {
|
|
8245
|
+
var _existingIdToken$deco;
|
|
8213
8246
|
const existingIdToken = await this._getIdTokenFromCache();
|
|
8214
|
-
if (
|
|
8247
|
+
if (existingIdToken !== null && existingIdToken !== void 0 && (_existingIdToken$deco = existingIdToken.decodedToken) !== null && _existingIdToken$deco !== void 0 && (_existingIdToken$deco = _existingIdToken$deco.claims) !== null && _existingIdToken$deco !== void 0 && _existingIdToken$deco.sub && existingIdToken.decodedToken.claims.sub !== decodedToken.claims.sub) {
|
|
8215
8248
|
await this.cacheManager.clear(this.options.clientId);
|
|
8216
8249
|
this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
|
|
8217
8250
|
}
|
|
8218
8251
|
}
|
|
8219
|
-
await this._saveEntryInCache(
|
|
8252
|
+
await this._saveEntryInCache(_objectSpread2(_objectSpread2(_objectSpread2({}, authResult), {}, {
|
|
8220
8253
|
decodedToken: decodedToken,
|
|
8221
8254
|
scope: options.scope,
|
|
8222
8255
|
audience: options.audience || DEFAULT_AUDIENCE
|
|
8223
|
-
}
|
|
8256
|
+
}, authResult.scope ? {
|
|
8224
8257
|
oauthTokenScope: authResult.scope
|
|
8225
|
-
} : null), {
|
|
8258
|
+
} : null), {}, {
|
|
8226
8259
|
client_id: this.options.clientId
|
|
8227
8260
|
}));
|
|
8228
8261
|
this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
|
|
@@ -8230,12 +8263,12 @@
|
|
|
8230
8263
|
cookieDomain: this.options.cookieDomain
|
|
8231
8264
|
});
|
|
8232
8265
|
this._processOrgHint(organization || decodedToken.claims.org_id);
|
|
8233
|
-
return
|
|
8266
|
+
return _objectSpread2(_objectSpread2({}, authResult), {}, {
|
|
8234
8267
|
decodedToken: decodedToken
|
|
8235
8268
|
});
|
|
8236
8269
|
}
|
|
8237
8270
|
async loginWithCustomTokenExchange(options) {
|
|
8238
|
-
return this._requestToken(
|
|
8271
|
+
return this._requestToken(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
8239
8272
|
grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
|
|
8240
8273
|
subject_token: options.subject_token,
|
|
8241
8274
|
subject_token_type: options.subject_token_type,
|
|
@@ -8269,10 +8302,10 @@
|
|
|
8269
8302
|
return new Fetcher(config, {
|
|
8270
8303
|
isDpopEnabled: () => !!this.options.useDpop,
|
|
8271
8304
|
getAccessToken: authParams => {
|
|
8272
|
-
var
|
|
8305
|
+
var _authParams$scope;
|
|
8273
8306
|
return this.getTokenSilently({
|
|
8274
8307
|
authorizationParams: {
|
|
8275
|
-
scope:
|
|
8308
|
+
scope: authParams === null || authParams === void 0 || (_authParams$scope = authParams.scope) === null || _authParams$scope === void 0 ? void 0 : _authParams$scope.join(" "),
|
|
8276
8309
|
audience: authParams === null || authParams === void 0 ? void 0 : authParams.audience
|
|
8277
8310
|
},
|
|
8278
8311
|
detailedResponse: true
|
|
@@ -8308,7 +8341,7 @@
|
|
|
8308
8341
|
redirect_uri: redirectUri,
|
|
8309
8342
|
appState: appState,
|
|
8310
8343
|
connection: connection,
|
|
8311
|
-
response_type:
|
|
8344
|
+
response_type: ResponseType.ConnectCode
|
|
8312
8345
|
});
|
|
8313
8346
|
const url = new URL(connect_uri);
|
|
8314
8347
|
url.searchParams.set("ticket", connect_params.ticket);
|
|
@@ -8319,8 +8352,8 @@
|
|
|
8319
8352
|
}
|
|
8320
8353
|
}
|
|
8321
8354
|
async _requestTokenForMfa(options, additionalParameters) {
|
|
8322
|
-
const {mfaToken: mfaToken} = options, restOptions =
|
|
8323
|
-
return this._requestToken(
|
|
8355
|
+
const {mfaToken: mfaToken} = options, restOptions = _objectWithoutProperties(options, _excluded7);
|
|
8356
|
+
return this._requestToken(_objectSpread2(_objectSpread2({}, restOptions), {}, {
|
|
8324
8357
|
mfa_token: mfaToken
|
|
8325
8358
|
}), additionalParameters);
|
|
8326
8359
|
}
|
|
@@ -8350,6 +8383,7 @@
|
|
|
8350
8383
|
exports.PopupCancelledError = PopupCancelledError;
|
|
8351
8384
|
exports.PopupOpenError = PopupOpenError;
|
|
8352
8385
|
exports.PopupTimeoutError = PopupTimeoutError;
|
|
8386
|
+
exports.ResponseType = ResponseType;
|
|
8353
8387
|
exports.TimeoutError = TimeoutError;
|
|
8354
8388
|
exports.UseDpopNonceError = UseDpopNonceError;
|
|
8355
8389
|
exports.User = User;
|