@auth0/auth0-spa-js 2.18.3 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/auth0-spa-js.development.js +405 -362
- 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 +132 -81
- 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 +427 -385
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/dist/typings/Auth0Client.d.ts +38 -1
- package/dist/typings/api.d.ts +31 -0
- package/dist/typings/cache/cache-manager.d.ts +13 -0
- package/dist/typings/global.d.ts +7 -0
- package/dist/typings/http.d.ts +6 -0
- package/dist/typings/version.d.ts +1 -1
- package/dist/typings/worker/worker.types.d.ts +13 -6
- package/dist/typings/worker/worker.utils.d.ts +11 -5
- package/package.json +2 -2
- package/src/Auth0Client.ts +73 -2
- package/src/api.ts +112 -2
- package/src/cache/cache-manager.ts +57 -0
- package/src/global.ts +8 -0
- package/src/http.ts +28 -21
- package/src/version.ts +1 -1
- package/src/worker/token.worker.ts +120 -5
- package/src/worker/worker.types.ts +17 -6
- package/src/worker/worker.utils.ts +18 -7
|
@@ -4,163 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
this.v = e, this.k = d;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function _assertClassBrand(e, t, n) {
|
|
12
|
-
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
13
|
-
throw new TypeError("Private element is not present on this object");
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function _awaitAsyncGenerator(e) {
|
|
17
|
-
return new _OverloadYield(e, 0);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _checkPrivateRedeclaration(e, t) {
|
|
21
|
-
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _classPrivateFieldGet2(s, a) {
|
|
25
|
-
return s.get(_assertClassBrand(s, a));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _classPrivateFieldInitSpec(e, t, a) {
|
|
29
|
-
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _classPrivateFieldSet2(s, a, r) {
|
|
33
|
-
return s.set(_assertClassBrand(s, a), r), r;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function _classPrivateMethodInitSpec(e, a) {
|
|
37
|
-
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _defineProperty(e, r, t) {
|
|
41
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
42
|
-
value: t,
|
|
43
|
-
enumerable: !0,
|
|
44
|
-
configurable: !0,
|
|
45
|
-
writable: !0
|
|
46
|
-
}) : e[r] = t, e;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function ownKeys(e, r) {
|
|
50
|
-
var t = Object.keys(e);
|
|
51
|
-
if (Object.getOwnPropertySymbols) {
|
|
52
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
53
|
-
r && (o = o.filter(function(r) {
|
|
54
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
55
|
-
})), t.push.apply(t, o);
|
|
56
|
-
}
|
|
57
|
-
return t;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _objectSpread2(e) {
|
|
61
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
62
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
63
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
64
|
-
_defineProperty(e, r, t[r]);
|
|
65
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
66
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return e;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function _objectWithoutProperties(e, t) {
|
|
73
|
-
if (null == e) return {};
|
|
74
|
-
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
75
|
-
if (Object.getOwnPropertySymbols) {
|
|
76
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
77
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
78
|
-
}
|
|
79
|
-
return i;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
83
|
-
if (null == r) return {};
|
|
7
|
+
function __rest(s, e) {
|
|
84
8
|
var t = {};
|
|
85
|
-
for (var
|
|
86
|
-
|
|
87
|
-
t[
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
10
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
11
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
88
12
|
}
|
|
89
13
|
return t;
|
|
90
14
|
}
|
|
91
15
|
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (void 0 !== e) {
|
|
96
|
-
var i = e.call(t, r || "default");
|
|
97
|
-
if ("object" != typeof i) return i;
|
|
98
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
99
|
-
}
|
|
100
|
-
return ("string" === r ? String : Number)(t);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function _toPropertyKey(t) {
|
|
104
|
-
var i = _toPrimitive(t, "string");
|
|
105
|
-
return "symbol" == typeof i ? i : i + "";
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function _wrapAsyncGenerator(e) {
|
|
109
|
-
return function() {
|
|
110
|
-
return new AsyncGenerator(e.apply(this, arguments));
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function AsyncGenerator(e) {
|
|
115
|
-
var t, n;
|
|
116
|
-
function resume(t, n) {
|
|
117
|
-
try {
|
|
118
|
-
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
|
|
119
|
-
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
120
|
-
if (u) {
|
|
121
|
-
var i = "return" === t && o.k ? t : "next";
|
|
122
|
-
if (!o.k || n.done) return resume(i, n);
|
|
123
|
-
n = e[i](n).value;
|
|
124
|
-
}
|
|
125
|
-
settle(!!r.done, n);
|
|
126
|
-
}, function(e) {
|
|
127
|
-
resume("throw", e);
|
|
128
|
-
});
|
|
129
|
-
} catch (e) {
|
|
130
|
-
settle(2, e);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
function settle(e, r) {
|
|
134
|
-
2 === e ? t.reject(r) : t.resolve({
|
|
135
|
-
value: r,
|
|
136
|
-
done: e
|
|
137
|
-
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
138
|
-
}
|
|
139
|
-
this._invoke = function(e, r) {
|
|
140
|
-
return new Promise(function(o, u) {
|
|
141
|
-
var i = {
|
|
142
|
-
key: e,
|
|
143
|
-
arg: r,
|
|
144
|
-
resolve: o,
|
|
145
|
-
reject: u,
|
|
146
|
-
next: null
|
|
147
|
-
};
|
|
148
|
-
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
149
|
-
});
|
|
150
|
-
}, "function" != typeof e.return && (this.return = void 0);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
154
|
-
return this;
|
|
155
|
-
}, AsyncGenerator.prototype.next = function(e) {
|
|
156
|
-
return this._invoke("next", e);
|
|
157
|
-
}, AsyncGenerator.prototype.throw = function(e) {
|
|
158
|
-
return this._invoke("throw", e);
|
|
159
|
-
}, AsyncGenerator.prototype.return = function(e) {
|
|
160
|
-
return this._invoke("return", e);
|
|
16
|
+
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
17
|
+
var e = new Error(message);
|
|
18
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
161
19
|
};
|
|
162
20
|
|
|
163
|
-
var version = "2.
|
|
21
|
+
var version = "2.19.0";
|
|
164
22
|
|
|
165
23
|
const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
|
|
166
24
|
|
|
@@ -301,8 +159,6 @@ function valueOrEmptyString(value) {
|
|
|
301
159
|
return value && !exclude.includes(value) ? value : "";
|
|
302
160
|
}
|
|
303
161
|
|
|
304
|
-
const _excluded$5 = [ "clientId" ];
|
|
305
|
-
|
|
306
162
|
const parseAuthenticationResult = queryString => {
|
|
307
163
|
if (queryString.indexOf("#") > -1) {
|
|
308
164
|
queryString = queryString.substring(0, queryString.indexOf("#"));
|
|
@@ -414,7 +270,7 @@ const createRandomString = () => {
|
|
|
414
270
|
|
|
415
271
|
const encode$2 = value => btoa(value);
|
|
416
272
|
|
|
417
|
-
const stripUndefined = params => Object.keys(params).filter(k => typeof params[k] !== "undefined").reduce((acc, key) =>
|
|
273
|
+
const stripUndefined = params => Object.keys(params).filter(k => typeof params[k] !== "undefined").reduce((acc, key) => Object.assign(Object.assign({}, acc), {
|
|
418
274
|
[key]: params[key]
|
|
419
275
|
}), {});
|
|
420
276
|
|
|
@@ -443,9 +299,9 @@ const stripAuth0Client = function stripAuth0Client(auth0Client) {
|
|
|
443
299
|
}, {});
|
|
444
300
|
};
|
|
445
301
|
|
|
446
|
-
const createQueryParams =
|
|
447
|
-
|
|
448
|
-
return new URLSearchParams(stripUndefined(
|
|
302
|
+
const createQueryParams = _a => {
|
|
303
|
+
var {clientId: client_id} = _a, params = __rest(_a, [ "clientId" ]);
|
|
304
|
+
return new URLSearchParams(stripUndefined(Object.assign({
|
|
449
305
|
client_id: client_id
|
|
450
306
|
}, params))).toString();
|
|
451
307
|
};
|
|
@@ -505,8 +361,8 @@ const parseNumber = value => {
|
|
|
505
361
|
return parseInt(value, 10) || undefined;
|
|
506
362
|
};
|
|
507
363
|
|
|
508
|
-
const fromEntries = iterable => [ ...iterable ].reduce((obj,
|
|
509
|
-
let [key, val] =
|
|
364
|
+
const fromEntries = iterable => [ ...iterable ].reduce((obj, _ref) => {
|
|
365
|
+
let [key, val] = _ref;
|
|
510
366
|
obj[key] = val;
|
|
511
367
|
return obj;
|
|
512
368
|
}, {});
|
|
@@ -1067,9 +923,7 @@ class WebLocksApiManager {
|
|
|
1067
923
|
|
|
1068
924
|
class LegacyLockManager {
|
|
1069
925
|
constructor() {
|
|
1070
|
-
|
|
1071
|
-
_defineProperty(this, "activeLocks", new Set);
|
|
1072
|
-
_defineProperty(this, "pagehideHandler", void 0);
|
|
926
|
+
this.activeLocks = new Set;
|
|
1073
927
|
this.lock = new _default;
|
|
1074
928
|
this.pagehideHandler = () => {
|
|
1075
929
|
this.activeLocks.forEach(key => this.lock.releaseLock(key));
|
|
@@ -1102,8 +956,8 @@ class LegacyLockManager {
|
|
|
1102
956
|
}
|
|
1103
957
|
|
|
1104
958
|
function isWebLocksSupported() {
|
|
1105
|
-
var
|
|
1106
|
-
return typeof navigator !== "undefined" && typeof ((
|
|
959
|
+
var _a;
|
|
960
|
+
return typeof navigator !== "undefined" && typeof ((_a = navigator.locks) === null || _a === void 0 ? void 0 : _a.request) === "function";
|
|
1107
961
|
}
|
|
1108
962
|
|
|
1109
963
|
function createLockManager() {
|
|
@@ -1473,24 +1327,13 @@ const sendMessage = (message, to) => new Promise(function(resolve, reject) {
|
|
|
1473
1327
|
to.postMessage(message, [ messageChannel.port2 ]);
|
|
1474
1328
|
});
|
|
1475
1329
|
|
|
1476
|
-
const _excluded$4 = [ "error", "error_description" ];
|
|
1477
|
-
|
|
1478
1330
|
const createAbortController = () => new AbortController;
|
|
1479
1331
|
|
|
1480
|
-
const
|
|
1481
|
-
const response = await fetch(fetchUrl, fetchOptions);
|
|
1482
|
-
return {
|
|
1483
|
-
ok: response.ok,
|
|
1484
|
-
json: await response.json(),
|
|
1485
|
-
headers: fromEntries(response.headers)
|
|
1486
|
-
};
|
|
1487
|
-
};
|
|
1488
|
-
|
|
1489
|
-
const fetchWithoutWorker = async (fetchUrl, fetchOptions, timeout) => {
|
|
1332
|
+
const fetchWithTimeout = (fetchUrl, fetchOptions, timeout) => {
|
|
1490
1333
|
const controller = createAbortController();
|
|
1491
1334
|
fetchOptions.signal = controller.signal;
|
|
1492
1335
|
let timeoutId;
|
|
1493
|
-
return Promise.race([
|
|
1336
|
+
return Promise.race([ fetch(fetchUrl, fetchOptions), new Promise((_, reject) => {
|
|
1494
1337
|
timeoutId = setTimeout(() => {
|
|
1495
1338
|
controller.abort();
|
|
1496
1339
|
reject(new Error("Timeout when executing 'fetch'"));
|
|
@@ -1500,7 +1343,17 @@ const fetchWithoutWorker = async (fetchUrl, fetchOptions, timeout) => {
|
|
|
1500
1343
|
});
|
|
1501
1344
|
};
|
|
1502
1345
|
|
|
1346
|
+
const fetchWithoutWorker = async (fetchUrl, fetchOptions, timeout) => {
|
|
1347
|
+
const response = await fetchWithTimeout(fetchUrl, fetchOptions, timeout);
|
|
1348
|
+
return {
|
|
1349
|
+
ok: response.ok,
|
|
1350
|
+
json: await response.json(),
|
|
1351
|
+
headers: fromEntries(response.headers)
|
|
1352
|
+
};
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1503
1355
|
const fetchWithWorker = async (fetchUrl, audience, scope, fetchOptions, timeout, worker, useFormData, useMrrt) => sendMessage({
|
|
1356
|
+
type: "refresh",
|
|
1504
1357
|
auth: {
|
|
1505
1358
|
audience: audience,
|
|
1506
1359
|
scope: scope
|
|
@@ -1529,7 +1382,7 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
1529
1382
|
method: options.method || "GET",
|
|
1530
1383
|
nonce: await dpop.getNonce()
|
|
1531
1384
|
});
|
|
1532
|
-
options.headers =
|
|
1385
|
+
options.headers = Object.assign(Object.assign({}, options.headers), {
|
|
1533
1386
|
dpop: dpopProof
|
|
1534
1387
|
});
|
|
1535
1388
|
}
|
|
@@ -1547,7 +1400,7 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
1547
1400
|
if (fetchError) {
|
|
1548
1401
|
throw fetchError;
|
|
1549
1402
|
}
|
|
1550
|
-
const
|
|
1403
|
+
const _a = response.json, {error: error, error_description: error_description} = _a, data = __rest(_a, [ "error", "error_description" ]), {headers: headers, ok: ok} = response;
|
|
1551
1404
|
let newDpopNonce;
|
|
1552
1405
|
if (dpop) {
|
|
1553
1406
|
newDpopNonce = headers[DPOP_NONCE_HEADER];
|
|
@@ -1574,13 +1427,11 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
1574
1427
|
return data;
|
|
1575
1428
|
}
|
|
1576
1429
|
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
async function oauthToken(_ref, worker) {
|
|
1580
|
-
let {baseUrl: baseUrl, timeout: timeout, audience: audience, scope: scope, auth0Client: auth0Client, useFormData: useFormData, useMrrt: useMrrt, dpop: dpop} = _ref, options = _objectWithoutProperties(_ref, _excluded$3);
|
|
1430
|
+
async function oauthToken(_a, worker) {
|
|
1431
|
+
var {baseUrl: baseUrl, timeout: timeout, audience: audience, scope: scope, auth0Client: auth0Client, useFormData: useFormData, useMrrt: useMrrt, dpop: dpop} = _a, options = __rest(_a, [ "baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData", "useMrrt", "dpop" ]);
|
|
1581
1432
|
const isTokenExchange = options.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange";
|
|
1582
1433
|
const refreshWithMrrt = options.grant_type === "refresh_token" && useMrrt;
|
|
1583
|
-
const allParams =
|
|
1434
|
+
const allParams = Object.assign(Object.assign(Object.assign(Object.assign({}, options), isTokenExchange && audience && {
|
|
1584
1435
|
audience: audience
|
|
1585
1436
|
}), isTokenExchange && scope && {
|
|
1586
1437
|
scope: scope
|
|
@@ -1600,6 +1451,60 @@ async function oauthToken(_ref, worker) {
|
|
|
1600
1451
|
}, worker, useFormData, useMrrt, isDpopSupported ? dpop : undefined);
|
|
1601
1452
|
}
|
|
1602
1453
|
|
|
1454
|
+
async function revokeToken(_ref, worker) {
|
|
1455
|
+
let {baseUrl: baseUrl, timeout: timeout, auth0Client: auth0Client, useFormData: useFormData, refreshTokens: refreshTokens, audience: audience, client_id: client_id, onRefreshTokenRevoked: onRefreshTokenRevoked} = _ref;
|
|
1456
|
+
const resolvedTimeout = timeout || DEFAULT_FETCH_TIMEOUT_MS;
|
|
1457
|
+
const token_type_hint = "refresh_token";
|
|
1458
|
+
const fetchUrl = "".concat(baseUrl, "/oauth/revoke");
|
|
1459
|
+
const headers = {
|
|
1460
|
+
"Content-Type": useFormData ? "application/x-www-form-urlencoded" : "application/json",
|
|
1461
|
+
"Auth0-Client": btoa(JSON.stringify(stripAuth0Client(auth0Client || DEFAULT_AUTH0_CLIENT)))
|
|
1462
|
+
};
|
|
1463
|
+
if (worker) {
|
|
1464
|
+
const baseParams = {
|
|
1465
|
+
client_id: client_id,
|
|
1466
|
+
token_type_hint: token_type_hint
|
|
1467
|
+
};
|
|
1468
|
+
const body = useFormData ? createQueryParams(baseParams) : JSON.stringify(baseParams);
|
|
1469
|
+
return sendMessage({
|
|
1470
|
+
type: "revoke",
|
|
1471
|
+
timeout: resolvedTimeout,
|
|
1472
|
+
fetchUrl: fetchUrl,
|
|
1473
|
+
fetchOptions: {
|
|
1474
|
+
method: "POST",
|
|
1475
|
+
body: body,
|
|
1476
|
+
headers: headers
|
|
1477
|
+
},
|
|
1478
|
+
useFormData: useFormData,
|
|
1479
|
+
auth: {
|
|
1480
|
+
audience: audience !== null && audience !== void 0 ? audience : DEFAULT_AUDIENCE
|
|
1481
|
+
}
|
|
1482
|
+
}, worker);
|
|
1483
|
+
}
|
|
1484
|
+
for (const refreshToken of refreshTokens) {
|
|
1485
|
+
const params = {
|
|
1486
|
+
client_id: client_id,
|
|
1487
|
+
token_type_hint: token_type_hint,
|
|
1488
|
+
token: refreshToken
|
|
1489
|
+
};
|
|
1490
|
+
const body = useFormData ? createQueryParams(params) : JSON.stringify(params);
|
|
1491
|
+
const response = await fetchWithTimeout(fetchUrl, {
|
|
1492
|
+
method: "POST",
|
|
1493
|
+
body: body,
|
|
1494
|
+
headers: headers
|
|
1495
|
+
}, resolvedTimeout);
|
|
1496
|
+
if (!response.ok) {
|
|
1497
|
+
let error;
|
|
1498
|
+
let errorDescription;
|
|
1499
|
+
try {
|
|
1500
|
+
({error: error, error_description: errorDescription} = JSON.parse(await response.text()));
|
|
1501
|
+
} catch (_a) {}
|
|
1502
|
+
throw new GenericError(error || "revoke_error", errorDescription || "HTTP error ".concat(response.status));
|
|
1503
|
+
}
|
|
1504
|
+
await (onRefreshTokenRevoked === null || onRefreshTokenRevoked === void 0 ? void 0 : onRefreshTokenRevoked(refreshToken));
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1603
1508
|
const dedupe = arr => Array.from(new Set(arr));
|
|
1604
1509
|
|
|
1605
1510
|
const getUniqueScopes = function getUniqueScopes() {
|
|
@@ -1649,9 +1554,6 @@ class CacheKey {
|
|
|
1649
1554
|
let suffix = arguments.length > 2 ? arguments[2] : undefined;
|
|
1650
1555
|
this.prefix = prefix;
|
|
1651
1556
|
this.suffix = suffix;
|
|
1652
|
-
_defineProperty(this, "clientId", void 0);
|
|
1653
|
-
_defineProperty(this, "scope", void 0);
|
|
1654
|
-
_defineProperty(this, "audience", void 0);
|
|
1655
1557
|
this.clientId = data.clientId;
|
|
1656
1558
|
this.scope = data.scope;
|
|
1657
1559
|
this.audience = data.audience;
|
|
@@ -1701,7 +1603,7 @@ class LocalStorageCache {
|
|
|
1701
1603
|
|
|
1702
1604
|
class InMemoryCache {
|
|
1703
1605
|
constructor() {
|
|
1704
|
-
|
|
1606
|
+
this.enclosedCache = function() {
|
|
1705
1607
|
let cache = {};
|
|
1706
1608
|
return {
|
|
1707
1609
|
set(key, entry) {
|
|
@@ -1721,7 +1623,7 @@ class InMemoryCache {
|
|
|
1721
1623
|
return Object.keys(cache);
|
|
1722
1624
|
}
|
|
1723
1625
|
};
|
|
1724
|
-
}()
|
|
1626
|
+
}();
|
|
1725
1627
|
}
|
|
1726
1628
|
}
|
|
1727
1629
|
|
|
@@ -1731,17 +1633,16 @@ class CacheManager {
|
|
|
1731
1633
|
constructor(cache, keyManifest, nowProvider) {
|
|
1732
1634
|
this.cache = cache;
|
|
1733
1635
|
this.keyManifest = keyManifest;
|
|
1734
|
-
_defineProperty(this, "nowProvider", void 0);
|
|
1735
1636
|
this.nowProvider = nowProvider || DEFAULT_NOW_PROVIDER;
|
|
1736
1637
|
}
|
|
1737
1638
|
async setIdToken(clientId, idToken, decodedToken) {
|
|
1738
|
-
var
|
|
1639
|
+
var _a;
|
|
1739
1640
|
const cacheKey = this.getIdTokenCacheKey(clientId);
|
|
1740
1641
|
await this.cache.set(cacheKey, {
|
|
1741
1642
|
id_token: idToken,
|
|
1742
1643
|
decodedToken: decodedToken
|
|
1743
1644
|
});
|
|
1744
|
-
await ((
|
|
1645
|
+
await ((_a = this.keyManifest) === null || _a === void 0 ? void 0 : _a.add(cacheKey));
|
|
1745
1646
|
}
|
|
1746
1647
|
async getIdToken(cacheKey) {
|
|
1747
1648
|
const entry = await this.cache.get(this.getIdTokenCacheKey(cacheKey.clientId));
|
|
@@ -1770,6 +1671,7 @@ class CacheManager {
|
|
|
1770
1671
|
let expiryAdjustmentSeconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_EXPIRY_ADJUSTMENT_SECONDS;
|
|
1771
1672
|
let useMrrt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1772
1673
|
let cacheMode = arguments.length > 3 ? arguments[3] : undefined;
|
|
1674
|
+
var _a;
|
|
1773
1675
|
let wrappedEntry = await this.cache.get(cacheKey.toKey());
|
|
1774
1676
|
if (!wrappedEntry) {
|
|
1775
1677
|
const keys = await this.getCacheKeys();
|
|
@@ -1788,12 +1690,11 @@ class CacheManager {
|
|
|
1788
1690
|
const now = await this.nowProvider();
|
|
1789
1691
|
const nowSeconds = Math.floor(now / 1e3);
|
|
1790
1692
|
if (wrappedEntry.expiresAt - expiryAdjustmentSeconds < nowSeconds) {
|
|
1791
|
-
var _this$keyManifest2;
|
|
1792
1693
|
if (wrappedEntry.body.refresh_token) {
|
|
1793
1694
|
return this.modifiedCachedEntry(wrappedEntry, cacheKey);
|
|
1794
1695
|
}
|
|
1795
1696
|
await this.cache.remove(cacheKey.toKey());
|
|
1796
|
-
await ((
|
|
1697
|
+
await ((_a = this.keyManifest) === null || _a === void 0 ? void 0 : _a.remove(cacheKey.toKey()));
|
|
1797
1698
|
return;
|
|
1798
1699
|
}
|
|
1799
1700
|
return wrappedEntry.body;
|
|
@@ -1812,7 +1713,7 @@ class CacheManager {
|
|
|
1812
1713
|
};
|
|
1813
1714
|
}
|
|
1814
1715
|
async set(entry) {
|
|
1815
|
-
var
|
|
1716
|
+
var _a;
|
|
1816
1717
|
const cacheKey = new CacheKey({
|
|
1817
1718
|
clientId: entry.client_id,
|
|
1818
1719
|
scope: entry.scope,
|
|
@@ -1820,7 +1721,7 @@ class CacheManager {
|
|
|
1820
1721
|
});
|
|
1821
1722
|
const wrappedEntry = await this.wrapCacheEntry(entry);
|
|
1822
1723
|
await this.cache.set(cacheKey.toKey(), wrappedEntry);
|
|
1823
|
-
await ((
|
|
1724
|
+
await ((_a = this.keyManifest) === null || _a === void 0 ? void 0 : _a.add(cacheKey.toKey()));
|
|
1824
1725
|
}
|
|
1825
1726
|
async remove(client_id, audience, scope) {
|
|
1826
1727
|
const cacheKey = new CacheKey({
|
|
@@ -1830,15 +1731,27 @@ class CacheManager {
|
|
|
1830
1731
|
});
|
|
1831
1732
|
await this.cache.remove(cacheKey.toKey());
|
|
1832
1733
|
}
|
|
1734
|
+
async stripRefreshToken(refreshToken) {
|
|
1735
|
+
var _a;
|
|
1736
|
+
const keys = await this.getCacheKeys();
|
|
1737
|
+
if (!keys) return;
|
|
1738
|
+
for (const key of keys) {
|
|
1739
|
+
const entry = await this.cache.get(key);
|
|
1740
|
+
if (((_a = entry === null || entry === void 0 ? void 0 : entry.body) === null || _a === void 0 ? void 0 : _a.refresh_token) === refreshToken) {
|
|
1741
|
+
delete entry.body.refresh_token;
|
|
1742
|
+
await this.cache.set(key, entry);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1833
1746
|
async clear(clientId) {
|
|
1834
|
-
var
|
|
1747
|
+
var _a;
|
|
1835
1748
|
const keys = await this.getCacheKeys();
|
|
1836
1749
|
if (!keys) return;
|
|
1837
1750
|
await keys.filter(key => clientId ? key.includes(clientId) : true).reduce(async (memo, key) => {
|
|
1838
1751
|
await memo;
|
|
1839
1752
|
await this.cache.remove(key);
|
|
1840
1753
|
}, Promise.resolve());
|
|
1841
|
-
await ((
|
|
1754
|
+
await ((_a = this.keyManifest) === null || _a === void 0 ? void 0 : _a.clear());
|
|
1842
1755
|
}
|
|
1843
1756
|
async wrapCacheEntry(entry) {
|
|
1844
1757
|
const now = await this.nowProvider();
|
|
@@ -1849,9 +1762,9 @@ class CacheManager {
|
|
|
1849
1762
|
};
|
|
1850
1763
|
}
|
|
1851
1764
|
async getCacheKeys() {
|
|
1765
|
+
var _a;
|
|
1852
1766
|
if (this.keyManifest) {
|
|
1853
|
-
|
|
1854
|
-
return (_await$this$keyManife = await this.keyManifest.get()) === null || _await$this$keyManife === void 0 ? void 0 : _await$this$keyManife.keys;
|
|
1767
|
+
return (_a = await this.keyManifest.get()) === null || _a === void 0 ? void 0 : _a.keys;
|
|
1855
1768
|
} else if (this.cache.allKeys) {
|
|
1856
1769
|
return this.cache.allKeys();
|
|
1857
1770
|
}
|
|
@@ -1863,34 +1776,50 @@ class CacheManager {
|
|
|
1863
1776
|
}
|
|
1864
1777
|
matchExistingCacheKey(keyToMatch, allKeys) {
|
|
1865
1778
|
return allKeys.filter(key => {
|
|
1866
|
-
var
|
|
1779
|
+
var _a;
|
|
1867
1780
|
const cacheKey = CacheKey.fromKey(key);
|
|
1868
1781
|
const scopeSet = new Set(cacheKey.scope && cacheKey.scope.split(" "));
|
|
1869
|
-
const scopesToMatch = ((
|
|
1782
|
+
const scopesToMatch = ((_a = keyToMatch.scope) === null || _a === void 0 ? void 0 : _a.split(" ")) || [];
|
|
1870
1783
|
const hasAllScopes = cacheKey.scope && scopesToMatch.reduce((acc, current) => acc && scopeSet.has(current), true);
|
|
1871
1784
|
return cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId && cacheKey.audience === keyToMatch.audience && hasAllScopes;
|
|
1872
1785
|
})[0];
|
|
1873
1786
|
}
|
|
1874
1787
|
async getEntryWithRefreshToken(keyToMatch, allKeys) {
|
|
1788
|
+
var _a;
|
|
1875
1789
|
for (const key of allKeys) {
|
|
1876
1790
|
const cacheKey = CacheKey.fromKey(key);
|
|
1877
1791
|
if (cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId) {
|
|
1878
|
-
var _cachedEntry$body;
|
|
1879
1792
|
const cachedEntry = await this.cache.get(key);
|
|
1880
|
-
if (cachedEntry
|
|
1793
|
+
if ((_a = cachedEntry === null || cachedEntry === void 0 ? void 0 : cachedEntry.body) === null || _a === void 0 ? void 0 : _a.refresh_token) {
|
|
1881
1794
|
return this.modifiedCachedEntry(cachedEntry, keyToMatch);
|
|
1882
1795
|
}
|
|
1883
1796
|
}
|
|
1884
1797
|
}
|
|
1885
1798
|
return undefined;
|
|
1886
1799
|
}
|
|
1800
|
+
async getRefreshTokensByAudience(audience, clientId) {
|
|
1801
|
+
var _a;
|
|
1802
|
+
const keys = await this.getCacheKeys();
|
|
1803
|
+
if (!keys) return [];
|
|
1804
|
+
const tokens = new Set;
|
|
1805
|
+
for (const key of keys) {
|
|
1806
|
+
const cacheKey = CacheKey.fromKey(key);
|
|
1807
|
+
if (cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === clientId && cacheKey.audience === audience) {
|
|
1808
|
+
const entry = await this.cache.get(key);
|
|
1809
|
+
if ((_a = entry === null || entry === void 0 ? void 0 : entry.body) === null || _a === void 0 ? void 0 : _a.refresh_token) {
|
|
1810
|
+
tokens.add(entry.body.refresh_token);
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
return Array.from(tokens);
|
|
1815
|
+
}
|
|
1887
1816
|
async updateEntry(oldRefreshToken, newRefreshToken) {
|
|
1817
|
+
var _a;
|
|
1888
1818
|
const allKeys = await this.getCacheKeys();
|
|
1889
1819
|
if (!allKeys) return;
|
|
1890
1820
|
for (const key of allKeys) {
|
|
1891
|
-
var _entry$body;
|
|
1892
1821
|
const entry = await this.cache.get(key);
|
|
1893
|
-
if ((entry === null || entry === void 0
|
|
1822
|
+
if (((_a = entry === null || entry === void 0 ? void 0 : entry.body) === null || _a === void 0 ? void 0 : _a.refresh_token) === oldRefreshToken) {
|
|
1894
1823
|
entry.body.refresh_token = newRefreshToken;
|
|
1895
1824
|
await this.cache.set(key, entry);
|
|
1896
1825
|
}
|
|
@@ -1905,7 +1834,6 @@ class TransactionManager {
|
|
|
1905
1834
|
this.storage = storage;
|
|
1906
1835
|
this.clientId = clientId;
|
|
1907
1836
|
this.cookieDomain = cookieDomain;
|
|
1908
|
-
_defineProperty(this, "storageKey", void 0);
|
|
1909
1837
|
this.storageKey = "".concat(TRANSACTION_STORAGE_KEY_PREFIX, ".").concat(this.clientId);
|
|
1910
1838
|
}
|
|
1911
1839
|
create(transaction) {
|
|
@@ -2146,17 +2074,17 @@ const CookieStorage = {
|
|
|
2146
2074
|
sameSite: "none"
|
|
2147
2075
|
};
|
|
2148
2076
|
}
|
|
2149
|
-
if (options
|
|
2077
|
+
if (options === null || options === void 0 ? void 0 : options.daysUntilExpire) {
|
|
2150
2078
|
cookieAttributes.expires = options.daysUntilExpire;
|
|
2151
2079
|
}
|
|
2152
|
-
if (options
|
|
2080
|
+
if (options === null || options === void 0 ? void 0 : options.cookieDomain) {
|
|
2153
2081
|
cookieAttributes.domain = options.cookieDomain;
|
|
2154
2082
|
}
|
|
2155
2083
|
set_1(key, JSON.stringify(value), cookieAttributes);
|
|
2156
2084
|
},
|
|
2157
2085
|
remove(key, options) {
|
|
2158
2086
|
let cookieAttributes = {};
|
|
2159
|
-
if (options
|
|
2087
|
+
if (options === null || options === void 0 ? void 0 : options.cookieDomain) {
|
|
2160
2088
|
cookieAttributes.domain = options.cookieDomain;
|
|
2161
2089
|
}
|
|
2162
2090
|
remove_1(key, cookieAttributes);
|
|
@@ -2180,10 +2108,10 @@ const CookieStorageWithLegacySameSite = {
|
|
|
2180
2108
|
secure: true
|
|
2181
2109
|
};
|
|
2182
2110
|
}
|
|
2183
|
-
if (options
|
|
2111
|
+
if (options === null || options === void 0 ? void 0 : options.daysUntilExpire) {
|
|
2184
2112
|
cookieAttributes.expires = options.daysUntilExpire;
|
|
2185
2113
|
}
|
|
2186
|
-
if (options
|
|
2114
|
+
if (options === null || options === void 0 ? void 0 : options.cookieDomain) {
|
|
2187
2115
|
cookieAttributes.domain = options.cookieDomain;
|
|
2188
2116
|
}
|
|
2189
2117
|
set_1("".concat(LEGACY_PREFIX).concat(key), JSON.stringify(value), cookieAttributes);
|
|
@@ -2191,7 +2119,7 @@ const CookieStorageWithLegacySameSite = {
|
|
|
2191
2119
|
},
|
|
2192
2120
|
remove(key, options) {
|
|
2193
2121
|
let cookieAttributes = {};
|
|
2194
|
-
if (options
|
|
2122
|
+
if (options === null || options === void 0 ? void 0 : options.cookieDomain) {
|
|
2195
2123
|
cookieAttributes.domain = options.cookieDomain;
|
|
2196
2124
|
}
|
|
2197
2125
|
remove_1(key, cookieAttributes);
|
|
@@ -2219,36 +2147,14 @@ const SessionStorage = {
|
|
|
2219
2147
|
}
|
|
2220
2148
|
};
|
|
2221
2149
|
|
|
2222
|
-
|
|
2150
|
+
exports.ResponseType = void 0;
|
|
2151
|
+
|
|
2152
|
+
(function(ResponseType) {
|
|
2223
2153
|
ResponseType["Code"] = "code";
|
|
2224
2154
|
ResponseType["ConnectCode"] = "connect_code";
|
|
2225
|
-
|
|
2226
|
-
}({});
|
|
2155
|
+
})(exports.ResponseType || (exports.ResponseType = {}));
|
|
2227
2156
|
|
|
2228
|
-
class User {
|
|
2229
|
-
constructor() {
|
|
2230
|
-
_defineProperty(this, "name", void 0);
|
|
2231
|
-
_defineProperty(this, "given_name", void 0);
|
|
2232
|
-
_defineProperty(this, "family_name", void 0);
|
|
2233
|
-
_defineProperty(this, "middle_name", void 0);
|
|
2234
|
-
_defineProperty(this, "nickname", void 0);
|
|
2235
|
-
_defineProperty(this, "preferred_username", void 0);
|
|
2236
|
-
_defineProperty(this, "profile", void 0);
|
|
2237
|
-
_defineProperty(this, "picture", void 0);
|
|
2238
|
-
_defineProperty(this, "website", void 0);
|
|
2239
|
-
_defineProperty(this, "email", void 0);
|
|
2240
|
-
_defineProperty(this, "email_verified", void 0);
|
|
2241
|
-
_defineProperty(this, "gender", void 0);
|
|
2242
|
-
_defineProperty(this, "birthdate", void 0);
|
|
2243
|
-
_defineProperty(this, "zoneinfo", void 0);
|
|
2244
|
-
_defineProperty(this, "locale", void 0);
|
|
2245
|
-
_defineProperty(this, "phone_number", void 0);
|
|
2246
|
-
_defineProperty(this, "phone_number_verified", void 0);
|
|
2247
|
-
_defineProperty(this, "address", void 0);
|
|
2248
|
-
_defineProperty(this, "updated_at", void 0);
|
|
2249
|
-
_defineProperty(this, "sub", void 0);
|
|
2250
|
-
}
|
|
2251
|
-
}
|
|
2157
|
+
class User {}
|
|
2252
2158
|
|
|
2253
2159
|
function decodeBase64$1(base64, enableUnicode) {
|
|
2254
2160
|
var binaryString = atob(base64);
|
|
@@ -2282,7 +2188,7 @@ function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
|
2282
2188
|
};
|
|
2283
2189
|
}
|
|
2284
2190
|
|
|
2285
|
-
var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBmdW5jdGlvbiBfZGVmaW5lUHJvcGVydHkoZSwgciwgdCkgewogICAgICAgIHJldHVybiAociA9IF90b1Byb3BlcnR5S2V5KHIpKSBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIsIHsKICAgICAgICAgICAgdmFsdWU6IHQsCiAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICB9KSA6IGVbcl0gPSB0LCBlOwogICAgfQogICAgZnVuY3Rpb24gb3duS2V5cyhlLCByKSB7CiAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICB2YXIgbyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgIHIgJiYgKG8gPSBvLmZpbHRlcihmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCByKS5lbnVtZXJhYmxlOwogICAgICAgICAgICB9KSksIHQucHVzaC5hcHBseSh0LCBvKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHQ7CiAgICB9CiAgICBmdW5jdGlvbiBfb2JqZWN0U3ByZWFkMihlKSB7CiAgICAgICAgZm9yICh2YXIgciA9IDE7IHIgPCBhcmd1bWVudHMubGVuZ3RoOyByKyspIHsKICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9IGFyZ3VtZW50c1tyXSA/IGFyZ3VtZW50c1tyXSA6IHt9OwogICAgICAgICAgICByICUgMiA/IG93bktleXMoT2JqZWN0KHQpLCAhMCkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBfZGVmaW5lUHJvcGVydHkoZSwgciwgdFtyXSk7CiAgICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhlLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyh0KSkgOiBvd25LZXlzKE9iamVjdCh0KSkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgciwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LCByKSk7CiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllcyhlLCB0KSB7CiAgICAgICAgaWYgKG51bGwgPT0gZSkgcmV0dXJuIHt9OwogICAgICAgIHZhciBvLCByLCBpID0gX29iamVjdFdpdGhvdXRQcm9wZXJ0aWVzTG9vc2UoZSwgdCk7CiAgICAgICAgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpIHsKICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpOwogICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgbi5sZW5ndGg7IHIrKykgbyA9IG5bcl0sIC0xID09PSB0LmluZGV4T2YobykgJiYge30ucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLCBvKSAmJiAoaVtvXSA9IGVbb10pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gaTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllc0xvb3NlKHIsIGUpIHsKICAgICAgICBpZiAobnVsbCA9PSByKSByZXR1cm4ge307CiAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICBmb3IgKHZhciBuIGluIHIpIGlmICh7fS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHIsIG4pKSB7CiAgICAgICAgICAgIGlmICgtMSAhPT0gZS5pbmRleE9mKG4pKSBjb250aW51ZTsKICAgICAgICAgICAgdFtuXSA9IHJbbl07CiAgICAgICAgfQogICAgICAgIHJldHVybiB0OwogICAgfQogICAgZnVuY3Rpb24gX3RvUHJpbWl0aXZlKHQsIHIpIHsKICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIHQgfHwgIXQpIHJldHVybiB0OwogICAgICAgIHZhciBlID0gdFtTeW1ib2wudG9QcmltaXRpdmVdOwogICAgICAgIGlmICh2b2lkIDAgIT09IGUpIHsKICAgICAgICAgICAgdmFyIGkgPSBlLmNhbGwodCwgciB8fCAiZGVmYXVsdCIpOwogICAgICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIGkpIHJldHVybiBpOwogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gKCJzdHJpbmciID09P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4gZGVsZXRlIHJlZnJlc2hUb2tlbnNbY2FjaGVLZXkoYXVkaWVuY2UsIHNjb3BlKV07CiAgICBjb25zdCB3YWl0ID0gdGltZSA9PiBuZXcgUHJvbWlzZShyZXNvbHZlID0+IHNldFRpbWVvdXQocmVzb2x2ZSwgdGltZSkpOwogICAgY29uc3QgZm9ybURhdGFUb09iamVjdCA9IGZvcm1EYXRhID0+IHsKICAgICAgICBjb25zdCBxdWVyeVBhcmFtcyA9IG5ldyBVUkxTZWFyY2hQYXJhbXMoZm9ybURhdGEpOwogICAgICAgIGNvbnN0IHBhcnNlZFF1ZXJ5ID0ge307CiAgICAgICAgcXVlcnlQYXJhbXMuZm9yRWFjaCgodmFsLCBrZXkpID0+IHsKICAgICAgICAgICAgcGFyc2VkUXVlcnlba2V5XSA9IHZhbDsKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gcGFyc2VkUXVlcnk7CiAgICB9OwogICAgY29uc3QgdXBkYXRlUmVmcmVzaFRva2VucyA9IChvbGRSZWZyZXNoVG9rZW4sIG5ld1JlZnJlc2hUb2tlbikgPT4gewogICAgICAgIE9iamVjdC5lbnRyaWVzKHJlZnJlc2hUb2tlbnMpLmZvckVhY2goX3JlZiA9PiB7CiAgICAgICAgICAgIGxldCBba2V5LCB0b2tlbl0gPSBfcmVmOwogICAgICAgICAgICBpZiAodG9rZW4gPT09IG9sZFJlZnJlc2hUb2tlbikgewogICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1trZXldID0gbmV3UmVmcmVzaFRva2VuOwogICAgICAgICAgICB9CiAgICAgICAgfSk7CiAgICB9OwogICAgY29uc3QgY2hlY2tEb3duc2NvcGluZyA9IChzY29wZSwgYXVkaWVuY2UpID0+IHsKICAgICAgICBjb25zdCBmaW5kQ29pbmNpZGVuY2UgPSBPYmplY3Qua2V5cyhyZWZyZXNoVG9rZW5zKS5maW5kKGtleSA9PiB7CiAgICAgICAgICAgIGlmIChrZXkgIT09ICJsYXRlc3RfcmVmcmVz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ybURhdGEgPyBmb3JtRGF0YVRvT2JqZWN0KGZldGNoT3B0aW9ucy5ib2R5KSA6IEpTT04ucGFyc2UoZmV0Y2hPcHRpb25zLmJvZHkpOwogICAgICAgICAgICBpZiAoIWJvZHkucmVmcmVzaF90b2tlbiAmJiBib2R5LmdyYW50X3R5cGUgPT09ICJyZWZyZXNoX3Rva2VuIikgewogICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gZ2V0UmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBpZiAoIXJlZnJlc2hUb2tlbiAmJiB1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgY29uc3QgbGF0ZXN0UmVmcmVzaFRva2VuID0gcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXTsKICAgICAgICAgICAgICAgICAgICBjb25zdCBpc0Rvd25zY29waW5nID0gY2hlY2tEb3duc2NvcGluZyhzY29wZSwgYXVkaWVuY2UpOwogICAgICAgICAgICAgICAgICAgIGlmIChsYXRlc3RSZWZyZXNoVG9rZW4gJiYgIWlzRG93bnNjb3BpbmcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gbGF0ZXN0UmVmcmVzaFRva2VuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghcmVmcmVzaFRva2VuKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE1pc3NpbmdSZWZyZXNoVG9rZW5FcnJvcihhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLmJvZHkgPSB1c2VGb3JtRGF0YSA/IGNyZWF0ZVF1ZXJ5UGFyYW1zKF9vYmplY3RTcHJlYWQyKF9vYmplY3RTcHJlYWQyKHt9LCBib2R5KSwge30sIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKSA6IEpTT04uc3RyaW5naWZ5KF9vYmplY3RTcHJlYWQyKF9vYmplY3RTcHJlYWQyKHt9LCBib2R5KSwge30sIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZXQgYWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICBpZiAodHlwZW9mIEFib3J0Q29udHJvbGxlciA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICAgICAgYWJvcnRDb250cm9sbGVyID0gbmV3IEFib3J0Q29udHJvbGxlcjsKICAgICAgICAgICAgICAgIGZldGNoT3B0aW9ucy5zaWduYWwgPSBhYm9ydENvbnRyb2xsZXIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCByZXNwb25zZTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgUHJvbWlzZS5yYWNlKFsgd2FpdCh0aW1lb3V0KSwgZmV0Y2goZmV0Y2hVcmwsIF9vYmplY3RTcHJlYWQyKHt9LCBmZXRjaE9wdGlvbnMpKSBdKTsKICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHsKICAgICAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcnJvci5tZXNzYWdlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoIXJlc3BvbnNlKSB7CiAgICAgICAgICAgICAgICBpZiAoYWJvcnRDb250cm9sbGVyKSBhYm9ydENvbnRyb2xsZXIuYWJvcnQoKTsKICAgICAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgICAgIGVycm9yOiAiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVhZGVycyA9IGZyb21FbnRyaWVzKHJlc3BvbnNlLmhlYWRlcnMpOwogICAgICAgICAgICBqc29uID0gYXdhaXQgcmVzcG9uc2UuanNvbigpOwogICAgICAgICAgICBpZiAoanNvbi5yZWZyZXNoX3Rva2VuKSB7CiAgICAgICAgICAgICAgICBpZiAodXNlTXJydCkgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hUb2tlbnNbImxhdGVzdF9yZWZyZXNoX3Rva2VuIl0gPSBqc29uLnJlZnJlc2hfdG9rZW47CiAgICAgICAgICAgICAgICAgICAgdXBkYXRlUmVmcmVzaFRva2VucyhyZWZyZXNoVG9rZW4sIGpzb24ucmVmcmVzaF90b2tlbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzZXRSZWZyZXNoVG9rZW4oanNvbi5yZWZyZXNoX3Rva2VuLCBhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICAgICAgZGVsZXRlIGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGRlbGV0ZVJlZnJlc2hUb2tlbihhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgb2s6IHJlc3BvbnNlLm9rLAogICAgICAgICAgICAgICAganNvbjoganNvbiwKICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMKICAgICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHsKICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogZmFsc2UsCiAgICAgICAgICAgICAgICBqc29uOiB7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLmVycm9yLAogICAgICAgICAgICAgICAgICAgIGVycm9yX2Rlc2NyaXB0aW9uOiBlcnJvci5tZXNzYWdlCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9OwogICAgY29uc3QgaXNBdXRob3JpemVkV29ya2VyUmVxdWVzdCA9IHdvcmtlclJlcXVlc3QgPT4gewogICAgICAgIGlmICghYWxsb3dlZEJhc2VVcmwpIHsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KICAgICAgICB0cnkgewogICAgICAgICAgICBjb25zdCBhbGxvd2VkQmFzZU9yaWdpbiA9IG5ldyBVUkwoYWxsb3dlZEJhc2VVcmwpLm9yaWdpbjsKICAgICAgICAgICAgY29uc3QgcmVxdWVzdGVkVXJsID0gbmV3IFVSTCh3b3JrZXJSZXF1ZXN0LmZldGNoVXJsKTsKICAgICAgICAgICAgcmV0dXJuIHJlcXVlc3RlZFVybC5vcmlnaW4gPT09IGFsbG93ZWRCYXNlT3JpZ2luICYmIHJlcXVlc3RlZFVybC5wYXRobmFtZSA9PT0gIi9vYXV0aC90b2tlbiI7CiAgICAgICAgfSBjYXRjaCAoX3VudXNlZCkgewogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgfTsKICAgIGNvbnN0IG1lc3NhZ2VSb3V0ZXIgPSBldmVudCA9PiB7CiAgICAgICAgY29uc3Qge2RhdGE6IGRhdGEsIHBvcnRzOiBwb3J0c30gPSBldmVudDsKICAgICAgICBjb25zdCBbcG9ydF0gPSBwb3J0czsKICAgICAgICBpZiAoInR5cGUiIGluIGRhdGEgJiYgZGF0YS50eXBlID09PSAiaW5pdCIpIHsKICAgICAgICAgICAgaWYgKGFsbG93ZWRCYXNlVXJsID09PSBudWxsKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIG5ldyBVUkwoZGF0YS5hbGxvd2VkQmFzZVVybCk7CiAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEJhc2VVcmwgPSBkYXRhLmFsbG93ZWRCYXNlVXJsOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoX3VudXNlZDIpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBpZiAoISgiZmV0Y2hVcmwiIGluIGRhdGEpIHx8ICFpc0F1dGhvcml6ZWRXb3JrZXJSZXF1ZXN0KGRhdGEpKSB7CiAgICAgICAgICAgIHBvcnQgPT09IG51bGwgfHwgcG9ydCA9PT0gdm9pZCAwIHx8IHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgb2s6IGZhbHNlLAogICAgICAgICAgICAgICAganNvbjogewogICAgICAgICAgICAgICAgICAgIGVycm9yOiAiaW52YWxpZF9mZXRjaF91cmwiLAogICAgICAgICAgICAgICAgICAgIGVycm9yX2Rlc2NyaXB0aW9uOiAiVW5hdXRob3JpemVkIGZldGNoIFVSTCIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7fQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBtZXNzYWdlSGFuZGxlcihldmVudCk7CiAgICB9OwogICAgewogICAgICAgIGFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLCBtZXNzYWdlUm91dGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
|
|
2191
|
+
var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBjbGFzcyBHZW5lcmljR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nJlc2hUb2tlbnNCeVZhbHVlID0gcmVmcmVzaFRva2VuID0+IHsKICAgICAgICBPYmplY3QuZW50cmllcyhyZWZyZXNoVG9rZW5zKS5mb3JFYWNoKF9yZWYyID0+IHsKICAgICAgICAgICAgbGV0IFtrZXksIHRva2VuXSA9IF9yZWYyOwogICAgICAgICAgICBpZiAodG9rZW4gPT09IHJlZnJlc2hUb2tlbikgewogICAgICAgICAgICAgICAgZGVsZXRlIHJlZnJlc2hUb2tlbnNba2V5XTsKICAgICAgICAgICAgfQogICAgICAgIH0pOwogICAgfTsKICAgIGNvbnN0IHdhaXQgPSB0aW1lID0+IG5ldyBQcm9taXNlKHJlc29sdmUgPT4gc2V0VGltZW91dChyZXNvbHZlLCB0aW1lKSk7CiAgICBjb25zdCBmb3JtRGF0YVRvT2JqZWN0ID0gZm9ybURhdGEgPT4gewogICAgICAgIGNvbnN0IHF1ZXJ5UGFyYW1zID0gbmV3IFVSTFNlYXJjaFBhcmFtcyhmb3JtRGF0YSk7CiAgICAgICAgY29uc3QgcGFyc2VkUXVlcnkgPSB7fTsKICAgICAgICBxdWVyeVBhcmFtcy5mb3JFYWNoKCh2YWwsIGtleSkgPT4gewogICAgICAgICAgICBwYXJzZWRRdWVyeVtrZXldID0gdmFsOwogICAgICAgIH0pOwogICAgICAgIHJldHVybiBwYXJzZWRRdWVyeTsKICAgIH07CiAgICBjb25zdCB1cGRhdGVSZWZyZXNoVG9rZW5zID0gKG9sZFJlZnJlc2hUb2tlbiwgbmV3UmVmcmVzaFRva2VuKSA9PiB7CiAgICAgICAgT2JqZWN0LmVudHJpZXMocmVmcmVzaFRva2VucykuZm9yRWFjaChfcmVmMyA9PiB7CiAgICAgICAgICAgIGxldCBba2V5LCB0b2tlbl0gPSBfcmVmMzsKICAgICAgICAgICAgaWYgKHRva2VuID09PSBvbGRSZWZyZXNoVG9rZW4pIHsKICAgICAgICAgICAgICAgIHJlZnJlc2hUb2tlbnNba2V5XSA9IG5ld1JlZnJlc2hUb2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ydHM6IFtwb3J0XX0gPSBfcmVmNDsKICAgICAgICBsZXQgaGVhZGVycyA9IHt9OwogICAgICAgIGxldCBqc29uOwogICAgICAgIGxldCByZWZyZXNoVG9rZW47CiAgICAgICAgY29uc3Qge2F1ZGllbmNlOiBhdWRpZW5jZSwgc2NvcGU6IHNjb3BlfSA9IGF1dGggfHwge307CiAgICAgICAgdHJ5IHsKICAgICAgICAgICAgY29uc3QgYm9keSA9IHVzZUZvcm1EYXRhID8gZm9ybURhdGFUb09iamVjdChmZXRjaE9wdGlvbnMuYm9keSkgOiBKU09OLnBhcnNlKGZldGNoT3B0aW9ucy5ib2R5KTsKICAgICAgICAgICAgaWYgKCFib2R5LnJlZnJlc2hfdG9rZW4gJiYgYm9keS5ncmFudF90eXBlID09PSAicmVmcmVzaF90b2tlbiIpIHsKICAgICAgICAgICAgICAgIHJlZnJlc2hUb2tlbiA9IGdldFJlZnJlc2hUb2tlbihhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICAgICAgaWYgKCFyZWZyZXNoVG9rZW4gJiYgdXNlTXJydCkgewogICAgICAgICAgICAgICAgICAgIGNvbnN0IGxhdGVzdFJlZnJlc2hUb2tlbiA9IHJlZnJlc2hUb2tlbnNbImxhdGVzdF9yZWZyZXNoX3Rva2VuIl07CiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNEb3duc2NvcGluZyA9IGNoZWNrRG93bnNjb3Bpbmcoc2NvcGUsIGF1ZGllbmNlKTsKICAgICAgICAgICAgICAgICAgICBpZiAobGF0ZXN0UmVmcmVzaFRva2VuICYmICFpc0Rvd25zY29waW5nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hUb2tlbiA9IGxhdGVzdFJlZnJlc2hUb2tlbjsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoIXJlZnJlc2hUb2tlbikgewogICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBNaXNzaW5nUmVmcmVzaFRva2VuRXJyb3IoYXVkaWVuY2UsIHNjb3BlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGZldGNoT3B0aW9ucy5ib2R5ID0gdXNlRm9ybURhdGEgPyBjcmVhdGVRdWVyeVBhcmFtcyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sIGJvZHkpLCB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaF90b2tlbjogcmVmcmVzaFRva2VuCiAgICAgICAgICAgICAgICB9KSkgOiBKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sIGJvZHkpLCB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaF90b2tlbjogcmVmcmVzaFRva2VuCiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbGV0IGFib3J0Q29udHJvbGxlcjsKICAgICAgICAgICAgaWYgKHR5cGVvZiBBYm9ydENvbnRyb2xsZXIgPT09ICJmdW5jdGlvbiIpIHsKICAgICAgICAgICAgICAgIGFib3J0Q29udHJvbGxlciA9IG5ldyBBYm9ydENvbnRyb2xsZXI7CiAgICAgICAgICAgICAgICBmZXRjaE9wdGlvbnMuc2lnbmFsID0gYWJvcnRDb250cm9sbGVyLnNpZ25hbDsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZXQgcmVzcG9uc2U7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICByZXNwb25zZSA9IGF3YWl0IFByb21pc2UucmFjZShbIHdhaXQodGltZW91dCksIGZldGNoKGZldGNoVXJsLCBPYmplY3QuYXNzaWduKHt9LCBmZXRjaE9wdGlvbnMpKSBdKTsKICAgICAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHsKICAgICAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcnJvci5tZXNzYWdlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoIXJlc3BvbnNlKSB7CiAgICAgICAgICAgICAgICBpZiAoYWJvcnRDb250cm9sbGVyKSBhYm9ydENvbnRyb2xsZXIuYWJvcnQoKTsKICAgICAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgICAgIGVycm9yOiAiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIgogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaGVhZGVycyA9IGZyb21FbnRyaWVzKHJlc3BvbnNlLmhlYWRlcnMpOwogICAgICAgICAgICBqc29uID0gYXdhaXQgcmVzcG9uc2UuanNvbigpOwogICAgICAgICAgICBpZiAoanNvbi5yZWZyZXNoX3Rva2VuKSB7CiAgICAgICAgICAgICAgICBpZiAodXNlTXJydCkgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hUb2tlbnNbImxhdGVzdF9yZWZyZXNoX3Rva2VuIl0gPSBqc29uLnJlZnJlc2hfdG9rZW47CiAgICAgICAgICAgICAgICAgICAgdXBkYXRlUmVmcmVzaFRva2VucyhyZWZyZXNoVG9rZW4sIGpzb24ucmVmcmVzaF90b2tlbik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBzZXRSZWZyZXNoVG9rZW4oanNvbi5yZWZyZXNoX3Rva2VuLCBhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICAgICAgZGVsZXRlIGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGRlbGV0ZVJlZnJlc2hUb2tlbihhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgb2s6IHJlc3BvbnNlLm9rLAogICAgICAgICAgICAgICAganNvbjoganNvbiwKICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMKICAgICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoZXJyb3IpIHsKICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogZmFsc2UsCiAgICAgICAgICAgICAgICBqc29uOiB7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLmVycm9yLAogICAgICAgICAgICAgICAgICAgIGVycm9yX2Rlc2NyaXB0aW9uOiBlcnJvci5tZXNzYWdlCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9OwogICAgY29uc3QgcmV2b2tlTWVzc2FnZUhhbmRsZXIgPSBhc3luYyBfcmVmNSA9PiB7CiAgICAgICAgbGV0IHtkYXRhOiB7dGltZW91dDogdGltZW91dCwgYXV0aDogYXV0aCwgZmV0Y2hVcmw6IGZldGNoVXJsLCBmZXRjaE9wdGlvbnM6IGZldGNoT3B0aW9ucywgdXNlRm9ybURhdGE6IHVzZUZvcm1EYXRhfSwgcG9ydHM6IFtwb3J0XX0gPSBfcmVmNTsKICAgICAgICBjb25zdCB7YXVkaWVuY2U6IGF1ZGllbmNlfSA9IGF1dGggfHwge307CiAgICAgICAgdHJ5IHsKICAgICAgICAgICAgY29uc3QgdG9rZW5zVG9SZXZva2UgPSBnZXRSZWZyZXNoVG9rZW5zQnlBdWRpZW5jZShhdWRpZW5jZSk7CiAgICAgICAgICAgIGlmICh0b2tlbnNUb1Jldm9rZS5sZW5ndGggPT09IDApIHsKICAgICAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgICAgIG9rOiB0cnVlCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBjb25zdCBiYXNlQm9keSA9IHVzZUZvcm1EYXRhID8gZm9ybURhdGFUb09iamVjdChmZXRjaE9wdGlvbnMuYm9keSkgOiBKU09OLnBhcnNlKGZldGNoT3B0aW9ucy5ib2R5KTsKICAgICAgICAgICAgZm9yIChjb25zdCByZWZyZXNoVG9rZW4gb2YgdG9rZW5zVG9SZXZva2UpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGJvZHkgPSB1c2VGb3JtRGF0YSA/IGNyZWF0ZVF1ZXJ5UGFyYW1zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgYmFzZUJvZHkpLCB7CiAgICAgICAgICAgICAgICAgICAgdG9rZW46IHJlZnJlc2hUb2tlbgogICAgICAgICAgICAgICAgfSkpIDogSlNPTi5zdHJpbmdpZnkoT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LCBiYXNlQm9keSksIHsKICAgICAgICAgICAgICAgICAgICB0b2tlbjogcmVmcmVzaFRva2VuCiAgICAgICAgICAgICAgICB9KSk7CiAgICAgICAgICAgICAgICBsZXQgYWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICAgICAgbGV0IHNpZ25hbDsKICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgQWJvcnRDb250cm9sbGVyID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICAgICAgYWJvcnRDb250cm9sbGVyID0gbmV3IEFib3J0Q29udHJvbGxlcjsKICAgICAgICAgICAgICAgICAgICBzaWduYWwgPSBhYm9ydENvbnRyb2xsZXIuc2lnbmFsOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgbGV0IHRpbWVvdXRJZDsKICAgICAgICAgICAgICAgIGxldCByZXNwb25zZTsKICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBQcm9taXNlLnJhY2UoWyBuZXcgUHJvbWlzZShyZXNvbHZlID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dElkID0gc2V0VGltZW91dChyZXNvbHZlLCB0aW1lb3V0KTsKICAgICAgICAgICAgICAgICAgICB9KSwgZmV0Y2goZmV0Y2hVcmwsIE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgZmV0Y2hPcHRpb25zKSwgewogICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBib2R5LAogICAgICAgICAgICAgICAgICAgICAgICBzaWduYWw6IHNpZ25hbAogICAgICAgICAgICAgICAgICAgIH0pKSBdKS5maW5hbGx5KCgpID0+IGNsZWFyVGltZW91dCh0aW1lb3V0SWQpKTsKICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGVycm9yKSB7CiAgICAgICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcnJvci5tZXNzYWdlCiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCFyZXNwb25zZSkgewogICAgICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgICAgICAgICAgIHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogIlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyIKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBpZiAoIXJlc3BvbnNlLm9rKSB7CiAgICAgICAgICAgICAgICAgICAgbGV0IGVycm9yRGVzY3JpcHRpb247CiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qge2Vycm9yX2Rlc2NyaXB0aW9uOiBlcnJvcl9kZXNjcmlwdGlvbn0gPSBKU09OLnBhcnNlKGF3YWl0IHJlc3BvbnNlLnRleHQoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yRGVzY3JpcHRpb24gPSBlcnJvcl9kZXNjcmlwdGlvbjsKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChfYSkge30KICAgICAgICAgICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yRGVzY3JpcHRpb24gfHwgIkhUVFAgZXJyb3IgIi5jb25jYXQocmVzcG9uc2Uuc3RhdHVzKQogICAgICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRlbGV0ZVJlZnJlc2hUb2tlbnNCeVZhbHVlKHJlZnJlc2hUb2tlbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIGVycm9yOiBlcnJvci5tZXNzYWdlIHx8ICJVbmtub3duIGVycm9yIGR1cmluZyB0b2tlbiByZXZvY2F0aW9uIgogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9OwogICAgY29uc3QgaXNBdXRob3JpemVkV29ya2VyUmVxdWVzdCA9ICh3b3JrZXJSZXF1ZXN0LCBleHBlY3RlZFBhdGgpID0+IHsKICAgICAgICBpZiAoIWFsbG93ZWRCYXNlVXJsKSB7CiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICB9CiAgICAgICAgdHJ5IHsKICAgICAgICAgICAgY29uc3QgYWxsb3dlZEJhc2VPcmlnaW4gPSBuZXcgVVJMKGFsbG93ZWRCYXNlVXJsKS5vcmlnaW47CiAgICAgICAgICAgIGNvbnN0IHJlcXVlc3RlZFVybCA9IG5ldyBVUkwod29ya2VyUmVxdWVzdC5mZXRjaFVybCk7CiAgICAgICAgICAgIHJldHVybiByZXF1ZXN0ZWRVcmwub3JpZ2luID09PSBhbGxvd2VkQmFzZU9yaWdpbiAmJiByZXF1ZXN0ZWRVcmwucGF0aG5hbWUgPT09IGV4cGVjdGVkUGF0aDsKICAgICAgICB9IGNhdGNoIChfYSkgewogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgfQogICAgfTsKICAgIGNvbnN0IG1lc3NhZ2VSb3V0ZXIgPSBldmVudCA9PiB7CiAgICAgICAgY29uc3Qge2RhdGE6IGRhdGEsIHBvcnRzOiBwb3J0c30gPSBldmVudDsKICAgICAgICBjb25zdCBbcG9ydF0gPSBwb3J0czsKICAgICAgICBpZiAoInR5cGUiIGluIGRhdGEgJiYgZGF0YS50eXBlID09PSAiaW5pdCIpIHsKICAgICAgICAgICAgaWYgKGFsbG93ZWRCYXNlVXJsID09PSBudWxsKSB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIG5ldyBVUkwoZGF0YS5hbGxvd2VkQmFzZVVybCk7CiAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEJhc2VVcmwgPSBkYXRhLmFsbG93ZWRCYXNlVXJsOwogICAgICAgICAgICAgICAgfSBjYXRjaCAoX2EpIHsKICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBpZiAoInR5cGUiIGluIGRhdGEgJiYgZGF0YS50eXBlID09PSAicmV2b2tlIikgewogICAgICAgICAgICBpZiAoIWlzQXV0aG9yaXplZFdvcmtlclJlcXVlc3QoZGF0YSwgIi9vYXV0aC9yZXZva2UiKSkgewogICAgICAgICAgICAgICAgcG9ydCA9PT0gbnVsbCB8fCBwb3J0ID09PSB2b2lkIDAgPyB2b2lkIDAgOiBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgICBvazogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAganNvbjogewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogImludmFsaWRfZmV0Y2hfdXJsIiwKICAgICAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246ICJVbmF1dGhvcml6ZWQgZmV0Y2ggVVJMIgogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge30KICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldm9rZU1lc3NhZ2VIYW5kbGVyKGV2ZW50KTsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBpZiAoISgiZmV0Y2hVcmwiIGluIGRhdGEpIHx8ICFpc0F1dGhvcml6ZWRXb3JrZXJSZXF1ZXN0KGRhdGEsICIvb2F1dGgvdG9rZW4iKSkgewogICAgICAgICAgICBwb3J0ID09PSBudWxsIHx8IHBvcnQgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHBvcnQucG9zdE1lc3NhZ2UoewogICAgICAgICAgICAgICAgb2s6IGZhbHNlLAogICAgICAgICAgICAgICAganNvbjogewogICAgICAgICAgICAgICAgICAgIGVycm9yOiAiaW52YWxpZF9mZXRjaF91cmwiLAogICAgICAgICAgICAgICAgICAgIGVycm9yX2Rlc2NyaXB0aW9uOiAiVW5hdXRob3JpemVkIGZldGNoIFVSTCIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7fQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIH0KICAgICAgICBtZXNzYWdlSGFuZGxlcihldmVudCk7CiAgICB9OwogICAgewogICAgICAgIGFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLCBtZXNzYWdlUm91dGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
|
|
2286
2192
|
|
|
2287
2193
|
const singlePromiseMap = {};
|
|
2288
2194
|
|
|
@@ -2302,12 +2208,11 @@ class CacheKeyManifest {
|
|
|
2302
2208
|
constructor(cache, clientId) {
|
|
2303
2209
|
this.cache = cache;
|
|
2304
2210
|
this.clientId = clientId;
|
|
2305
|
-
_defineProperty(this, "manifestKey", void 0);
|
|
2306
2211
|
this.manifestKey = this.createManifestKeyFrom(this.clientId);
|
|
2307
2212
|
}
|
|
2308
2213
|
async add(key) {
|
|
2309
|
-
var
|
|
2310
|
-
const keys = new Set(((
|
|
2214
|
+
var _a;
|
|
2215
|
+
const keys = new Set(((_a = await this.cache.get(this.manifestKey)) === null || _a === void 0 ? void 0 : _a.keys) || []);
|
|
2311
2216
|
keys.add(key);
|
|
2312
2217
|
await this.cache.set(this.manifestKey, {
|
|
2313
2218
|
keys: [ ...keys ]
|
|
@@ -2337,8 +2242,6 @@ class CacheKeyManifest {
|
|
|
2337
2242
|
}
|
|
2338
2243
|
}
|
|
2339
2244
|
|
|
2340
|
-
const _excluded$2 = [ "openUrl", "onRedirect" ];
|
|
2341
|
-
|
|
2342
2245
|
const GET_TOKEN_SILENTLY_LOCK_KEY = "auth0.lock.getTokenSilently";
|
|
2343
2246
|
|
|
2344
2247
|
const GET_TOKEN_FROM_IFRAME_LOCK_KEY = "auth0.lock.getTokenFromIFrame";
|
|
@@ -2360,9 +2263,9 @@ const cacheLocationBuilders = {
|
|
|
2360
2263
|
|
|
2361
2264
|
const cacheFactory = location => cacheLocationBuilders[location];
|
|
2362
2265
|
|
|
2363
|
-
const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, nonce, code_challenge, redirect_uri, response_mode, thumbprint) =>
|
|
2266
|
+
const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, nonce, code_challenge, redirect_uri, response_mode, thumbprint) => Object.assign(Object.assign(Object.assign({
|
|
2364
2267
|
client_id: clientOptions.clientId
|
|
2365
|
-
}, clientOptions.authorizationParams), authorizationParams), {
|
|
2268
|
+
}, clientOptions.authorizationParams), authorizationParams), {
|
|
2366
2269
|
scope: scopesToRequest(scope, authorizationParams.scope, authorizationParams.audience),
|
|
2367
2270
|
response_type: "code",
|
|
2368
2271
|
response_mode: response_mode || "query",
|
|
@@ -2375,8 +2278,8 @@ const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, no
|
|
|
2375
2278
|
});
|
|
2376
2279
|
|
|
2377
2280
|
const patchOpenUrlWithOnRedirect = options => {
|
|
2378
|
-
const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions =
|
|
2379
|
-
const result =
|
|
2281
|
+
const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions = __rest(options, [ "openUrl", "onRedirect" ]);
|
|
2282
|
+
const result = Object.assign(Object.assign({}, originalOptions), {
|
|
2380
2283
|
openUrl: openUrl === false || openUrl ? openUrl : onRedirect
|
|
2381
2284
|
});
|
|
2382
2285
|
return result;
|
|
@@ -2396,13 +2299,13 @@ const getMissingScopes = (requestedScope, respondedScope) => {
|
|
|
2396
2299
|
};
|
|
2397
2300
|
|
|
2398
2301
|
const getScopeToRequest = (useMrrt, authorizationParams, cachedAudience, cachedScope) => {
|
|
2302
|
+
var _a;
|
|
2399
2303
|
if (useMrrt && cachedAudience && cachedScope) {
|
|
2400
|
-
var _authorizationParams$;
|
|
2401
2304
|
if (authorizationParams.audience !== cachedAudience) {
|
|
2402
2305
|
return authorizationParams.scope;
|
|
2403
2306
|
}
|
|
2404
2307
|
const cachedScopes = cachedScope.split(" ");
|
|
2405
|
-
const newScopes = ((
|
|
2308
|
+
const newScopes = ((_a = authorizationParams.scope) === null || _a === void 0 ? void 0 : _a.split(" ")) || [];
|
|
2406
2309
|
const newScopesAreIncluded = newScopes.every(scope => cachedScopes.includes(scope));
|
|
2407
2310
|
return cachedScopes.length >= newScopes.length && newScopesAreIncluded ? cachedScope : authorizationParams.scope;
|
|
2408
2311
|
}
|
|
@@ -2429,8 +2332,6 @@ const AUTH0_NONCE_ID = "auth0";
|
|
|
2429
2332
|
|
|
2430
2333
|
class DpopStorage {
|
|
2431
2334
|
constructor(clientId) {
|
|
2432
|
-
_defineProperty(this, "clientId", void 0);
|
|
2433
|
-
_defineProperty(this, "dbHandle", void 0);
|
|
2434
2335
|
this.clientId = clientId;
|
|
2435
2336
|
}
|
|
2436
2337
|
getVersion() {
|
|
@@ -2484,7 +2385,7 @@ class DpopStorage {
|
|
|
2484
2385
|
}
|
|
2485
2386
|
async deleteBy(table, predicate) {
|
|
2486
2387
|
const allKeys = await this.executeDbRequest(table, "readonly", table => table.getAllKeys());
|
|
2487
|
-
allKeys === null || allKeys === void 0
|
|
2388
|
+
allKeys === null || allKeys === void 0 ? void 0 : allKeys.filter(predicate).map(k => this.executeDbRequest(table, "readwrite", table => table.delete(k)));
|
|
2488
2389
|
}
|
|
2489
2390
|
deleteByClientId(table, clientId) {
|
|
2490
2391
|
return this.deleteBy(table, k => typeof k === "string" && k.startsWith("".concat(clientId, "::")));
|
|
@@ -2499,7 +2400,6 @@ class DpopStorage {
|
|
|
2499
2400
|
|
|
2500
2401
|
class Dpop {
|
|
2501
2402
|
constructor(clientId) {
|
|
2502
|
-
_defineProperty(this, "storage", void 0);
|
|
2503
2403
|
this.storage = new DpopStorage(clientId);
|
|
2504
2404
|
}
|
|
2505
2405
|
getNonce(id) {
|
|
@@ -2518,7 +2418,7 @@ class Dpop {
|
|
|
2518
2418
|
}
|
|
2519
2419
|
async generateProof(params) {
|
|
2520
2420
|
const keyPair = await this.getOrGenerateKeyPair();
|
|
2521
|
-
return generateProof(
|
|
2421
|
+
return generateProof(Object.assign({
|
|
2522
2422
|
keyPair: keyPair
|
|
2523
2423
|
}, params));
|
|
2524
2424
|
}
|
|
@@ -2531,18 +2431,17 @@ class Dpop {
|
|
|
2531
2431
|
}
|
|
2532
2432
|
}
|
|
2533
2433
|
|
|
2534
|
-
var TokenType
|
|
2434
|
+
var TokenType;
|
|
2435
|
+
|
|
2436
|
+
(function(TokenType) {
|
|
2535
2437
|
TokenType["Bearer"] = "Bearer";
|
|
2536
2438
|
TokenType["DPoP"] = "DPoP";
|
|
2537
|
-
|
|
2538
|
-
}(TokenType || {});
|
|
2439
|
+
})(TokenType || (TokenType = {}));
|
|
2539
2440
|
|
|
2540
2441
|
class Fetcher {
|
|
2541
2442
|
constructor(config, hooks) {
|
|
2542
|
-
_defineProperty(this, "config", void 0);
|
|
2543
|
-
_defineProperty(this, "hooks", void 0);
|
|
2544
2443
|
this.hooks = hooks;
|
|
2545
|
-
this.config =
|
|
2444
|
+
this.config = Object.assign(Object.assign({}, config), {
|
|
2546
2445
|
fetch: config.fetch || (typeof window === "undefined" ? fetch : window.fetch.bind(window))
|
|
2547
2446
|
});
|
|
2548
2447
|
}
|
|
@@ -2650,7 +2549,7 @@ class Fetcher {
|
|
|
2650
2549
|
}
|
|
2651
2550
|
fetchWithAuth(info, init, authParams) {
|
|
2652
2551
|
const callbacks = {
|
|
2653
|
-
onUseDpopNonceError: () => this.internalFetchWithAuth(info, init,
|
|
2552
|
+
onUseDpopNonceError: () => this.internalFetchWithAuth(info, init, Object.assign(Object.assign({}, callbacks), {
|
|
2654
2553
|
onUseDpopNonceError: undefined
|
|
2655
2554
|
}), authParams)
|
|
2656
2555
|
};
|
|
@@ -2708,11 +2607,6 @@ class MyAccountApiError extends Error {
|
|
|
2708
2607
|
constructor(_ref) {
|
|
2709
2608
|
let {type: type, status: status, title: title, detail: detail, validation_errors: validation_errors} = _ref;
|
|
2710
2609
|
super(detail);
|
|
2711
|
-
_defineProperty(this, "type", void 0);
|
|
2712
|
-
_defineProperty(this, "status", void 0);
|
|
2713
|
-
_defineProperty(this, "title", void 0);
|
|
2714
|
-
_defineProperty(this, "detail", void 0);
|
|
2715
|
-
_defineProperty(this, "validation_errors", void 0);
|
|
2716
2610
|
this.name = "MyAccountApiError";
|
|
2717
2611
|
this.type = type;
|
|
2718
2612
|
this.status = status;
|
|
@@ -2753,7 +2647,7 @@ const MfaGrantTypes = {
|
|
|
2753
2647
|
|
|
2754
2648
|
function getAuthJsEnrollParams(params) {
|
|
2755
2649
|
const mapping = FACTOR_MAPPING[params.factorType];
|
|
2756
|
-
return
|
|
2650
|
+
return Object.assign(Object.assign(Object.assign({
|
|
2757
2651
|
mfaToken: params.mfaToken,
|
|
2758
2652
|
authenticatorTypes: mapping.authenticatorTypes
|
|
2759
2653
|
}, mapping.oobChannels && {
|
|
@@ -2778,6 +2672,162 @@ function getGrantType(params) {
|
|
|
2778
2672
|
return undefined;
|
|
2779
2673
|
}
|
|
2780
2674
|
|
|
2675
|
+
function _OverloadYield(e, d) {
|
|
2676
|
+
this.v = e, this.k = d;
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
function _assertClassBrand(e, t, n) {
|
|
2680
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
2681
|
+
throw new TypeError("Private element is not present on this object");
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
function _awaitAsyncGenerator(e) {
|
|
2685
|
+
return new _OverloadYield(e, 0);
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
2689
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
2690
|
+
}
|
|
2691
|
+
|
|
2692
|
+
function _classPrivateFieldGet2(s, a) {
|
|
2693
|
+
return s.get(_assertClassBrand(s, a));
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
2697
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
2701
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
function _classPrivateMethodInitSpec(e, a) {
|
|
2705
|
+
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
function _defineProperty(e, r, t) {
|
|
2709
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
2710
|
+
value: t,
|
|
2711
|
+
enumerable: !0,
|
|
2712
|
+
configurable: !0,
|
|
2713
|
+
writable: !0
|
|
2714
|
+
}) : e[r] = t, e;
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
function ownKeys(e, r) {
|
|
2718
|
+
var t = Object.keys(e);
|
|
2719
|
+
if (Object.getOwnPropertySymbols) {
|
|
2720
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
2721
|
+
r && (o = o.filter(function(r) {
|
|
2722
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
2723
|
+
})), t.push.apply(t, o);
|
|
2724
|
+
}
|
|
2725
|
+
return t;
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
function _objectSpread2(e) {
|
|
2729
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
2730
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
2731
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
2732
|
+
_defineProperty(e, r, t[r]);
|
|
2733
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
2734
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
2735
|
+
});
|
|
2736
|
+
}
|
|
2737
|
+
return e;
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
function _objectWithoutProperties(e, t) {
|
|
2741
|
+
if (null == e) return {};
|
|
2742
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
2743
|
+
if (Object.getOwnPropertySymbols) {
|
|
2744
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
2745
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
2746
|
+
}
|
|
2747
|
+
return i;
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
2751
|
+
if (null == r) return {};
|
|
2752
|
+
var t = {};
|
|
2753
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2754
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
2755
|
+
t[n] = r[n];
|
|
2756
|
+
}
|
|
2757
|
+
return t;
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
function _toPrimitive(t, r) {
|
|
2761
|
+
if ("object" != typeof t || !t) return t;
|
|
2762
|
+
var e = t[Symbol.toPrimitive];
|
|
2763
|
+
if (void 0 !== e) {
|
|
2764
|
+
var i = e.call(t, r || "default");
|
|
2765
|
+
if ("object" != typeof i) return i;
|
|
2766
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2767
|
+
}
|
|
2768
|
+
return ("string" === r ? String : Number)(t);
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
function _toPropertyKey(t) {
|
|
2772
|
+
var i = _toPrimitive(t, "string");
|
|
2773
|
+
return "symbol" == typeof i ? i : i + "";
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
function _wrapAsyncGenerator(e) {
|
|
2777
|
+
return function() {
|
|
2778
|
+
return new AsyncGenerator(e.apply(this, arguments));
|
|
2779
|
+
};
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
function AsyncGenerator(e) {
|
|
2783
|
+
var t, n;
|
|
2784
|
+
function resume(t, n) {
|
|
2785
|
+
try {
|
|
2786
|
+
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
|
|
2787
|
+
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
2788
|
+
if (u) {
|
|
2789
|
+
var i = "return" === t && o.k ? t : "next";
|
|
2790
|
+
if (!o.k || n.done) return resume(i, n);
|
|
2791
|
+
n = e[i](n).value;
|
|
2792
|
+
}
|
|
2793
|
+
settle(!!r.done, n);
|
|
2794
|
+
}, function(e) {
|
|
2795
|
+
resume("throw", e);
|
|
2796
|
+
});
|
|
2797
|
+
} catch (e) {
|
|
2798
|
+
settle(2, e);
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
function settle(e, r) {
|
|
2802
|
+
2 === e ? t.reject(r) : t.resolve({
|
|
2803
|
+
value: r,
|
|
2804
|
+
done: e
|
|
2805
|
+
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
2806
|
+
}
|
|
2807
|
+
this._invoke = function(e, r) {
|
|
2808
|
+
return new Promise(function(o, u) {
|
|
2809
|
+
var i = {
|
|
2810
|
+
key: e,
|
|
2811
|
+
arg: r,
|
|
2812
|
+
resolve: o,
|
|
2813
|
+
reject: u,
|
|
2814
|
+
next: null
|
|
2815
|
+
};
|
|
2816
|
+
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
2817
|
+
});
|
|
2818
|
+
}, "function" != typeof e.return && (this.return = void 0);
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
2822
|
+
return this;
|
|
2823
|
+
}, AsyncGenerator.prototype.next = function(e) {
|
|
2824
|
+
return this._invoke("next", e);
|
|
2825
|
+
}, AsyncGenerator.prototype.throw = function(e) {
|
|
2826
|
+
return this._invoke("throw", e);
|
|
2827
|
+
}, AsyncGenerator.prototype.return = function(e) {
|
|
2828
|
+
return this._invoke("return", e);
|
|
2829
|
+
};
|
|
2830
|
+
|
|
2781
2831
|
var _navigator$userAgent$2, _navigator$userAgent$$2;
|
|
2782
2832
|
|
|
2783
2833
|
let USER_AGENT$2;
|
|
@@ -7058,7 +7108,7 @@ function createRemoteJWKSet(url, options) {
|
|
|
7058
7108
|
return remoteJWKSet;
|
|
7059
7109
|
}
|
|
7060
7110
|
|
|
7061
|
-
const _excluded
|
|
7111
|
+
const _excluded = [ "mfaToken" ], _excluded2 = [ "mfaToken" ];
|
|
7062
7112
|
|
|
7063
7113
|
var _baseUrl, _clientId, _customFetch, _entries, _ttlMs, _maxEntries, _configuration, _serverMetadata, _clientAuthPromise, _options, _customFetch2, _jwks, _discoveryCache, _inFlightDiscovery, _jwksCache, _Class9_brand;
|
|
7064
7114
|
|
|
@@ -7303,7 +7353,7 @@ class MfaClient {
|
|
|
7303
7353
|
}
|
|
7304
7354
|
async enrollAuthenticator(options) {
|
|
7305
7355
|
const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/associate");
|
|
7306
|
-
const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded
|
|
7356
|
+
const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded);
|
|
7307
7357
|
const apiParams = {
|
|
7308
7358
|
authenticator_types: sdkParams.authenticatorTypes
|
|
7309
7359
|
};
|
|
@@ -7348,7 +7398,7 @@ class MfaClient {
|
|
|
7348
7398
|
}
|
|
7349
7399
|
async challengeAuthenticator(options) {
|
|
7350
7400
|
const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/challenge");
|
|
7351
|
-
const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2
|
|
7401
|
+
const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2);
|
|
7352
7402
|
const body = {
|
|
7353
7403
|
mfa_token: mfaToken,
|
|
7354
7404
|
client_id: _classPrivateFieldGet2(_clientId, this),
|
|
@@ -8103,13 +8153,12 @@ const DEFAULT_TTL_MS = 10 * 60 * 1e3;
|
|
|
8103
8153
|
class MfaContextManager {
|
|
8104
8154
|
constructor() {
|
|
8105
8155
|
let ttlMs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_TTL_MS;
|
|
8106
|
-
|
|
8107
|
-
_defineProperty(this, "ttlMs", void 0);
|
|
8156
|
+
this.contexts = new Map;
|
|
8108
8157
|
this.ttlMs = ttlMs;
|
|
8109
8158
|
}
|
|
8110
8159
|
set(mfaToken, context) {
|
|
8111
8160
|
this.cleanup();
|
|
8112
|
-
this.contexts.set(mfaToken,
|
|
8161
|
+
this.contexts.set(mfaToken, Object.assign(Object.assign({}, context), {
|
|
8113
8162
|
createdAt: Date.now()
|
|
8114
8163
|
}));
|
|
8115
8164
|
}
|
|
@@ -8142,9 +8191,6 @@ class MfaContextManager {
|
|
|
8142
8191
|
|
|
8143
8192
|
class MfaApiClient {
|
|
8144
8193
|
constructor(authJsMfaClient, auth0Client) {
|
|
8145
|
-
_defineProperty(this, "authJsMfaClient", void 0);
|
|
8146
|
-
_defineProperty(this, "auth0Client", void 0);
|
|
8147
|
-
_defineProperty(this, "contextManager", void 0);
|
|
8148
8194
|
this.authJsMfaClient = authJsMfaClient;
|
|
8149
8195
|
this.auth0Client = auth0Client;
|
|
8150
8196
|
this.contextManager = new MfaContextManager;
|
|
@@ -8157,9 +8203,9 @@ class MfaApiClient {
|
|
|
8157
8203
|
});
|
|
8158
8204
|
}
|
|
8159
8205
|
async getAuthenticators(mfaToken) {
|
|
8160
|
-
var
|
|
8206
|
+
var _a, _b;
|
|
8161
8207
|
const context = this.contextManager.get(mfaToken);
|
|
8162
|
-
if (!(context
|
|
8208
|
+
if (!((_a = context === null || context === void 0 ? void 0 : context.mfaRequirements) === null || _a === void 0 ? void 0 : _a.challenge) || context.mfaRequirements.challenge.length === 0) {
|
|
8163
8209
|
throw new MfaListAuthenticatorsError("invalid_request", "challengeType is required and must contain at least one challenge type, please check mfa_required error payload");
|
|
8164
8210
|
}
|
|
8165
8211
|
const challengeTypes = context.mfaRequirements.challenge.map(c => c.type);
|
|
@@ -8173,25 +8219,25 @@ class MfaApiClient {
|
|
|
8173
8219
|
});
|
|
8174
8220
|
} catch (error) {
|
|
8175
8221
|
if (error instanceof MfaListAuthenticatorsError$1) {
|
|
8176
|
-
|
|
8177
|
-
throw new MfaListAuthenticatorsError((_error$cause = error.cause) === null || _error$cause === void 0 ? void 0 : _error$cause.error, error.message);
|
|
8222
|
+
throw new MfaListAuthenticatorsError((_b = error.cause) === null || _b === void 0 ? void 0 : _b.error, error.message);
|
|
8178
8223
|
}
|
|
8179
8224
|
throw error;
|
|
8180
8225
|
}
|
|
8181
8226
|
}
|
|
8182
8227
|
async enroll(params) {
|
|
8228
|
+
var _a;
|
|
8183
8229
|
const authJsParams = getAuthJsEnrollParams(params);
|
|
8184
8230
|
try {
|
|
8185
8231
|
return await this.authJsMfaClient.enrollAuthenticator(authJsParams);
|
|
8186
8232
|
} catch (error) {
|
|
8187
8233
|
if (error instanceof MfaEnrollmentError$1) {
|
|
8188
|
-
|
|
8189
|
-
throw new MfaEnrollmentError((_error$cause2 = error.cause) === null || _error$cause2 === void 0 ? void 0 : _error$cause2.error, error.message);
|
|
8234
|
+
throw new MfaEnrollmentError((_a = error.cause) === null || _a === void 0 ? void 0 : _a.error, error.message);
|
|
8190
8235
|
}
|
|
8191
8236
|
throw error;
|
|
8192
8237
|
}
|
|
8193
8238
|
}
|
|
8194
8239
|
async challenge(params) {
|
|
8240
|
+
var _a;
|
|
8195
8241
|
try {
|
|
8196
8242
|
const authJsParams = {
|
|
8197
8243
|
challengeType: params.challengeType,
|
|
@@ -8203,8 +8249,7 @@ class MfaApiClient {
|
|
|
8203
8249
|
return await this.authJsMfaClient.challengeAuthenticator(authJsParams);
|
|
8204
8250
|
} catch (error) {
|
|
8205
8251
|
if (error instanceof MfaChallengeError$1) {
|
|
8206
|
-
|
|
8207
|
-
throw new MfaChallengeError((_error$cause3 = error.cause) === null || _error$cause3 === void 0 ? void 0 : _error$cause3.error, error.message);
|
|
8252
|
+
throw new MfaChallengeError((_a = error.cause) === null || _a === void 0 ? void 0 : _a.error, error.message);
|
|
8208
8253
|
}
|
|
8209
8254
|
throw error;
|
|
8210
8255
|
}
|
|
@@ -8254,38 +8299,18 @@ class MfaApiClient {
|
|
|
8254
8299
|
}
|
|
8255
8300
|
}
|
|
8256
8301
|
|
|
8257
|
-
const _excluded = [ "openUrl", "fragment", "appState" ], _excluded2 = [ "url" ], _excluded3 = [ "cacheMode" ], _excluded4 = [ "federated" ], _excluded5 = [ "openUrl" ], _excluded6 = [ "id_token", "decodedToken" ], _excluded7 = [ "mfaToken" ];
|
|
8258
|
-
|
|
8259
8302
|
class Auth0Client {
|
|
8260
8303
|
constructor(options) {
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
_defineProperty(this, "lockManager", void 0);
|
|
8264
|
-
_defineProperty(this, "domainUrl", void 0);
|
|
8265
|
-
_defineProperty(this, "tokenIssuer", void 0);
|
|
8266
|
-
_defineProperty(this, "scope", void 0);
|
|
8267
|
-
_defineProperty(this, "cookieStorage", void 0);
|
|
8268
|
-
_defineProperty(this, "dpop", void 0);
|
|
8269
|
-
_defineProperty(this, "sessionCheckExpiryDays", void 0);
|
|
8270
|
-
_defineProperty(this, "orgHintCookieName", void 0);
|
|
8271
|
-
_defineProperty(this, "isAuthenticatedCookieName", void 0);
|
|
8272
|
-
_defineProperty(this, "nowProvider", void 0);
|
|
8273
|
-
_defineProperty(this, "httpTimeoutMs", void 0);
|
|
8274
|
-
_defineProperty(this, "options", void 0);
|
|
8275
|
-
_defineProperty(this, "userCache", (new InMemoryCache).enclosedCache);
|
|
8276
|
-
_defineProperty(this, "myAccountApi", void 0);
|
|
8277
|
-
_defineProperty(this, "mfa", void 0);
|
|
8278
|
-
_defineProperty(this, "worker", void 0);
|
|
8279
|
-
_defineProperty(this, "authJsClient", void 0);
|
|
8280
|
-
_defineProperty(this, "defaultOptions", {
|
|
8304
|
+
this.userCache = (new InMemoryCache).enclosedCache;
|
|
8305
|
+
this.defaultOptions = {
|
|
8281
8306
|
authorizationParams: {
|
|
8282
8307
|
scope: DEFAULT_SCOPE
|
|
8283
8308
|
},
|
|
8284
8309
|
useRefreshTokensFallback: false,
|
|
8285
8310
|
useFormData: true
|
|
8286
|
-
}
|
|
8287
|
-
this.options =
|
|
8288
|
-
authorizationParams:
|
|
8311
|
+
};
|
|
8312
|
+
this.options = Object.assign(Object.assign(Object.assign({}, this.defaultOptions), options), {
|
|
8313
|
+
authorizationParams: Object.assign(Object.assign({}, this.defaultOptions.authorizationParams), options.authorizationParams)
|
|
8289
8314
|
});
|
|
8290
8315
|
typeof window !== "undefined" && validateCrypto();
|
|
8291
8316
|
this.lockManager = getLockManager();
|
|
@@ -8317,9 +8342,9 @@ class Auth0Client {
|
|
|
8317
8342
|
this.domainUrl = getDomain(this.options.domain);
|
|
8318
8343
|
this.tokenIssuer = getTokenIssuer(this.options.issuer, this.domainUrl);
|
|
8319
8344
|
const myAccountApiIdentifier = "".concat(this.domainUrl, "/me/");
|
|
8320
|
-
const myAccountFetcher = this.createFetcher(
|
|
8345
|
+
const myAccountFetcher = this.createFetcher(Object.assign(Object.assign({}, this.options.useDpop && {
|
|
8321
8346
|
dpopNonceId: "__auth0_my_account_api__"
|
|
8322
|
-
}), {
|
|
8347
|
+
}), {
|
|
8323
8348
|
getAccessToken: () => this.getTokenSilently({
|
|
8324
8349
|
authorizationParams: {
|
|
8325
8350
|
scope: "create:me:connected_accounts",
|
|
@@ -8397,7 +8422,7 @@ class Auth0Client {
|
|
|
8397
8422
|
url.searchParams.delete(paramName);
|
|
8398
8423
|
window.history.replaceState({}, "", url.toString());
|
|
8399
8424
|
}
|
|
8400
|
-
} catch (
|
|
8425
|
+
} catch (_a) {}
|
|
8401
8426
|
}
|
|
8402
8427
|
_applySessionTransferToken(authorizationParams) {
|
|
8403
8428
|
const paramName = this.options.sessionTransferTokenQueryParamName;
|
|
@@ -8407,18 +8432,18 @@ class Auth0Client {
|
|
|
8407
8432
|
const token = this._extractSessionTransferToken(paramName);
|
|
8408
8433
|
if (!token) return authorizationParams;
|
|
8409
8434
|
this._clearSessionTransferTokenFromUrl(paramName);
|
|
8410
|
-
return
|
|
8435
|
+
return Object.assign(Object.assign({}, authorizationParams), {
|
|
8411
8436
|
session_transfer_token: token
|
|
8412
8437
|
});
|
|
8413
8438
|
}
|
|
8414
8439
|
async _prepareAuthorizeUrl(authorizationParams, authorizeOptions, fallbackRedirectUri) {
|
|
8415
|
-
var
|
|
8440
|
+
var _a;
|
|
8416
8441
|
const state = encode$2(createRandomString());
|
|
8417
8442
|
const nonce = encode$2(createRandomString());
|
|
8418
8443
|
const code_verifier = createRandomString();
|
|
8419
8444
|
const code_challengeBuffer = await sha256(code_verifier);
|
|
8420
8445
|
const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
|
|
8421
|
-
const thumbprint = await ((
|
|
8446
|
+
const thumbprint = await ((_a = this.dpop) === null || _a === void 0 ? void 0 : _a.calculateThumbprint());
|
|
8422
8447
|
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);
|
|
8423
8448
|
const url = this._authorizeUrl(params);
|
|
8424
8449
|
return {
|
|
@@ -8432,7 +8457,7 @@ class Auth0Client {
|
|
|
8432
8457
|
};
|
|
8433
8458
|
}
|
|
8434
8459
|
async loginWithPopup(options, config) {
|
|
8435
|
-
var
|
|
8460
|
+
var _a;
|
|
8436
8461
|
options = options || {};
|
|
8437
8462
|
config = config || {};
|
|
8438
8463
|
if (!config.popup) {
|
|
@@ -8446,13 +8471,13 @@ class Auth0Client {
|
|
|
8446
8471
|
response_mode: "web_message"
|
|
8447
8472
|
}, window.location.origin);
|
|
8448
8473
|
config.popup.location.href = params.url;
|
|
8449
|
-
const codeResult = await runPopup(
|
|
8474
|
+
const codeResult = await runPopup(Object.assign(Object.assign({}, config), {
|
|
8450
8475
|
timeoutInSeconds: config.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
|
|
8451
8476
|
}), new URL(params.url).origin);
|
|
8452
8477
|
if (params.state !== codeResult.state) {
|
|
8453
8478
|
throw new GenericError("state_mismatch", "Invalid state");
|
|
8454
8479
|
}
|
|
8455
|
-
const organization = ((
|
|
8480
|
+
const organization = ((_a = options.authorizationParams) === null || _a === void 0 ? void 0 : _a.organization) || this.options.authorizationParams.organization;
|
|
8456
8481
|
await this._requestToken({
|
|
8457
8482
|
audience: params.audience,
|
|
8458
8483
|
scope: params.scope,
|
|
@@ -8466,26 +8491,26 @@ class Auth0Client {
|
|
|
8466
8491
|
});
|
|
8467
8492
|
}
|
|
8468
8493
|
async getUser() {
|
|
8469
|
-
var
|
|
8494
|
+
var _a;
|
|
8470
8495
|
const cache = await this._getIdTokenFromCache();
|
|
8471
|
-
return cache === null || cache === void 0
|
|
8496
|
+
return (_a = cache === null || cache === void 0 ? void 0 : cache.decodedToken) === null || _a === void 0 ? void 0 : _a.user;
|
|
8472
8497
|
}
|
|
8473
8498
|
async getIdTokenClaims() {
|
|
8474
|
-
var
|
|
8499
|
+
var _a;
|
|
8475
8500
|
const cache = await this._getIdTokenFromCache();
|
|
8476
|
-
return cache === null || cache === void 0
|
|
8501
|
+
return (_a = cache === null || cache === void 0 ? void 0 : cache.decodedToken) === null || _a === void 0 ? void 0 : _a.claims;
|
|
8477
8502
|
}
|
|
8478
8503
|
async loginWithRedirect() {
|
|
8479
|
-
var _urlOptions$authoriza;
|
|
8480
8504
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8481
|
-
|
|
8482
|
-
const
|
|
8505
|
+
var _a;
|
|
8506
|
+
const _b = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl, fragment: fragment, appState: appState} = _b, urlOptions = __rest(_b, [ "openUrl", "fragment", "appState" ]);
|
|
8507
|
+
const organization = ((_a = urlOptions.authorizationParams) === null || _a === void 0 ? void 0 : _a.organization) || this.options.authorizationParams.organization;
|
|
8483
8508
|
const authorizationParams = this._applySessionTransferToken(urlOptions.authorizationParams || {});
|
|
8484
|
-
const
|
|
8485
|
-
this.transactionManager.create(
|
|
8509
|
+
const _c = await this._prepareAuthorizeUrl(authorizationParams), {url: url} = _c, transaction = __rest(_c, [ "url" ]);
|
|
8510
|
+
this.transactionManager.create(Object.assign(Object.assign(Object.assign({}, transaction), {
|
|
8486
8511
|
appState: appState,
|
|
8487
|
-
response_type: ResponseType.Code
|
|
8488
|
-
}, organization && {
|
|
8512
|
+
response_type: exports.ResponseType.Code
|
|
8513
|
+
}), organization && {
|
|
8489
8514
|
organization: organization
|
|
8490
8515
|
}));
|
|
8491
8516
|
const urlWithFragment = fragment ? "".concat(url, "#").concat(fragment) : url;
|
|
@@ -8507,7 +8532,7 @@ class Auth0Client {
|
|
|
8507
8532
|
}
|
|
8508
8533
|
this.transactionManager.remove();
|
|
8509
8534
|
const authenticationResult = parseAuthenticationResult(queryStringFragments.join(""));
|
|
8510
|
-
if (transaction.response_type === ResponseType.ConnectCode) {
|
|
8535
|
+
if (transaction.response_type === exports.ResponseType.ConnectCode) {
|
|
8511
8536
|
return this._handleConnectAccountRedirectCallback(authenticationResult, transaction);
|
|
8512
8537
|
}
|
|
8513
8538
|
return this._handleLoginRedirectCallback(authenticationResult, transaction);
|
|
@@ -8523,7 +8548,7 @@ class Auth0Client {
|
|
|
8523
8548
|
const organization = transaction.organization;
|
|
8524
8549
|
const nonceIn = transaction.nonce;
|
|
8525
8550
|
const redirect_uri = transaction.redirect_uri;
|
|
8526
|
-
await this._requestToken(
|
|
8551
|
+
await this._requestToken(Object.assign({
|
|
8527
8552
|
audience: transaction.audience,
|
|
8528
8553
|
scope: transaction.scope,
|
|
8529
8554
|
code_verifier: transaction.code_verifier,
|
|
@@ -8537,7 +8562,7 @@ class Auth0Client {
|
|
|
8537
8562
|
});
|
|
8538
8563
|
return {
|
|
8539
8564
|
appState: transaction.appState,
|
|
8540
|
-
response_type: ResponseType.Code
|
|
8565
|
+
response_type: exports.ResponseType.Code
|
|
8541
8566
|
};
|
|
8542
8567
|
}
|
|
8543
8568
|
async _handleConnectAccountRedirectCallback(connectResult, transaction) {
|
|
@@ -8557,9 +8582,9 @@ class Auth0Client {
|
|
|
8557
8582
|
redirect_uri: transaction.redirect_uri,
|
|
8558
8583
|
code_verifier: transaction.code_verifier
|
|
8559
8584
|
});
|
|
8560
|
-
return
|
|
8585
|
+
return Object.assign(Object.assign({}, data), {
|
|
8561
8586
|
appState: transaction.appState,
|
|
8562
|
-
response_type: ResponseType.ConnectCode
|
|
8587
|
+
response_type: exports.ResponseType.ConnectCode
|
|
8563
8588
|
});
|
|
8564
8589
|
}
|
|
8565
8590
|
async checkSession(options) {
|
|
@@ -8579,20 +8604,20 @@ class Auth0Client {
|
|
|
8579
8604
|
} catch (_) {}
|
|
8580
8605
|
}
|
|
8581
8606
|
async getTokenSilently() {
|
|
8582
|
-
var _options$authorizatio2, _options$authorizatio3;
|
|
8583
8607
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8584
|
-
|
|
8608
|
+
var _a, _b;
|
|
8609
|
+
const localOptions = Object.assign(Object.assign({
|
|
8585
8610
|
cacheMode: "on"
|
|
8586
|
-
}, options), {
|
|
8587
|
-
authorizationParams:
|
|
8588
|
-
scope: scopesToRequest(this.scope, (
|
|
8611
|
+
}, options), {
|
|
8612
|
+
authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), options.authorizationParams), {
|
|
8613
|
+
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)
|
|
8589
8614
|
})
|
|
8590
8615
|
});
|
|
8591
8616
|
const result = await singlePromise(() => this._getTokenSilently(localOptions), "".concat(this.options.clientId, "::").concat(localOptions.authorizationParams.audience, "::").concat(localOptions.authorizationParams.scope));
|
|
8592
8617
|
return options.detailedResponse ? result : result === null || result === void 0 ? void 0 : result.access_token;
|
|
8593
8618
|
}
|
|
8594
8619
|
async _getTokenSilently(options) {
|
|
8595
|
-
const {cacheMode: cacheMode} = options, getTokenOptions =
|
|
8620
|
+
const {cacheMode: cacheMode} = options, getTokenOptions = __rest(options, [ "cacheMode" ]);
|
|
8596
8621
|
if (cacheMode !== "off") {
|
|
8597
8622
|
const entry = await this._getEntryFromCache({
|
|
8598
8623
|
scope: getTokenOptions.authorizationParams.scope,
|
|
@@ -8622,13 +8647,13 @@ class Auth0Client {
|
|
|
8622
8647
|
}
|
|
8623
8648
|
const authResult = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(getTokenOptions) : await this._getTokenFromIFrame(getTokenOptions);
|
|
8624
8649
|
const {id_token: id_token, token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = authResult;
|
|
8625
|
-
return
|
|
8650
|
+
return Object.assign(Object.assign({
|
|
8626
8651
|
id_token: id_token,
|
|
8627
8652
|
token_type: token_type,
|
|
8628
8653
|
access_token: access_token
|
|
8629
8654
|
}, oauthTokenScope ? {
|
|
8630
8655
|
scope: oauthTokenScope
|
|
8631
|
-
} : null), {
|
|
8656
|
+
} : null), {
|
|
8632
8657
|
expires_in: expires_in
|
|
8633
8658
|
});
|
|
8634
8659
|
});
|
|
@@ -8664,15 +8689,15 @@ class Auth0Client {
|
|
|
8664
8689
|
}
|
|
8665
8690
|
}
|
|
8666
8691
|
async getTokenWithPopup() {
|
|
8667
|
-
var _options$authorizatio4, _options$authorizatio5;
|
|
8668
8692
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8669
8693
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8694
|
+
var _a, _b;
|
|
8695
|
+
const localOptions = Object.assign(Object.assign({}, options), {
|
|
8696
|
+
authorizationParams: Object.assign(Object.assign(Object.assign({}, this.options.authorizationParams), options.authorizationParams), {
|
|
8697
|
+
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)
|
|
8673
8698
|
})
|
|
8674
8699
|
});
|
|
8675
|
-
config =
|
|
8700
|
+
config = Object.assign(Object.assign({}, DEFAULT_POPUP_CONFIG_OPTIONS), config);
|
|
8676
8701
|
await this.loginWithPopup(localOptions, config);
|
|
8677
8702
|
const cache = await this.cacheManager.get(new CacheKey({
|
|
8678
8703
|
scope: localOptions.authorizationParams.scope,
|
|
@@ -8691,17 +8716,36 @@ class Auth0Client {
|
|
|
8691
8716
|
} else {
|
|
8692
8717
|
delete options.clientId;
|
|
8693
8718
|
}
|
|
8694
|
-
const
|
|
8719
|
+
const _a = options.logoutParams || {}, {federated: federated} = _a, logoutOptions = __rest(_a, [ "federated" ]);
|
|
8695
8720
|
const federatedQuery = federated ? "&federated" : "";
|
|
8696
|
-
const url = this._url("/v2/logout?".concat(createQueryParams(
|
|
8721
|
+
const url = this._url("/v2/logout?".concat(createQueryParams(Object.assign({
|
|
8697
8722
|
clientId: options.clientId
|
|
8698
8723
|
}, logoutOptions))));
|
|
8699
8724
|
return url + federatedQuery;
|
|
8700
8725
|
}
|
|
8726
|
+
async revokeRefreshToken() {
|
|
8727
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8728
|
+
if (!this.options.useRefreshTokens) {
|
|
8729
|
+
return;
|
|
8730
|
+
}
|
|
8731
|
+
const audience = options.audience || this.options.authorizationParams.audience;
|
|
8732
|
+
const resolvedAudience = audience || DEFAULT_AUDIENCE;
|
|
8733
|
+
const refreshTokens = await this.cacheManager.getRefreshTokensByAudience(resolvedAudience, this.options.clientId);
|
|
8734
|
+
await revokeToken({
|
|
8735
|
+
baseUrl: this.domainUrl,
|
|
8736
|
+
timeout: this.httpTimeoutMs,
|
|
8737
|
+
auth0Client: this.options.auth0Client,
|
|
8738
|
+
useFormData: this.options.useFormData,
|
|
8739
|
+
client_id: this.options.clientId,
|
|
8740
|
+
refreshTokens: refreshTokens,
|
|
8741
|
+
audience: resolvedAudience,
|
|
8742
|
+
onRefreshTokenRevoked: refreshToken => this.cacheManager.stripRefreshToken(refreshToken)
|
|
8743
|
+
}, this.worker);
|
|
8744
|
+
}
|
|
8701
8745
|
async logout() {
|
|
8702
|
-
var _this$dpop2;
|
|
8703
8746
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8704
|
-
|
|
8747
|
+
var _a;
|
|
8748
|
+
const _b = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _b, logoutOptions = __rest(_b, [ "openUrl" ]);
|
|
8705
8749
|
if (options.clientId === null) {
|
|
8706
8750
|
await this.cacheManager.clear();
|
|
8707
8751
|
} else {
|
|
@@ -8714,7 +8758,7 @@ class Auth0Client {
|
|
|
8714
8758
|
cookieDomain: this.options.cookieDomain
|
|
8715
8759
|
});
|
|
8716
8760
|
this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
|
|
8717
|
-
await ((
|
|
8761
|
+
await ((_a = this.dpop) === null || _a === void 0 ? void 0 : _a.clear());
|
|
8718
8762
|
const url = this._buildLogoutUrl(logoutOptions);
|
|
8719
8763
|
if (openUrl) {
|
|
8720
8764
|
await openUrl(url);
|
|
@@ -8726,7 +8770,7 @@ class Auth0Client {
|
|
|
8726
8770
|
const iframeLockKey = buildIframeLockKey(this.options.clientId);
|
|
8727
8771
|
try {
|
|
8728
8772
|
return await this.lockManager.runWithLock(iframeLockKey, 5e3, async () => {
|
|
8729
|
-
const params =
|
|
8773
|
+
const params = Object.assign(Object.assign({}, options.authorizationParams), {
|
|
8730
8774
|
prompt: "none"
|
|
8731
8775
|
});
|
|
8732
8776
|
const orgHint = this.cookieStorage.get(this.orgHintCookieName);
|
|
@@ -8743,14 +8787,14 @@ class Auth0Client {
|
|
|
8743
8787
|
let eventOrigin;
|
|
8744
8788
|
try {
|
|
8745
8789
|
eventOrigin = new URL(this.domainUrl).origin;
|
|
8746
|
-
} catch (
|
|
8790
|
+
} catch (_a) {
|
|
8747
8791
|
eventOrigin = this.domainUrl;
|
|
8748
8792
|
}
|
|
8749
8793
|
const codeResult = await runIframe(url, eventOrigin, authorizeTimeout);
|
|
8750
8794
|
if (stateIn !== codeResult.state) {
|
|
8751
8795
|
throw new GenericError("state_mismatch", "Invalid state");
|
|
8752
8796
|
}
|
|
8753
|
-
const tokenResult = await this._requestToken(
|
|
8797
|
+
const tokenResult = await this._requestToken(Object.assign(Object.assign({}, options.authorizationParams), {
|
|
8754
8798
|
code_verifier: code_verifier,
|
|
8755
8799
|
code: codeResult.code,
|
|
8756
8800
|
grant_type: "authorization_code",
|
|
@@ -8760,7 +8804,7 @@ class Auth0Client {
|
|
|
8760
8804
|
nonceIn: nonceIn,
|
|
8761
8805
|
organization: params.organization
|
|
8762
8806
|
});
|
|
8763
|
-
return
|
|
8807
|
+
return Object.assign(Object.assign({}, tokenResult), {
|
|
8764
8808
|
scope: scope,
|
|
8765
8809
|
oauthTokenScope: tokenResult.scope,
|
|
8766
8810
|
audience: audience
|
|
@@ -8779,6 +8823,7 @@ class Auth0Client {
|
|
|
8779
8823
|
}
|
|
8780
8824
|
}
|
|
8781
8825
|
async _getTokenUsingRefreshToken(options) {
|
|
8826
|
+
var _a, _b;
|
|
8782
8827
|
const cache = await this.cacheManager.get(new CacheKey({
|
|
8783
8828
|
scope: options.authorizationParams.scope,
|
|
8784
8829
|
audience: options.authorizationParams.audience || DEFAULT_AUDIENCE,
|
|
@@ -8794,16 +8839,16 @@ class Auth0Client {
|
|
|
8794
8839
|
const timeout = typeof options.timeoutInSeconds === "number" ? options.timeoutInSeconds * 1e3 : null;
|
|
8795
8840
|
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);
|
|
8796
8841
|
try {
|
|
8797
|
-
const tokenResult = await this._requestToken(
|
|
8842
|
+
const tokenResult = await this._requestToken(Object.assign(Object.assign(Object.assign({}, options.authorizationParams), {
|
|
8798
8843
|
grant_type: "refresh_token",
|
|
8799
8844
|
refresh_token: cache && cache.refresh_token,
|
|
8800
8845
|
redirect_uri: redirect_uri
|
|
8801
|
-
}, timeout && {
|
|
8846
|
+
}), timeout && {
|
|
8802
8847
|
timeout: timeout
|
|
8803
8848
|
}), {
|
|
8804
8849
|
scopesToRequest: scopesToRequest
|
|
8805
8850
|
});
|
|
8806
|
-
if (tokenResult.refresh_token && cache
|
|
8851
|
+
if (tokenResult.refresh_token && (cache === null || cache === void 0 ? void 0 : cache.refresh_token)) {
|
|
8807
8852
|
await this.cacheManager.updateEntry(cache.refresh_token, tokenResult.refresh_token);
|
|
8808
8853
|
}
|
|
8809
8854
|
if (this.options.useMrrt) {
|
|
@@ -8820,7 +8865,7 @@ class Auth0Client {
|
|
|
8820
8865
|
}
|
|
8821
8866
|
}
|
|
8822
8867
|
}
|
|
8823
|
-
return
|
|
8868
|
+
return Object.assign(Object.assign({}, tokenResult), {
|
|
8824
8869
|
scope: options.authorizationParams.scope,
|
|
8825
8870
|
oauthTokenScope: tokenResult.scope,
|
|
8826
8871
|
audience: options.authorizationParams.audience || DEFAULT_AUDIENCE
|
|
@@ -8838,14 +8883,13 @@ class Auth0Client {
|
|
|
8838
8883
|
}
|
|
8839
8884
|
}
|
|
8840
8885
|
if (e instanceof MfaRequiredError) {
|
|
8841
|
-
|
|
8842
|
-
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);
|
|
8886
|
+
this.mfa.setMFAAuthDetails(e.mfa_token, (_a = options.authorizationParams) === null || _a === void 0 ? void 0 : _a.scope, (_b = options.authorizationParams) === null || _b === void 0 ? void 0 : _b.audience, e.mfa_requirements);
|
|
8843
8887
|
}
|
|
8844
8888
|
throw e;
|
|
8845
8889
|
}
|
|
8846
8890
|
}
|
|
8847
8891
|
async _saveEntryInCache(entry) {
|
|
8848
|
-
const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken =
|
|
8892
|
+
const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken = __rest(entry, [ "id_token", "decodedToken" ]);
|
|
8849
8893
|
this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, {
|
|
8850
8894
|
id_token: id_token,
|
|
8851
8895
|
decodedToken: decodedToken
|
|
@@ -8868,8 +8912,8 @@ class Auth0Client {
|
|
|
8868
8912
|
this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, cache);
|
|
8869
8913
|
return cache;
|
|
8870
8914
|
}
|
|
8871
|
-
async _getEntryFromCache(
|
|
8872
|
-
let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} =
|
|
8915
|
+
async _getEntryFromCache(_ref) {
|
|
8916
|
+
let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} = _ref;
|
|
8873
8917
|
const entry = await this.cacheManager.get(new CacheKey({
|
|
8874
8918
|
scope: scope,
|
|
8875
8919
|
audience: audience,
|
|
@@ -8878,20 +8922,21 @@ class Auth0Client {
|
|
|
8878
8922
|
if (entry && entry.access_token) {
|
|
8879
8923
|
const {token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = entry;
|
|
8880
8924
|
const cache = await this._getIdTokenFromCache();
|
|
8881
|
-
return cache &&
|
|
8925
|
+
return cache && Object.assign(Object.assign({
|
|
8882
8926
|
id_token: cache.id_token,
|
|
8883
8927
|
token_type: token_type ? token_type : "Bearer",
|
|
8884
8928
|
access_token: access_token
|
|
8885
8929
|
}, oauthTokenScope ? {
|
|
8886
8930
|
scope: oauthTokenScope
|
|
8887
|
-
} : null), {
|
|
8931
|
+
} : null), {
|
|
8888
8932
|
expires_in: expires_in
|
|
8889
8933
|
});
|
|
8890
8934
|
}
|
|
8891
8935
|
}
|
|
8892
8936
|
async _requestToken(options, additionalParameters) {
|
|
8937
|
+
var _a, _b;
|
|
8893
8938
|
const {nonceIn: nonceIn, organization: organization, scopesToRequest: scopesToRequest} = additionalParameters || {};
|
|
8894
|
-
const authResult = await oauthToken(
|
|
8939
|
+
const authResult = await oauthToken(Object.assign(Object.assign({
|
|
8895
8940
|
baseUrl: this.domainUrl,
|
|
8896
8941
|
client_id: this.options.clientId,
|
|
8897
8942
|
auth0Client: this.options.auth0Client,
|
|
@@ -8899,25 +8944,24 @@ class Auth0Client {
|
|
|
8899
8944
|
timeout: this.httpTimeoutMs,
|
|
8900
8945
|
useMrrt: this.options.useMrrt,
|
|
8901
8946
|
dpop: this.dpop
|
|
8902
|
-
}, options), {
|
|
8947
|
+
}, options), {
|
|
8903
8948
|
scope: scopesToRequest || options.scope
|
|
8904
8949
|
}), this.worker);
|
|
8905
8950
|
const decodedToken = await this._verifyIdToken(authResult.id_token, nonceIn, organization);
|
|
8906
8951
|
if (options.grant_type === "authorization_code") {
|
|
8907
|
-
var _existingIdToken$deco;
|
|
8908
8952
|
const existingIdToken = await this._getIdTokenFromCache();
|
|
8909
|
-
if (existingIdToken
|
|
8953
|
+
if (((_b = (_a = existingIdToken === null || existingIdToken === void 0 ? void 0 : existingIdToken.decodedToken) === null || _a === void 0 ? void 0 : _a.claims) === null || _b === void 0 ? void 0 : _b.sub) && existingIdToken.decodedToken.claims.sub !== decodedToken.claims.sub) {
|
|
8910
8954
|
await this.cacheManager.clear(this.options.clientId);
|
|
8911
8955
|
this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
|
|
8912
8956
|
}
|
|
8913
8957
|
}
|
|
8914
|
-
await this._saveEntryInCache(
|
|
8958
|
+
await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({}, authResult), {
|
|
8915
8959
|
decodedToken: decodedToken,
|
|
8916
8960
|
scope: options.scope,
|
|
8917
8961
|
audience: options.audience || DEFAULT_AUDIENCE
|
|
8918
|
-
}, authResult.scope ? {
|
|
8962
|
+
}), authResult.scope ? {
|
|
8919
8963
|
oauthTokenScope: authResult.scope
|
|
8920
|
-
} : null), {
|
|
8964
|
+
} : null), {
|
|
8921
8965
|
client_id: this.options.clientId
|
|
8922
8966
|
}));
|
|
8923
8967
|
this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
|
|
@@ -8925,12 +8969,12 @@ class Auth0Client {
|
|
|
8925
8969
|
cookieDomain: this.options.cookieDomain
|
|
8926
8970
|
});
|
|
8927
8971
|
this._processOrgHint(organization || decodedToken.claims.org_id);
|
|
8928
|
-
return
|
|
8972
|
+
return Object.assign(Object.assign({}, authResult), {
|
|
8929
8973
|
decodedToken: decodedToken
|
|
8930
8974
|
});
|
|
8931
8975
|
}
|
|
8932
8976
|
async loginWithCustomTokenExchange(options) {
|
|
8933
|
-
return this._requestToken(
|
|
8977
|
+
return this._requestToken(Object.assign(Object.assign({}, options), {
|
|
8934
8978
|
grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
|
|
8935
8979
|
subject_token: options.subject_token,
|
|
8936
8980
|
subject_token_type: options.subject_token_type,
|
|
@@ -8964,10 +9008,10 @@ class Auth0Client {
|
|
|
8964
9008
|
return new Fetcher(config, {
|
|
8965
9009
|
isDpopEnabled: () => !!this.options.useDpop,
|
|
8966
9010
|
getAccessToken: authParams => {
|
|
8967
|
-
var
|
|
9011
|
+
var _a;
|
|
8968
9012
|
return this.getTokenSilently({
|
|
8969
9013
|
authorizationParams: {
|
|
8970
|
-
scope: authParams === null || authParams === void 0
|
|
9014
|
+
scope: (_a = authParams === null || authParams === void 0 ? void 0 : authParams.scope) === null || _a === void 0 ? void 0 : _a.join(" "),
|
|
8971
9015
|
audience: authParams === null || authParams === void 0 ? void 0 : authParams.audience
|
|
8972
9016
|
},
|
|
8973
9017
|
detailedResponse: true
|
|
@@ -9003,7 +9047,7 @@ class Auth0Client {
|
|
|
9003
9047
|
redirect_uri: redirectUri,
|
|
9004
9048
|
appState: appState,
|
|
9005
9049
|
connection: connection,
|
|
9006
|
-
response_type: ResponseType.ConnectCode
|
|
9050
|
+
response_type: exports.ResponseType.ConnectCode
|
|
9007
9051
|
});
|
|
9008
9052
|
const url = new URL(connect_uri);
|
|
9009
9053
|
url.searchParams.set("ticket", connect_params.ticket);
|
|
@@ -9014,8 +9058,8 @@ class Auth0Client {
|
|
|
9014
9058
|
}
|
|
9015
9059
|
}
|
|
9016
9060
|
async _requestTokenForMfa(options, additionalParameters) {
|
|
9017
|
-
const {mfaToken: mfaToken} = options, restOptions =
|
|
9018
|
-
return this._requestToken(
|
|
9061
|
+
const {mfaToken: mfaToken} = options, restOptions = __rest(options, [ "mfaToken" ]);
|
|
9062
|
+
return this._requestToken(Object.assign(Object.assign({}, restOptions), {
|
|
9019
9063
|
mfa_token: mfaToken
|
|
9020
9064
|
}), additionalParameters);
|
|
9021
9065
|
}
|
|
@@ -9067,8 +9111,6 @@ exports.PopupOpenError = PopupOpenError;
|
|
|
9067
9111
|
|
|
9068
9112
|
exports.PopupTimeoutError = PopupTimeoutError;
|
|
9069
9113
|
|
|
9070
|
-
exports.ResponseType = ResponseType;
|
|
9071
|
-
|
|
9072
9114
|
exports.TimeoutError = TimeoutError;
|
|
9073
9115
|
|
|
9074
9116
|
exports.UseDpopNonceError = UseDpopNonceError;
|