@auth0/auth0-spa-js 2.18.0 → 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/dist/auth0-spa-js.development.js +394 -297
- 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 +417 -317
- package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
- package/package.json +4 -3
- package/src/Auth0Client.ts +10 -7
- package/src/index.ts +6 -3
- package/src/utils.ts +2 -1
- package/src/version.ts +1 -1
- package/dist/typings/Auth0Client.d.ts +0 -439
- 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 -819
- 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.18.
|
|
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
|
}
|
|
@@ -269,7 +414,7 @@ const createRandomString = () => {
|
|
|
269
414
|
|
|
270
415
|
const encode$2 = value => btoa(value);
|
|
271
416
|
|
|
272
|
-
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), {}, {
|
|
273
418
|
[key]: params[key]
|
|
274
419
|
}), {});
|
|
275
420
|
|
|
@@ -298,9 +443,9 @@ const stripAuth0Client = function stripAuth0Client(auth0Client) {
|
|
|
298
443
|
}, {});
|
|
299
444
|
};
|
|
300
445
|
|
|
301
|
-
const createQueryParams =
|
|
302
|
-
|
|
303
|
-
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({
|
|
304
449
|
client_id: client_id
|
|
305
450
|
}, params))).toString();
|
|
306
451
|
};
|
|
@@ -360,8 +505,8 @@ const parseNumber = value => {
|
|
|
360
505
|
return parseInt(value, 10) || undefined;
|
|
361
506
|
};
|
|
362
507
|
|
|
363
|
-
const fromEntries = iterable => [ ...iterable ].reduce((obj,
|
|
364
|
-
let [key, val] =
|
|
508
|
+
const fromEntries = iterable => [ ...iterable ].reduce((obj, _ref2) => {
|
|
509
|
+
let [key, val] = _ref2;
|
|
365
510
|
obj[key] = val;
|
|
366
511
|
return obj;
|
|
367
512
|
}, {});
|
|
@@ -922,7 +1067,9 @@ class WebLocksApiManager {
|
|
|
922
1067
|
|
|
923
1068
|
class LegacyLockManager {
|
|
924
1069
|
constructor() {
|
|
925
|
-
this
|
|
1070
|
+
_defineProperty(this, "lock", void 0);
|
|
1071
|
+
_defineProperty(this, "activeLocks", new Set);
|
|
1072
|
+
_defineProperty(this, "pagehideHandler", void 0);
|
|
926
1073
|
this.lock = new _default;
|
|
927
1074
|
this.pagehideHandler = () => {
|
|
928
1075
|
this.activeLocks.forEach(key => this.lock.releaseLock(key));
|
|
@@ -955,8 +1102,8 @@ class LegacyLockManager {
|
|
|
955
1102
|
}
|
|
956
1103
|
|
|
957
1104
|
function isWebLocksSupported() {
|
|
958
|
-
var
|
|
959
|
-
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";
|
|
960
1107
|
}
|
|
961
1108
|
|
|
962
1109
|
function createLockManager() {
|
|
@@ -1326,6 +1473,8 @@ const sendMessage = (message, to) => new Promise(function(resolve, reject) {
|
|
|
1326
1473
|
to.postMessage(message, [ messageChannel.port2 ]);
|
|
1327
1474
|
});
|
|
1328
1475
|
|
|
1476
|
+
const _excluded$4 = [ "error", "error_description" ];
|
|
1477
|
+
|
|
1329
1478
|
const createAbortController = () => new AbortController;
|
|
1330
1479
|
|
|
1331
1480
|
const dofetch = async (fetchUrl, fetchOptions) => {
|
|
@@ -1380,7 +1529,7 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
1380
1529
|
method: options.method || "GET",
|
|
1381
1530
|
nonce: await dpop.getNonce()
|
|
1382
1531
|
});
|
|
1383
|
-
options.headers =
|
|
1532
|
+
options.headers = _objectSpread2(_objectSpread2({}, options.headers), {}, {
|
|
1384
1533
|
dpop: dpopProof
|
|
1385
1534
|
});
|
|
1386
1535
|
}
|
|
@@ -1398,7 +1547,7 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
1398
1547
|
if (fetchError) {
|
|
1399
1548
|
throw fetchError;
|
|
1400
1549
|
}
|
|
1401
|
-
const
|
|
1550
|
+
const {json: {error: error, error_description: error_description}, headers: headers, ok: ok} = response, data = _objectWithoutProperties(response.json, _excluded$4);
|
|
1402
1551
|
let newDpopNonce;
|
|
1403
1552
|
if (dpop) {
|
|
1404
1553
|
newDpopNonce = headers[DPOP_NONCE_HEADER];
|
|
@@ -1425,11 +1574,13 @@ async function getJSON(url, timeout, audience, scope, options, worker, useFormDa
|
|
|
1425
1574
|
return data;
|
|
1426
1575
|
}
|
|
1427
1576
|
|
|
1428
|
-
|
|
1429
|
-
|
|
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);
|
|
1430
1581
|
const isTokenExchange = options.grant_type === "urn:ietf:params:oauth:grant-type:token-exchange";
|
|
1431
1582
|
const refreshWithMrrt = options.grant_type === "refresh_token" && useMrrt;
|
|
1432
|
-
const allParams =
|
|
1583
|
+
const allParams = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, options), isTokenExchange && audience && {
|
|
1433
1584
|
audience: audience
|
|
1434
1585
|
}), isTokenExchange && scope && {
|
|
1435
1586
|
scope: scope
|
|
@@ -1498,6 +1649,9 @@ class CacheKey {
|
|
|
1498
1649
|
let suffix = arguments.length > 2 ? arguments[2] : undefined;
|
|
1499
1650
|
this.prefix = prefix;
|
|
1500
1651
|
this.suffix = suffix;
|
|
1652
|
+
_defineProperty(this, "clientId", void 0);
|
|
1653
|
+
_defineProperty(this, "scope", void 0);
|
|
1654
|
+
_defineProperty(this, "audience", void 0);
|
|
1501
1655
|
this.clientId = data.clientId;
|
|
1502
1656
|
this.scope = data.scope;
|
|
1503
1657
|
this.audience = data.audience;
|
|
@@ -1547,7 +1701,7 @@ class LocalStorageCache {
|
|
|
1547
1701
|
|
|
1548
1702
|
class InMemoryCache {
|
|
1549
1703
|
constructor() {
|
|
1550
|
-
this
|
|
1704
|
+
_defineProperty(this, "enclosedCache", function() {
|
|
1551
1705
|
let cache = {};
|
|
1552
1706
|
return {
|
|
1553
1707
|
set(key, entry) {
|
|
@@ -1567,7 +1721,7 @@ class InMemoryCache {
|
|
|
1567
1721
|
return Object.keys(cache);
|
|
1568
1722
|
}
|
|
1569
1723
|
};
|
|
1570
|
-
}();
|
|
1724
|
+
}());
|
|
1571
1725
|
}
|
|
1572
1726
|
}
|
|
1573
1727
|
|
|
@@ -1577,16 +1731,17 @@ class CacheManager {
|
|
|
1577
1731
|
constructor(cache, keyManifest, nowProvider) {
|
|
1578
1732
|
this.cache = cache;
|
|
1579
1733
|
this.keyManifest = keyManifest;
|
|
1734
|
+
_defineProperty(this, "nowProvider", void 0);
|
|
1580
1735
|
this.nowProvider = nowProvider || DEFAULT_NOW_PROVIDER;
|
|
1581
1736
|
}
|
|
1582
1737
|
async setIdToken(clientId, idToken, decodedToken) {
|
|
1583
|
-
var
|
|
1738
|
+
var _this$keyManifest;
|
|
1584
1739
|
const cacheKey = this.getIdTokenCacheKey(clientId);
|
|
1585
1740
|
await this.cache.set(cacheKey, {
|
|
1586
1741
|
id_token: idToken,
|
|
1587
1742
|
decodedToken: decodedToken
|
|
1588
1743
|
});
|
|
1589
|
-
await ((
|
|
1744
|
+
await ((_this$keyManifest = this.keyManifest) === null || _this$keyManifest === void 0 ? void 0 : _this$keyManifest.add(cacheKey));
|
|
1590
1745
|
}
|
|
1591
1746
|
async getIdToken(cacheKey) {
|
|
1592
1747
|
const entry = await this.cache.get(this.getIdTokenCacheKey(cacheKey.clientId));
|
|
@@ -1615,7 +1770,6 @@ class CacheManager {
|
|
|
1615
1770
|
let expiryAdjustmentSeconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_EXPIRY_ADJUSTMENT_SECONDS;
|
|
1616
1771
|
let useMrrt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1617
1772
|
let cacheMode = arguments.length > 3 ? arguments[3] : undefined;
|
|
1618
|
-
var _a;
|
|
1619
1773
|
let wrappedEntry = await this.cache.get(cacheKey.toKey());
|
|
1620
1774
|
if (!wrappedEntry) {
|
|
1621
1775
|
const keys = await this.getCacheKeys();
|
|
@@ -1634,11 +1788,12 @@ class CacheManager {
|
|
|
1634
1788
|
const now = await this.nowProvider();
|
|
1635
1789
|
const nowSeconds = Math.floor(now / 1e3);
|
|
1636
1790
|
if (wrappedEntry.expiresAt - expiryAdjustmentSeconds < nowSeconds) {
|
|
1791
|
+
var _this$keyManifest2;
|
|
1637
1792
|
if (wrappedEntry.body.refresh_token) {
|
|
1638
1793
|
return this.modifiedCachedEntry(wrappedEntry, cacheKey);
|
|
1639
1794
|
}
|
|
1640
1795
|
await this.cache.remove(cacheKey.toKey());
|
|
1641
|
-
await ((
|
|
1796
|
+
await ((_this$keyManifest2 = this.keyManifest) === null || _this$keyManifest2 === void 0 ? void 0 : _this$keyManifest2.remove(cacheKey.toKey()));
|
|
1642
1797
|
return;
|
|
1643
1798
|
}
|
|
1644
1799
|
return wrappedEntry.body;
|
|
@@ -1657,7 +1812,7 @@ class CacheManager {
|
|
|
1657
1812
|
};
|
|
1658
1813
|
}
|
|
1659
1814
|
async set(entry) {
|
|
1660
|
-
var
|
|
1815
|
+
var _this$keyManifest3;
|
|
1661
1816
|
const cacheKey = new CacheKey({
|
|
1662
1817
|
clientId: entry.client_id,
|
|
1663
1818
|
scope: entry.scope,
|
|
@@ -1665,7 +1820,7 @@ class CacheManager {
|
|
|
1665
1820
|
});
|
|
1666
1821
|
const wrappedEntry = await this.wrapCacheEntry(entry);
|
|
1667
1822
|
await this.cache.set(cacheKey.toKey(), wrappedEntry);
|
|
1668
|
-
await ((
|
|
1823
|
+
await ((_this$keyManifest3 = this.keyManifest) === null || _this$keyManifest3 === void 0 ? void 0 : _this$keyManifest3.add(cacheKey.toKey()));
|
|
1669
1824
|
}
|
|
1670
1825
|
async remove(client_id, audience, scope) {
|
|
1671
1826
|
const cacheKey = new CacheKey({
|
|
@@ -1676,14 +1831,14 @@ class CacheManager {
|
|
|
1676
1831
|
await this.cache.remove(cacheKey.toKey());
|
|
1677
1832
|
}
|
|
1678
1833
|
async clear(clientId) {
|
|
1679
|
-
var
|
|
1834
|
+
var _this$keyManifest4;
|
|
1680
1835
|
const keys = await this.getCacheKeys();
|
|
1681
1836
|
if (!keys) return;
|
|
1682
1837
|
await keys.filter(key => clientId ? key.includes(clientId) : true).reduce(async (memo, key) => {
|
|
1683
1838
|
await memo;
|
|
1684
1839
|
await this.cache.remove(key);
|
|
1685
1840
|
}, Promise.resolve());
|
|
1686
|
-
await ((
|
|
1841
|
+
await ((_this$keyManifest4 = this.keyManifest) === null || _this$keyManifest4 === void 0 ? void 0 : _this$keyManifest4.clear());
|
|
1687
1842
|
}
|
|
1688
1843
|
async wrapCacheEntry(entry) {
|
|
1689
1844
|
const now = await this.nowProvider();
|
|
@@ -1694,9 +1849,9 @@ class CacheManager {
|
|
|
1694
1849
|
};
|
|
1695
1850
|
}
|
|
1696
1851
|
async getCacheKeys() {
|
|
1697
|
-
var _a;
|
|
1698
1852
|
if (this.keyManifest) {
|
|
1699
|
-
|
|
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;
|
|
1700
1855
|
} else if (this.cache.allKeys) {
|
|
1701
1856
|
return this.cache.allKeys();
|
|
1702
1857
|
}
|
|
@@ -1708,21 +1863,21 @@ class CacheManager {
|
|
|
1708
1863
|
}
|
|
1709
1864
|
matchExistingCacheKey(keyToMatch, allKeys) {
|
|
1710
1865
|
return allKeys.filter(key => {
|
|
1711
|
-
var
|
|
1866
|
+
var _keyToMatch$scope;
|
|
1712
1867
|
const cacheKey = CacheKey.fromKey(key);
|
|
1713
1868
|
const scopeSet = new Set(cacheKey.scope && cacheKey.scope.split(" "));
|
|
1714
|
-
const scopesToMatch = ((
|
|
1869
|
+
const scopesToMatch = ((_keyToMatch$scope = keyToMatch.scope) === null || _keyToMatch$scope === void 0 ? void 0 : _keyToMatch$scope.split(" ")) || [];
|
|
1715
1870
|
const hasAllScopes = cacheKey.scope && scopesToMatch.reduce((acc, current) => acc && scopeSet.has(current), true);
|
|
1716
1871
|
return cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId && cacheKey.audience === keyToMatch.audience && hasAllScopes;
|
|
1717
1872
|
})[0];
|
|
1718
1873
|
}
|
|
1719
1874
|
async getEntryWithRefreshToken(keyToMatch, allKeys) {
|
|
1720
|
-
var _a;
|
|
1721
1875
|
for (const key of allKeys) {
|
|
1722
1876
|
const cacheKey = CacheKey.fromKey(key);
|
|
1723
1877
|
if (cacheKey.prefix === CACHE_KEY_PREFIX && cacheKey.clientId === keyToMatch.clientId) {
|
|
1878
|
+
var _cachedEntry$body;
|
|
1724
1879
|
const cachedEntry = await this.cache.get(key);
|
|
1725
|
-
if (
|
|
1880
|
+
if (cachedEntry !== null && cachedEntry !== void 0 && (_cachedEntry$body = cachedEntry.body) !== null && _cachedEntry$body !== void 0 && _cachedEntry$body.refresh_token) {
|
|
1726
1881
|
return this.modifiedCachedEntry(cachedEntry, keyToMatch);
|
|
1727
1882
|
}
|
|
1728
1883
|
}
|
|
@@ -1730,12 +1885,12 @@ class CacheManager {
|
|
|
1730
1885
|
return undefined;
|
|
1731
1886
|
}
|
|
1732
1887
|
async updateEntry(oldRefreshToken, newRefreshToken) {
|
|
1733
|
-
var _a;
|
|
1734
1888
|
const allKeys = await this.getCacheKeys();
|
|
1735
1889
|
if (!allKeys) return;
|
|
1736
1890
|
for (const key of allKeys) {
|
|
1891
|
+
var _entry$body;
|
|
1737
1892
|
const entry = await this.cache.get(key);
|
|
1738
|
-
if ((
|
|
1893
|
+
if ((entry === null || entry === void 0 || (_entry$body = entry.body) === null || _entry$body === void 0 ? void 0 : _entry$body.refresh_token) === oldRefreshToken) {
|
|
1739
1894
|
entry.body.refresh_token = newRefreshToken;
|
|
1740
1895
|
await this.cache.set(key, entry);
|
|
1741
1896
|
}
|
|
@@ -1750,6 +1905,7 @@ class TransactionManager {
|
|
|
1750
1905
|
this.storage = storage;
|
|
1751
1906
|
this.clientId = clientId;
|
|
1752
1907
|
this.cookieDomain = cookieDomain;
|
|
1908
|
+
_defineProperty(this, "storageKey", void 0);
|
|
1753
1909
|
this.storageKey = "".concat(TRANSACTION_STORAGE_KEY_PREFIX, ".").concat(this.clientId);
|
|
1754
1910
|
}
|
|
1755
1911
|
create(transaction) {
|
|
@@ -1990,17 +2146,17 @@ const CookieStorage = {
|
|
|
1990
2146
|
sameSite: "none"
|
|
1991
2147
|
};
|
|
1992
2148
|
}
|
|
1993
|
-
if (options
|
|
2149
|
+
if (options !== null && options !== void 0 && options.daysUntilExpire) {
|
|
1994
2150
|
cookieAttributes.expires = options.daysUntilExpire;
|
|
1995
2151
|
}
|
|
1996
|
-
if (options
|
|
2152
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
1997
2153
|
cookieAttributes.domain = options.cookieDomain;
|
|
1998
2154
|
}
|
|
1999
2155
|
set_1(key, JSON.stringify(value), cookieAttributes);
|
|
2000
2156
|
},
|
|
2001
2157
|
remove(key, options) {
|
|
2002
2158
|
let cookieAttributes = {};
|
|
2003
|
-
if (options
|
|
2159
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
2004
2160
|
cookieAttributes.domain = options.cookieDomain;
|
|
2005
2161
|
}
|
|
2006
2162
|
remove_1(key, cookieAttributes);
|
|
@@ -2024,10 +2180,10 @@ const CookieStorageWithLegacySameSite = {
|
|
|
2024
2180
|
secure: true
|
|
2025
2181
|
};
|
|
2026
2182
|
}
|
|
2027
|
-
if (options
|
|
2183
|
+
if (options !== null && options !== void 0 && options.daysUntilExpire) {
|
|
2028
2184
|
cookieAttributes.expires = options.daysUntilExpire;
|
|
2029
2185
|
}
|
|
2030
|
-
if (options
|
|
2186
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
2031
2187
|
cookieAttributes.domain = options.cookieDomain;
|
|
2032
2188
|
}
|
|
2033
2189
|
set_1("".concat(LEGACY_PREFIX).concat(key), JSON.stringify(value), cookieAttributes);
|
|
@@ -2035,7 +2191,7 @@ const CookieStorageWithLegacySameSite = {
|
|
|
2035
2191
|
},
|
|
2036
2192
|
remove(key, options) {
|
|
2037
2193
|
let cookieAttributes = {};
|
|
2038
|
-
if (options
|
|
2194
|
+
if (options !== null && options !== void 0 && options.cookieDomain) {
|
|
2039
2195
|
cookieAttributes.domain = options.cookieDomain;
|
|
2040
2196
|
}
|
|
2041
2197
|
remove_1(key, cookieAttributes);
|
|
@@ -2063,14 +2219,36 @@ const SessionStorage = {
|
|
|
2063
2219
|
}
|
|
2064
2220
|
};
|
|
2065
2221
|
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
(function(ResponseType) {
|
|
2222
|
+
let ResponseType = function(ResponseType) {
|
|
2069
2223
|
ResponseType["Code"] = "code";
|
|
2070
2224
|
ResponseType["ConnectCode"] = "connect_code";
|
|
2071
|
-
|
|
2225
|
+
return ResponseType;
|
|
2226
|
+
}({});
|
|
2072
2227
|
|
|
2073
|
-
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
|
+
}
|
|
2074
2252
|
|
|
2075
2253
|
function decodeBase64$1(base64, enableUnicode) {
|
|
2076
2254
|
var binaryString = atob(base64);
|
|
@@ -2104,7 +2282,7 @@ function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
|
2104
2282
|
};
|
|
2105
2283
|
}
|
|
2106
2284
|
|
|
2107
|
-
var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBjbGFzcyBHZW5lcmljRXJyb3IgZXh0ZW5kcyBFcnJvciB7CiAgICAgICAgY29uc3RydWN0b3IoZXJyb3IsIGVycm9yX2Rlc2NyaXB0aW9uKSB7CiAgICAgICAgICAgIHN1cGVyKGVycm9yX2Rlc2NyaXB0aW9uKTsKICAgICAgICAgICAgdGhpcy5lcnJvciA9IGVycm9yOwogICAgICAgICAgICB0aGlzLmVycm9yX2Rlc2NyaXB0aW9uID0gZXJyb3JfZGVzY3JpcHRpb247CiAgICAgICAgICAgIE9iamVjdC5zZXRQcm90b3R5cGVPZih0aGlzLCBHZW5lcmljRXJyb3IucHJvdG90eXBlKTsKICAgICAgICB9CiAgICAgICAgc3RhdGljIGZyb21QYXlsb2FkKF9yZWYpIHsKICAgICAgICAgICAgbGV0IHtlcnJvcjogZXJyb3IsIGVycm9yX2Rlc2NyaXB0aW9uOiBlcnJvcl9kZXNjcmlwdGlvbn0gPSBfcmVmOwogICAgICAgICAgICByZXR1cm4gbmV3IEdlbmVyaWNFcnJvcihlcnJvciwgZXJyb3JfZGVzY3JpcHRpb24pOwogICAgICAgIH0KICAgIH0KICAgIGNsYXNzIE1pc3NpbmdSZWZyZXNoVG9rZW5FcnJvciBleHRlbmRzIEdlbmVyaWNFcnJvciB7C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QocmVzb2x2ZSwgdGltZSkpOwogICAgY29uc3QgZm9ybURhdGFUb09iamVjdCA9IGZvcm1EYXRhID0+IHsKICAgICAgICBjb25zdCBxdWVyeVBhcmFtcyA9IG5ldyBVUkxTZWFyY2hQYXJhbXMoZm9ybURhdGEpOwogICAgICAgIGNvbnN0IHBhcnNlZFF1ZXJ5ID0ge307CiAgICAgICAgcXVlcnlQYXJhbXMuZm9yRWFjaCgodmFsLCBrZXkpID0+IHsKICAgICAgICAgICAgcGFyc2VkUXVlcnlba2V5XSA9IHZhbDsKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gcGFyc2VkUXVlcnk7CiAgICB9OwogICAgY29uc3QgdXBkYXRlUmVmcmVzaFRva2VucyA9IChvbGRSZWZyZXNoVG9rZW4sIG5ld1JlZnJlc2hUb2tlbikgPT4gewogICAgICAgIE9iamVjdC5lbnRyaWVzKHJlZnJlc2hUb2tlbnMpLmZvckVhY2goX3JlZiA9PiB7CiAgICAgICAgICAgIGxldCBba2V5LCB0b2tlbl0gPSBfcmVmOwogICAgICAgICAgICBpZiAodG9rZW4gPT09IG9sZFJlZnJlc2hUb2tlbikgewogICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1trZXldID0gbmV3UmVmcmVzaFRva2VuOwogICAgICAgICAgICB9CiAgICAgICAgfSk7CiAgICB9OwogICAgY29uc3QgY2hlY2tEb3duc2NvcGluZyA9IChzY29wZSwgYXVkaWVuY2UpID0+IHsKICAgICAgICBjb25zdCBmaW5kQ29pbmNpZGVuY2UgPSBPYmplY3Qua2V5cyhyZWZyZXNoVG9rZW5zKS5maW5kKGtleSA9PiB7CiAgICAgICAgICAgIGlmIChrZXkgIT09ICJsYXRlc3RfcmVmcmVzaF90b2tlbiIpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGlzU2FtZUF1ZGllbmNlID0gY2FjaGVLZXlDb250YWluc0F1ZGllbmNlKGF1ZGllbmNlLCBrZXkpOwogICAgICAgICAgICAgICAgY29uc3Qgc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lbiAmJiBib2R5LmdyYW50X3R5cGUgPT09ICJyZWZyZXNoX3Rva2VuIikgewogICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gZ2V0UmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBpZiAoIXJlZnJlc2hUb2tlbiAmJiB1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgY29uc3QgbGF0ZXN0UmVmcmVzaFRva2VuID0gcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXTsKICAgICAgICAgICAgICAgICAgICBjb25zdCBpc0Rvd25zY29waW5nID0gY2hlY2tEb3duc2NvcGluZyhzY29wZSwgYXVkaWVuY2UpOwogICAgICAgICAgICAgICAgICAgIGlmIChsYXRlc3RSZWZyZXNoVG9rZW4gJiYgIWlzRG93bnNjb3BpbmcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2VuID0gbGF0ZXN0UmVmcmVzaFRva2VuOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGlmICghcmVmcmVzaFRva2VuKSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE1pc3NpbmdSZWZyZXNoVG9rZW5FcnJvcihhdWRpZW5jZSwgc2NvcGUpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLmJvZHkgPSB1c2VGb3JtRGF0YSA/IGNyZWF0ZVF1ZXJ5UGFyYW1zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgYm9keSksIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKSA6IEpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgYm9keSksIHsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoX3Rva2VuOiByZWZyZXNoVG9rZW4KICAgICAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZXQgYWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICBpZiAodHlwZW9mIEFib3J0Q29udHJvbGxlciA9PT0gImZ1bmN0aW9uIikgewogICAgICAgICAgICAgICAgYWJvcnRDb250cm9sbGVyID0gbmV3IEFib3J0Q29udHJvbGxlcjsKICAgICAgICAgICAgICAgIGZldGNoT3B0aW9ucy5zaWduYWwgPSBhYm9ydENvbnRyb2xsZXIuc2lnbmFsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCByZXNwb25zZTsKICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgIHJlc3BvbnNlID0gYXdhaXQgUHJvbWlzZS5yYWNlKFsgd2FpdCh0aW1lb3V0KSwgZmV0Y2goZmV0Y2hVcmwsIE9iamVjdC5hc3NpZ24oe30sIGZldGNoT3B0aW9ucykpIF0pOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCciCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXJzID0gZnJvbUVudHJpZXMocmVzcG9uc2UuaGVhZGVycyk7CiAgICAgICAgICAgIGpzb24gPSBhd2FpdCByZXNwb25zZS5qc29uKCk7CiAgICAgICAgICAgIGlmIChqc29uLnJlZnJlc2hfdG9rZW4pIHsKICAgICAgICAgICAgICAgIGlmICh1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXSA9IGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgICAgICAgICB1cGRhdGVSZWZyZXNoVG9rZW5zKHJlZnJlc2hUb2tlbiwganNvbi5yZWZyZXNoX3Rva2VuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUb2tlbihqc29uLnJlZnJlc2hfdG9rZW4sIGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBkZWxldGUganNvbi5yZWZyZXNoX3Rva2VuOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZGVsZXRlUmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogcmVzcG9uc2Uub2ssCiAgICAgICAgICAgICAgICBqc29uOiBqc29uLAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIG9rOiBmYWxzZSwKICAgICAgICAgICAgICAgIGpzb246IHsKICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IuZXJyb3IsCiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzCiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgIH07CiAgICB7CiAgICAgICAgYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIG1lc3NhZ2VIYW5kbGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
|
|
2285
|
+
var WorkerFactory = createBase64WorkerFactory("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKSB7CiAgICAidXNlIHN0cmljdCI7CiAgICBmdW5jdGlvbiBfZGVmaW5lUHJvcGVydHkoZSwgciwgdCkgewogICAgICAgIHJldHVybiAociA9IF90b1Byb3BlcnR5S2V5KHIpKSBpbiBlID8gT2JqZWN0LmRlZmluZVByb3BlcnR5KGUsIHIsIHsKICAgICAgICAgICAgdmFsdWU6IHQsCiAgICAgICAgICAgIGVudW1lcmFibGU6ICEwLAogICAgICAgICAgICBjb25maWd1cmFibGU6ICEwLAogICAgICAgICAgICB3cml0YWJsZTogITAKICAgICAgICB9KSA6IGVbcl0gPSB0LCBlOwogICAgfQogICAgZnVuY3Rpb24gb3duS2V5cyhlLCByKSB7CiAgICAgICAgdmFyIHQgPSBPYmplY3Qua2V5cyhlKTsKICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scykgewogICAgICAgICAgICB2YXIgbyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7CiAgICAgICAgICAgIHIgJiYgKG8gPSBvLmZpbHRlcihmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihlLCByKS5lbnVtZXJhYmxlOwogICAgICAgICAgICB9KSksIHQucHVzaC5hcHBseSh0LCBvKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHQ7CiAgICB9CiAgICBmdW5jdGlvbiBfb2JqZWN0U3ByZWFkMihlKSB7CiAgICAgICAgZm9yICh2YXIgciA9IDE7IHIgPCBhcmd1bWVudHMubGVuZ3RoOyByKyspIHsKICAgICAgICAgICAgdmFyIHQgPSBudWxsICE9IGFyZ3VtZW50c1tyXSA/IGFyZ3VtZW50c1tyXSA6IHt9OwogICAgICAgICAgICByICUgMiA/IG93bktleXMoT2JqZWN0KHQpLCAhMCkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBfZGVmaW5lUHJvcGVydHkoZSwgciwgdFtyXSk7CiAgICAgICAgICAgIH0pIDogT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhlLCBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyh0KSkgOiBvd25LZXlzKE9iamVjdCh0KSkuZm9yRWFjaChmdW5jdGlvbihyKSB7CiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwgciwgT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LCByKSk7CiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gZTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllcyhlLCB0KSB7CiAgICAgICAgaWYgKG51bGwgPT0gZSkgcmV0dXJuIHt9OwogICAgICAgIHZhciBvLCByLCBpID0gX29iamVjdFdpdGhvdXRQcm9wZXJ0aWVzTG9vc2UoZSwgdCk7CiAgICAgICAgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpIHsKICAgICAgICAgICAgdmFyIG4gPSBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKGUpOwogICAgICAgICAgICBmb3IgKHIgPSAwOyByIDwgbi5sZW5ndGg7IHIrKykgbyA9IG5bcl0sIC0xID09PSB0LmluZGV4T2YobykgJiYge30ucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLCBvKSAmJiAoaVtvXSA9IGVbb10pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gaTsKICAgIH0KICAgIGZ1bmN0aW9uIF9vYmplY3RXaXRob3V0UHJvcGVydGllc0xvb3NlKHIsIGUpIHsKICAgICAgICBpZiAobnVsbCA9PSByKSByZXR1cm4ge307CiAgICAgICAgdmFyIHQgPSB7fTsKICAgICAgICBmb3IgKHZhciBuIGluIHIpIGlmICh7fS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHIsIG4pKSB7CiAgICAgICAgICAgIGlmICgtMSAhPT0gZS5pbmRleE9mKG4pKSBjb250aW51ZTsKICAgICAgICAgICAgdFtuXSA9IHJbbl07CiAgICAgICAgfQogICAgICAgIHJldHVybiB0OwogICAgfQogICAgZnVuY3Rpb24gX3RvUHJpbWl0aXZlKHQsIHIpIHsKICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIHQgfHwgIXQpIHJldHVybiB0OwogICAgICAgIHZhciBlID0gdFtTeW1ib2wudG9QcmltaXRpdmVdOwogICAgICAgIGlmICh2b2lkIDAgIT09IGUpIHsKICAgICAgICAgICAgdmFyIGkgPSBlLmNhbGwodCwgciB8fCAiZGVmYXVsdCIpOwogICAgICAgICAgICBpZiAoIm9iamVjdCIgIT0gdHlwZW9mIGkpIHJldHVybiBpOwogICAgICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpOwogICAgICAgIH0KICAgICAgICByZXR1cm4gKCJzdHJpbmciID09PSByID8gU3RyaW5nIDogTnVtYmVyKSh0KTsKICAgIH0KICAgIGZ1bmN0aW9uIF90b1Byb3BlcnR5S2V5KHQpIHsKICAgICAgICB2YXIgaSA9IF90b1ByaW1pdGl2ZSh0LCAic3RyaW5nIik7CiAgICAgICAgcmV0dXJuICJzeW1ib2wiID09IHR5cGVvZiBpID8gaSA6IGkgKyAiIj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N0IHF1ZXJ5UGFyYW1zID0gbmV3IFVSTFNlYXJjaFBhcmFtcyhmb3JtRGF0YSk7CiAgICAgICAgY29uc3QgcGFyc2VkUXVlcnkgPSB7fTsKICAgICAgICBxdWVyeVBhcmFtcy5mb3JFYWNoKCh2YWwsIGtleSkgPT4gewogICAgICAgICAgICBwYXJzZWRRdWVyeVtrZXldID0gdmFsOwogICAgICAgIH0pOwogICAgICAgIHJldHVybiBwYXJzZWRRdWVyeTsKICAgIH07CiAgICBjb25zdCB1cGRhdGVSZWZyZXNoVG9rZW5zID0gKG9sZFJlZnJlc2hUb2tlbiwgbmV3UmVmcmVzaFRva2VuKSA9PiB7CiAgICAgICAgT2JqZWN0LmVudHJpZXMocmVmcmVzaFRva2VucykuZm9yRWFjaChfcmVmID0+IHsKICAgICAgICAgICAgbGV0IFtrZXksIHRva2VuXSA9IF9yZWY7CiAgICAgICAgICAgIGlmICh0b2tlbiA9PT0gb2xkUmVmcmVzaFRva2VuKSB7CiAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW5zW2tleV0gPSBuZXdSZWZyZXNoVG9rZW47CiAgICAgICAgICAgIH0KICAgICAgICB9KTsKICAgIH07CiAgICBjb25zdCBjaGVja0Rvd25zY29waW5nID0gKHNjb3BlLCBhdWRpZW5jZSkgPT4gewogICAgICAgIGNvbnN0IGZpbmRDb2luY2lkZW5jZSA9IE9iamVjdC5rZXlzKHJlZnJlc2hUb2tlbnMpLmZpbmQoa2V5ID0+IHsKICAgICAgICAgICAgaWYgKGtleSAhPT0gImxhdGVzdF9yZWZyZXNoX3Rva2VuIikgewogICAgICAgICAgICAgICAgY29uc3QgaXNTYW1lQXVkaWVuY2UgPSBjYWNoZUtleUNvbnRhaW5zQXVkaWVuY2UoYXVkaWVuY2UsIGtleSk7CiAgICAgICAgICAgICAgICBjb25zdCBzY29wZXNLZXkgPSBrZXkuc3BsaXQoInwiKVsxXS5zcGxpdCgiICIpOwogICAgICAgICAgICAgICAgY29uc3QgcmVxdWV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AgICByZWZyZXNoVG9rZW4gPSBnZXRSZWZyZXNoVG9rZW4oYXVkaWVuY2UsIHNjb3BlKTsKICAgICAgICAgICAgICAgIGlmICghcmVmcmVzaFRva2VuICYmIHVzZU1ycnQpIHsKICAgICAgICAgICAgICAgICAgICBjb25zdCBsYXRlc3RSZWZyZXNoVG9rZW4gPSByZWZyZXNoVG9rZW5zWyJsYXRlc3RfcmVmcmVzaF90b2tlbiJdOwogICAgICAgICAgICAgICAgICAgIGNvbnN0IGlzRG93bnNjb3BpbmcgPSBjaGVja0Rvd25zY29waW5nKHNjb3BlLCBhdWRpZW5jZSk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGxhdGVzdFJlZnJlc2hUb2tlbiAmJiAhaXNEb3duc2NvcGluZykgewogICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoVG9rZW4gPSBsYXRlc3RSZWZyZXNoVG9rZW47CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYgKCFyZWZyZXNoVG9rZW4pIHsKICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTWlzc2luZ1JlZnJlc2hUb2tlbkVycm9yKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmZXRjaE9wdGlvbnMuYm9keSA9IHVzZUZvcm1EYXRhID8gY3JlYXRlUXVlcnlQYXJhbXMoX29iamVjdFNwcmVhZDIoX29iamVjdFNwcmVhZDIoe30sIGJvZHkpLCB7fSwgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHJlZnJlc2hUb2tlbgogICAgICAgICAgICAgICAgfSkpIDogSlNPTi5zdHJpbmdpZnkoX29iamVjdFNwcmVhZDIoX29iamVjdFNwcmVhZDIoe30sIGJvZHkpLCB7fSwgewogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHJlZnJlc2hUb2tlbgogICAgICAgICAgICAgICAgfSkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGxldCBhYm9ydENvbnRyb2xsZXI7CiAgICAgICAgICAgIGlmICh0eXBlb2YgQWJvcnRDb250cm9sbGVyID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICAgICAgICBhYm9ydENvbnRyb2xsZXIgPSBuZXcgQWJvcnRDb250cm9sbGVyOwogICAgICAgICAgICAgICAgZmV0Y2hPcHRpb25zLnNpZ25hbCA9IGFib3J0Q29udHJvbGxlci5zaWduYWw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbGV0IHJlc3BvbnNlOwogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgcmVzcG9uc2UgPSBhd2FpdCBQcm9taXNlLnJhY2UoWyB3YWl0KHRpbWVvdXQpLCBmZXRjaChmZXRjaFVybCwgX29iamVjdFNwcmVhZDIoe30sIGZldGNoT3B0aW9ucykpIF0pOwogICAgICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0pOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICghcmVzcG9uc2UpIHsKICAgICAgICAgICAgICAgIGlmIChhYm9ydENvbnRyb2xsZXIpIGFib3J0Q29udHJvbGxlci5hYm9ydCgpOwogICAgICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICJUaW1lb3V0IHdoZW4gZXhlY3V0aW5nICdmZXRjaCciCiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBoZWFkZXJzID0gZnJvbUVudHJpZXMocmVzcG9uc2UuaGVhZGVycyk7CiAgICAgICAgICAgIGpzb24gPSBhd2FpdCByZXNwb25zZS5qc29uKCk7CiAgICAgICAgICAgIGlmIChqc29uLnJlZnJlc2hfdG9rZW4pIHsKICAgICAgICAgICAgICAgIGlmICh1c2VNcnJ0KSB7CiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFRva2Vuc1sibGF0ZXN0X3JlZnJlc2hfdG9rZW4iXSA9IGpzb24ucmVmcmVzaF90b2tlbjsKICAgICAgICAgICAgICAgICAgICB1cGRhdGVSZWZyZXNoVG9rZW5zKHJlZnJlc2hUb2tlbiwganNvbi5yZWZyZXNoX3Rva2VuKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHNldFJlZnJlc2hUb2tlbihqc29uLnJlZnJlc2hfdG9rZW4sIGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgICAgICBkZWxldGUganNvbi5yZWZyZXNoX3Rva2VuOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgZGVsZXRlUmVmcmVzaFRva2VuKGF1ZGllbmNlLCBzY29wZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICBvazogcmVzcG9uc2Uub2ssCiAgICAgICAgICAgICAgICBqc29uOiBqc29uLAogICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycwogICAgICAgICAgICB9KTsKICAgICAgICB9IGNhdGNoIChlcnJvcikgewogICAgICAgICAgICBwb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIG9rOiBmYWxzZSwKICAgICAgICAgICAgICAgIGpzb246IHsKICAgICAgICAgICAgICAgICAgICBlcnJvcjogZXJyb3IuZXJyb3IsCiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yLm1lc3NhZ2UKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzCiAgICAgICAgICAgIH0pOwogICAgICAgIH0KICAgIH07CiAgICB7CiAgICAgICAgYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIG1lc3NhZ2VIYW5kbGVyKTsKICAgIH0KfSkoKTsKCg==", null, false);
|
|
2108
2286
|
|
|
2109
2287
|
const singlePromiseMap = {};
|
|
2110
2288
|
|
|
@@ -2124,11 +2302,12 @@ class CacheKeyManifest {
|
|
|
2124
2302
|
constructor(cache, clientId) {
|
|
2125
2303
|
this.cache = cache;
|
|
2126
2304
|
this.clientId = clientId;
|
|
2305
|
+
_defineProperty(this, "manifestKey", void 0);
|
|
2127
2306
|
this.manifestKey = this.createManifestKeyFrom(this.clientId);
|
|
2128
2307
|
}
|
|
2129
2308
|
async add(key) {
|
|
2130
|
-
var
|
|
2131
|
-
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) || []);
|
|
2132
2311
|
keys.add(key);
|
|
2133
2312
|
await this.cache.set(this.manifestKey, {
|
|
2134
2313
|
keys: [ ...keys ]
|
|
@@ -2158,6 +2337,8 @@ class CacheKeyManifest {
|
|
|
2158
2337
|
}
|
|
2159
2338
|
}
|
|
2160
2339
|
|
|
2340
|
+
const _excluded$2 = [ "openUrl", "onRedirect" ];
|
|
2341
|
+
|
|
2161
2342
|
const GET_TOKEN_SILENTLY_LOCK_KEY = "auth0.lock.getTokenSilently";
|
|
2162
2343
|
|
|
2163
2344
|
const GET_TOKEN_FROM_IFRAME_LOCK_KEY = "auth0.lock.getTokenFromIFrame";
|
|
@@ -2179,9 +2360,9 @@ const cacheLocationBuilders = {
|
|
|
2179
2360
|
|
|
2180
2361
|
const cacheFactory = location => cacheLocationBuilders[location];
|
|
2181
2362
|
|
|
2182
|
-
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({
|
|
2183
2364
|
client_id: clientOptions.clientId
|
|
2184
|
-
}, clientOptions.authorizationParams), authorizationParams), {
|
|
2365
|
+
}, clientOptions.authorizationParams), authorizationParams), {}, {
|
|
2185
2366
|
scope: scopesToRequest(scope, authorizationParams.scope, authorizationParams.audience),
|
|
2186
2367
|
response_type: "code",
|
|
2187
2368
|
response_mode: response_mode || "query",
|
|
@@ -2194,8 +2375,8 @@ const getAuthorizeParams = (clientOptions, scope, authorizationParams, state, no
|
|
|
2194
2375
|
});
|
|
2195
2376
|
|
|
2196
2377
|
const patchOpenUrlWithOnRedirect = options => {
|
|
2197
|
-
const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions =
|
|
2198
|
-
const result =
|
|
2378
|
+
const {openUrl: openUrl, onRedirect: onRedirect} = options, originalOptions = _objectWithoutProperties(options, _excluded$2);
|
|
2379
|
+
const result = _objectSpread2(_objectSpread2({}, originalOptions), {}, {
|
|
2199
2380
|
openUrl: openUrl === false || openUrl ? openUrl : onRedirect
|
|
2200
2381
|
});
|
|
2201
2382
|
return result;
|
|
@@ -2215,13 +2396,13 @@ const getMissingScopes = (requestedScope, respondedScope) => {
|
|
|
2215
2396
|
};
|
|
2216
2397
|
|
|
2217
2398
|
const getScopeToRequest = (useMrrt, authorizationParams, cachedAudience, cachedScope) => {
|
|
2218
|
-
var _a;
|
|
2219
2399
|
if (useMrrt && cachedAudience && cachedScope) {
|
|
2400
|
+
var _authorizationParams$;
|
|
2220
2401
|
if (authorizationParams.audience !== cachedAudience) {
|
|
2221
2402
|
return authorizationParams.scope;
|
|
2222
2403
|
}
|
|
2223
2404
|
const cachedScopes = cachedScope.split(" ");
|
|
2224
|
-
const newScopes = ((
|
|
2405
|
+
const newScopes = ((_authorizationParams$ = authorizationParams.scope) === null || _authorizationParams$ === void 0 ? void 0 : _authorizationParams$.split(" ")) || [];
|
|
2225
2406
|
const newScopesAreIncluded = newScopes.every(scope => cachedScopes.includes(scope));
|
|
2226
2407
|
return cachedScopes.length >= newScopes.length && newScopesAreIncluded ? cachedScope : authorizationParams.scope;
|
|
2227
2408
|
}
|
|
@@ -2248,6 +2429,8 @@ const AUTH0_NONCE_ID = "auth0";
|
|
|
2248
2429
|
|
|
2249
2430
|
class DpopStorage {
|
|
2250
2431
|
constructor(clientId) {
|
|
2432
|
+
_defineProperty(this, "clientId", void 0);
|
|
2433
|
+
_defineProperty(this, "dbHandle", void 0);
|
|
2251
2434
|
this.clientId = clientId;
|
|
2252
2435
|
}
|
|
2253
2436
|
getVersion() {
|
|
@@ -2301,7 +2484,7 @@ class DpopStorage {
|
|
|
2301
2484
|
}
|
|
2302
2485
|
async deleteBy(table, predicate) {
|
|
2303
2486
|
const allKeys = await this.executeDbRequest(table, "readonly", table => table.getAllKeys());
|
|
2304
|
-
allKeys === null || allKeys === void 0
|
|
2487
|
+
allKeys === null || allKeys === void 0 || allKeys.filter(predicate).map(k => this.executeDbRequest(table, "readwrite", table => table.delete(k)));
|
|
2305
2488
|
}
|
|
2306
2489
|
deleteByClientId(table, clientId) {
|
|
2307
2490
|
return this.deleteBy(table, k => typeof k === "string" && k.startsWith("".concat(clientId, "::")));
|
|
@@ -2316,6 +2499,7 @@ class DpopStorage {
|
|
|
2316
2499
|
|
|
2317
2500
|
class Dpop {
|
|
2318
2501
|
constructor(clientId) {
|
|
2502
|
+
_defineProperty(this, "storage", void 0);
|
|
2319
2503
|
this.storage = new DpopStorage(clientId);
|
|
2320
2504
|
}
|
|
2321
2505
|
getNonce(id) {
|
|
@@ -2334,7 +2518,7 @@ class Dpop {
|
|
|
2334
2518
|
}
|
|
2335
2519
|
async generateProof(params) {
|
|
2336
2520
|
const keyPair = await this.getOrGenerateKeyPair();
|
|
2337
|
-
return generateProof(
|
|
2521
|
+
return generateProof(_objectSpread2({
|
|
2338
2522
|
keyPair: keyPair
|
|
2339
2523
|
}, params));
|
|
2340
2524
|
}
|
|
@@ -2347,17 +2531,18 @@ class Dpop {
|
|
|
2347
2531
|
}
|
|
2348
2532
|
}
|
|
2349
2533
|
|
|
2350
|
-
var TokenType
|
|
2351
|
-
|
|
2352
|
-
(function(TokenType) {
|
|
2534
|
+
var TokenType = function(TokenType) {
|
|
2353
2535
|
TokenType["Bearer"] = "Bearer";
|
|
2354
2536
|
TokenType["DPoP"] = "DPoP";
|
|
2355
|
-
|
|
2537
|
+
return TokenType;
|
|
2538
|
+
}(TokenType || {});
|
|
2356
2539
|
|
|
2357
2540
|
class Fetcher {
|
|
2358
2541
|
constructor(config, hooks) {
|
|
2542
|
+
_defineProperty(this, "config", void 0);
|
|
2543
|
+
_defineProperty(this, "hooks", void 0);
|
|
2359
2544
|
this.hooks = hooks;
|
|
2360
|
-
this.config =
|
|
2545
|
+
this.config = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
2361
2546
|
fetch: config.fetch || (typeof window === "undefined" ? fetch : window.fetch.bind(window))
|
|
2362
2547
|
});
|
|
2363
2548
|
}
|
|
@@ -2465,7 +2650,7 @@ class Fetcher {
|
|
|
2465
2650
|
}
|
|
2466
2651
|
fetchWithAuth(info, init, authParams) {
|
|
2467
2652
|
const callbacks = {
|
|
2468
|
-
onUseDpopNonceError: () => this.internalFetchWithAuth(info, init,
|
|
2653
|
+
onUseDpopNonceError: () => this.internalFetchWithAuth(info, init, _objectSpread2(_objectSpread2({}, callbacks), {}, {
|
|
2469
2654
|
onUseDpopNonceError: undefined
|
|
2470
2655
|
}), authParams)
|
|
2471
2656
|
};
|
|
@@ -2523,6 +2708,11 @@ class MyAccountApiError extends Error {
|
|
|
2523
2708
|
constructor(_ref) {
|
|
2524
2709
|
let {type: type, status: status, title: title, detail: detail, validation_errors: validation_errors} = _ref;
|
|
2525
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);
|
|
2526
2716
|
this.name = "MyAccountApiError";
|
|
2527
2717
|
this.type = type;
|
|
2528
2718
|
this.status = status;
|
|
@@ -2563,7 +2753,7 @@ const MfaGrantTypes = {
|
|
|
2563
2753
|
|
|
2564
2754
|
function getAuthJsEnrollParams(params) {
|
|
2565
2755
|
const mapping = FACTOR_MAPPING[params.factorType];
|
|
2566
|
-
return
|
|
2756
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2567
2757
|
mfaToken: params.mfaToken,
|
|
2568
2758
|
authenticatorTypes: mapping.authenticatorTypes
|
|
2569
2759
|
}, mapping.oobChannels && {
|
|
@@ -2588,162 +2778,6 @@ function getGrantType(params) {
|
|
|
2588
2778
|
return undefined;
|
|
2589
2779
|
}
|
|
2590
2780
|
|
|
2591
|
-
function _OverloadYield(e, d) {
|
|
2592
|
-
this.v = e, this.k = d;
|
|
2593
|
-
}
|
|
2594
|
-
|
|
2595
|
-
function _assertClassBrand(e, t, n) {
|
|
2596
|
-
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
2597
|
-
throw new TypeError("Private element is not present on this object");
|
|
2598
|
-
}
|
|
2599
|
-
|
|
2600
|
-
function _awaitAsyncGenerator(e) {
|
|
2601
|
-
return new _OverloadYield(e, 0);
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
|
-
function _checkPrivateRedeclaration(e, t) {
|
|
2605
|
-
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
2606
|
-
}
|
|
2607
|
-
|
|
2608
|
-
function _classPrivateFieldGet2(s, a) {
|
|
2609
|
-
return s.get(_assertClassBrand(s, a));
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
|
-
function _classPrivateFieldInitSpec(e, t, a) {
|
|
2613
|
-
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
2614
|
-
}
|
|
2615
|
-
|
|
2616
|
-
function _classPrivateFieldSet2(s, a, r) {
|
|
2617
|
-
return s.set(_assertClassBrand(s, a), r), r;
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
function _classPrivateMethodInitSpec(e, a) {
|
|
2621
|
-
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
function _defineProperty(e, r, t) {
|
|
2625
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
2626
|
-
value: t,
|
|
2627
|
-
enumerable: !0,
|
|
2628
|
-
configurable: !0,
|
|
2629
|
-
writable: !0
|
|
2630
|
-
}) : e[r] = t, e;
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2633
|
-
function ownKeys(e, r) {
|
|
2634
|
-
var t = Object.keys(e);
|
|
2635
|
-
if (Object.getOwnPropertySymbols) {
|
|
2636
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
2637
|
-
r && (o = o.filter(function(r) {
|
|
2638
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
2639
|
-
})), t.push.apply(t, o);
|
|
2640
|
-
}
|
|
2641
|
-
return t;
|
|
2642
|
-
}
|
|
2643
|
-
|
|
2644
|
-
function _objectSpread2(e) {
|
|
2645
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
2646
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
2647
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
2648
|
-
_defineProperty(e, r, t[r]);
|
|
2649
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
2650
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
return e;
|
|
2654
|
-
}
|
|
2655
|
-
|
|
2656
|
-
function _objectWithoutProperties(e, t) {
|
|
2657
|
-
if (null == e) return {};
|
|
2658
|
-
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
2659
|
-
if (Object.getOwnPropertySymbols) {
|
|
2660
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
2661
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
2662
|
-
}
|
|
2663
|
-
return i;
|
|
2664
|
-
}
|
|
2665
|
-
|
|
2666
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
2667
|
-
if (null == r) return {};
|
|
2668
|
-
var t = {};
|
|
2669
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
2670
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
2671
|
-
t[n] = r[n];
|
|
2672
|
-
}
|
|
2673
|
-
return t;
|
|
2674
|
-
}
|
|
2675
|
-
|
|
2676
|
-
function _toPrimitive(t, r) {
|
|
2677
|
-
if ("object" != typeof t || !t) return t;
|
|
2678
|
-
var e = t[Symbol.toPrimitive];
|
|
2679
|
-
if (void 0 !== e) {
|
|
2680
|
-
var i = e.call(t, r || "default");
|
|
2681
|
-
if ("object" != typeof i) return i;
|
|
2682
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2683
|
-
}
|
|
2684
|
-
return ("string" === r ? String : Number)(t);
|
|
2685
|
-
}
|
|
2686
|
-
|
|
2687
|
-
function _toPropertyKey(t) {
|
|
2688
|
-
var i = _toPrimitive(t, "string");
|
|
2689
|
-
return "symbol" == typeof i ? i : i + "";
|
|
2690
|
-
}
|
|
2691
|
-
|
|
2692
|
-
function _wrapAsyncGenerator(e) {
|
|
2693
|
-
return function() {
|
|
2694
|
-
return new AsyncGenerator(e.apply(this, arguments));
|
|
2695
|
-
};
|
|
2696
|
-
}
|
|
2697
|
-
|
|
2698
|
-
function AsyncGenerator(e) {
|
|
2699
|
-
var t, n;
|
|
2700
|
-
function resume(t, n) {
|
|
2701
|
-
try {
|
|
2702
|
-
var r = e[t](n), o = r.value, u = o instanceof _OverloadYield;
|
|
2703
|
-
Promise.resolve(u ? o.v : o).then(function(n) {
|
|
2704
|
-
if (u) {
|
|
2705
|
-
var i = "return" === t && o.k ? t : "next";
|
|
2706
|
-
if (!o.k || n.done) return resume(i, n);
|
|
2707
|
-
n = e[i](n).value;
|
|
2708
|
-
}
|
|
2709
|
-
settle(!!r.done, n);
|
|
2710
|
-
}, function(e) {
|
|
2711
|
-
resume("throw", e);
|
|
2712
|
-
});
|
|
2713
|
-
} catch (e) {
|
|
2714
|
-
settle(2, e);
|
|
2715
|
-
}
|
|
2716
|
-
}
|
|
2717
|
-
function settle(e, r) {
|
|
2718
|
-
2 === e ? t.reject(r) : t.resolve({
|
|
2719
|
-
value: r,
|
|
2720
|
-
done: e
|
|
2721
|
-
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
2722
|
-
}
|
|
2723
|
-
this._invoke = function(e, r) {
|
|
2724
|
-
return new Promise(function(o, u) {
|
|
2725
|
-
var i = {
|
|
2726
|
-
key: e,
|
|
2727
|
-
arg: r,
|
|
2728
|
-
resolve: o,
|
|
2729
|
-
reject: u,
|
|
2730
|
-
next: null
|
|
2731
|
-
};
|
|
2732
|
-
n ? n = n.next = i : (t = n = i, resume(e, r));
|
|
2733
|
-
});
|
|
2734
|
-
}, "function" != typeof e.return && (this.return = void 0);
|
|
2735
|
-
}
|
|
2736
|
-
|
|
2737
|
-
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
2738
|
-
return this;
|
|
2739
|
-
}, AsyncGenerator.prototype.next = function(e) {
|
|
2740
|
-
return this._invoke("next", e);
|
|
2741
|
-
}, AsyncGenerator.prototype.throw = function(e) {
|
|
2742
|
-
return this._invoke("throw", e);
|
|
2743
|
-
}, AsyncGenerator.prototype.return = function(e) {
|
|
2744
|
-
return this._invoke("return", e);
|
|
2745
|
-
};
|
|
2746
|
-
|
|
2747
2781
|
var _navigator$userAgent$2, _navigator$userAgent$$2;
|
|
2748
2782
|
|
|
2749
2783
|
let USER_AGENT$2;
|
|
@@ -7024,7 +7058,7 @@ function createRemoteJWKSet(url, options) {
|
|
|
7024
7058
|
return remoteJWKSet;
|
|
7025
7059
|
}
|
|
7026
7060
|
|
|
7027
|
-
const _excluded = [ "mfaToken" ], _excluded2 = [ "mfaToken" ];
|
|
7061
|
+
const _excluded$1 = [ "mfaToken" ], _excluded2$1 = [ "mfaToken" ];
|
|
7028
7062
|
|
|
7029
7063
|
var _baseUrl, _clientId, _customFetch, _entries, _ttlMs, _maxEntries, _configuration, _serverMetadata, _clientAuthPromise, _options, _customFetch2, _jwks, _discoveryCache, _inFlightDiscovery, _jwksCache, _Class9_brand;
|
|
7030
7064
|
|
|
@@ -7072,6 +7106,13 @@ var TokenByRefreshTokenError = class extends ApiError {
|
|
|
7072
7106
|
}
|
|
7073
7107
|
};
|
|
7074
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
|
+
|
|
7075
7116
|
var TokenForConnectionError = class extends ApiError {
|
|
7076
7117
|
constructor(message, cause) {
|
|
7077
7118
|
super("token_for_connection_error", message, cause);
|
|
@@ -7262,7 +7303,7 @@ class MfaClient {
|
|
|
7262
7303
|
}
|
|
7263
7304
|
async enrollAuthenticator(options) {
|
|
7264
7305
|
const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/associate");
|
|
7265
|
-
const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded);
|
|
7306
|
+
const {mfaToken: mfaToken} = options, sdkParams = _objectWithoutProperties(options, _excluded$1);
|
|
7266
7307
|
const apiParams = {
|
|
7267
7308
|
authenticator_types: sdkParams.authenticatorTypes
|
|
7268
7309
|
};
|
|
@@ -7307,7 +7348,7 @@ class MfaClient {
|
|
|
7307
7348
|
}
|
|
7308
7349
|
async challengeAuthenticator(options) {
|
|
7309
7350
|
const url = "".concat(_classPrivateFieldGet2(_baseUrl, this), "/mfa/challenge");
|
|
7310
|
-
const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2);
|
|
7351
|
+
const {mfaToken: mfaToken} = options, challengeParams = _objectWithoutProperties(options, _excluded2$1);
|
|
7311
7352
|
const body = {
|
|
7312
7353
|
mfa_token: mfaToken,
|
|
7313
7354
|
client_id: _classPrivateFieldGet2(_clientId, this),
|
|
@@ -7364,7 +7405,7 @@ function getTelemetryConfig(config) {
|
|
|
7364
7405
|
return {
|
|
7365
7406
|
enabled: true,
|
|
7366
7407
|
name: (_config$name = config === null || config === void 0 ? void 0 : config.name) !== null && _config$name !== void 0 ? _config$name : "@auth0/auth0-auth-js",
|
|
7367
|
-
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"
|
|
7368
7409
|
};
|
|
7369
7410
|
}
|
|
7370
7411
|
|
|
@@ -7731,6 +7772,38 @@ class AuthClient {
|
|
|
7731
7772
|
throw new TokenByRefreshTokenError("The access token has expired and there was an error while trying to refresh it.", e);
|
|
7732
7773
|
}
|
|
7733
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
|
+
}
|
|
7734
7807
|
async getTokenByClientCredentials(options) {
|
|
7735
7808
|
const {configuration: configuration} = await _assertClassBrand(_Class9_brand, this, _discover).call(this);
|
|
7736
7809
|
try {
|
|
@@ -8030,12 +8103,13 @@ const DEFAULT_TTL_MS = 10 * 60 * 1e3;
|
|
|
8030
8103
|
class MfaContextManager {
|
|
8031
8104
|
constructor() {
|
|
8032
8105
|
let ttlMs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_TTL_MS;
|
|
8033
|
-
this
|
|
8106
|
+
_defineProperty(this, "contexts", new Map);
|
|
8107
|
+
_defineProperty(this, "ttlMs", void 0);
|
|
8034
8108
|
this.ttlMs = ttlMs;
|
|
8035
8109
|
}
|
|
8036
8110
|
set(mfaToken, context) {
|
|
8037
8111
|
this.cleanup();
|
|
8038
|
-
this.contexts.set(mfaToken,
|
|
8112
|
+
this.contexts.set(mfaToken, _objectSpread2(_objectSpread2({}, context), {}, {
|
|
8039
8113
|
createdAt: Date.now()
|
|
8040
8114
|
}));
|
|
8041
8115
|
}
|
|
@@ -8068,6 +8142,9 @@ class MfaContextManager {
|
|
|
8068
8142
|
|
|
8069
8143
|
class MfaApiClient {
|
|
8070
8144
|
constructor(authJsMfaClient, auth0Client) {
|
|
8145
|
+
_defineProperty(this, "authJsMfaClient", void 0);
|
|
8146
|
+
_defineProperty(this, "auth0Client", void 0);
|
|
8147
|
+
_defineProperty(this, "contextManager", void 0);
|
|
8071
8148
|
this.authJsMfaClient = authJsMfaClient;
|
|
8072
8149
|
this.auth0Client = auth0Client;
|
|
8073
8150
|
this.contextManager = new MfaContextManager;
|
|
@@ -8080,9 +8157,9 @@ class MfaApiClient {
|
|
|
8080
8157
|
});
|
|
8081
8158
|
}
|
|
8082
8159
|
async getAuthenticators(mfaToken) {
|
|
8083
|
-
var
|
|
8160
|
+
var _context$mfaRequireme;
|
|
8084
8161
|
const context = this.contextManager.get(mfaToken);
|
|
8085
|
-
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) {
|
|
8086
8163
|
throw new MfaListAuthenticatorsError("invalid_request", "challengeType is required and must contain at least one challenge type, please check mfa_required error payload");
|
|
8087
8164
|
}
|
|
8088
8165
|
const challengeTypes = context.mfaRequirements.challenge.map(c => c.type);
|
|
@@ -8096,25 +8173,25 @@ class MfaApiClient {
|
|
|
8096
8173
|
});
|
|
8097
8174
|
} catch (error) {
|
|
8098
8175
|
if (error instanceof MfaListAuthenticatorsError$1) {
|
|
8099
|
-
|
|
8176
|
+
var _error$cause;
|
|
8177
|
+
throw new MfaListAuthenticatorsError((_error$cause = error.cause) === null || _error$cause === void 0 ? void 0 : _error$cause.error, error.message);
|
|
8100
8178
|
}
|
|
8101
8179
|
throw error;
|
|
8102
8180
|
}
|
|
8103
8181
|
}
|
|
8104
8182
|
async enroll(params) {
|
|
8105
|
-
var _a;
|
|
8106
8183
|
const authJsParams = getAuthJsEnrollParams(params);
|
|
8107
8184
|
try {
|
|
8108
8185
|
return await this.authJsMfaClient.enrollAuthenticator(authJsParams);
|
|
8109
8186
|
} catch (error) {
|
|
8110
8187
|
if (error instanceof MfaEnrollmentError$1) {
|
|
8111
|
-
|
|
8188
|
+
var _error$cause2;
|
|
8189
|
+
throw new MfaEnrollmentError((_error$cause2 = error.cause) === null || _error$cause2 === void 0 ? void 0 : _error$cause2.error, error.message);
|
|
8112
8190
|
}
|
|
8113
8191
|
throw error;
|
|
8114
8192
|
}
|
|
8115
8193
|
}
|
|
8116
8194
|
async challenge(params) {
|
|
8117
|
-
var _a;
|
|
8118
8195
|
try {
|
|
8119
8196
|
const authJsParams = {
|
|
8120
8197
|
challengeType: params.challengeType,
|
|
@@ -8126,7 +8203,8 @@ class MfaApiClient {
|
|
|
8126
8203
|
return await this.authJsMfaClient.challengeAuthenticator(authJsParams);
|
|
8127
8204
|
} catch (error) {
|
|
8128
8205
|
if (error instanceof MfaChallengeError$1) {
|
|
8129
|
-
|
|
8206
|
+
var _error$cause3;
|
|
8207
|
+
throw new MfaChallengeError((_error$cause3 = error.cause) === null || _error$cause3 === void 0 ? void 0 : _error$cause3.error, error.message);
|
|
8130
8208
|
}
|
|
8131
8209
|
throw error;
|
|
8132
8210
|
}
|
|
@@ -8176,18 +8254,38 @@ class MfaApiClient {
|
|
|
8176
8254
|
}
|
|
8177
8255
|
}
|
|
8178
8256
|
|
|
8257
|
+
const _excluded = [ "openUrl", "fragment", "appState" ], _excluded2 = [ "url" ], _excluded3 = [ "cacheMode" ], _excluded4 = [ "federated" ], _excluded5 = [ "openUrl" ], _excluded6 = [ "id_token", "decodedToken" ], _excluded7 = [ "mfaToken" ];
|
|
8258
|
+
|
|
8179
8259
|
class Auth0Client {
|
|
8180
8260
|
constructor(options) {
|
|
8181
|
-
this
|
|
8182
|
-
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", {
|
|
8183
8281
|
authorizationParams: {
|
|
8184
8282
|
scope: DEFAULT_SCOPE
|
|
8185
8283
|
},
|
|
8186
8284
|
useRefreshTokensFallback: false,
|
|
8187
8285
|
useFormData: true
|
|
8188
|
-
};
|
|
8189
|
-
this.options =
|
|
8190
|
-
authorizationParams:
|
|
8286
|
+
});
|
|
8287
|
+
this.options = _objectSpread2(_objectSpread2(_objectSpread2({}, this.defaultOptions), options), {}, {
|
|
8288
|
+
authorizationParams: _objectSpread2(_objectSpread2({}, this.defaultOptions.authorizationParams), options.authorizationParams)
|
|
8191
8289
|
});
|
|
8192
8290
|
typeof window !== "undefined" && validateCrypto();
|
|
8193
8291
|
this.lockManager = getLockManager();
|
|
@@ -8219,9 +8317,9 @@ class Auth0Client {
|
|
|
8219
8317
|
this.domainUrl = getDomain(this.options.domain);
|
|
8220
8318
|
this.tokenIssuer = getTokenIssuer(this.options.issuer, this.domainUrl);
|
|
8221
8319
|
const myAccountApiIdentifier = "".concat(this.domainUrl, "/me/");
|
|
8222
|
-
const myAccountFetcher = this.createFetcher(
|
|
8320
|
+
const myAccountFetcher = this.createFetcher(_objectSpread2(_objectSpread2({}, this.options.useDpop && {
|
|
8223
8321
|
dpopNonceId: "__auth0_my_account_api__"
|
|
8224
|
-
}), {
|
|
8322
|
+
}), {}, {
|
|
8225
8323
|
getAccessToken: () => this.getTokenSilently({
|
|
8226
8324
|
authorizationParams: {
|
|
8227
8325
|
scope: "create:me:connected_accounts",
|
|
@@ -8295,7 +8393,7 @@ class Auth0Client {
|
|
|
8295
8393
|
url.searchParams.delete(paramName);
|
|
8296
8394
|
window.history.replaceState({}, "", url.toString());
|
|
8297
8395
|
}
|
|
8298
|
-
} catch (
|
|
8396
|
+
} catch (_unused) {}
|
|
8299
8397
|
}
|
|
8300
8398
|
_applySessionTransferToken(authorizationParams) {
|
|
8301
8399
|
const paramName = this.options.sessionTransferTokenQueryParamName;
|
|
@@ -8305,18 +8403,18 @@ class Auth0Client {
|
|
|
8305
8403
|
const token = this._extractSessionTransferToken(paramName);
|
|
8306
8404
|
if (!token) return authorizationParams;
|
|
8307
8405
|
this._clearSessionTransferTokenFromUrl(paramName);
|
|
8308
|
-
return
|
|
8406
|
+
return _objectSpread2(_objectSpread2({}, authorizationParams), {}, {
|
|
8309
8407
|
session_transfer_token: token
|
|
8310
8408
|
});
|
|
8311
8409
|
}
|
|
8312
8410
|
async _prepareAuthorizeUrl(authorizationParams, authorizeOptions, fallbackRedirectUri) {
|
|
8313
|
-
var
|
|
8411
|
+
var _this$dpop;
|
|
8314
8412
|
const state = encode$2(createRandomString());
|
|
8315
8413
|
const nonce = encode$2(createRandomString());
|
|
8316
8414
|
const code_verifier = createRandomString();
|
|
8317
8415
|
const code_challengeBuffer = await sha256(code_verifier);
|
|
8318
8416
|
const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
|
|
8319
|
-
const thumbprint = await ((
|
|
8417
|
+
const thumbprint = await ((_this$dpop = this.dpop) === null || _this$dpop === void 0 ? void 0 : _this$dpop.calculateThumbprint());
|
|
8320
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);
|
|
8321
8419
|
const url = this._authorizeUrl(params);
|
|
8322
8420
|
return {
|
|
@@ -8330,7 +8428,7 @@ class Auth0Client {
|
|
|
8330
8428
|
};
|
|
8331
8429
|
}
|
|
8332
8430
|
async loginWithPopup(options, config) {
|
|
8333
|
-
var
|
|
8431
|
+
var _options$authorizatio;
|
|
8334
8432
|
options = options || {};
|
|
8335
8433
|
config = config || {};
|
|
8336
8434
|
if (!config.popup) {
|
|
@@ -8344,13 +8442,13 @@ class Auth0Client {
|
|
|
8344
8442
|
response_mode: "web_message"
|
|
8345
8443
|
}, window.location.origin);
|
|
8346
8444
|
config.popup.location.href = params.url;
|
|
8347
|
-
const codeResult = await runPopup(
|
|
8445
|
+
const codeResult = await runPopup(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
8348
8446
|
timeoutInSeconds: config.timeoutInSeconds || this.options.authorizeTimeoutInSeconds || DEFAULT_AUTHORIZE_TIMEOUT_IN_SECONDS
|
|
8349
|
-
}));
|
|
8447
|
+
}), new URL(params.url).origin);
|
|
8350
8448
|
if (params.state !== codeResult.state) {
|
|
8351
8449
|
throw new GenericError("state_mismatch", "Invalid state");
|
|
8352
8450
|
}
|
|
8353
|
-
const organization = ((
|
|
8451
|
+
const organization = ((_options$authorizatio = options.authorizationParams) === null || _options$authorizatio === void 0 ? void 0 : _options$authorizatio.organization) || this.options.authorizationParams.organization;
|
|
8354
8452
|
await this._requestToken({
|
|
8355
8453
|
audience: params.audience,
|
|
8356
8454
|
scope: params.scope,
|
|
@@ -8364,26 +8462,26 @@ class Auth0Client {
|
|
|
8364
8462
|
});
|
|
8365
8463
|
}
|
|
8366
8464
|
async getUser() {
|
|
8367
|
-
var
|
|
8465
|
+
var _cache$decodedToken;
|
|
8368
8466
|
const cache = await this._getIdTokenFromCache();
|
|
8369
|
-
return
|
|
8467
|
+
return cache === null || cache === void 0 || (_cache$decodedToken = cache.decodedToken) === null || _cache$decodedToken === void 0 ? void 0 : _cache$decodedToken.user;
|
|
8370
8468
|
}
|
|
8371
8469
|
async getIdTokenClaims() {
|
|
8372
|
-
var
|
|
8470
|
+
var _cache$decodedToken2;
|
|
8373
8471
|
const cache = await this._getIdTokenFromCache();
|
|
8374
|
-
return
|
|
8472
|
+
return cache === null || cache === void 0 || (_cache$decodedToken2 = cache.decodedToken) === null || _cache$decodedToken2 === void 0 ? void 0 : _cache$decodedToken2.claims;
|
|
8375
8473
|
}
|
|
8376
8474
|
async loginWithRedirect() {
|
|
8475
|
+
var _urlOptions$authoriza;
|
|
8377
8476
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8378
|
-
|
|
8379
|
-
const
|
|
8380
|
-
const organization = ((_a = urlOptions.authorizationParams) === null || _a === void 0 ? void 0 : _a.organization) || this.options.authorizationParams.organization;
|
|
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;
|
|
8381
8479
|
const authorizationParams = this._applySessionTransferToken(urlOptions.authorizationParams || {});
|
|
8382
|
-
const
|
|
8383
|
-
this.transactionManager.create(
|
|
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), {}, {
|
|
8384
8482
|
appState: appState,
|
|
8385
|
-
response_type:
|
|
8386
|
-
}
|
|
8483
|
+
response_type: ResponseType.Code
|
|
8484
|
+
}, organization && {
|
|
8387
8485
|
organization: organization
|
|
8388
8486
|
}));
|
|
8389
8487
|
const urlWithFragment = fragment ? "".concat(url, "#").concat(fragment) : url;
|
|
@@ -8405,7 +8503,7 @@ class Auth0Client {
|
|
|
8405
8503
|
}
|
|
8406
8504
|
this.transactionManager.remove();
|
|
8407
8505
|
const authenticationResult = parseAuthenticationResult(queryStringFragments.join(""));
|
|
8408
|
-
if (transaction.response_type ===
|
|
8506
|
+
if (transaction.response_type === ResponseType.ConnectCode) {
|
|
8409
8507
|
return this._handleConnectAccountRedirectCallback(authenticationResult, transaction);
|
|
8410
8508
|
}
|
|
8411
8509
|
return this._handleLoginRedirectCallback(authenticationResult, transaction);
|
|
@@ -8421,7 +8519,7 @@ class Auth0Client {
|
|
|
8421
8519
|
const organization = transaction.organization;
|
|
8422
8520
|
const nonceIn = transaction.nonce;
|
|
8423
8521
|
const redirect_uri = transaction.redirect_uri;
|
|
8424
|
-
await this._requestToken(
|
|
8522
|
+
await this._requestToken(_objectSpread2({
|
|
8425
8523
|
audience: transaction.audience,
|
|
8426
8524
|
scope: transaction.scope,
|
|
8427
8525
|
code_verifier: transaction.code_verifier,
|
|
@@ -8435,7 +8533,7 @@ class Auth0Client {
|
|
|
8435
8533
|
});
|
|
8436
8534
|
return {
|
|
8437
8535
|
appState: transaction.appState,
|
|
8438
|
-
response_type:
|
|
8536
|
+
response_type: ResponseType.Code
|
|
8439
8537
|
};
|
|
8440
8538
|
}
|
|
8441
8539
|
async _handleConnectAccountRedirectCallback(connectResult, transaction) {
|
|
@@ -8455,9 +8553,9 @@ class Auth0Client {
|
|
|
8455
8553
|
redirect_uri: transaction.redirect_uri,
|
|
8456
8554
|
code_verifier: transaction.code_verifier
|
|
8457
8555
|
});
|
|
8458
|
-
return
|
|
8556
|
+
return _objectSpread2(_objectSpread2({}, data), {}, {
|
|
8459
8557
|
appState: transaction.appState,
|
|
8460
|
-
response_type:
|
|
8558
|
+
response_type: ResponseType.ConnectCode
|
|
8461
8559
|
});
|
|
8462
8560
|
}
|
|
8463
8561
|
async checkSession(options) {
|
|
@@ -8477,20 +8575,20 @@ class Auth0Client {
|
|
|
8477
8575
|
} catch (_) {}
|
|
8478
8576
|
}
|
|
8479
8577
|
async getTokenSilently() {
|
|
8578
|
+
var _options$authorizatio2, _options$authorizatio3;
|
|
8480
8579
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8481
|
-
|
|
8482
|
-
const localOptions = Object.assign(Object.assign({
|
|
8580
|
+
const localOptions = _objectSpread2(_objectSpread2({
|
|
8483
8581
|
cacheMode: "on"
|
|
8484
|
-
}, options), {
|
|
8485
|
-
authorizationParams:
|
|
8486
|
-
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)
|
|
8487
8585
|
})
|
|
8488
8586
|
});
|
|
8489
8587
|
const result = await singlePromise(() => this._getTokenSilently(localOptions), "".concat(this.options.clientId, "::").concat(localOptions.authorizationParams.audience, "::").concat(localOptions.authorizationParams.scope));
|
|
8490
8588
|
return options.detailedResponse ? result : result === null || result === void 0 ? void 0 : result.access_token;
|
|
8491
8589
|
}
|
|
8492
8590
|
async _getTokenSilently(options) {
|
|
8493
|
-
const {cacheMode: cacheMode} = options, getTokenOptions =
|
|
8591
|
+
const {cacheMode: cacheMode} = options, getTokenOptions = _objectWithoutProperties(options, _excluded3);
|
|
8494
8592
|
if (cacheMode !== "off") {
|
|
8495
8593
|
const entry = await this._getEntryFromCache({
|
|
8496
8594
|
scope: getTokenOptions.authorizationParams.scope,
|
|
@@ -8520,13 +8618,13 @@ class Auth0Client {
|
|
|
8520
8618
|
}
|
|
8521
8619
|
const authResult = this.options.useRefreshTokens ? await this._getTokenUsingRefreshToken(getTokenOptions) : await this._getTokenFromIFrame(getTokenOptions);
|
|
8522
8620
|
const {id_token: id_token, token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = authResult;
|
|
8523
|
-
return
|
|
8621
|
+
return _objectSpread2(_objectSpread2({
|
|
8524
8622
|
id_token: id_token,
|
|
8525
8623
|
token_type: token_type,
|
|
8526
8624
|
access_token: access_token
|
|
8527
8625
|
}, oauthTokenScope ? {
|
|
8528
8626
|
scope: oauthTokenScope
|
|
8529
|
-
} : null), {
|
|
8627
|
+
} : null), {}, {
|
|
8530
8628
|
expires_in: expires_in
|
|
8531
8629
|
});
|
|
8532
8630
|
});
|
|
@@ -8562,15 +8660,15 @@ class Auth0Client {
|
|
|
8562
8660
|
}
|
|
8563
8661
|
}
|
|
8564
8662
|
async getTokenWithPopup() {
|
|
8663
|
+
var _options$authorizatio4, _options$authorizatio5;
|
|
8565
8664
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8566
8665
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
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)
|
|
8571
8669
|
})
|
|
8572
8670
|
});
|
|
8573
|
-
config =
|
|
8671
|
+
config = _objectSpread2(_objectSpread2({}, DEFAULT_POPUP_CONFIG_OPTIONS), config);
|
|
8574
8672
|
await this.loginWithPopup(localOptions, config);
|
|
8575
8673
|
const cache = await this.cacheManager.get(new CacheKey({
|
|
8576
8674
|
scope: localOptions.authorizationParams.scope,
|
|
@@ -8589,17 +8687,17 @@ class Auth0Client {
|
|
|
8589
8687
|
} else {
|
|
8590
8688
|
delete options.clientId;
|
|
8591
8689
|
}
|
|
8592
|
-
const
|
|
8690
|
+
const _ref = options.logoutParams || {}, {federated: federated} = _ref, logoutOptions = _objectWithoutProperties(_ref, _excluded4);
|
|
8593
8691
|
const federatedQuery = federated ? "&federated" : "";
|
|
8594
|
-
const url = this._url("/v2/logout?".concat(createQueryParams(
|
|
8692
|
+
const url = this._url("/v2/logout?".concat(createQueryParams(_objectSpread2({
|
|
8595
8693
|
clientId: options.clientId
|
|
8596
8694
|
}, logoutOptions))));
|
|
8597
8695
|
return url + federatedQuery;
|
|
8598
8696
|
}
|
|
8599
8697
|
async logout() {
|
|
8698
|
+
var _this$dpop2;
|
|
8600
8699
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8601
|
-
|
|
8602
|
-
const _b = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _b, logoutOptions = __rest(_b, [ "openUrl" ]);
|
|
8700
|
+
const _patchOpenUrlWithOnRe2 = patchOpenUrlWithOnRedirect(options), {openUrl: openUrl} = _patchOpenUrlWithOnRe2, logoutOptions = _objectWithoutProperties(_patchOpenUrlWithOnRe2, _excluded5);
|
|
8603
8701
|
if (options.clientId === null) {
|
|
8604
8702
|
await this.cacheManager.clear();
|
|
8605
8703
|
} else {
|
|
@@ -8612,7 +8710,7 @@ class Auth0Client {
|
|
|
8612
8710
|
cookieDomain: this.options.cookieDomain
|
|
8613
8711
|
});
|
|
8614
8712
|
this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
|
|
8615
|
-
await ((
|
|
8713
|
+
await ((_this$dpop2 = this.dpop) === null || _this$dpop2 === void 0 ? void 0 : _this$dpop2.clear());
|
|
8616
8714
|
const url = this._buildLogoutUrl(logoutOptions);
|
|
8617
8715
|
if (openUrl) {
|
|
8618
8716
|
await openUrl(url);
|
|
@@ -8624,7 +8722,7 @@ class Auth0Client {
|
|
|
8624
8722
|
const iframeLockKey = buildIframeLockKey(this.options.clientId);
|
|
8625
8723
|
try {
|
|
8626
8724
|
return await this.lockManager.runWithLock(iframeLockKey, 5e3, async () => {
|
|
8627
|
-
const params =
|
|
8725
|
+
const params = _objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
|
|
8628
8726
|
prompt: "none"
|
|
8629
8727
|
});
|
|
8630
8728
|
const orgHint = this.cookieStorage.get(this.orgHintCookieName);
|
|
@@ -8641,14 +8739,14 @@ class Auth0Client {
|
|
|
8641
8739
|
let eventOrigin;
|
|
8642
8740
|
try {
|
|
8643
8741
|
eventOrigin = new URL(this.domainUrl).origin;
|
|
8644
|
-
} catch (
|
|
8742
|
+
} catch (_unused2) {
|
|
8645
8743
|
eventOrigin = this.domainUrl;
|
|
8646
8744
|
}
|
|
8647
8745
|
const codeResult = await runIframe(url, eventOrigin, authorizeTimeout);
|
|
8648
8746
|
if (stateIn !== codeResult.state) {
|
|
8649
8747
|
throw new GenericError("state_mismatch", "Invalid state");
|
|
8650
8748
|
}
|
|
8651
|
-
const tokenResult = await this._requestToken(
|
|
8749
|
+
const tokenResult = await this._requestToken(_objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
|
|
8652
8750
|
code_verifier: code_verifier,
|
|
8653
8751
|
code: codeResult.code,
|
|
8654
8752
|
grant_type: "authorization_code",
|
|
@@ -8658,7 +8756,7 @@ class Auth0Client {
|
|
|
8658
8756
|
nonceIn: nonceIn,
|
|
8659
8757
|
organization: params.organization
|
|
8660
8758
|
});
|
|
8661
|
-
return
|
|
8759
|
+
return _objectSpread2(_objectSpread2({}, tokenResult), {}, {
|
|
8662
8760
|
scope: scope,
|
|
8663
8761
|
oauthTokenScope: tokenResult.scope,
|
|
8664
8762
|
audience: audience
|
|
@@ -8677,7 +8775,6 @@ class Auth0Client {
|
|
|
8677
8775
|
}
|
|
8678
8776
|
}
|
|
8679
8777
|
async _getTokenUsingRefreshToken(options) {
|
|
8680
|
-
var _a, _b;
|
|
8681
8778
|
const cache = await this.cacheManager.get(new CacheKey({
|
|
8682
8779
|
scope: options.authorizationParams.scope,
|
|
8683
8780
|
audience: options.authorizationParams.audience || DEFAULT_AUDIENCE,
|
|
@@ -8693,16 +8790,16 @@ class Auth0Client {
|
|
|
8693
8790
|
const timeout = typeof options.timeoutInSeconds === "number" ? options.timeoutInSeconds * 1e3 : null;
|
|
8694
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);
|
|
8695
8792
|
try {
|
|
8696
|
-
const tokenResult = await this._requestToken(
|
|
8793
|
+
const tokenResult = await this._requestToken(_objectSpread2(_objectSpread2({}, options.authorizationParams), {}, {
|
|
8697
8794
|
grant_type: "refresh_token",
|
|
8698
8795
|
refresh_token: cache && cache.refresh_token,
|
|
8699
8796
|
redirect_uri: redirect_uri
|
|
8700
|
-
}
|
|
8797
|
+
}, timeout && {
|
|
8701
8798
|
timeout: timeout
|
|
8702
8799
|
}), {
|
|
8703
8800
|
scopesToRequest: scopesToRequest
|
|
8704
8801
|
});
|
|
8705
|
-
if (tokenResult.refresh_token &&
|
|
8802
|
+
if (tokenResult.refresh_token && cache !== null && cache !== void 0 && cache.refresh_token) {
|
|
8706
8803
|
await this.cacheManager.updateEntry(cache.refresh_token, tokenResult.refresh_token);
|
|
8707
8804
|
}
|
|
8708
8805
|
if (this.options.useMrrt) {
|
|
@@ -8719,7 +8816,7 @@ class Auth0Client {
|
|
|
8719
8816
|
}
|
|
8720
8817
|
}
|
|
8721
8818
|
}
|
|
8722
|
-
return
|
|
8819
|
+
return _objectSpread2(_objectSpread2({}, tokenResult), {}, {
|
|
8723
8820
|
scope: options.authorizationParams.scope,
|
|
8724
8821
|
oauthTokenScope: tokenResult.scope,
|
|
8725
8822
|
audience: options.authorizationParams.audience || DEFAULT_AUDIENCE
|
|
@@ -8737,13 +8834,14 @@ class Auth0Client {
|
|
|
8737
8834
|
}
|
|
8738
8835
|
}
|
|
8739
8836
|
if (e instanceof MfaRequiredError) {
|
|
8740
|
-
|
|
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);
|
|
8741
8839
|
}
|
|
8742
8840
|
throw e;
|
|
8743
8841
|
}
|
|
8744
8842
|
}
|
|
8745
8843
|
async _saveEntryInCache(entry) {
|
|
8746
|
-
const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken =
|
|
8844
|
+
const {id_token: id_token, decodedToken: decodedToken} = entry, entryWithoutIdToken = _objectWithoutProperties(entry, _excluded6);
|
|
8747
8845
|
this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, {
|
|
8748
8846
|
id_token: id_token,
|
|
8749
8847
|
decodedToken: decodedToken
|
|
@@ -8766,8 +8864,8 @@ class Auth0Client {
|
|
|
8766
8864
|
this.userCache.set(CACHE_KEY_ID_TOKEN_SUFFIX, cache);
|
|
8767
8865
|
return cache;
|
|
8768
8866
|
}
|
|
8769
|
-
async _getEntryFromCache(
|
|
8770
|
-
let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} =
|
|
8867
|
+
async _getEntryFromCache(_ref2) {
|
|
8868
|
+
let {scope: scope, audience: audience, clientId: clientId, cacheMode: cacheMode} = _ref2;
|
|
8771
8869
|
const entry = await this.cacheManager.get(new CacheKey({
|
|
8772
8870
|
scope: scope,
|
|
8773
8871
|
audience: audience,
|
|
@@ -8776,21 +8874,20 @@ class Auth0Client {
|
|
|
8776
8874
|
if (entry && entry.access_token) {
|
|
8777
8875
|
const {token_type: token_type, access_token: access_token, oauthTokenScope: oauthTokenScope, expires_in: expires_in} = entry;
|
|
8778
8876
|
const cache = await this._getIdTokenFromCache();
|
|
8779
|
-
return cache &&
|
|
8877
|
+
return cache && _objectSpread2(_objectSpread2({
|
|
8780
8878
|
id_token: cache.id_token,
|
|
8781
8879
|
token_type: token_type ? token_type : "Bearer",
|
|
8782
8880
|
access_token: access_token
|
|
8783
8881
|
}, oauthTokenScope ? {
|
|
8784
8882
|
scope: oauthTokenScope
|
|
8785
|
-
} : null), {
|
|
8883
|
+
} : null), {}, {
|
|
8786
8884
|
expires_in: expires_in
|
|
8787
8885
|
});
|
|
8788
8886
|
}
|
|
8789
8887
|
}
|
|
8790
8888
|
async _requestToken(options, additionalParameters) {
|
|
8791
|
-
var _a, _b;
|
|
8792
8889
|
const {nonceIn: nonceIn, organization: organization, scopesToRequest: scopesToRequest} = additionalParameters || {};
|
|
8793
|
-
const authResult = await oauthToken(
|
|
8890
|
+
const authResult = await oauthToken(_objectSpread2(_objectSpread2({
|
|
8794
8891
|
baseUrl: this.domainUrl,
|
|
8795
8892
|
client_id: this.options.clientId,
|
|
8796
8893
|
auth0Client: this.options.auth0Client,
|
|
@@ -8798,24 +8895,25 @@ class Auth0Client {
|
|
|
8798
8895
|
timeout: this.httpTimeoutMs,
|
|
8799
8896
|
useMrrt: this.options.useMrrt,
|
|
8800
8897
|
dpop: this.dpop
|
|
8801
|
-
}, options), {
|
|
8898
|
+
}, options), {}, {
|
|
8802
8899
|
scope: scopesToRequest || options.scope
|
|
8803
8900
|
}), this.worker);
|
|
8804
8901
|
const decodedToken = await this._verifyIdToken(authResult.id_token, nonceIn, organization);
|
|
8805
8902
|
if (options.grant_type === "authorization_code") {
|
|
8903
|
+
var _existingIdToken$deco;
|
|
8806
8904
|
const existingIdToken = await this._getIdTokenFromCache();
|
|
8807
|
-
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) {
|
|
8808
8906
|
await this.cacheManager.clear(this.options.clientId);
|
|
8809
8907
|
this.userCache.remove(CACHE_KEY_ID_TOKEN_SUFFIX);
|
|
8810
8908
|
}
|
|
8811
8909
|
}
|
|
8812
|
-
await this._saveEntryInCache(
|
|
8910
|
+
await this._saveEntryInCache(_objectSpread2(_objectSpread2(_objectSpread2({}, authResult), {}, {
|
|
8813
8911
|
decodedToken: decodedToken,
|
|
8814
8912
|
scope: options.scope,
|
|
8815
8913
|
audience: options.audience || DEFAULT_AUDIENCE
|
|
8816
|
-
}
|
|
8914
|
+
}, authResult.scope ? {
|
|
8817
8915
|
oauthTokenScope: authResult.scope
|
|
8818
|
-
} : null), {
|
|
8916
|
+
} : null), {}, {
|
|
8819
8917
|
client_id: this.options.clientId
|
|
8820
8918
|
}));
|
|
8821
8919
|
this.cookieStorage.save(this.isAuthenticatedCookieName, true, {
|
|
@@ -8823,12 +8921,12 @@ class Auth0Client {
|
|
|
8823
8921
|
cookieDomain: this.options.cookieDomain
|
|
8824
8922
|
});
|
|
8825
8923
|
this._processOrgHint(organization || decodedToken.claims.org_id);
|
|
8826
|
-
return
|
|
8924
|
+
return _objectSpread2(_objectSpread2({}, authResult), {}, {
|
|
8827
8925
|
decodedToken: decodedToken
|
|
8828
8926
|
});
|
|
8829
8927
|
}
|
|
8830
8928
|
async loginWithCustomTokenExchange(options) {
|
|
8831
|
-
return this._requestToken(
|
|
8929
|
+
return this._requestToken(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
8832
8930
|
grant_type: "urn:ietf:params:oauth:grant-type:token-exchange",
|
|
8833
8931
|
subject_token: options.subject_token,
|
|
8834
8932
|
subject_token_type: options.subject_token_type,
|
|
@@ -8862,10 +8960,10 @@ class Auth0Client {
|
|
|
8862
8960
|
return new Fetcher(config, {
|
|
8863
8961
|
isDpopEnabled: () => !!this.options.useDpop,
|
|
8864
8962
|
getAccessToken: authParams => {
|
|
8865
|
-
var
|
|
8963
|
+
var _authParams$scope;
|
|
8866
8964
|
return this.getTokenSilently({
|
|
8867
8965
|
authorizationParams: {
|
|
8868
|
-
scope:
|
|
8966
|
+
scope: authParams === null || authParams === void 0 || (_authParams$scope = authParams.scope) === null || _authParams$scope === void 0 ? void 0 : _authParams$scope.join(" "),
|
|
8869
8967
|
audience: authParams === null || authParams === void 0 ? void 0 : authParams.audience
|
|
8870
8968
|
},
|
|
8871
8969
|
detailedResponse: true
|
|
@@ -8901,7 +8999,7 @@ class Auth0Client {
|
|
|
8901
8999
|
redirect_uri: redirectUri,
|
|
8902
9000
|
appState: appState,
|
|
8903
9001
|
connection: connection,
|
|
8904
|
-
response_type:
|
|
9002
|
+
response_type: ResponseType.ConnectCode
|
|
8905
9003
|
});
|
|
8906
9004
|
const url = new URL(connect_uri);
|
|
8907
9005
|
url.searchParams.set("ticket", connect_params.ticket);
|
|
@@ -8912,8 +9010,8 @@ class Auth0Client {
|
|
|
8912
9010
|
}
|
|
8913
9011
|
}
|
|
8914
9012
|
async _requestTokenForMfa(options, additionalParameters) {
|
|
8915
|
-
const {mfaToken: mfaToken} = options, restOptions =
|
|
8916
|
-
return this._requestToken(
|
|
9013
|
+
const {mfaToken: mfaToken} = options, restOptions = _objectWithoutProperties(options, _excluded7);
|
|
9014
|
+
return this._requestToken(_objectSpread2(_objectSpread2({}, restOptions), {}, {
|
|
8917
9015
|
mfa_token: mfaToken
|
|
8918
9016
|
}), additionalParameters);
|
|
8919
9017
|
}
|
|
@@ -8965,6 +9063,8 @@ exports.PopupOpenError = PopupOpenError;
|
|
|
8965
9063
|
|
|
8966
9064
|
exports.PopupTimeoutError = PopupTimeoutError;
|
|
8967
9065
|
|
|
9066
|
+
exports.ResponseType = ResponseType;
|
|
9067
|
+
|
|
8968
9068
|
exports.TimeoutError = TimeoutError;
|
|
8969
9069
|
|
|
8970
9070
|
exports.UseDpopNonceError = UseDpopNonceError;
|