@auth0/auth0-spa-js 2.17.1 → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/auth0-spa-js.development.js +430 -314
- package/dist/auth0-spa-js.development.js.map +1 -1
- package/dist/auth0-spa-js.production.esm.js +1 -1
- package/dist/auth0-spa-js.production.esm.js.map +1 -1
- package/dist/auth0-spa-js.production.js +1 -1
- package/dist/auth0-spa-js.production.js.map +1 -1
- package/dist/auth0-spa-js.worker.development.js +71 -21
- package/dist/auth0-spa-js.worker.development.js.map +1 -1
- package/dist/auth0-spa-js.worker.production.js +1 -1
- package/dist/auth0-spa-js.worker.production.js.map +1 -1
- package/dist/lib/auth0-spa-js.cjs.js +453 -334
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/package.json +4 -3
- package/src/Auth0Client.ts +67 -9
- package/src/global.ts +44 -0
- package/src/index.ts +6 -3
- package/src/utils.ts +11 -5
- package/src/version.ts +1 -1
- package/dist/typings/Auth0Client.d.ts +0 -415
- package/dist/typings/Auth0Client.utils.d.ts +0 -90
- package/dist/typings/MyAccountApiClient.d.ts +0 -92
- package/dist/typings/TokenExchange.d.ts +0 -77
- package/dist/typings/api.d.ts +0 -2
- package/dist/typings/cache/cache-localstorage.d.ts +0 -7
- package/dist/typings/cache/cache-manager.d.ts +0 -56
- package/dist/typings/cache/cache-memory.d.ts +0 -4
- package/dist/typings/cache/index.d.ts +0 -4
- package/dist/typings/cache/key-manifest.d.ts +0 -12
- package/dist/typings/cache/shared.d.ts +0 -68
- package/dist/typings/constants.d.ts +0 -58
- package/dist/typings/dpop/dpop.d.ts +0 -17
- package/dist/typings/dpop/storage.d.ts +0 -27
- package/dist/typings/dpop/utils.d.ts +0 -15
- package/dist/typings/errors.d.ts +0 -96
- package/dist/typings/fetcher.d.ts +0 -54
- package/dist/typings/global.d.ts +0 -777
- package/dist/typings/http.d.ts +0 -5
- package/dist/typings/index.d.ts +0 -23
- package/dist/typings/jwt.d.ts +0 -21
- package/dist/typings/lock.d.ts +0 -32
- package/dist/typings/mfa/MfaApiClient.d.ts +0 -225
- package/dist/typings/mfa/MfaContextManager.d.ts +0 -79
- package/dist/typings/mfa/constants.d.ts +0 -23
- package/dist/typings/mfa/errors.d.ts +0 -117
- package/dist/typings/mfa/index.d.ts +0 -4
- package/dist/typings/mfa/types.d.ts +0 -181
- package/dist/typings/mfa/utils.d.ts +0 -23
- package/dist/typings/promise-utils.d.ts +0 -2
- package/dist/typings/scope.d.ts +0 -35
- package/dist/typings/storage.d.ts +0 -26
- package/dist/typings/transaction-manager.d.ts +0 -33
- package/dist/typings/utils.d.ts +0 -36
- package/dist/typings/version.d.ts +0 -2
- package/dist/typings/worker/token.worker.d.ts +0 -1
- package/dist/typings/worker/worker.types.d.ts +0 -15
- package/dist/typings/worker/worker.utils.d.ts +0 -7
|
@@ -4,21 +4,163 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function _OverloadYield(e, d) {
|
|
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 {};
|
|
8
84
|
var t = {};
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
|
|
85
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
86
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
87
|
+
t[n] = r[n];
|
|
12
88
|
}
|
|
13
89
|
return t;
|
|
14
90
|
}
|
|
15
91
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
92
|
+
function _toPrimitive(t, r) {
|
|
93
|
+
if ("object" != typeof t || !t) return t;
|
|
94
|
+
var e = t[Symbol.toPrimitive];
|
|
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);
|
|
19
161
|
};
|
|
20
162
|
|
|
21
|
-
var version = "2.
|
|
163
|
+
var version = "2.18.1";
|
|
22
164
|
|
|
23
165
|
const DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS = 60;
|
|
24
166
|
|
|
@@ -159,6 +301,8 @@ function valueOrEmptyString(value) {
|
|
|
159
301
|
return value && !exclude.includes(value) ? value : "";
|
|
160
302
|
}
|
|
161
303
|
|
|
304
|
+
const _excluded$5 = [ "clientId" ];
|
|
305
|
+
|
|
162
306
|
const parseAuthenticationResult = queryString => {
|
|
163
307
|
if (queryString.indexOf("#") > -1) {
|
|
164
308
|
queryString = queryString.substring(0, queryString.indexOf("#"));
|
|
@@ -217,7 +361,7 @@ const openPopup = url => {
|
|
|
217
361
|
return window.open(url, "auth0:authorize:popup", "left=".concat(left, ",top=").concat(top, ",width=").concat(width, ",height=").concat(height, ",resizable,scrollbars=yes,status=1"));
|
|
218
362
|
};
|
|
219
363
|
|
|
220
|
-
const runPopup = config => new Promise((resolve, reject) => {
|
|
364
|
+
const runPopup = (config, eventOrigin) => new Promise((resolve, reject) => {
|
|
221
365
|
let _popupEventListener;
|
|
222
366
|
const popupTimer = setInterval(() => {
|
|
223
367
|
if (config.popup && config.popup.closed) {
|
|
@@ -233,6 +377,7 @@ const runPopup = config => new Promise((resolve, reject) => {
|
|
|
233
377
|
window.removeEventListener("message", _popupEventListener, false);
|
|
234
378
|
}, (config.timeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS) * 1e3);
|
|
235
379
|
_popupEventListener = function popupEventListener(e) {
|
|
380
|
+
if (e.origin !== eventOrigin) return;
|
|
236
381
|
if (!e.data || e.data.type !== "authorization_response") {
|
|
237
382
|
return;
|
|
238
383
|
}
|
|
@@ -254,15 +399,22 @@ const getCrypto = () => window.crypto;
|
|
|
254
399
|
|
|
255
400
|
const createRandomString = () => {
|
|
256
401
|
const charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";
|
|
402
|
+
const validMax = 256 - 256 % charset.length;
|
|
257
403
|
let random = "";
|
|
258
|
-
|
|
259
|
-
|
|
404
|
+
while (random.length < 43) {
|
|
405
|
+
const bytes = getCrypto().getRandomValues(new Uint8Array(43 - random.length));
|
|
406
|
+
for (const byte of bytes) {
|
|
407
|
+
if (random.length < 43 && byte < validMax) {
|
|
408
|
+
random += charset[byte % charset.length];
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
260
412
|
return random;
|
|
261
413
|
};
|
|
262
414
|
|
|
263
415
|
const encode$2 = value => btoa(value);
|
|
264
416
|
|
|
265
|
-
const stripUndefined = params => Object.keys(params).filter(k => typeof params[k] !== "undefined").reduce((acc, key) =>
|
|
417
|
+
const stripUndefined = params => Object.keys(params).filter(k => typeof params[k] !== "undefined").reduce((acc, key) => _objectSpread2(_objectSpread2({}, acc), {}, {
|
|
266
418
|
[key]: params[key]
|
|
267
419
|
}), {});
|
|
268
420
|
|
|
@@ -291,9 +443,9 @@ const stripAuth0Client = function stripAuth0Client(auth0Client) {
|
|
|
291
443
|
}, {});
|
|
292
444
|
};
|
|
293
445
|
|
|
294
|
-
const createQueryParams =
|
|
295
|
-
|
|
296
|
-
return new URLSearchParams(stripUndefined(
|
|
446
|
+
const createQueryParams = _ref => {
|
|
447
|
+
let {clientId: client_id} = _ref, params = _objectWithoutProperties(_ref, _excluded$5);
|
|
448
|
+
return new URLSearchParams(stripUndefined(_objectSpread2({
|
|
297
449
|
client_id: client_id
|
|
298
450
|
}, params))).toString();
|
|
299
451
|
};
|
|
@@ -353,8 +505,8 @@ const parseNumber = value => {
|
|
|
353
505
|
return parseInt(value, 10) || undefined;
|
|
354
506
|
};
|
|
355
507
|
|
|
356
|
-
const fromEntries = iterable => [ ...iterable ].reduce((obj,
|
|
357
|
-
let [key, val] =
|
|
508
|
+
const fromEntries = iterable => [ ...iterable ].reduce((obj, _ref2) => {
|
|
509
|
+
let [key, val] = _ref2;
|
|
358
510
|
obj[key] = val;
|
|
359
511
|
return obj;
|
|
360
512
|
}, {});
|
|
@@ -915,7 +1067,9 @@ class WebLocksApiManager {
|
|
|
915
1067
|
|
|
916
1068
|
class LegacyLockManager {
|
|
917
1069
|
constructor() {
|
|
918
|
-
this
|
|
1070
|
+
_defineProperty(this, "lock", void 0);
|
|
1071
|
+
_defineProperty(this, "activeLocks", new Set);
|
|
1072
|
+
_defineProperty(this, "pagehideHandler", void 0);
|
|
919
1073
|
this.lock = new _default;
|
|
920
1074
|
this.pagehideHandler = () => {
|
|
921
1075
|
this.activeLocks.forEach(key => this.lock.releaseLock(key));
|
|
@@ -948,8 +1102,8 @@ class LegacyLockManager {
|
|
|
948
1102
|
}
|
|
949
1103
|
|
|
950
1104
|
function isWebLocksSupported() {
|
|
951
|
-
var
|
|
952
|
-
return typeof navigator !== "undefined" && typeof ((
|
|
1105
|
+
var _navigator$locks;
|
|
1106
|
+
return typeof navigator !== "undefined" && typeof ((_navigator$locks = navigator.locks) === null || _navigator$locks === void 0 ? void 0 : _navigator$locks.request) === "function";
|
|
953
1107
|
}
|
|
954
1108
|
|
|
955
1109
|
function createLockManager() {
|
|
@@ -1319,6 +1473,8 @@ const sendMessage = (message, to) => new Promise(function(resolve, reject) {
|
|
|
1319
1473
|
to.postMessage(message, [ messageChannel.port2 ]);
|
|
1320
1474
|
});
|
|
1321
1475
|
|
|
1476
|
+
const _excluded$4 = [ "error", "error_description" ];
|
|
1477
|
+
|
|
1322
1478
|
const createAbortController = () => new AbortController;
|
|
1323
1479
|
|
|
1324
1480
|
const dofetch = async (fetchUrl, fetchOptions) => {
|
|
@@ -1373,7 +1529,7 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
1373
1529
|
method: options.method || "GET",
|
|
1374
1530
|
nonce: await dpop.getNonce()
|
|
1375
1531
|
});
|
|
1376
|
-
options.headers =
|
|
1532
|
+
options.headers = _objectSpread2(_objectSpread2({}, options.headers), {}, {
|
|
1377
1533
|
dpop: dpopProof
|
|
1378
1534
|
});
|
|
1379
1535
|
}
|
|
@@ -1391,7 +1547,7 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
1391
1547
|
if (fetchError) {
|
|
1392
1548
|
throw fetchError;
|
|
1393
1549
|
}
|
|
1394
|
-
const
|
|
1550
|
+
const {json: {error: error, error_description: error_description}, headers: headers, ok: ok} = response, data = _objectWithoutProperties(response.json, _excluded$4);
|
|
1395
1551
|
let newDpopNonce;
|
|
1396
1552
|
if (dpop) {
|
|
1397
1553
|
newDpopNonce = headers[DPOP_NONCE_HEADER];
|
|
@@ -1418,11 +1574,13 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
1418
1574
|
return data;
|
|
1419
1575
|
}
|
|
1420
1576
|
|
|
1421
|
-
|
|
1422
|
-
|
|
1577
|
+
const _excluded$3 = [ "baseUrl", "timeout", "audience", "scope", "auth0Client", "useFormData", "useMrrt", "dpop" ];
|
|
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);
|
|
1423
1581
|
const isTokenExchange = options.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange";
|
|
1424
1582
|
const refreshWithMrrt = options.grant_type === "refresh_token" && useMrrt;
|
|
1425
|
-
const allParams =
|
|
1583
|
+
const allParams = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, options), isTokenExchange && audience && {
|
|
1426
1584
|
audience: audience
|
|
1427
1585
|
}), isTokenExchange && scope && {
|
|
1428
1586
|
scope: scope
|
|
@@ -1491,6 +1649,9 @@ class CacheKey {
|
|
|
1491
1649
|
let suffix = arguments.length > 2 ? arguments[2] : undefined;
|
|
1492
1650
|
this.prefix = prefix;
|
|
1493
1651
|
this.suffix = suffix;
|
|
1652
|
+
_defineProperty(this, "clientId", void 0);
|
|
1653
|
+
_defineProperty(this, "scope", void 0);
|
|
1654
|
+
_defineProperty(this, "audience", void 0);
|
|
1494
1655
|
this.clientId = data.clientId;
|
|
1495
1656
|
this.scope = data.scope;
|
|
1496
1657
|
this.audience = data.audience;
|
|
@@ -1540,7 +1701,7 @@ class LocalStorageCache {
|
|
|
1540
1701
|
|
|
1541
1702
|
class InMemoryCache {
|
|
1542
1703
|
constructor() {
|
|
1543
|
-
this
|
|
1704
|
+
_defineProperty(this, "enclosedCache", function() {
|
|
1544
1705
|
let cache = {};
|
|
1545
1706
|
return {
|
|
1546
1707
|
set(key, entry) {
|
|
@@ -1560,7 +1721,7 @@ class InMemoryCache {
|
|
|
1560
1721
|
return Object.keys(cache);
|
|
1561
1722
|
}
|
|
1562
1723
|
};
|
|
1563
|
-
}();
|
|
1724
|
+
}());
|
|
1564
1725
|
}
|
|
1565
1726
|
}
|
|
1566
1727
|
|
|
@@ -1570,16 +1731,17 @@ class CacheManager {
|
|
|
1570
1731
|
constructor(cache, keyManifest, nowProvider) {
|
|
1571
1732
|
this.cache = cache;
|
|
1572
1733
|
this.keyManifest = keyManifest;
|
|
1734
|
+
_defineProperty(this, "nowProvider", void 0);
|
|
1573
1735
|
this.nowProvider = nowProvider || DEFAULT_NOW_PROVIDER;
|
|
1574
1736
|
}
|
|
1575
1737
|
async setIdToken(clientId, idToken, decodedToken) {
|
|
1576
|
-
var
|
|
1738
|
+
var _this$keyManifest;
|
|
1577
1739
|
const cacheKey = this.getIdTokenCacheKey(clientId);
|
|
1578
1740
|
await this.cache.set(cacheKey, {
|
|
1579
1741
|
id_token: idToken,
|
|
1580
1742
|
decodedToken: decodedToken
|
|
1581
1743
|
});
|
|
1582
|
-
await ((
|
|
1744
|
+
await ((_this$keyManifest = this.keyManifest) === null || _this$keyManifest === void 0 ? void 0 : _this$keyManifest.add(cacheKey));
|
|
1583
1745
|
}
|
|
1584
1746
|
async getIdToken(cacheKey) {
|
|
1585
1747
|
const entry = await this.cache.get(this.getIdTokenCacheKey(cacheKey.clientId));
|
|
@@ -1608,7 +1770,6 @@ class CacheManager {
|
|
|
1608
1770
|
let expiryAdjustmentSeconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_EXPIRY_ADJUSTMENT_SECONDS;
|
|
1609
1771
|
let useMrrt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1610
1772
|
let cacheMode = arguments.length > 3 ? arguments[3] : undefined;
|
|
1611
|
-
var _a;
|
|
1612
1773
|
let wrappedEntry = await this.cache.get(cacheKey.toKey());
|
|
1613
1774
|
if (!wrappedEntry) {
|
|
1614
1775
|
const keys = await this.getCacheKeys();
|
|
@@ -1627,11 +1788,12 @@ class CacheManager {
|
|
|
1627
1788
|
const now = await this.nowProvider();
|
|
1628
1789
|
const nowSeconds = Math.floor(now / 1e3);
|
|
1629
1790
|
if (wrappedEntry.expiresAt - expiryAdjustmentSeconds < nowSeconds) {
|
|
1791
|
+
var _this$keyManifest2;
|
|
1630
1792
|
if (wrappedEntry.body.refresh_token) {
|
|
1631
1793
|
return this.modifiedCachedEntry(wrappedEntry, cacheKey);
|
|
1632
1794
|
}
|
|
1633
1795
|
await this.cache.remove(cacheKey.toKey());
|
|
1634
|
-
await ((
|
|
1796
|
+
await ((_this$keyManifest2 = this.keyManifest) === null || _this$keyManifest2 === void 0 ? void 0 : _this$keyManifest2.remove(cacheKey.toKey()));
|
|
1635
1797
|
return;
|
|
1636
1798
|
}
|
|
1637
1799
|
return wrappedEntry.body;
|
|
@@ -1650,7 +1812,7 @@ class CacheManager {
|
|
|
1650
1812
|
};
|
|
1651
1813
|
}
|
|
1652
1814
|
async set(entry) {
|
|
1653
|
-
var
|
|
1815
|
+
var _this$keyManifest3;
|
|
1654
1816
|
const cacheKey = new CacheKey({
|
|
1655
1817
|
clientId: entry.client_id,
|
|
1656
1818
|
scope: entry.scope,
|
|
@@ -1658,7 +1820,7 @@ class CacheManager {
|
|
|
1658
1820
|
});
|
|
1659
1821
|
const wrappedEntry = await this.wrapCacheEntry(entry);
|
|
1660
1822
|
await this.cache.set(cacheKey.toKey(), wrappedEntry);
|
|
1661
|
-
await ((
|
|
1823
|
+
await ((_this$keyManifest3 = this.keyManifest) === null || _this$keyManifest3 === void 0 ? void 0 : _this$keyManifest3.add(cacheKey.toKey()));
|
|
1662
1824
|
}
|
|
1663
1825
|
async remove(client_id, audience, scope) {
|
|
1664
1826
|
const cacheKey = new CacheKey({
|
|
@@ -1669,14 +1831,14 @@ class CacheManager {
|
|
|
1669
1831
|
await this.cache.remove(cacheKey.toKey());
|
|
1670
1832
|
}
|
|
1671
1833
|
async clear(clientId) {
|
|
1672
|
-
var
|
|
1834
|
+
var _this$keyManifest4;
|
|
1673
1835
|
const keys = await this.getCacheKeys();
|
|
1674
1836
|
if (!keys) return;
|
|
1675
1837
|
await keys.filter(key => clientId ? key.includes(clientId) : true).reduce(async (memo, key) => {
|
|
1676
1838
|
await memo;
|
|
1677
1839
|
await this.cache.remove(key);
|
|
1678
1840
|
}, Promise.resolve());
|
|
1679
|
-
await ((
|
|
1841
|
+
await ((_this$keyManifest4 = this.keyManifest) === null || _this$keyManifest4 === void 0 ? void 0 : _this$keyManifest4.clear());
|
|
1680
1842
|
}
|
|
1681
1843
|
async wrapCacheEntry(entry) {
|
|
1682
1844
|
const now = await this.nowProvider();
|
|
@@ -1687,9 +1849,9 @@ class CacheManager {
|
|
|
1687
1849
|
};
|
|
1688
1850
|
}
|
|
1689
1851
|
async getCacheKeys() {
|
|
1690
|
-
var _a;
|
|
1691
1852
|
if (this.keyManifest) {
|
|
1692
|
-
|
|
1853
|
+
var _await$this$keyManife;
|
|
1854
|
+
return (_await$this$keyManife = await this.keyManifest.get()) === null || _await$this$keyManife === void 0 ? void 0 : _await$this$keyManife.keys;
|
|
1693
1855
|
} else if (this.cache.allKeys) {
|
|
1694
1856
|
return this.cache.allKeys();
|
|
1695
1857
|
}
|
|
@@ -1701,21 +1863,21 @@ class CacheManager {
|
|
|
1701
1863
|
}
|
|
1702
1864
|
matchExistingCacheKey(keyToMatch, allKeys) {
|
|
1703
1865
|
return allKeys.filter(key => {
|
|
1704
|
-
var
|
|
1866
|
+
var _keyToMatch$scope;
|
|
1705
1867
|
const cacheKey = CacheKey.fromKey(key);
|
|
1706
1868
|
const scopeSet = new Set(cacheKey.scope && cacheKey.scope.split(" "));
|
|
1707
|
-
const scopesToMatch = ((
|
|
1869
|
+
const scopesToMatch = ((_keyToMatch$scope = keyToMatch.scope) === null || _keyToMatch$scope === void 0 ? void 0 : _keyToMatch$scope.split(" ")) || [];
|
|
1708
1870
|
const hasAllScopes = cacheKey.scope && scopesToMatch.reduce((acc, current) => acc && scopeSet.has(current), true);
|
|
1709
1871
|
return cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId && cacheKey.audience === keyToMatch.audience && hasAllScopes;
|
|
1710
1872
|
})[0];
|
|
1711
1873
|
}
|
|
1712
1874
|
async getEntryWithRefreshToken(keyToMatch, allKeys) {
|
|
1713
|
-
var _a;
|
|
1714
1875
|
for (const key of allKeys) {
|
|
1715
1876
|
const cacheKey = CacheKey.fromKey(key);
|
|
1716
1877
|
if (cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId) {
|
|
1878
|
+
var _cachedEntry$body;
|
|
1717
1879
|
const cachedEntry = await this.cache.get(key);
|
|
1718
|
-
if (
|
|
1880
|
+
if (cachedEntry !== null && cachedEntry !== void 0 && (_cachedEntry$body = cachedEntry.body) !== null && _cachedEntry$body !== void 0 && _cachedEntry$body.refresh_token) {
|
|
1719
1881
|
return this.modifiedCachedEntry(cachedEntry, keyToMatch);
|
|
1720
1882
|
}
|
|
1721
1883
|
}
|
|
@@ -1723,12 +1885,12 @@ class CacheManager {
|
|
|
1723
1885
|
return undefined;
|
|
1724
1886
|
}
|
|
1725
1887
|
async updateEntry(oldRefreshToken, newRefreshToken) {
|
|
1726
|
-
var _a;
|
|
1727
1888
|
const allKeys = await this.getCacheKeys();
|
|
1728
1889
|
if (!allKeys) return;
|
|
1729
1890
|
for (const key of allKeys) {
|
|
1891
|
+
var _entry$body;
|
|
1730
1892
|
const entry = await this.cache.get(key);
|
|
1731
|
-
if ((
|
|
1893
|
+
if ((entry === null || entry === void 0 || (_entry$body = entry.body) === null || _entry$body === void 0 ? void 0 : _entry$body.refresh_token) === oldRefreshToken) {
|
|
1732
1894
|
entry.body.refresh_token = newRefreshToken;
|
|
1733
1895
|
await this.cache.set(key, entry);
|
|
1734
1896
|
}
|
|
@@ -1743,6 +1905,7 @@ class TransactionManager {
|
|
|
1743
1905
|
this.storage = storage;
|
|
1744
1906
|
this.clientId = clientId;
|
|
1745
1907
|
this.cookieDomain = cookieDomain;
|
|
1908
|
+
_defineProperty(this, "storageKey", void 0);
|
|
1746
1909
|
this.storageKey = "".concat(TRANSACTION_STORAGE_KEY_PREFIX, ".").concat(this.clientId);
|
|
1747
1910
|
}
|
|
1748
1911
|
create(transaction) {
|
|
@@ -1983,17 +2146,17 @@ const CookieStorage = {
|
|
|
1983
2146
|
sameSite: "none"
|
|
1984
2147
|
};
|
|
1985
2148
|
}
|
|
1986
|
-
if (options
|
|
2149
|
+
if (options !== null && options !== void 0 && options.daysUntilExpire) {
|
|
1987
2150
|
cookieAttributes.expires = options.daysUntilExpire;
|
|
1988
2151
|
}
|
|
1989
|
-
if (options
|
|
2152
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
1990
2153
|
cookieAttributes.domain = options.cookieDomain;
|
|
1991
2154
|
}
|
|
1992
2155
|
set_1(key, JSON.stringify(value), cookieAttributes);
|
|
1993
2156
|
},
|
|
1994
2157
|
remove(key, options) {
|
|
1995
2158
|
let cookieAttributes = {};
|
|
1996
|
-
if (options
|
|
2159
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
1997
2160
|
cookieAttributes.domain = options.cookieDomain;
|
|
1998
2161
|
}
|
|
1999
2162
|
remove_1(key, cookieAttributes);
|
|
@@ -2017,10 +2180,10 @@ const CookieStorageWithLegacySameSite = {
|
|
|
2017
2180
|
secure: true
|
|
2018
2181
|
};
|
|
2019
2182
|
}
|
|
2020
|
-
if (options
|
|
2183
|
+
if (options !== null && options !== void 0 && options.daysUntilExpire) {
|
|
2021
2184
|
cookieAttributes.expires = options.daysUntilExpire;
|
|
2022
2185
|
}
|
|
2023
|
-
if (options
|
|
2186
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
2024
2187
|
cookieAttributes.domain = options.cookieDomain;
|
|
2025
2188
|
}
|
|
2026
2189
|
set_1("".concat(LEGACY_PREFIX).concat(key), JSON.stringify(value), cookieAttributes);
|
|
@@ -2028,7 +2191,7 @@ const CookieStorageWithLegacySameSite = {
|
|
|
2028
2191
|
},
|
|
2029
2192
|
remove(key, options) {
|
|
2030
2193
|
let cookieAttributes = {};
|
|
2031
|
-
if (options
|
|
2194
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
2032
2195
|
cookieAttributes.domain = options.cookieDomain;
|
|
2033
2196
|
}
|
|
2034
2197
|
remove_1(key, cookieAttributes);
|
|
@@ -2056,14 +2219,36 @@ const SessionStorage = {
|
|
|
2056
2219
|
}
|
|
2057
2220
|
};
|
|
2058
2221
|
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
(function(ResponseType) {
|
|
2222
|
+
let ResponseType = function(ResponseType) {
|
|
2062
2223
|
ResponseType["Code"] = "code";
|
|
2063
2224
|
ResponseType["ConnectCode"] = "connect_code";
|
|
2064
|
-
|
|
2225
|
+
return ResponseType;
|
|
2226
|
+
}({});
|
|
2065
2227
|
|
|
2066
|
-
class User {
|
|
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
|
+
}
|
|
2067
2252
|
|
|
2068
2253
|
function decodeBase64$1(base64, enableUnicode) {
|
|
2069
2254
|
var binaryString = atob(base64);
|
|
@@ -2097,7 +2282,7 @@ function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
|
2097
2282
|
};
|
|
2098
2283
|
}
|
|
2099
2284
|
|
|
2100
|
-
var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBjbGFzcyBHZW5lcmljRXJyb3IgZXh0ZW5kcyBFcnJvciB7CiAgICAgICAgY29uc3RydWN0b3IoZXJyb3IsIGVycm9yX2Rlc2NyaXB0aW9uKSB7CiAgICAgICAgICAgIHN1cGVyKGVycm9yX2Rlc2NyaXB0aW9uKTsKICAgICAgICAgICAgdGhpcy5lcnJvciA9IGVycm9yOwogICAgICAgICAgICB0aGlzLmVycm9yX2Rlc2NyaXB0aW9uID0gZXJyb3JfZGVzY3JpcHR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ZU1ycnQ6IHVzZU1ycnR9LCBwb3J0czogW3BvcnRdfSA9IF9yZWYyOwogICAgICAgIGxldCBoZWFkZXJzID0ge307CiAgICAgICAgbGV0IGpzb247CiAgICAgICAgbGV0IHJlZnJlc2hUb2tlbjsKICAgICAgICBjb25zdCB7YXVkaWVuY2U6IGF1ZGllbmNlLCBzY29wZTogc2NvcGV9ID0gYXV0aCB8fCB7fTsKICAgICAgICB0cnkgewogICAgICAgICAgICBjb25zdCBib2R5ID0gdXNlRm9ybURhdGEgPyBmb3JtRGF0YVRvT2JqZWN0KGZldGNoT3B0aW9ucy5ib2R5KSA6IEpTT04ucGFyc2UoZmV0Y2hPcHRpb25zLmJvZHkpOwogICAgICAgICAgICBpZiAoIWJvZHkucmVmcmVzaF90b2tlbiAmJiBib2R5LmdyYW50X3R5cGUgPT09ICJyZWZyZXNoX3Rva2VuIikgewogICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gZ2V0UmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBpZiAoIXJlZnJlc2hUb2tlbiAmJiB1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgY29uc3QgbGF0ZXN0UmVmcmVzaFRva2VuID0gcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXTsKICAgICAgICAgICAgICAgICAgICBjb25zdCBpc0Rvd25zY29waW5nID0gY2hlY2tEb3duc2NvcGluZyhzY29wZSwgYXVkaWVuY2UpOwogICAgICAgICAgICAgICAgICAgIGlmIChsYXRlc3RSZWZyZXNoVG9rZW4gJiYgIWlzRG93bnNjb3BpbmcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gbGF0ZXN0UmVmcmVzaFRva2VuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghcmVmcmVzaFRva2VuKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE1pc3NpbmdSZWZyZXNoVG9rZW5FcnJvcihhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLmJvZHkgPSB1c2VGb3JtRGF0YSA/IGNyZWF0ZVF1ZXJ5UGFyYW1zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgYm9keSksIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKSA6IEpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgYm9keSksIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZXQgYWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICBpZiAodHlwZW9mIEFib3J0Q29udHJvbGxlciA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICAgICAgYWJvcnRDb250cm9sbGVyID0gbmV3IEFib3J0Q29udHJvbGxlcjsKICAgICAgICAgICAgICAgIGZldGNoT3B0aW9ucy5zaWduYWwgPSBhYm9ydENvbnRyb2xsZXIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCByZXNwb25zZTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgUHJvbWlzZS5yYWNlKFsgd2FpdCh0aW1lb3V0KSwgZmV0Y2goZmV0Y2hVcmwsIE9iamVjdC5hc3NpZ24oe30sIGZldGNoT3B0aW9ucykpIF0pOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCciCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXJzID0gZnJvbUVudHJpZXMocmVzcG9uc2UuaGVhZGVycyk7CiAgICAgICAgICAgIGpzb24gPSBhd2FpdCByZXNwb25zZS5qc29uKCk7CiAgICAgICAgICAgIGlmIChqc29uLnJlZnJlc2hfdG9rZW4pIHsKICAgICAgICAgICAgICAgIGlmICh1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXSA9IGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgICAgICAgICB1cGRhdGVSZWZyZXNoVG9rZW5zKHJlZnJlc2hUb2tlbiwganNvbi5yZWZyZXNoX3Rva2VuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUb2tlbihqc29uLnJlZnJlc2hfdG9rZW4sIGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBkZWxldGUganNvbi5yZWZyZXNoX3Rva2VuOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZGVsZXRlUmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogcmVzcG9uc2Uub2ssCiAgICAgICAgICAgICAgICBqc29uOiBqc29uLAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIG9rOiBmYWxzZSwKICAgICAgICAgICAgICAgIGpzb246IHsKICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IuZXJyb3IsCiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzCiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgIH07CiAgICB7CiAgICAgICAgYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIG1lc3NhZ2VIYW5kbGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
|
|
2285
|
+
var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBmdW5jdGlvbiBfZGVmaW5lUHJvcGVydHkoZSwgciwgdCkgewogICAgICAgIHJldHVybiAociA9IF90b1Byb3BlcnR5S2V5KHIpKSBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIsIHsKICAgICAgICAgICAgdmFsdWU6IHQsCiAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICB9KSA6IGVbcl0gPSB0LCBlOwogICAgfQogICAgZnVuY3Rpb24gb3duS2V5cyhlLCByKSB7CiAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICB2YXIgbyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgIHIgJiYgKG8gPSBvLmZpbHRlcihmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCByKS5lbnVtZXJhYmxlOwogICAgICAgICAgICB9KSksIHQucHVzaC5hcHBseSh0LCBvKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHQ7CiAgICB9CiAgICBmdW5jdGlvbiBfb2JqZWN0U3ByZWFkMihlKSB7CiAgICAgICAgZm9yICh2YXIgciA9IDE7IHIgPCBhcmd1bWVudHMubGVuZ3RoOyByKyspIHsKICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9IGFyZ3VtZW50c1tyXSA/IGFyZ3VtZW50c1tyXSA6IHt9OwogICAgICAgICAgICByICUgMiA/IG93bktleXMoT2JqZWN0KHQpLCAhMCkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBfZGVmaW5lUHJvcGVydHkoZSwgciwgdFtyXSk7CiAgICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhlLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyh0KSkgOiBvd25LZXlzKE9iamVjdCh0KSkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgciwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LCByKSk7CiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllcyhlLCB0KSB7CiAgICAgICAgaWYgKG51bGwgPT0gZSkgcmV0dXJuIHt9OwogICAgICAgIHZhciBvLCByLCBpID0gX29iamVjdFdpdGhvdXRQcm9wZXJ0aWVzTG9vc2UoZSwgdCk7CiAgICAgICAgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpIHsKICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpOwogICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgbi5sZW5ndGg7IHIrKykgbyA9IG5bcl0sIC0xID09PSB0LmluZGV4T2YobykgJiYge30ucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLCBvKSAmJiAoaVtvXSA9IGVbb10pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gaTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllc0xvb3NlKHIsIGUpIHsKICAgICAgICBpZiAobnVsbCA9PSByKSByZXR1cm4ge307CiAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICBmb3IgKHZhciBuIGluIHIpIGlmICh7fS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHIsIG4pKSB7CiAgICAgICAgICAgIGlmICgtMSAhPT0gZS5pbmRleE9mKG4pKSBjb250aW51ZTsKICAgICAgICAgICAgdFtuXSA9IHJbbl07CiAgICAgICAgfQogICAgICAgIHJldHVybiB0OwogICAgfQogICAgZnVuY3Rpb24gX3RvUHJpbWl0aXZlKHQsIHIpIHsKICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIHQgfHwgIXQpIHJldHVybiB0OwogICAgICAgIHZhciBlID0gdFtTeW1ib2wudG9QcmltaXRpdmVdOwogICAgICAgIGlmICh2b2lkIDAgIT09IGUpIHsKICAgICAgICAgICAgdmFyIGkgPSBlLmNhbGwodCwgciB8fCAiZGVmYXVsdCIpOwogICAgICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIGkpIHJldHVybiBpOwogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gKCJzdHJpbmciID09PSByID8gU3RyaW5nIDogTnVtYmVyKSh0KTsKICAgIH0KICAgIGZ1bmN0aW9uIF90b1Byb3BlcnR5S2V5KHQpIHsKICAgICAgICB2YXIgaSA9IF90b1ByaW1pdGl2ZSh0LCAic3RyaW5nIik7CiAgICAgICAgcmV0dXJuICJzeW1ib2wiID09IHR5cGVvZiBpID8gaSA6IGkgKyAiIjsKICAgIH0KICAgIGNsYXNzIEdlbmVyaWNFcnJvciBleHRlbmRzIEVycm9yIHsKICAgICAgICBjb25zdHJ1Y3RvcihlcnJvciwgZXJyb3JfZGVzY3JpcHRpb24pIHsKICAgICAgICAgICAgc3VwZXIoZXJyb3JfZGVzY3JpcHRpb24pOwogICAgICAgICAgICB0aGlzLmVycm9yID0gZXJyb3I7CiAgICAgICAgICAgIHRoaXMuZXJyb3JfZGVzY3JpcHRpb24gPSBlcnJvcl9kZXNjcmlwdGlvbjsKICAgICAgICAgICAgT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsIEdlbmVyaWNFcnJvci5wcm90b3R5cGUpOwogICAgICAgIH0KICAgICAgICBzdGF0aWMgZnJvbVBheWxvYWQoX3JlZikgewogICAgICAgICAgICBsZXQge2Vycm9yOiBlcnJvciwgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yX2Rlc2NyaXB0aW9ufSA9IF9yZWY7CiAgICAgICAgICAgIHJldHVybiBuZXcgR2VuZXJpY0Vycm9yKGVycm9yLCBlcnJvcl9kZXNjcmlwdGlvbik7CiAgICAgICAgfQogICAgfQogICAgY2xhc3MgTWlzc2luZ1JlZnJlc2hUb2tlbkVycm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PSB7fTsKICAgICAgICBsZXQganNvbjsKICAgICAgICBsZXQgcmVmcmVzaFRva2VuOwogICAgICAgIGNvbnN0IHthdWRpZW5jZTogYXVkaWVuY2UsIHNjb3BlOiBzY29wZX0gPSBhdXRoIHx8IHt9OwogICAgICAgIHRyeSB7CiAgICAgICAgICAgIGNvbnN0IGJvZHkgPSB1c2VGb3JtRGF0YSA/IGZvcm1EYXRhVG9PYmplY3QoZmV0Y2hPcHRpb25zLmJvZHkpIDogSlNPTi5wYXJzZShmZXRjaE9wdGlvbnMuYm9keSk7CiAgICAgICAgICAgIGlmICghYm9keS5yZWZyZXNoX3Rva2VuICYmIGJvZHkuZ3JhbnRfdHlwZSA9PT0gInJlZnJlc2hfdG9rZW4iKSB7CiAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4gPSBnZXRSZWZyZXNoVG9rZW4oYXVkaWVuY2UsIHNjb3BlKTsKICAgICAgICAgICAgICAgIGlmICghcmVmcmVzaFRva2VuICYmIHVzZU1ycnQpIHsKICAgICAgICAgICAgICAgICAgICBjb25zdCBsYXRlc3RSZWZyZXNoVG9rZW4gPSByZWZyZXNoVG9rZW5zWyJsYXRlc3RfcmVmcmVzaF90b2tlbiJdOwogICAgICAgICAgICAgICAgICAgIGNvbnN0IGlzRG93bnNjb3BpbmcgPSBjaGVja0Rvd25zY29waW5nKHNjb3BlLCBhdWRpZW5jZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGxhdGVzdFJlZnJlc2hUb2tlbiAmJiAhaXNEb3duc2NvcGluZykgewogICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4gPSBsYXRlc3RSZWZyZXNoVG9rZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCFyZWZyZXNoVG9rZW4pIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTWlzc2luZ1JlZnJlc2hUb2tlbkVycm9yKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmZXRjaE9wdGlvbnMuYm9keSA9IHVzZUZvcm1EYXRhID8gY3JlYXRlUXVlcnlQYXJhbXMoX29iamVjdFNwcmVhZDIoX29iamVjdFNwcmVhZDIoe30sIGJvZHkpLCB7fSwgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHJlZnJlc2hUb2tlbgogICAgICAgICAgICAgICAgfSkpIDogSlNPTi5zdHJpbmdpZnkoX29iamVjdFNwcmVhZDIoX29iamVjdFNwcmVhZDIoe30sIGJvZHkpLCB7fSwgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHJlZnJlc2hUb2tlbgogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCBhYm9ydENvbnRyb2xsZXI7CiAgICAgICAgICAgIGlmICh0eXBlb2YgQWJvcnRDb250cm9sbGVyID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICBhYm9ydENvbnRyb2xsZXIgPSBuZXcgQWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLnNpZ25hbCA9IGFib3J0Q29udHJvbGxlci5zaWduYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbGV0IHJlc3BvbnNlOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBQcm9taXNlLnJhY2UoWyB3YWl0KHRpbWVvdXQpLCBmZXRjaChmZXRjaFVybCwgX29iamVjdFNwcmVhZDIoe30sIGZldGNoT3B0aW9ucykpIF0pOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCciCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXJzID0gZnJvbUVudHJpZXMocmVzcG9uc2UuaGVhZGVycyk7CiAgICAgICAgICAgIGpzb24gPSBhd2FpdCByZXNwb25zZS5qc29uKCk7CiAgICAgICAgICAgIGlmIChqc29uLnJlZnJlc2hfdG9rZW4pIHsKICAgICAgICAgICAgICAgIGlmICh1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXSA9IGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgICAgICAgICB1cGRhdGVSZWZyZXNoVG9rZW5zKHJlZnJlc2hUb2tlbiwganNvbi5yZWZyZXNoX3Rva2VuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUb2tlbihqc29uLnJlZnJlc2hfdG9rZW4sIGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBkZWxldGUganNvbi5yZWZyZXNoX3Rva2VuOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZGVsZXRlUmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogcmVzcG9uc2Uub2ssCiAgICAgICAgICAgICAgICBqc29uOiBqc29uLAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIG9rOiBmYWxzZSwKICAgICAgICAgICAgICAgIGpzb246IHsKICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IuZXJyb3IsCiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzCiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgIH07CiAgICB7CiAgICAgICAgYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIG1lc3NhZ2VIYW5kbGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
|
|
2101
2286
|
|
|
2102
2287
|
const singlePromiseMap = {};
|
|
2103
2288
|
|
|
@@ -2117,11 +2302,12 @@ class CacheKeyManifest {
|
|
|
2117
2302
|
constructor(cache, clientId) {
|
|
2118
2303
|
this.cache = cache;
|
|
2119
2304
|
this.clientId = clientId;
|
|
2305
|
+
_defineProperty(this, "manifestKey", void 0);
|
|
2120
2306
|
this.manifestKey = this.createManifestKeyFrom(this.clientId);
|
|
2121
2307
|
}
|
|
2122
2308
|
async add(key) {
|
|
2123
|
-
var
|
|
2124
|
-
const keys = new Set(((
|
|
2309
|
+
var _await$this$cache$get;
|
|
2310
|
+
const keys = new Set(((_await$this$cache$get = await this.cache.get(this.manifestKey)) === null || _await$this$cache$get === void 0 ? void 0 : _await$this$cache$get.keys) || []);
|
|
2125
2311
|
keys.add(key);
|
|
2126
2312
|
await this.cache.set(this.manifestKey, {
|
|
2127
2313
|
keys: [ ...keys ]
|
|
@@ -2151,6 +2337,8 @@ class CacheKeyManifest {
|
|
|
2151
2337
|
}
|
|
2152
2338
|
}
|
|
2153
2339
|
|
|
2340
|
+
const _excluded$2 = [ "openUrl", "onRedirect" ];
|
|
2341
|
+
|
|
2154
2342
|
const GET_TOKEN_SILENTLY_LOCK_KEY = "auth0.lock.getTokenSilently";
|
|
2155
2343
|
|
|
2156
2344
|
const GET_TOKEN_FROM_IFRAME_LOCK_KEY = "auth0.lock.getTokenFromIFrame";
|
|
@@ -2172,9 +2360,9 @@ const cacheLocationBuilders = {
|
|
|
2172
2360
|
|
|
2173
2361
|
const cacheFactory = location => cacheLocationBuilders[location];
|
|
2174
2362
|
|
|
2175
|
-
const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, nonce, code_challenge, redirect_uri, response_mode, thumbprint) =>
|
|
2363
|
+
const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, nonce, code_challenge, redirect_uri, response_mode, thumbprint) => _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2176
2364
|
client_id: clientOptions.clientId
|
|
2177
|
-
}, clientOptions.authorizationParams), authorizationParams), {
|
|
2365
|
+
}, clientOptions.authorizationParams), authorizationParams), {}, {
|
|
2178
2366
|
scope: scopesToRequest(scope, authorizationParams.scope, authorizationParams.audience),
|
|
2179
2367
|
response_type: "code",
|
|
2180
2368
|
response_mode: response_mode || "query",
|
|
@@ -2187,8 +2375,8 @@ const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, no
|
|
|
2187
2375
|
});
|
|
2188
2376
|
|
|
2189
2377
|
const patchOpenUrlWithOnRedirect = options => {
|
|
2190
|
-
const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions =
|
|
2191
|
-
const result =
|
|
2378
|
+
const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions = _objectWithoutProperties(options, _excluded$2);
|
|
2379
|
+
const result = _objectSpread2(_objectSpread2({}, originalOptions), {}, {
|
|
2192
2380
|
openUrl: openUrl === false || openUrl ? openUrl : onRedirect
|
|
2193
2381
|
});
|
|
2194
2382
|
return result;
|
|
@@ -2208,13 +2396,13 @@ const getMissingScopes = (requestedScope, respondedScope) => {
|
|
|
2208
2396
|
};
|
|
2209
2397
|
|
|
2210
2398
|
const getScopeToRequest = (useMrrt, authorizationParams, cachedAudience, cachedScope) => {
|
|
2211
|
-
var _a;
|
|
2212
2399
|
if (useMrrt && cachedAudience && cachedScope) {
|
|
2400
|
+
var _authorizationParams$;
|
|
2213
2401
|
if (authorizationParams.audience !== cachedAudience) {
|
|
2214
2402
|
return authorizationParams.scope;
|
|
2215
2403
|
}
|
|
2216
2404
|
const cachedScopes = cachedScope.split(" ");
|
|
2217
|
-
const newScopes = ((
|
|
2405
|
+
const newScopes = ((_authorizationParams$ = authorizationParams.scope) === null || _authorizationParams$ === void 0 ? void 0 : _authorizationParams$.split(" ")) || [];
|
|
2218
2406
|
const newScopesAreIncluded = newScopes.every(scope => cachedScopes.includes(scope));
|
|
2219
2407
|
return cachedScopes.length >= newScopes.length && newScopesAreIncluded ? cachedScope : authorizationParams.scope;
|
|
2220
2408
|
}
|
|
@@ -2241,6 +2429,8 @@ const AUTH0_NONCE_ID = "auth0";
|
|
|
2241
2429
|
|
|
2242
2430
|
class DpopStorage {
|
|
2243
2431
|
constructor(clientId) {
|
|
2432
|
+
_defineProperty(this, "clientId", void 0);
|
|
2433
|
+
_defineProperty(this, "dbHandle", void 0);
|
|
2244
2434
|
this.clientId = clientId;
|
|
2245
2435
|
}
|
|
2246
2436
|
getVersion() {
|
|
@@ -2294,7 +2484,7 @@ class DpopStorage {
|
|
|
2294
2484
|
}
|
|
2295
2485
|
async deleteBy(table, predicate) {
|
|
2296
2486
|
const allKeys = await this.executeDbRequest(table, "readonly", table => table.getAllKeys());
|
|
2297
|
-
allKeys === null || allKeys === void 0
|
|
2487
|
+
allKeys === null || allKeys === void 0 || allKeys.filter(predicate).map(k => this.executeDbRequest(table, "readwrite", table => table.delete(k)));
|
|
2298
2488
|
}
|
|
2299
2489
|
deleteByClientId(table, clientId) {
|
|
2300
2490
|
return this.deleteBy(table, k => typeof k === "string" && k.startsWith("".concat(clientId, "::")));
|
|
@@ -2309,6 +2499,7 @@ class DpopStorage {
|
|
|
2309
2499
|
|
|
2310
2500
|
class Dpop {
|
|
2311
2501
|
constructor(clientId) {
|
|
2502
|
+
_defineProperty(this, "storage", void 0);
|
|
2312
2503
|
this.storage = new DpopStorage(clientId);
|
|
2313
2504
|
}
|
|
2314
2505
|
getNonce(id) {
|
|
@@ -2327,7 +2518,7 @@ class Dpop {
|
|
|
2327
2518
|
}
|
|
2328
2519
|
async generateProof(params) {
|
|
2329
2520
|
const keyPair = await this.getOrGenerateKeyPair();
|
|
2330
|
-
return generateProof(
|
|
2521
|
+
return generateProof(_objectSpread2({
|
|
2331
2522
|
keyPair: keyPair
|
|
2332
2523
|
}, params));
|
|
2333
2524
|
}
|
|
@@ -2340,17 +2531,18 @@ class Dpop {
|
|
|
2340
2531
|
}
|
|
2341
2532
|
}
|
|
2342
2533
|
|
|
2343
|
-
var TokenType
|
|
2344
|
-
|
|
2345
|
-
(function(TokenType) {
|
|
2534
|
+
var TokenType = function(TokenType) {
|
|
2346
2535
|
TokenType["Bearer"] = "Bearer";
|
|
2347
2536
|
TokenType["DPoP"] = "DPoP";
|
|
2348
|
-
|
|
2537
|
+
return TokenType;
|
|
2538
|
+
}(TokenType || {});
|
|
2349
2539
|
|
|
2350
2540
|
class Fetcher {
|
|
2351
2541
|
constructor(config, hooks) {
|
|
2542
|
+
_defineProperty(this, "config", void 0);
|
|
2543
|
+
_defineProperty(this, "hooks", void 0);
|
|
2352
2544
|
this.hooks = hooks;
|
|
2353
|
-
this.config =
|
|
2545
|
+
this.config = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
2354
2546
|
fetch: config.fetch || (typeof window === "undefined" ? fetch : window.fetch.bind(window))
|
|
2355
2547
|
});
|
|
2356
2548
|
}
|
|
@@ -2458,7 +2650,7 @@ class Fetcher {
|
|
|
2458
2650
|
}
|
|
2459
2651
|
fetchWithAuth(info, init, authParams) {
|
|
2460
2652
|
const callbacks = {
|
|
2461
|
-
onUseDpopNonceError: () => this.internalFetchWithAuth(info, init,
|
|
2653
|
+
onUseDpopNonceError: () => this.internalFetchWithAuth(info, init, _objectSpread2(_objectSpread2({}, callbacks), {}, {
|
|
2462
2654
|
onUseDpopNonceError: undefined
|
|
2463
2655
|
}), authParams)
|
|
2464
2656
|
};
|
|
@@ -2516,6 +2708,11 @@ class MyAccountApiError extends Error {
|
|
|
2516
2708
|
constructor(_ref) {
|
|
2517
2709
|
let {type: type, status: status, title: title, detail: detail, validation_errors: validation_errors} = _ref;
|
|
2518
2710
|
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);
|
|
2519
2716
|
this.name = "MyAccountApiError";
|
|
2520
2717
|
this.type = type;
|
|
2521
2718
|
this.status = status;
|
|
@@ -2556,7 +2753,7 @@ const MfaGrantTypes = {
|
|
|
2556
2753
|
|
|
2557
2754
|
function getAuthJsEnrollParams(params) {
|
|
2558
2755
|
const mapping = FACTOR_MAPPING[params.factorType];
|
|
2559
|
-
return
|
|
2756
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2560
2757
|
mfaToken: params.mfaToken,
|
|
2561
2758
|
authenticatorTypes: mapping.authenticatorTypes
|
|
2562
2759
|
}, mapping.oobChannels && {
|
|
@@ -2581,177 +2778,6 @@ function getGrantType(params) {
|
|
|
2581
2778
|
return undefined;
|
|
2582
2779
|
}
|
|
2583
2780
|
|
|
2584
|
-
function _OverloadYield(e, d) {
|
|
2585
|
-
this.v = e, this.k = d;
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
function _assertClassBrand(e, t, n) {
|
|
2589
|
-
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
2590
|
-
throw new TypeError("Private element is not present on this object");
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
-
function _awaitAsyncGenerator(e) {
|
|
2594
|
-
return new _OverloadYield(e, 0);
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
function _checkPrivateRedeclaration(e, t) {
|
|
2598
|
-
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
2599
|
-
}
|
|
2600
|
-
|
|
2601
|
-
function _classPrivateFieldGet2(s, a) {
|
|
2602
|
-
return s.get(_assertClassBrand(s, a));
|
|
2603
|
-
}
|
|
2604
|
-
|
|
2605
|
-
function _classPrivateFieldInitSpec(e, t, a) {
|
|
2606
|
-
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
2607
|
-
}
|
|
2608
|
-
|
|
2609
|
-
function _classPrivateFieldSet2(s, a, r) {
|
|
2610
|
-
return s.set(_assertClassBrand(s, a), r), r;
|
|
2611
|
-
}
|
|
2612
|
-
|
|
2613
|
-
function _classPrivateMethodInitSpec(e, a) {
|
|
2614
|
-
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
|
-
function _defineProperty(e, r, t) {
|
|
2618
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
2619
|
-
value: t,
|
|
2620
|
-
enumerable: !0,
|
|
2621
|
-
configurable: !0,
|
|
2622
|
-
writable: !0
|
|
2623
|
-
}) : e[r] = t, e;
|
|
2624
|
-
}
|
|
2625
|
-
|
|
2626
|
-
function ownKeys(e, r) {
|
|
2627
|
-
var t = Object.keys(e);
|
|
2628
|
-
if (Object.getOwnPropertySymbols) {
|
|
2629
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
2630
|
-
r && (o = o.filter(function(r) {
|
|
2631
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
2632
|
-
})), t.push.apply(t, o);
|
|
2633
|
-
}
|
|
2634
|
-
return t;
|
|
2635
|
-
}
|
|
2636
|
-
|
|
2637
|
-
function _objectSpread2(e) {
|
|
2638
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
2639
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
2640
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
2641
|
-
_defineProperty(e, r, t[r]);
|
|
2642
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
2643
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
2644
|
-
});
|
|
2645
|
-
}
|
|
2646
|
-
return e;
|
|
2647
|
-
}
|
|
2648
|
-
|
|
2649
|
-
function _objectWithoutProperties(e, t) {
|
|
2650
|
-
if (null == e) return {};
|
|
2651
|
-
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
2652
|
-
if (Object.getOwnPropertySymbols) {
|
|
2653
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
2654
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
2655
|
-
}
|
|
2656
|
-
return i;
|
|
2657
|
-
}
|
|
2658
|
-
|
|
2659
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
2660
|
-
if (null == r) return {};
|
|
2661
|
-
var t = {};
|
|
2662
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2663
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
2664
|
-
t[n] = r[n];
|
|
2665
|
-
}
|
|
2666
|
-
return t;
|
|
2667
|
-
}
|
|
2668
|
-
|
|
2669
|
-
function _toPrimitive(t, r) {
|
|
2670
|
-
if ("object" != typeof t || !t) return t;
|
|
2671
|
-
var e = t[Symbol.toPrimitive];
|
|
2672
|
-
if (void 0 !== e) {
|
|
2673
|
-
var i = e.call(t, r || "default");
|
|
2674
|
-
if ("object" != typeof i) return i;
|
|
2675
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2676
|
-
}
|
|
2677
|
-
return ("string" === r ? String : Number)(t);
|
|
2678
|
-
}
|
|
2679
|
-
|
|
2680
|
-
function _toPropertyKey(t) {
|
|
2681
|
-
var i = _toPrimitive(t, "string");
|
|
2682
|
-
return "symbol" == typeof i ? i : i + "";
|
|
2683
|
-
}
|
|
2684
|
-
|
|
2685
|
-
function _wrapAsyncGenerator(e) {
|
|
2686
|
-
return function() {
|
|
2687
|
-
return new AsyncGenerator(e.apply(this, arguments));
|
|
2688
|
-
};
|
|
2689
|
-
}
|
|
2690
|
-
|
|
2691
|
-
function AsyncGenerator(e) {
|
|
2692
|
-
var r, t;
|
|
2693
|
-
function resume(r, t) {
|
|
2694
|
-
try {
|
|
2695
|
-
var n = e[r](t), o = n.value, u = o instanceof _OverloadYield;
|
|
2696
|
-
Promise.resolve(u ? o.v : o).then(function(t) {
|
|
2697
|
-
if (u) {
|
|
2698
|
-
var i = "return" === r ? "return" : "next";
|
|
2699
|
-
if (!o.k || t.done) return resume(i, t);
|
|
2700
|
-
t = e[i](t).value;
|
|
2701
|
-
}
|
|
2702
|
-
settle(n.done ? "return" : "normal", t);
|
|
2703
|
-
}, function(e) {
|
|
2704
|
-
resume("throw", e);
|
|
2705
|
-
});
|
|
2706
|
-
} catch (e) {
|
|
2707
|
-
settle("throw", e);
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
function settle(e, n) {
|
|
2711
|
-
switch (e) {
|
|
2712
|
-
case "return":
|
|
2713
|
-
r.resolve({
|
|
2714
|
-
value: n,
|
|
2715
|
-
done: !0
|
|
2716
|
-
});
|
|
2717
|
-
break;
|
|
2718
|
-
|
|
2719
|
-
case "throw":
|
|
2720
|
-
r.reject(n);
|
|
2721
|
-
break;
|
|
2722
|
-
|
|
2723
|
-
default:
|
|
2724
|
-
r.resolve({
|
|
2725
|
-
value: n,
|
|
2726
|
-
done: !1
|
|
2727
|
-
});
|
|
2728
|
-
}
|
|
2729
|
-
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
|
2730
|
-
}
|
|
2731
|
-
this._invoke = function(e, n) {
|
|
2732
|
-
return new Promise(function(o, u) {
|
|
2733
|
-
var i = {
|
|
2734
|
-
key: e,
|
|
2735
|
-
arg: n,
|
|
2736
|
-
resolve: o,
|
|
2737
|
-
reject: u,
|
|
2738
|
-
next: null
|
|
2739
|
-
};
|
|
2740
|
-
t ? t = t.next = i : (r = t = i, resume(e, n));
|
|
2741
|
-
});
|
|
2742
|
-
}, "function" != typeof e.return && (this.return = void 0);
|
|
2743
|
-
}
|
|
2744
|
-
|
|
2745
|
-
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
2746
|
-
return this;
|
|
2747
|
-
}, AsyncGenerator.prototype.next = function(e) {
|
|
2748
|
-
return this._invoke("next", e);
|
|
2749
|
-
}, AsyncGenerator.prototype.throw = function(e) {
|
|
2750
|
-
return this._invoke("throw", e);
|
|
2751
|
-
}, AsyncGenerator.prototype.return = function(e) {
|
|
2752
|
-
return this._invoke("return", e);
|
|
2753
|
-
};
|
|
2754
|
-
|
|
2755
2781
|
var _navigator$userAgent$2, _navigator$userAgent$$2;
|
|
2756
2782
|
|
|
2757
2783
|
let USER_AGENT$2;
|
|
@@ -6848,7 +6874,7 @@ let USER_AGENT;
|
|
|
6848
6874
|
|
|
6849
6875
|
if (typeof navigator === "undefined" || !((_navigator$userAgent = navigator.userAgent) !== null && _navigator$userAgent !== void 0 && (_navigator$userAgent$ = _navigator$userAgent.startsWith) !== null && _navigator$userAgent$ !== void 0 && _navigator$userAgent$.call(_navigator$userAgent, "Mozilla/5.0 "))) {
|
|
6850
6876
|
const NAME = "jose";
|
|
6851
|
-
const VERSION = "v6.2.
|
|
6877
|
+
const VERSION = "v6.2.2";
|
|
6852
6878
|
USER_AGENT = "".concat(NAME, "/").concat(VERSION);
|
|
6853
6879
|
}
|
|
6854
6880
|
|
|
@@ -7032,7 +7058,7 @@ function createRemoteJWKSet(url, options) {
|
|
|
7032
7058
|
return remoteJWKSet;
|
|
7033
7059
|
}
|
|
7034
7060
|
|
|
7035
|
-
const _excluded = [ "mfaToken" ], _excluded2 = [ "mfaToken" ];
|
|
7061
|
+
const _excluded$1 = [ "mfaToken" ], _excluded2$1 = [ "mfaToken" ];
|
|
7036
7062
|
|
|
7037
7063
|
var _baseUrl, _clientId, _customFetch, _entries, _ttlMs, _maxEntries, _configuration, _serverMetadata, _clientAuthPromise, _options, _customFetch2, _jwks, _discoveryCache, _inFlightDiscovery, _jwksCache, _Class9_brand;
|
|
7038
7064
|
|
|
@@ -7080,6 +7106,13 @@ var TokenByRefreshTokenError = class extends ApiError {
|
|
|
7080
7106
|
}
|
|
7081
7107
|
};
|
|
7082
7108
|
|
|
7109
|
+
var TokenByPasswordError = class extends ApiError {
|
|
7110
|
+
constructor(message, cause) {
|
|
7111
|
+
super("token_by_password_error", message, cause);
|
|
7112
|
+
this.name = "TokenByPasswordError";
|
|
7113
|
+
}
|
|
7114
|
+
};
|
|
7115
|
+
|
|
7083
7116
|
var TokenForConnectionError = class extends ApiError {
|
|
7084
7117
|
constructor(message, cause) {
|
|
7085
7118
|
super("token_for_connection_error", message, cause);
|
|
@@ -7270,7 +7303,7 @@ class MfaClient {
|
|
|
7270
7303
|
}
|
|
7271
7304
|
async enrollAuthenticator(options) {
|
|
7272
7305
|
const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/associate");
|
|
7273
|
-
const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded);
|
|
7306
|
+
const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded$1);
|
|
7274
7307
|
const apiParams = {
|
|
7275
7308
|
authenticator_types: sdkParams.authenticatorTypes
|
|
7276
7309
|
};
|
|
@@ -7315,7 +7348,7 @@ class MfaClient {
|
|
|
7315
7348
|
}
|
|
7316
7349
|
async challengeAuthenticator(options) {
|
|
7317
7350
|
const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/challenge");
|
|
7318
|
-
const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2);
|
|
7351
|
+
const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2$1);
|
|
7319
7352
|
const body = {
|
|
7320
7353
|
mfa_token: mfaToken,
|
|
7321
7354
|
client_id: _classPrivateFieldGet2(_clientId, this),
|
|
@@ -7372,7 +7405,7 @@ function getTelemetryConfig(config) {
|
|
|
7372
7405
|
return {
|
|
7373
7406
|
enabled: true,
|
|
7374
7407
|
name: (_config$name = config === null || config === void 0 ? void 0 : config.name) !== null && _config$name !== void 0 ? _config$name : "@auth0/auth0-auth-js",
|
|
7375
|
-
version: (_config$version = config === null || config === void 0 ? void 0 : config.version) !== null && _config$version !== void 0 ? _config$version : "1.
|
|
7408
|
+
version: (_config$version = config === null || config === void 0 ? void 0 : config.version) !== null && _config$version !== void 0 ? _config$version : "1.6.0"
|
|
7376
7409
|
};
|
|
7377
7410
|
}
|
|
7378
7411
|
|
|
@@ -7739,6 +7772,38 @@ class AuthClient {
|
|
|
7739
7772
|
throw new TokenByRefreshTokenError("The access token has expired and there was an error while trying to refresh it.", e);
|
|
7740
7773
|
}
|
|
7741
7774
|
}
|
|
7775
|
+
async getTokenByPassword(options) {
|
|
7776
|
+
const {configuration: configuration} = await _assertClassBrand(_Class9_brand, this, _discover).call(this);
|
|
7777
|
+
const params = new URLSearchParams({
|
|
7778
|
+
username: options.username,
|
|
7779
|
+
password: options.password
|
|
7780
|
+
});
|
|
7781
|
+
if (options.audience) {
|
|
7782
|
+
params.append("audience", options.audience);
|
|
7783
|
+
}
|
|
7784
|
+
if (options.scope) {
|
|
7785
|
+
params.append("scope", options.scope);
|
|
7786
|
+
}
|
|
7787
|
+
if (options.realm) {
|
|
7788
|
+
params.append("realm", options.realm);
|
|
7789
|
+
}
|
|
7790
|
+
let requestConfig = configuration;
|
|
7791
|
+
if (options.auth0ForwardedFor) {
|
|
7792
|
+
const clientAuth = await _assertClassBrand(_Class9_brand, this, _getClientAuth).call(this);
|
|
7793
|
+
requestConfig = new Configuration(configuration.serverMetadata(), _classPrivateFieldGet2(_options, this).clientId, _classPrivateFieldGet2(_options, this).clientSecret, clientAuth);
|
|
7794
|
+
requestConfig[customFetch$1] = (url, init) => _classPrivateFieldGet2(_customFetch2, this).call(this, url, _objectSpread2(_objectSpread2({}, init), {}, {
|
|
7795
|
+
headers: _objectSpread2(_objectSpread2({}, init.headers), {}, {
|
|
7796
|
+
"auth0-forwarded-for": options.auth0ForwardedFor
|
|
7797
|
+
})
|
|
7798
|
+
}));
|
|
7799
|
+
}
|
|
7800
|
+
try {
|
|
7801
|
+
const tokenEndpointResponse = await genericGrantRequest(requestConfig, "password", params);
|
|
7802
|
+
return TokenResponse.fromTokenEndpointResponse(tokenEndpointResponse);
|
|
7803
|
+
} catch (e) {
|
|
7804
|
+
throw new TokenByPasswordError("There was an error while trying to request a token.", e);
|
|
7805
|
+
}
|
|
7806
|
+
}
|
|
7742
7807
|
async getTokenByClientCredentials(options) {
|
|
7743
7808
|
const {configuration: configuration} = await _assertClassBrand(_Class9_brand, this, _discover).call(this);
|
|
7744
7809
|
try {
|
|
@@ -8038,12 +8103,13 @@ const DEFAULT_TTL_MS = 10 * 60 * 1e3;
|
|
|
8038
8103
|
class MfaContextManager {
|
|
8039
8104
|
constructor() {
|
|
8040
8105
|
let ttlMs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_TTL_MS;
|
|
8041
|
-
this
|
|
8106
|
+
_defineProperty(this, "contexts", new Map);
|
|
8107
|
+
_defineProperty(this, "ttlMs", void 0);
|
|
8042
8108
|
this.ttlMs = ttlMs;
|
|
8043
8109
|
}
|
|
8044
8110
|
set(mfaToken, context) {
|
|
8045
8111
|
this.cleanup();
|
|
8046
|
-
this.contexts.set(mfaToken,
|
|
8112
|
+
this.contexts.set(mfaToken, _objectSpread2(_objectSpread2({}, context), {}, {
|
|
8047
8113
|
createdAt: Date.now()
|
|
8048
8114
|
}));
|
|
8049
8115
|
}
|
|
@@ -8076,6 +8142,9 @@ class MfaContextManager {
|
|
|
8076
8142
|
|
|
8077
8143
|
class MfaApiClient {
|
|
8078
8144
|
constructor(authJsMfaClient, auth0Client) {
|
|
8145
|
+
_defineProperty(this, "authJsMfaClient", void 0);
|
|
8146
|
+
_defineProperty(this, "auth0Client", void 0);
|
|
8147
|
+
_defineProperty(this, "contextManager", void 0);
|
|
8079
8148
|
this.authJsMfaClient = authJsMfaClient;
|
|
8080
8149
|
this.auth0Client = auth0Client;
|
|
8081
8150
|
this.contextManager = new MfaContextManager;
|
|
@@ -8088,9 +8157,9 @@ class MfaApiClient {
|
|
|
8088
8157
|
});
|
|
8089
8158
|
}
|
|
8090
8159
|
async getAuthenticators(mfaToken) {
|
|
8091
|
-
var
|
|
8160
|
+
var _context$mfaRequireme;
|
|
8092
8161
|
const context = this.contextManager.get(mfaToken);
|
|
8093
|
-
if (!(
|
|
8162
|
+
if (!(context !== null && context !== void 0 && (_context$mfaRequireme = context.mfaRequirements) !== null && _context$mfaRequireme !== void 0 && _context$mfaRequireme.challenge) || context.mfaRequirements.challenge.length === 0) {
|
|
8094
8163
|
throw new MfaListAuthenticatorsError("invalid_request", "challengeType is required and must contain at least one challenge type, please check mfa_required error payload");
|
|
8095
8164
|
}
|
|
8096
8165
|
const challengeTypes = context.mfaRequirements.challenge.map(c => c.type);
|
|
@@ -8104,25 +8173,25 @@ class MfaApiClient {
|
|
|
8104
8173
|
});
|
|
8105
8174
|
} catch (error) {
|
|
8106
8175
|
if (error instanceof MfaListAuthenticatorsError$1) {
|
|
8107
|
-
|
|
8176
|
+
var _error$cause;
|
|
8177
|
+
throw new MfaListAuthenticatorsError((_error$cause = error.cause) === null || _error$cause === void 0 ? void 0 : _error$cause.error, error.message);
|
|
8108
8178
|
}
|
|
8109
8179
|
throw error;
|
|
8110
8180
|
}
|
|
8111
8181
|
}
|
|
8112
8182
|
async enroll(params) {
|
|
8113
|
-
var _a;
|
|
8114
8183
|
const authJsParams = getAuthJsEnrollParams(params);
|
|
8115
8184
|
try {
|
|
8116
8185
|
return await this.authJsMfaClient.enrollAuthenticator(authJsParams);
|
|
8117
8186
|
} catch (error) {
|
|
8118
8187
|
if (error instanceof MfaEnrollmentError$1) {
|
|
8119
|
-
|
|
8188
|
+
var _error$cause2;
|
|
8189
|
+
throw new MfaEnrollmentError((_error$cause2 = error.cause) === null || _error$cause2 === void 0 ? void 0 : _error$cause2.error, error.message);
|
|
8120
8190
|
}
|
|
8121
8191
|
throw error;
|
|
8122
8192
|
}
|
|
8123
8193
|
}
|
|
8124
8194
|
async challenge(params) {
|
|
8125
|
-
var _a;
|
|
8126
8195
|
try {
|
|
8127
8196
|
const authJsParams = {
|
|
8128
8197
|
challengeType: params.challengeType,
|
|
@@ -8134,7 +8203,8 @@ class MfaApiClient {
|
|
|
8134
8203
|
return await this.authJsMfaClient.challengeAuthenticator(authJsParams);
|
|
8135
8204
|
} catch (error) {
|
|
8136
8205
|
if (error instanceof MfaChallengeError$1) {
|
|
8137
|
-
|
|
8206
|
+
var _error$cause3;
|
|
8207
|
+
throw new MfaChallengeError((_error$cause3 = error.cause) === null || _error$cause3 === void 0 ? void 0 : _error$cause3.error, error.message);
|
|
8138
8208
|
}
|
|
8139
8209
|
throw error;
|
|
8140
8210
|
}
|
|
@@ -8184,18 +8254,38 @@ class MfaApiClient {
|
|
|
8184
8254
|
}
|
|
8185
8255
|
}
|
|
8186
8256
|
|
|
8257
|
+
const _excluded = [ "openUrl", "fragment", "appState" ], _excluded2 = [ "url" ], _excluded3 = [ "cacheMode" ], _excluded4 = [ "federated" ], _excluded5 = [ "openUrl" ], _excluded6 = [ "id_token", "decodedToken" ], _excluded7 = [ "mfaToken" ];
|
|
8258
|
+
|
|
8187
8259
|
class Auth0Client {
|
|
8188
8260
|
constructor(options) {
|
|
8189
|
-
this
|
|
8190
|
-
this
|
|
8261
|
+
_defineProperty(this, "transactionManager", void 0);
|
|
8262
|
+
_defineProperty(this, "cacheManager", void 0);
|
|
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", {
|
|
8191
8281
|
authorizationParams: {
|
|
8192
8282
|
scope: DEFAULT_SCOPE
|
|
8193
8283
|
},
|
|
8194
8284
|
useRefreshTokensFallback: false,
|
|
8195
8285
|
useFormData: true
|
|
8196
|
-
};
|
|
8197
|
-
this.options =
|
|
8198
|
-
authorizationParams:
|
|
8286
|
+
});
|
|
8287
|
+
this.options = _objectSpread2(_objectSpread2(_objectSpread2({}, this.defaultOptions), options), {}, {
|
|
8288
|
+
authorizationParams: _objectSpread2(_objectSpread2({}, this.defaultOptions.authorizationParams), options.authorizationParams)
|
|
8199
8289
|
});
|
|
8200
8290
|
typeof window !== "undefined" && validateCrypto();
|
|
8201
8291
|
this.lockManager = getLockManager();
|
|
@@ -8227,9 +8317,9 @@ class Auth0Client {
|
|
|
8227
8317
|
this.domainUrl = getDomain(this.options.domain);
|
|
8228
8318
|
this.tokenIssuer = getTokenIssuer(this.options.issuer, this.domainUrl);
|
|
8229
8319
|
const myAccountApiIdentifier = "".concat(this.domainUrl, "/me/");
|
|
8230
|
-
const myAccountFetcher = this.createFetcher(
|
|
8320
|
+
const myAccountFetcher = this.createFetcher(_objectSpread2(_objectSpread2({}, this.options.useDpop && {
|
|
8231
8321
|
dpopNonceId: "__auth0_my_account_api__"
|
|
8232
|
-
}), {
|
|
8322
|
+
}), {}, {
|
|
8233
8323
|
getAccessToken: () => this.getTokenSilently({
|
|
8234
8324
|
authorizationParams: {
|
|
8235
8325
|
scope: "create:me:connected_accounts",
|
|
@@ -8292,14 +8382,39 @@ class Auth0Client {
|
|
|
8292
8382
|
});
|
|
8293
8383
|
}
|
|
8294
8384
|
}
|
|
8385
|
+
_extractSessionTransferToken(paramName) {
|
|
8386
|
+
const params = new URLSearchParams(window.location.search);
|
|
8387
|
+
return params.get(paramName) || undefined;
|
|
8388
|
+
}
|
|
8389
|
+
_clearSessionTransferTokenFromUrl(paramName) {
|
|
8390
|
+
try {
|
|
8391
|
+
const url = new URL(window.location.href);
|
|
8392
|
+
if (url.searchParams.has(paramName)) {
|
|
8393
|
+
url.searchParams.delete(paramName);
|
|
8394
|
+
window.history.replaceState({}, "", url.toString());
|
|
8395
|
+
}
|
|
8396
|
+
} catch (_unused) {}
|
|
8397
|
+
}
|
|
8398
|
+
_applySessionTransferToken(authorizationParams) {
|
|
8399
|
+
const paramName = this.options.sessionTransferTokenQueryParamName;
|
|
8400
|
+
if (!paramName || authorizationParams.session_transfer_token) {
|
|
8401
|
+
return authorizationParams;
|
|
8402
|
+
}
|
|
8403
|
+
const token = this._extractSessionTransferToken(paramName);
|
|
8404
|
+
if (!token) return authorizationParams;
|
|
8405
|
+
this._clearSessionTransferTokenFromUrl(paramName);
|
|
8406
|
+
return _objectSpread2(_objectSpread2({}, authorizationParams), {}, {
|
|
8407
|
+
session_transfer_token: token
|
|
8408
|
+
});
|
|
8409
|
+
}
|
|
8295
8410
|
async _prepareAuthorizeUrl(authorizationParams, authorizeOptions, fallbackRedirectUri) {
|
|
8296
|
-
var
|
|
8411
|
+
var _this$dpop;
|
|
8297
8412
|
const state = encode$2(createRandomString());
|
|
8298
8413
|
const nonce = encode$2(createRandomString());
|
|
8299
8414
|
const code_verifier = createRandomString();
|
|
8300
8415
|
const code_challengeBuffer = await sha256(code_verifier);
|
|
8301
8416
|
const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
|
|
8302
|
-
const thumbprint = await ((
|
|
8417
|
+
const thumbprint = await ((_this$dpop = this.dpop) === null || _this$dpop === void 0 ? void 0 : _this$dpop.calculateThumbprint());
|
|
8303
8418
|
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);
|
|
8304
8419
|
const url = this._authorizeUrl(params);
|
|
8305
8420
|
return {
|
|
@@ -8313,7 +8428,7 @@ class Auth0Client {
|
|
|
8313
8428
|
};
|
|
8314
8429
|
}
|
|
8315
8430
|
async loginWithPopup(options, config) {
|
|
8316
|
-
var
|
|
8431
|
+
var _options$authorizatio;
|
|
8317
8432
|
options = options || {};
|
|
8318
8433
|
config = config || {};
|
|
8319
8434
|
if (!config.popup) {
|
|
@@ -8322,17 +8437,18 @@ class Auth0Client {
|
|
|
8322
8437
|
throw new PopupOpenError;
|
|
8323
8438
|
}
|
|
8324
8439
|
}
|
|
8325
|
-
const
|
|
8440
|
+
const authorizationParams = this._applySessionTransferToken(options.authorizationParams || {});
|
|
8441
|
+
const params = await this._prepareAuthorizeUrl(authorizationParams, {
|
|
8326
8442
|
response_mode: "web_message"
|
|
8327
8443
|
}, window.location.origin);
|
|
8328
8444
|
config.popup.location.href = params.url;
|
|
8329
|
-
const codeResult = await runPopup(
|
|
8445
|
+
const codeResult = await runPopup(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
8330
8446
|
timeoutInSeconds: config.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
|
|
8331
|
-
}));
|
|
8447
|
+
}), new URL(params.url).origin);
|
|
8332
8448
|
if (params.state !== codeResult.state) {
|
|
8333
8449
|
throw new GenericError("state_mismatch", "Invalid state");
|
|
8334
8450
|
}
|
|
8335
|
-
const organization = ((
|
|
8451
|
+
const organization = ((_options$authorizatio = options.authorizationParams) === null || _options$authorizatio === void 0 ? void 0 : _options$authorizatio.organization) || this.options.authorizationParams.organization;
|
|
8336
8452
|
await this._requestToken({
|
|
8337
8453
|
audience: params.audience,
|
|
8338
8454
|
scope: params.scope,
|
|
@@ -8346,25 +8462,26 @@ class Auth0Client {
|
|
|
8346
8462
|
});
|
|
8347
8463
|
}
|
|
8348
8464
|
async getUser() {
|
|
8349
|
-
var
|
|
8465
|
+
var _cache$decodedToken;
|
|
8350
8466
|
const cache = await this._getIdTokenFromCache();
|
|
8351
|
-
return
|
|
8467
|
+
return cache === null || cache === void 0 || (_cache$decodedToken = cache.decodedToken) === null || _cache$decodedToken === void 0 ? void 0 : _cache$decodedToken.user;
|
|
8352
8468
|
}
|
|
8353
8469
|
async getIdTokenClaims() {
|
|
8354
|
-
var
|
|
8470
|
+
var _cache$decodedToken2;
|
|
8355
8471
|
const cache = await this._getIdTokenFromCache();
|
|
8356
|
-
return
|
|
8472
|
+
return cache === null || cache === void 0 || (_cache$decodedToken2 = cache.decodedToken) === null || _cache$decodedToken2 === void 0 ? void 0 : _cache$decodedToken2.claims;
|
|
8357
8473
|
}
|
|
8358
8474
|
async loginWithRedirect() {
|
|
8475
|
+
var _urlOptions$authoriza;
|
|
8359
8476
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8360
|
-
|
|
8361
|
-
const
|
|
8362
|
-
const
|
|
8363
|
-
const
|
|
8364
|
-
this.transactionManager.create(
|
|
8477
|
+
const _patchOpenUrlWithOnRe = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl, fragment: fragment, appState: appState} = _patchOpenUrlWithOnRe, urlOptions = _objectWithoutProperties(_patchOpenUrlWithOnRe, _excluded);
|
|
8478
|
+
const organization = ((_urlOptions$authoriza = urlOptions.authorizationParams) === null || _urlOptions$authoriza === void 0 ? void 0 : _urlOptions$authoriza.organization) || this.options.authorizationParams.organization;
|
|
8479
|
+
const authorizationParams = this._applySessionTransferToken(urlOptions.authorizationParams || {});
|
|
8480
|
+
const _await$this$_prepareA = await this._prepareAuthorizeUrl(authorizationParams), {url: url} = _await$this$_prepareA, transaction = _objectWithoutProperties(_await$this$_prepareA, _excluded2);
|
|
8481
|
+
this.transactionManager.create(_objectSpread2(_objectSpread2({}, transaction), {}, {
|
|
8365
8482
|
appState: appState,
|
|
8366
|
-
response_type:
|
|
8367
|
-
}
|
|
8483
|
+
response_type: ResponseType.Code
|
|
8484
|
+
}, organization && {
|
|
8368
8485
|
organization: organization
|
|
8369
8486
|
}));
|
|
8370
8487
|
const urlWithFragment = fragment ? "".concat(url, "#").concat(fragment) : url;
|
|
@@ -8386,7 +8503,7 @@ class Auth0Client {
|
|
|
8386
8503
|
}
|
|
8387
8504
|
this.transactionManager.remove();
|
|
8388
8505
|
const authenticationResult = parseAuthenticationResult(queryStringFragments.join(""));
|
|
8389
|
-
if (transaction.response_type ===
|
|
8506
|
+
if (transaction.response_type === ResponseType.ConnectCode) {
|
|
8390
8507
|
return this._handleConnectAccountRedirectCallback(authenticationResult, transaction);
|
|
8391
8508
|
}
|
|
8392
8509
|
return this._handleLoginRedirectCallback(authenticationResult, transaction);
|
|
@@ -8402,7 +8519,7 @@ class Auth0Client {
|
|
|
8402
8519
|
const organization = transaction.organization;
|
|
8403
8520
|
const nonceIn = transaction.nonce;
|
|
8404
8521
|
const redirect_uri = transaction.redirect_uri;
|
|
8405
|
-
await this._requestToken(
|
|
8522
|
+
await this._requestToken(_objectSpread2({
|
|
8406
8523
|
audience: transaction.audience,
|
|
8407
8524
|
scope: transaction.scope,
|
|
8408
8525
|
code_verifier: transaction.code_verifier,
|
|
@@ -8416,7 +8533,7 @@ class Auth0Client {
|
|
|
8416
8533
|
});
|
|
8417
8534
|
return {
|
|
8418
8535
|
appState: transaction.appState,
|
|
8419
|
-
response_type:
|
|
8536
|
+
response_type: ResponseType.Code
|
|
8420
8537
|
};
|
|
8421
8538
|
}
|
|
8422
8539
|
async _handleConnectAccountRedirectCallback(connectResult, transaction) {
|
|
@@ -8436,9 +8553,9 @@ class Auth0Client {
|
|
|
8436
8553
|
redirect_uri: transaction.redirect_uri,
|
|
8437
8554
|
code_verifier: transaction.code_verifier
|
|
8438
8555
|
});
|
|
8439
|
-
return
|
|
8556
|
+
return _objectSpread2(_objectSpread2({}, data), {}, {
|
|
8440
8557
|
appState: transaction.appState,
|
|
8441
|
-
response_type:
|
|
8558
|
+
response_type: ResponseType.ConnectCode
|
|
8442
8559
|
});
|
|
8443
8560
|
}
|
|
8444
8561
|
async checkSession(options) {
|
|
@@ -8458,20 +8575,20 @@ class Auth0Client {
|
|
|
8458
8575
|
} catch (_) {}
|
|
8459
8576
|
}
|
|
8460
8577
|
async getTokenSilently() {
|
|
8578
|
+
var _options$authorizatio2, _options$authorizatio3;
|
|
8461
8579
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8462
|
-
|
|
8463
|
-
const localOptions = Object.assign(Object.assign({
|
|
8580
|
+
const localOptions = _objectSpread2(_objectSpread2({
|
|
8464
8581
|
cacheMode: "on"
|
|
8465
|
-
}, options), {
|
|
8466
|
-
authorizationParams:
|
|
8467
|
-
scope: scopesToRequest(this.scope, (
|
|
8582
|
+
}, options), {}, {
|
|
8583
|
+
authorizationParams: _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.authorizationParams), options.authorizationParams), {}, {
|
|
8584
|
+
scope: scopesToRequest(this.scope, (_options$authorizatio2 = options.authorizationParams) === null || _options$authorizatio2 === void 0 ? void 0 : _options$authorizatio2.scope, ((_options$authorizatio3 = options.authorizationParams) === null || _options$authorizatio3 === void 0 ? void 0 : _options$authorizatio3.audience) || this.options.authorizationParams.audience)
|
|
8468
8585
|
})
|
|
8469
8586
|
});
|
|
8470
8587
|
const result = await singlePromise(() => this._getTokenSilently(localOptions), "".concat(this.options.clientId, "::").concat(localOptions.authorizationParams.audience, "::").concat(localOptions.authorizationParams.scope));
|
|
8471
8588
|
return options.detailedResponse ? result : result === null || result === void 0 ? void 0 : result.access_token;
|
|
8472
8589
|
}
|
|
8473
8590
|
async _getTokenSilently(options) {
|
|
8474
|
-
const {cacheMode: cacheMode} = options, getTokenOptions =
|
|
8591
|
+
const {cacheMode: cacheMode} = options, getTokenOptions = _objectWithoutProperties(options, _excluded3);
|
|
8475
8592
|
if (cacheMode !== "off") {
|
|
8476
8593
|
const entry = await this._getEntryFromCache({
|
|
8477
8594
|
scope: getTokenOptions.authorizationParams.scope,
|
|
@@ -8501,13 +8618,13 @@ class Auth0Client {
|
|
|
8501
8618
|
}
|
|
8502
8619
|
const authResult = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(getTokenOptions) : await this._getTokenFromIFrame(getTokenOptions);
|
|
8503
8620
|
const {id_token: id_token, token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = authResult;
|
|
8504
|
-
return
|
|
8621
|
+
return _objectSpread2(_objectSpread2({
|
|
8505
8622
|
id_token: id_token,
|
|
8506
8623
|
token_type: token_type,
|
|
8507
8624
|
access_token: access_token
|
|
8508
8625
|
}, oauthTokenScope ? {
|
|
8509
8626
|
scope: oauthTokenScope
|
|
8510
|
-
} : null), {
|
|
8627
|
+
} : null), {}, {
|
|
8511
8628
|
expires_in: expires_in
|
|
8512
8629
|
});
|
|
8513
8630
|
});
|
|
@@ -8543,15 +8660,15 @@ class Auth0Client {
|
|
|
8543
8660
|
}
|
|
8544
8661
|
}
|
|
8545
8662
|
async getTokenWithPopup() {
|
|
8663
|
+
var _options$authorizatio4, _options$authorizatio5;
|
|
8546
8664
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8547
8665
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
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)
|
|
8666
|
+
const localOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
8667
|
+
authorizationParams: _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.authorizationParams), options.authorizationParams), {}, {
|
|
8668
|
+
scope: scopesToRequest(this.scope, (_options$authorizatio4 = options.authorizationParams) === null || _options$authorizatio4 === void 0 ? void 0 : _options$authorizatio4.scope, ((_options$authorizatio5 = options.authorizationParams) === null || _options$authorizatio5 === void 0 ? void 0 : _options$authorizatio5.audience) || this.options.authorizationParams.audience)
|
|
8552
8669
|
})
|
|
8553
8670
|
});
|
|
8554
|
-
config =
|
|
8671
|
+
config = _objectSpread2(_objectSpread2({}, DEFAULT_POPUP_CONFIG_OPTIONS), config);
|
|
8555
8672
|
await this.loginWithPopup(localOptions, config);
|
|
8556
8673
|
const cache = await this.cacheManager.get(new CacheKey({
|
|
8557
8674
|
scope: localOptions.authorizationParams.scope,
|
|
@@ -8570,17 +8687,17 @@ class Auth0Client {
|
|
|
8570
8687
|
} else {
|
|
8571
8688
|
delete options.clientId;
|
|
8572
8689
|
}
|
|
8573
|
-
const
|
|
8690
|
+
const _ref = options.logoutParams || {}, {federated: federated} = _ref, logoutOptions = _objectWithoutProperties(_ref, _excluded4);
|
|
8574
8691
|
const federatedQuery = federated ? "&federated" : "";
|
|
8575
|
-
const url = this._url("/v2/logout?".concat(createQueryParams(
|
|
8692
|
+
const url = this._url("/v2/logout?".concat(createQueryParams(_objectSpread2({
|
|
8576
8693
|
clientId: options.clientId
|
|
8577
8694
|
}, logoutOptions))));
|
|
8578
8695
|
return url + federatedQuery;
|
|
8579
8696
|
}
|
|
8580
8697
|
async logout() {
|
|
8698
|
+
var _this$dpop2;
|
|
8581
8699
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8582
|
-
|
|
8583
|
-
const _b = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _b, logoutOptions = __rest(_b, [ "openUrl" ]);
|
|
8700
|
+
const _patchOpenUrlWithOnRe2 = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _patchOpenUrlWithOnRe2, logoutOptions = _objectWithoutProperties(_patchOpenUrlWithOnRe2, _excluded5);
|
|
8584
8701
|
if (options.clientId === null) {
|
|
8585
8702
|
await this.cacheManager.clear();
|
|
8586
8703
|
} else {
|
|
@@ -8593,7 +8710,7 @@ class Auth0Client {
|
|
|
8593
8710
|
cookieDomain: this.options.cookieDomain
|
|
8594
8711
|
});
|
|
8595
8712
|
this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
|
|
8596
|
-
await ((
|
|
8713
|
+
await ((_this$dpop2 = this.dpop) === null || _this$dpop2 === void 0 ? void 0 : _this$dpop2.clear());
|
|
8597
8714
|
const url = this._buildLogoutUrl(logoutOptions);
|
|
8598
8715
|
if (openUrl) {
|
|
8599
8716
|
await openUrl(url);
|
|
@@ -8605,7 +8722,7 @@ class Auth0Client {
|
|
|
8605
8722
|
const iframeLockKey = buildIframeLockKey(this.options.clientId);
|
|
8606
8723
|
try {
|
|
8607
8724
|
return await this.lockManager.runWithLock(iframeLockKey, 5e3, async () => {
|
|
8608
|
-
const params =
|
|
8725
|
+
const params = _objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
|
|
8609
8726
|
prompt: "none"
|
|
8610
8727
|
});
|
|
8611
8728
|
const orgHint = this.cookieStorage.get(this.orgHintCookieName);
|
|
@@ -8622,14 +8739,14 @@ class Auth0Client {
|
|
|
8622
8739
|
let eventOrigin;
|
|
8623
8740
|
try {
|
|
8624
8741
|
eventOrigin = new URL(this.domainUrl).origin;
|
|
8625
|
-
} catch (
|
|
8742
|
+
} catch (_unused2) {
|
|
8626
8743
|
eventOrigin = this.domainUrl;
|
|
8627
8744
|
}
|
|
8628
8745
|
const codeResult = await runIframe(url, eventOrigin, authorizeTimeout);
|
|
8629
8746
|
if (stateIn !== codeResult.state) {
|
|
8630
8747
|
throw new GenericError("state_mismatch", "Invalid state");
|
|
8631
8748
|
}
|
|
8632
|
-
const tokenResult = await this._requestToken(
|
|
8749
|
+
const tokenResult = await this._requestToken(_objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
|
|
8633
8750
|
code_verifier: code_verifier,
|
|
8634
8751
|
code: codeResult.code,
|
|
8635
8752
|
grant_type: "authorization_code",
|
|
@@ -8639,7 +8756,7 @@ class Auth0Client {
|
|
|
8639
8756
|
nonceIn: nonceIn,
|
|
8640
8757
|
organization: params.organization
|
|
8641
8758
|
});
|
|
8642
|
-
return
|
|
8759
|
+
return _objectSpread2(_objectSpread2({}, tokenResult), {}, {
|
|
8643
8760
|
scope: scope,
|
|
8644
8761
|
oauthTokenScope: tokenResult.scope,
|
|
8645
8762
|
audience: audience
|
|
@@ -8658,7 +8775,6 @@ class Auth0Client {
|
|
|
8658
8775
|
}
|
|
8659
8776
|
}
|
|
8660
8777
|
async _getTokenUsingRefreshToken(options) {
|
|
8661
|
-
var _a, _b;
|
|
8662
8778
|
const cache = await this.cacheManager.get(new CacheKey({
|
|
8663
8779
|
scope: options.authorizationParams.scope,
|
|
8664
8780
|
audience: options.authorizationParams.audience || DEFAULT_AUDIENCE,
|
|
@@ -8674,16 +8790,16 @@ class Auth0Client {
|
|
|
8674
8790
|
const timeout = typeof options.timeoutInSeconds === "number" ? options.timeoutInSeconds * 1e3 : null;
|
|
8675
8791
|
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);
|
|
8676
8792
|
try {
|
|
8677
|
-
const tokenResult = await this._requestToken(
|
|
8793
|
+
const tokenResult = await this._requestToken(_objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
|
|
8678
8794
|
grant_type: "refresh_token",
|
|
8679
8795
|
refresh_token: cache && cache.refresh_token,
|
|
8680
8796
|
redirect_uri: redirect_uri
|
|
8681
|
-
}
|
|
8797
|
+
}, timeout && {
|
|
8682
8798
|
timeout: timeout
|
|
8683
8799
|
}), {
|
|
8684
8800
|
scopesToRequest: scopesToRequest
|
|
8685
8801
|
});
|
|
8686
|
-
if (tokenResult.refresh_token &&
|
|
8802
|
+
if (tokenResult.refresh_token && cache !== null && cache !== void 0 && cache.refresh_token) {
|
|
8687
8803
|
await this.cacheManager.updateEntry(cache.refresh_token, tokenResult.refresh_token);
|
|
8688
8804
|
}
|
|
8689
8805
|
if (this.options.useMrrt) {
|
|
@@ -8700,7 +8816,7 @@ class Auth0Client {
|
|
|
8700
8816
|
}
|
|
8701
8817
|
}
|
|
8702
8818
|
}
|
|
8703
|
-
return
|
|
8819
|
+
return _objectSpread2(_objectSpread2({}, tokenResult), {}, {
|
|
8704
8820
|
scope: options.authorizationParams.scope,
|
|
8705
8821
|
oauthTokenScope: tokenResult.scope,
|
|
8706
8822
|
audience: options.authorizationParams.audience || DEFAULT_AUDIENCE
|
|
@@ -8718,13 +8834,14 @@ class Auth0Client {
|
|
|
8718
8834
|
}
|
|
8719
8835
|
}
|
|
8720
8836
|
if (e instanceof MfaRequiredError) {
|
|
8721
|
-
|
|
8837
|
+
var _options$authorizatio6, _options$authorizatio7;
|
|
8838
|
+
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);
|
|
8722
8839
|
}
|
|
8723
8840
|
throw e;
|
|
8724
8841
|
}
|
|
8725
8842
|
}
|
|
8726
8843
|
async _saveEntryInCache(entry) {
|
|
8727
|
-
const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken =
|
|
8844
|
+
const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken = _objectWithoutProperties(entry, _excluded6);
|
|
8728
8845
|
this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, {
|
|
8729
8846
|
id_token: id_token,
|
|
8730
8847
|
decodedToken: decodedToken
|
|
@@ -8747,8 +8864,8 @@ class Auth0Client {
|
|
|
8747
8864
|
this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, cache);
|
|
8748
8865
|
return cache;
|
|
8749
8866
|
}
|
|
8750
|
-
async _getEntryFromCache(
|
|
8751
|
-
let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} =
|
|
8867
|
+
async _getEntryFromCache(_ref2) {
|
|
8868
|
+
let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} = _ref2;
|
|
8752
8869
|
const entry = await this.cacheManager.get(new CacheKey({
|
|
8753
8870
|
scope: scope,
|
|
8754
8871
|
audience: audience,
|
|
@@ -8757,21 +8874,20 @@ class Auth0Client {
|
|
|
8757
8874
|
if (entry && entry.access_token) {
|
|
8758
8875
|
const {token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = entry;
|
|
8759
8876
|
const cache = await this._getIdTokenFromCache();
|
|
8760
|
-
return cache &&
|
|
8877
|
+
return cache && _objectSpread2(_objectSpread2({
|
|
8761
8878
|
id_token: cache.id_token,
|
|
8762
8879
|
token_type: token_type ? token_type : "Bearer",
|
|
8763
8880
|
access_token: access_token
|
|
8764
8881
|
}, oauthTokenScope ? {
|
|
8765
8882
|
scope: oauthTokenScope
|
|
8766
|
-
} : null), {
|
|
8883
|
+
} : null), {}, {
|
|
8767
8884
|
expires_in: expires_in
|
|
8768
8885
|
});
|
|
8769
8886
|
}
|
|
8770
8887
|
}
|
|
8771
8888
|
async _requestToken(options, additionalParameters) {
|
|
8772
|
-
var _a, _b;
|
|
8773
8889
|
const {nonceIn: nonceIn, organization: organization, scopesToRequest: scopesToRequest} = additionalParameters || {};
|
|
8774
|
-
const authResult = await oauthToken(
|
|
8890
|
+
const authResult = await oauthToken(_objectSpread2(_objectSpread2({
|
|
8775
8891
|
baseUrl: this.domainUrl,
|
|
8776
8892
|
client_id: this.options.clientId,
|
|
8777
8893
|
auth0Client: this.options.auth0Client,
|
|
@@ -8779,24 +8895,25 @@ class Auth0Client {
|
|
|
8779
8895
|
timeout: this.httpTimeoutMs,
|
|
8780
8896
|
useMrrt: this.options.useMrrt,
|
|
8781
8897
|
dpop: this.dpop
|
|
8782
|
-
}, options), {
|
|
8898
|
+
}, options), {}, {
|
|
8783
8899
|
scope: scopesToRequest || options.scope
|
|
8784
8900
|
}), this.worker);
|
|
8785
8901
|
const decodedToken = await this._verifyIdToken(authResult.id_token, nonceIn, organization);
|
|
8786
8902
|
if (options.grant_type === "authorization_code") {
|
|
8903
|
+
var _existingIdToken$deco;
|
|
8787
8904
|
const existingIdToken = await this._getIdTokenFromCache();
|
|
8788
|
-
if (
|
|
8905
|
+
if (existingIdToken !== null && existingIdToken !== void 0 && (_existingIdToken$deco = existingIdToken.decodedToken) !== null && _existingIdToken$deco !== void 0 && (_existingIdToken$deco = _existingIdToken$deco.claims) !== null && _existingIdToken$deco !== void 0 && _existingIdToken$deco.sub && existingIdToken.decodedToken.claims.sub !== decodedToken.claims.sub) {
|
|
8789
8906
|
await this.cacheManager.clear(this.options.clientId);
|
|
8790
8907
|
this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
|
|
8791
8908
|
}
|
|
8792
8909
|
}
|
|
8793
|
-
await this._saveEntryInCache(
|
|
8910
|
+
await this._saveEntryInCache(_objectSpread2(_objectSpread2(_objectSpread2({}, authResult), {}, {
|
|
8794
8911
|
decodedToken: decodedToken,
|
|
8795
8912
|
scope: options.scope,
|
|
8796
8913
|
audience: options.audience || DEFAULT_AUDIENCE
|
|
8797
|
-
}
|
|
8914
|
+
}, authResult.scope ? {
|
|
8798
8915
|
oauthTokenScope: authResult.scope
|
|
8799
|
-
} : null), {
|
|
8916
|
+
} : null), {}, {
|
|
8800
8917
|
client_id: this.options.clientId
|
|
8801
8918
|
}));
|
|
8802
8919
|
this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
|
|
@@ -8804,12 +8921,12 @@ class Auth0Client {
|
|
|
8804
8921
|
cookieDomain: this.options.cookieDomain
|
|
8805
8922
|
});
|
|
8806
8923
|
this._processOrgHint(organization || decodedToken.claims.org_id);
|
|
8807
|
-
return
|
|
8924
|
+
return _objectSpread2(_objectSpread2({}, authResult), {}, {
|
|
8808
8925
|
decodedToken: decodedToken
|
|
8809
8926
|
});
|
|
8810
8927
|
}
|
|
8811
8928
|
async loginWithCustomTokenExchange(options) {
|
|
8812
|
-
return this._requestToken(
|
|
8929
|
+
return this._requestToken(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
8813
8930
|
grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
|
|
8814
8931
|
subject_token: options.subject_token,
|
|
8815
8932
|
subject_token_type: options.subject_token_type,
|
|
@@ -8843,10 +8960,10 @@ class Auth0Client {
|
|
|
8843
8960
|
return new Fetcher(config, {
|
|
8844
8961
|
isDpopEnabled: () => !!this.options.useDpop,
|
|
8845
8962
|
getAccessToken: authParams => {
|
|
8846
|
-
var
|
|
8963
|
+
var _authParams$scope;
|
|
8847
8964
|
return this.getTokenSilently({
|
|
8848
8965
|
authorizationParams: {
|
|
8849
|
-
scope:
|
|
8966
|
+
scope: authParams === null || authParams === void 0 || (_authParams$scope = authParams.scope) === null || _authParams$scope === void 0 ? void 0 : _authParams$scope.join(" "),
|
|
8850
8967
|
audience: authParams === null || authParams === void 0 ? void 0 : authParams.audience
|
|
8851
8968
|
},
|
|
8852
8969
|
detailedResponse: true
|
|
@@ -8882,7 +8999,7 @@ class Auth0Client {
|
|
|
8882
8999
|
redirect_uri: redirectUri,
|
|
8883
9000
|
appState: appState,
|
|
8884
9001
|
connection: connection,
|
|
8885
|
-
response_type:
|
|
9002
|
+
response_type: ResponseType.ConnectCode
|
|
8886
9003
|
});
|
|
8887
9004
|
const url = new URL(connect_uri);
|
|
8888
9005
|
url.searchParams.set("ticket", connect_params.ticket);
|
|
@@ -8893,8 +9010,8 @@ class Auth0Client {
|
|
|
8893
9010
|
}
|
|
8894
9011
|
}
|
|
8895
9012
|
async _requestTokenForMfa(options, additionalParameters) {
|
|
8896
|
-
const {mfaToken: mfaToken} = options, restOptions =
|
|
8897
|
-
return this._requestToken(
|
|
9013
|
+
const {mfaToken: mfaToken} = options, restOptions = _objectWithoutProperties(options, _excluded7);
|
|
9014
|
+
return this._requestToken(_objectSpread2(_objectSpread2({}, restOptions), {}, {
|
|
8898
9015
|
mfa_token: mfaToken
|
|
8899
9016
|
}), additionalParameters);
|
|
8900
9017
|
}
|
|
@@ -8946,6 +9063,8 @@ exports.PopupOpenError = PopupOpenError;
|
|
|
8946
9063
|
|
|
8947
9064
|
exports.PopupTimeoutError = PopupTimeoutError;
|
|
8948
9065
|
|
|
9066
|
+
exports.ResponseType = ResponseType;
|
|
9067
|
+
|
|
8949
9068
|
exports.TimeoutError = TimeoutError;
|
|
8950
9069
|
|
|
8951
9070
|
exports.UseDpopNonceError = UseDpopNonceError;
|