@frontegg/js 7.131.0-alpha.1 → 7.131.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FronteggApp/FronteggApp.js +7 -4
- package/index.js +1 -1
- package/node/FronteggApp/FronteggApp.js +7 -4
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +287 -232
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +1 -1
- package/version.js +1 -1
|
@@ -894,6 +894,7 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
894
894
|
key: "initContainers",
|
|
895
895
|
value: function () {
|
|
896
896
|
var _initContainers = (0,_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__["default"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default().mark(function _callee15(elements) {
|
|
897
|
+
var featureFlagsLoading;
|
|
897
898
|
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_4___default().wrap(function _callee15$(_context15) {
|
|
898
899
|
while (1) switch (_context15.prev = _context15.next) {
|
|
899
900
|
case 0:
|
|
@@ -910,9 +911,11 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
910
911
|
} catch (e) {
|
|
911
912
|
console.error('Failed to add frontegg-loading to body classList');
|
|
912
913
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
914
|
+
featureFlagsLoading = this.loadFeatureFlags(); // reads that must not race the flags (SSO enforcement on the first refresh) wait for this request
|
|
915
|
+
_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_15__.FeatureFlags.setLoading(featureFlagsLoading, this.name);
|
|
916
|
+
_context15.next = 11;
|
|
917
|
+
return Promise.all([featureFlagsLoading, this.loadAdminBoxMetadata(), this.requestAuthorize()]);
|
|
918
|
+
case 11:
|
|
916
919
|
if (!this.options.previewMode && !this.options.customLoginBox) {
|
|
917
920
|
this.loadLoginBox();
|
|
918
921
|
(0,_utils__WEBPACK_IMPORTED_MODULE_9__.loadGTM)(this.name);
|
|
@@ -920,7 +923,7 @@ var FronteggApp = /*#__PURE__*/function () {
|
|
|
920
923
|
if (!this.options.lazyLoadAdminPortal) {
|
|
921
924
|
this.loadScript('FronteggAdminPortal');
|
|
922
925
|
}
|
|
923
|
-
case
|
|
926
|
+
case 13:
|
|
924
927
|
case "end":
|
|
925
928
|
return _context15.stop();
|
|
926
929
|
}
|
|
@@ -1934,7 +1937,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1934
1937
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1935
1938
|
/* harmony export */ });
|
|
1936
1939
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
1937
|
-
cdnVersion: '7.131.0
|
|
1940
|
+
cdnVersion: '7.131.0'
|
|
1938
1941
|
});
|
|
1939
1942
|
|
|
1940
1943
|
/***/ }),
|
|
@@ -6018,11 +6021,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6018
6021
|
/* harmony export */ });
|
|
6019
6022
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
6020
6023
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/refreshTokenRetry.js");
|
|
6021
|
-
/* harmony import */ var
|
|
6024
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
6022
6025
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/random.js");
|
|
6023
6026
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
|
|
6024
6027
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../constants */ "../../dist/@frontegg/redux-store/constants.js");
|
|
6025
|
-
/* harmony import */ var
|
|
6028
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
|
|
6026
6029
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
|
|
6027
6030
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
|
|
6028
6031
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
|
|
@@ -6045,7 +6048,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6045
6048
|
const __requestHostedLoginSilentAuthorize = async () => {
|
|
6046
6049
|
var _response;
|
|
6047
6050
|
let response;
|
|
6048
|
-
(0,_helpers__WEBPACK_IMPORTED_MODULE_1__.restoreTabTenantUnlessSsoCallback)(store);
|
|
6051
|
+
await (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.restoreTabTenantUnlessSsoCallback)(store);
|
|
6049
6052
|
if (_toolkit__WEBPACK_IMPORTED_MODULE_2__["default"].isGetTokensAvailable()) {
|
|
6050
6053
|
const authApi = api.auth;
|
|
6051
6054
|
response = await (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.refreshTokenWithRetry)(async () => {
|
|
@@ -6057,12 +6060,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6057
6060
|
response = await api.auth.silentOAuthRefreshTokenV2();
|
|
6058
6061
|
} catch (error) {
|
|
6059
6062
|
var _store$auth$user, _error$errorContext;
|
|
6063
|
+
// on the hosted login callback the page finishes the login with its code: fail as without SSO enforcement
|
|
6064
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_1__.isOnLoginCodeCallbackRoute)(store)) {
|
|
6065
|
+
throw error;
|
|
6066
|
+
}
|
|
6060
6067
|
// the tenant requires SSO: hosted login for that tenant, not the plain one the caller falls back to
|
|
6061
6068
|
if (await actions.__redirectToSsoIfRequired(error)) {
|
|
6062
6069
|
return;
|
|
6063
6070
|
}
|
|
6064
6071
|
const tenantId = (_store$auth$user = store.auth.user) == null ? void 0 : _store$auth$user.tenantId;
|
|
6065
|
-
if (!(0,
|
|
6072
|
+
if (!(0,_helpers__WEBPACK_IMPORTED_MODULE_4__.isSsoEnforcementError)(error) || ((_error$errorContext = error.errorContext) == null ? void 0 : _error$errorContext.ssoRequired) !== false || !tenantId || !(await (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName))) {
|
|
6066
6073
|
throw error;
|
|
6067
6074
|
}
|
|
6068
6075
|
// one retry for the tenant of the current token (a cold reload has no user yet: no retry)
|
|
@@ -6326,32 +6333,32 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6326
6333
|
/* harmony import */ var _mfaWithEmailCode_actions__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./mfaWithEmailCode.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithEmailCode.actions.js");
|
|
6327
6334
|
/* harmony import */ var _mfaWithSMS_actions__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./mfaWithSMS.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithSMS.actions.js");
|
|
6328
6335
|
/* harmony import */ var _mfaWithWebAuthn_actions__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./mfaWithWebAuthn.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithWebAuthn.actions.js");
|
|
6329
|
-
/* harmony import */ var
|
|
6330
|
-
/* harmony import */ var
|
|
6331
|
-
/* harmony import */ var
|
|
6332
|
-
/* harmony import */ var
|
|
6336
|
+
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/LoginState/interfaces.js");
|
|
6337
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
6338
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/refreshTokenRetry.js");
|
|
6339
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
|
|
6333
6340
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
|
|
6334
6341
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/encoders.js");
|
|
6335
6342
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/converters.js");
|
|
6336
|
-
/* harmony import */ var
|
|
6337
|
-
/* harmony import */ var
|
|
6343
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../state */ "../../dist/@frontegg/redux-store/auth/LoginState/state.js");
|
|
6344
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
|
|
6338
6345
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
6339
|
-
/* harmony import */ var
|
|
6340
|
-
/* harmony import */ var
|
|
6341
|
-
/* harmony import */ var
|
|
6342
|
-
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/
|
|
6346
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/feature-flags/index.js");
|
|
6347
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
|
|
6348
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
|
|
6349
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/enums.js");
|
|
6343
6350
|
/* harmony import */ var _hostedLoginAuthorize_actions__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./hostedLoginAuthorize.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/hostedLoginAuthorize.actions.js");
|
|
6344
6351
|
/* harmony import */ var _oauthStorage__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../oauthStorage */ "../../dist/@frontegg/redux-store/auth/LoginState/oauthStorage.js");
|
|
6345
|
-
/* harmony import */ var
|
|
6346
|
-
/* harmony import */ var
|
|
6347
|
-
/* harmony import */ var
|
|
6348
|
-
/* harmony import */ var
|
|
6352
|
+
/* harmony import */ var _StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../StepUpState/consts */ "../../dist/@frontegg/redux-store/auth/StepUpState/consts.js");
|
|
6353
|
+
/* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/toolkit/FronteggNativeModule.js");
|
|
6354
|
+
/* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/auth/Entitlements/helpers.js");
|
|
6355
|
+
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../interfaces */ "../../dist/@frontegg/redux-store/auth/interfaces.js");
|
|
6349
6356
|
/* harmony import */ var _consts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../consts */ "../../dist/@frontegg/redux-store/auth/LoginState/consts.js");
|
|
6350
|
-
/* harmony import */ var
|
|
6351
|
-
/* harmony import */ var
|
|
6357
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
|
|
6358
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
|
|
6352
6359
|
/* harmony import */ var _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../../MfaState/interfaces */ "../../dist/@frontegg/redux-store/auth/MfaState/interfaces.js");
|
|
6353
6360
|
/* harmony import */ var _SSOState_interfaces__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../SSOState/interfaces */ "../../dist/@frontegg/redux-store/auth/SSOState/interfaces.js");
|
|
6354
|
-
/* harmony import */ var
|
|
6361
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../../constants */ "../../dist/@frontegg/redux-store/constants.js");
|
|
6355
6362
|
|
|
6356
6363
|
|
|
6357
6364
|
const _excluded = ["callback", "error"],
|
|
@@ -6402,8 +6409,10 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6402
6409
|
* @protected
|
|
6403
6410
|
*/
|
|
6404
6411
|
// as preLogin (takeLeading): an SSO redirect started while another is in flight is dropped; the first one leaves the
|
|
6405
|
-
// page, and a second hosted one would replace the PKCE verifier the first one's callback needs
|
|
6412
|
+
// page, and a second hosted one would replace the PKCE verifier the first one's callback needs. Kept set after a
|
|
6413
|
+
// redirect: the page is still there until the navigation commits.
|
|
6406
6414
|
let ssoRedirectInFlight = false;
|
|
6415
|
+
let ssoPageShowListenerRegistered = false;
|
|
6407
6416
|
const __redirectToSsoForTenant = async ({
|
|
6408
6417
|
tenantId,
|
|
6409
6418
|
address
|
|
@@ -6412,13 +6421,25 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6412
6421
|
return;
|
|
6413
6422
|
}
|
|
6414
6423
|
ssoRedirectInFlight = true;
|
|
6424
|
+
// Only an enabled SSO redirect needs bfcache recovery. Do not attach listeners to ordinary or preview stores.
|
|
6425
|
+
if (!ssoPageShowListenerRegistered && typeof window !== 'undefined' && !store.root.previewMode) {
|
|
6426
|
+
window.addEventListener('pageshow', event => {
|
|
6427
|
+
const [enforceSsoOnTenantAccess] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.FeatureFlags.getFeatureFlags([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ENFORCE_SSO_ON_TENANT_ACCESS_FF], store.root.appName);
|
|
6428
|
+
if (event.persisted && enforceSsoOnTenantAccess) {
|
|
6429
|
+
ssoRedirectInFlight = false;
|
|
6430
|
+
void (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.restoreTabTenantUnlessSsoCallback)(store);
|
|
6431
|
+
}
|
|
6432
|
+
});
|
|
6433
|
+
ssoPageShowListenerRegistered = true;
|
|
6434
|
+
}
|
|
6415
6435
|
try {
|
|
6416
6436
|
await __redirectToSsoForTenantNow({
|
|
6417
6437
|
tenantId,
|
|
6418
6438
|
address
|
|
6419
6439
|
});
|
|
6420
|
-
}
|
|
6440
|
+
} catch (e) {
|
|
6421
6441
|
ssoRedirectInFlight = false;
|
|
6442
|
+
throw e;
|
|
6422
6443
|
}
|
|
6423
6444
|
};
|
|
6424
6445
|
const __redirectToSsoForTenantNow = async ({
|
|
@@ -6429,21 +6450,21 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6429
6450
|
// the login box shows login's "redirecting to SSO" step instead of the screen that was refused (its spinner and
|
|
6430
6451
|
// a previous error)
|
|
6431
6452
|
setLoginState({
|
|
6432
|
-
step:
|
|
6453
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.redirectToSSO,
|
|
6433
6454
|
loading: false,
|
|
6434
6455
|
error: undefined
|
|
6435
6456
|
});
|
|
6436
6457
|
// on an auth page (login, tenant chooser, social / magic link / SSO callback) keep the destination the login
|
|
6437
6458
|
// already saved: the page itself is not one to come back to
|
|
6438
6459
|
const urlStrategy = (_store$root$urlStrate = store.root.urlStrategy) != null ? _store$root$urlStrate : 'path';
|
|
6439
|
-
const isOnAuthPage = (0,
|
|
6460
|
+
const isOnAuthPage = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isOnAuthPageRoute)(urlStrategy, store.auth.routes);
|
|
6440
6461
|
if (!isOnAuthPage) {
|
|
6441
|
-
(0,
|
|
6462
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_8__.setAfterAuthRedirectUrlForStepUp)(urlStrategy);
|
|
6442
6463
|
}
|
|
6443
6464
|
if (store.auth.hostedLoginBox) {
|
|
6444
6465
|
var _window$localStorage;
|
|
6445
6466
|
// as loginWithRedirect does, but the SSO tenant wins over the custom login tenant
|
|
6446
|
-
(_window$localStorage = window.localStorage) == null ? void 0 : _window$localStorage.removeItem(
|
|
6467
|
+
(_window$localStorage = window.localStorage) == null ? void 0 : _window$localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY);
|
|
6447
6468
|
await actions.__requestHostedLoginAuthorize({
|
|
6448
6469
|
prompt: 'login',
|
|
6449
6470
|
tenantId
|
|
@@ -6452,12 +6473,9 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6452
6473
|
});
|
|
6453
6474
|
return;
|
|
6454
6475
|
}
|
|
6455
|
-
// as login does for an OIDC SSO page
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
ssoRedirectUrl += `&redirect_uri=${window.location.origin}${store.auth.routes.oidcRedirectUrl}`;
|
|
6459
|
-
}
|
|
6460
|
-
redirectToFullPage(ssoRedirectUrl);
|
|
6476
|
+
// as login does for an OIDC SSO page; the refusal has no idpType, but an OIDC page asks for a code
|
|
6477
|
+
const isOidcPage = /[?&]response_type=code(&|$)/.test(address);
|
|
6478
|
+
redirectToFullPage(isOidcPage ? (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.withOidcRedirectUri)(address, store.auth.routes.oidcRedirectUrl) : address);
|
|
6461
6479
|
};
|
|
6462
6480
|
|
|
6463
6481
|
/**
|
|
@@ -6468,7 +6486,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6468
6486
|
*/
|
|
6469
6487
|
const __redirectToSsoIfRequired = async e => {
|
|
6470
6488
|
var _e$errorContext;
|
|
6471
|
-
|
|
6489
|
+
// Ordinary failures keep their existing handling even while the flags request is pending.
|
|
6490
|
+
if (!(0,_helpers__WEBPACK_IMPORTED_MODULE_11__.isSsoEnforcementError)(e) || !((_e$errorContext = e.errorContext) != null && _e$errorContext.ssoRequired) || !(await (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName))) {
|
|
6472
6491
|
return false;
|
|
6473
6492
|
}
|
|
6474
6493
|
await __redirectToSsoForTenant(e.errorContext);
|
|
@@ -6482,19 +6501,25 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6482
6501
|
* @private
|
|
6483
6502
|
*/
|
|
6484
6503
|
const __handleSsoEnforcementRefreshError = async (e, isSsoEnforcementRetry, refreshForTenant) => {
|
|
6485
|
-
var _store$auth$user;
|
|
6486
|
-
|
|
6504
|
+
var _e$errorContext2, _store$auth$user;
|
|
6505
|
+
// on a login callback the page finishes the login with its code: log out as without SSO enforcement, no new SSO
|
|
6506
|
+
// trip
|
|
6507
|
+
if (!(0,_helpers__WEBPACK_IMPORTED_MODULE_11__.isSsoEnforcementError)(e) || (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isOnLoginCodeCallbackRoute)(store) || !(await (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName))) {
|
|
6487
6508
|
return false;
|
|
6488
6509
|
}
|
|
6489
6510
|
if (await __redirectToSsoIfRequired(e)) {
|
|
6490
6511
|
return true;
|
|
6491
6512
|
}
|
|
6513
|
+
// Only an explicit refusal without SSO permits recovery; missing context follows ordinary logout handling.
|
|
6514
|
+
if (((_e$errorContext2 = e.errorContext) == null ? void 0 : _e$errorContext2.ssoRequired) !== false) {
|
|
6515
|
+
return false;
|
|
6516
|
+
}
|
|
6492
6517
|
const currentTenantId = (_store$auth$user = store.auth.user) == null ? void 0 : _store$auth$user.tenantId;
|
|
6493
6518
|
if (isSsoEnforcementRetry || !currentTenantId) {
|
|
6494
6519
|
return false;
|
|
6495
6520
|
}
|
|
6496
6521
|
if (contextHolder.isSessionPerTenantEnabled()) {
|
|
6497
|
-
(0,
|
|
6522
|
+
(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__.setTabTenantInSessionStorage)(currentTenantId);
|
|
6498
6523
|
}
|
|
6499
6524
|
await refreshForTenant(currentTenantId);
|
|
6500
6525
|
return true;
|
|
@@ -6516,7 +6541,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6516
6541
|
return;
|
|
6517
6542
|
}
|
|
6518
6543
|
try {
|
|
6519
|
-
const tabTenantId = tenantId != null ? tenantId : (0,
|
|
6544
|
+
const tabTenantId = tenantId != null ? tenantId : (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__.getTabTenantFromSessionStorage)(store.root.appName);
|
|
6520
6545
|
const body = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({
|
|
6521
6546
|
grant_type: 'refresh_token',
|
|
6522
6547
|
refresh_token: user == null ? void 0 : user.refreshToken
|
|
@@ -6568,8 +6593,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6568
6593
|
user,
|
|
6569
6594
|
tenants = [],
|
|
6570
6595
|
activeTenant
|
|
6571
|
-
} = await (0,
|
|
6572
|
-
if ((0,
|
|
6596
|
+
} = await (0,_helpers__WEBPACK_IMPORTED_MODULE_13__.refreshTokenWithRetry)(() => api.auth.refreshTokenV3());
|
|
6597
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
|
|
6573
6598
|
const mfaRequiredState = await actions.getMfaRequiredState(user);
|
|
6574
6599
|
actions.setAuthState(mfaRequiredState);
|
|
6575
6600
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -6590,7 +6615,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6590
6615
|
}, {
|
|
6591
6616
|
loginState: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, loginState, {
|
|
6592
6617
|
quickLoginToRegister,
|
|
6593
|
-
flow: shouldNavigateToRegisterQuickLogin ?
|
|
6618
|
+
flow: shouldNavigateToRegisterQuickLogin ? _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.RegisterQuickLogin : _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login
|
|
6594
6619
|
}),
|
|
6595
6620
|
isAuthenticated: true
|
|
6596
6621
|
});
|
|
@@ -6599,9 +6624,10 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6599
6624
|
});
|
|
6600
6625
|
}
|
|
6601
6626
|
} catch (e) {
|
|
6602
|
-
//
|
|
6603
|
-
// the
|
|
6604
|
-
|
|
6627
|
+
// no retry: identity already refreshes for the session's own tenant when it can, so a refusal without SSO means
|
|
6628
|
+
// there is none to keep. Only the SSO redirect, except on a login callback, where the page itself completes the
|
|
6629
|
+
// login
|
|
6630
|
+
if (!(0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isOnLoginCodeCallbackRoute)(store) && (await __redirectToSsoIfRequired(e))) {
|
|
6605
6631
|
return;
|
|
6606
6632
|
}
|
|
6607
6633
|
contextHolder.setAccessToken(null);
|
|
@@ -6614,13 +6640,11 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6614
6640
|
};
|
|
6615
6641
|
|
|
6616
6642
|
/** @private */
|
|
6617
|
-
const __refreshTokenWithNativeTokens = async ({
|
|
6618
|
-
isSsoEnforcementRetry = false
|
|
6619
|
-
} = {}) => {
|
|
6643
|
+
const __refreshTokenWithNativeTokens = async () => {
|
|
6620
6644
|
try {
|
|
6621
6645
|
const authApi = api.auth;
|
|
6622
|
-
const response = await (0,
|
|
6623
|
-
const tokens = await
|
|
6646
|
+
const response = await (0,_helpers__WEBPACK_IMPORTED_MODULE_13__.refreshTokenWithRetry)(async () => {
|
|
6647
|
+
const tokens = await _toolkit__WEBPACK_IMPORTED_MODULE_14__["default"].getTokens();
|
|
6624
6648
|
return await authApi.silentOAuthRefreshTokenV3(tokens);
|
|
6625
6649
|
});
|
|
6626
6650
|
const updatedUser = await __handleUnnecessaryEntitlementsUpdate(response.user);
|
|
@@ -6630,13 +6654,6 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6630
6654
|
isAuthenticated: true
|
|
6631
6655
|
});
|
|
6632
6656
|
} catch (e) {
|
|
6633
|
-
// native tokens can't name a tenant: the retry relies on the tab tenant only
|
|
6634
|
-
const retry = () => __refreshTokenWithNativeTokens({
|
|
6635
|
-
isSsoEnforcementRetry: true
|
|
6636
|
-
});
|
|
6637
|
-
if (await __handleSsoEnforcementRefreshError(e, isSsoEnforcementRetry, retry)) {
|
|
6638
|
-
return;
|
|
6639
|
-
}
|
|
6640
6657
|
contextHolder.setAccessToken(null);
|
|
6641
6658
|
contextHolder.setUser(null);
|
|
6642
6659
|
actions.setAuthState({
|
|
@@ -6648,8 +6665,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6648
6665
|
|
|
6649
6666
|
/** @protected */
|
|
6650
6667
|
const __refreshToken = async () => {
|
|
6651
|
-
(0,
|
|
6652
|
-
if (
|
|
6668
|
+
await (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.restoreTabTenantUnlessSsoCallback)(store);
|
|
6669
|
+
if (_toolkit__WEBPACK_IMPORTED_MODULE_14__["default"].isGetTokensAvailable()) {
|
|
6653
6670
|
await __refreshTokenWithNativeTokens();
|
|
6654
6671
|
return;
|
|
6655
6672
|
}
|
|
@@ -6674,7 +6691,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6674
6691
|
var _store$auth$user2;
|
|
6675
6692
|
// @ts-ignore TODO: fix entitlements state type
|
|
6676
6693
|
const oldEntitlements = (_store$auth$user2 = store.auth.user) == null ? void 0 : _store$auth$user2.entitlements;
|
|
6677
|
-
if ((0,
|
|
6694
|
+
if ((0,_toolkit__WEBPACK_IMPORTED_MODULE_15__.isEntitlementsDeeplyEqual)(oldEntitlements, updatedUser == null ? void 0 : updatedUser.entitlements)) {
|
|
6678
6695
|
// set the previous entitlements object
|
|
6679
6696
|
return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, updatedUser, {
|
|
6680
6697
|
entitlements: oldEntitlements
|
|
@@ -6694,7 +6711,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6694
6711
|
loginState,
|
|
6695
6712
|
onRedirectTo
|
|
6696
6713
|
} = store.auth;
|
|
6697
|
-
const [preventAuthRedirectOnSocialLogin] =
|
|
6714
|
+
const [preventAuthRedirectOnSocialLogin] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.FeatureFlags.getFeatureFlags(['prevent-auth-redirect-on-social-login'], store.root.appName);
|
|
6698
6715
|
const invitationToken = url.searchParams.get('invitationToken');
|
|
6699
6716
|
const redirectRoutes = [routes.socialLoginCallbackUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl, routes.magicLinkCallbackUrl];
|
|
6700
6717
|
if (!invitationToken) {
|
|
@@ -6723,7 +6740,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6723
6740
|
var _payload$callback;
|
|
6724
6741
|
const {
|
|
6725
6742
|
isActive
|
|
6726
|
-
} = await (0,
|
|
6743
|
+
} = await (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.retryIfNeeded)(api.auth.getSSOPublicConfiguration, payload == null ? void 0 : payload.retryConfig);
|
|
6727
6744
|
actions.setAuthState({
|
|
6728
6745
|
isSSOAuth: isActive
|
|
6729
6746
|
});
|
|
@@ -6742,7 +6759,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6742
6759
|
let ssoACS;
|
|
6743
6760
|
try {
|
|
6744
6761
|
var _metadata$configurati;
|
|
6745
|
-
const metadata = await (0,
|
|
6762
|
+
const metadata = await (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.retryIfNeeded)(api.metadata.getSamlMetadata, payload == null ? void 0 : payload.retryConfig);
|
|
6746
6763
|
ssoACS = metadata == null ? void 0 : (_metadata$configurati = metadata.configuration) == null ? void 0 : _metadata$configurati.acsUrl;
|
|
6747
6764
|
} catch (e) {
|
|
6748
6765
|
console.error(e);
|
|
@@ -6768,8 +6785,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6768
6785
|
onRedirectTo,
|
|
6769
6786
|
routes
|
|
6770
6787
|
} = store.auth;
|
|
6771
|
-
if ((0,
|
|
6772
|
-
const mfaRequiredState = await actions.getMfaRequiredState(user,
|
|
6788
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
|
|
6789
|
+
const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_17__.DEFAULT_RETRY_CONFIG, true);
|
|
6773
6790
|
actions.setAuthState(mfaRequiredState);
|
|
6774
6791
|
onRedirectTo(routes.loginUrl, {
|
|
6775
6792
|
preserveQueryParams: true
|
|
@@ -6780,17 +6797,17 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6780
6797
|
Object.assign(store.auth.loginState, state);
|
|
6781
6798
|
};
|
|
6782
6799
|
const resetLoginState = () => {
|
|
6783
|
-
(0,
|
|
6800
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_16__.deepResetState)(store, ['auth', 'loginState'], _state__WEBPACK_IMPORTED_MODULE_18__.initialState);
|
|
6784
6801
|
};
|
|
6785
6802
|
const getRetryWithBlockingCallbackPayload = requestName => {
|
|
6786
6803
|
const callback = (_, error) => {
|
|
6787
6804
|
if (!error || error.statusCode < 500) return;
|
|
6788
6805
|
actions.setErrorByRequestName({
|
|
6789
6806
|
requestName,
|
|
6790
|
-
traceId: (0,
|
|
6807
|
+
traceId: (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.errorTraceId)(error)
|
|
6791
6808
|
});
|
|
6792
6809
|
};
|
|
6793
|
-
return (0,
|
|
6810
|
+
return (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.withRetryConfig)({
|
|
6794
6811
|
callback
|
|
6795
6812
|
});
|
|
6796
6813
|
};
|
|
@@ -6802,19 +6819,19 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6802
6819
|
actions.setAuthState({
|
|
6803
6820
|
isLoading: true
|
|
6804
6821
|
});
|
|
6805
|
-
calls.push(actions.loadSocialLoginsConfigurationV2((0,
|
|
6806
|
-
calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(
|
|
6807
|
-
calls.push(actions.loadPublicAuthStrategiesPolicy(getRetryWithBlockingCallbackPayload(
|
|
6822
|
+
calls.push(actions.loadSocialLoginsConfigurationV2((0,_helpers__WEBPACK_IMPORTED_MODULE_16__.withRetryConfig)()));
|
|
6823
|
+
calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_19__.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
|
|
6824
|
+
calls.push(actions.loadPublicAuthStrategiesPolicy(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_19__.REQUEST_NAME.LOAD_PUBLIC_AUTH_STRATEGIES_POLICY)));
|
|
6808
6825
|
calls.push(actions.loadSignUpStrategies());
|
|
6809
|
-
calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(
|
|
6810
|
-
calls.push(actions.loadVendorPublicInfo((0,
|
|
6811
|
-
calls.push(__refreshMetadata((0,
|
|
6826
|
+
calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_19__.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
|
|
6827
|
+
calls.push(actions.loadVendorPublicInfo((0,_helpers__WEBPACK_IMPORTED_MODULE_16__.withRetryConfig)()));
|
|
6828
|
+
calls.push(__refreshMetadata((0,_helpers__WEBPACK_IMPORTED_MODULE_16__.withRetryConfig)()));
|
|
6812
6829
|
/*
|
|
6813
6830
|
We will load custom login routes only if custom login is enabled
|
|
6814
6831
|
to check if custom login is enabled without the tenant alias (search-param/subdomain)
|
|
6815
6832
|
we have to wait for the user state (refreshToken request)
|
|
6816
6833
|
*/
|
|
6817
|
-
callsAfterRefresh.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(
|
|
6834
|
+
callsAfterRefresh.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_19__.REQUEST_NAME.LOAD_CUSTOM_LOGIN_ROUTES)));
|
|
6818
6835
|
}
|
|
6819
6836
|
await Promise.all(calls);
|
|
6820
6837
|
if (callsAfterRefresh.length > 0) {
|
|
@@ -6826,14 +6843,14 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6826
6843
|
};
|
|
6827
6844
|
const requestAuthorizeSSR = async payload => {
|
|
6828
6845
|
const calls = [];
|
|
6829
|
-
calls.push(actions.loadSocialLoginsConfigurationV2((0,
|
|
6830
|
-
calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(
|
|
6831
|
-
calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(
|
|
6846
|
+
calls.push(actions.loadSocialLoginsConfigurationV2((0,_helpers__WEBPACK_IMPORTED_MODULE_16__.withRetryConfig)()));
|
|
6847
|
+
calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_19__.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
|
|
6848
|
+
calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_19__.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
|
|
6832
6849
|
calls.push(actions.loadSignUpStrategies());
|
|
6833
|
-
calls.push(actions.loadVendorPublicInfo((0,
|
|
6850
|
+
calls.push(actions.loadVendorPublicInfo((0,_helpers__WEBPACK_IMPORTED_MODULE_16__.withRetryConfig)()));
|
|
6834
6851
|
calls.push(__refreshMetadata());
|
|
6835
6852
|
calls.push(__isMFARequiredSSR(payload));
|
|
6836
|
-
calls.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(
|
|
6853
|
+
calls.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_19__.REQUEST_NAME.LOAD_CUSTOM_LOGIN_ROUTES)));
|
|
6837
6854
|
await Promise.all(calls);
|
|
6838
6855
|
};
|
|
6839
6856
|
const ssoPreloginFailed = async _ref3 => {
|
|
@@ -6845,28 +6862,28 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6845
6862
|
const publicPolicy = store.auth.securityPolicyState.publicPolicy.policy;
|
|
6846
6863
|
if (!(publicPolicy != null && publicPolicy.authStrategy)) {
|
|
6847
6864
|
actions.setLoginState({
|
|
6848
|
-
step:
|
|
6865
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithPassword,
|
|
6849
6866
|
loading: false
|
|
6850
6867
|
});
|
|
6851
6868
|
callback == null ? void 0 : callback();
|
|
6852
6869
|
return;
|
|
6853
6870
|
}
|
|
6854
|
-
if ((publicPolicy == null ? void 0 : publicPolicy.authStrategy) ===
|
|
6871
|
+
if ((publicPolicy == null ? void 0 : publicPolicy.authStrategy) === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__.AuthStrategyEnum.EmailAndPassword) {
|
|
6855
6872
|
actions.setLoginState({
|
|
6856
|
-
step:
|
|
6873
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithPassword,
|
|
6857
6874
|
loading: false
|
|
6858
6875
|
});
|
|
6859
6876
|
callback == null ? void 0 : callback();
|
|
6860
|
-
} else if ([
|
|
6877
|
+
} else if ([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__.AuthStrategyEnum.MagicLink, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__.AuthStrategyEnum.Code, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__.AuthStrategyEnum.SmsCode].includes(publicPolicy == null ? void 0 : publicPolicy.authStrategy)) {
|
|
6861
6878
|
await actions.passwordlessPreLogin((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, body, {
|
|
6862
6879
|
type: publicPolicy == null ? void 0 : publicPolicy.authStrategy,
|
|
6863
6880
|
callback
|
|
6864
6881
|
}));
|
|
6865
6882
|
} else {
|
|
6866
6883
|
actions.setLoginState({
|
|
6867
|
-
step:
|
|
6884
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithPassword,
|
|
6868
6885
|
loading: false,
|
|
6869
|
-
error: (0,
|
|
6886
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(error)
|
|
6870
6887
|
});
|
|
6871
6888
|
callback == null ? void 0 : callback();
|
|
6872
6889
|
}
|
|
@@ -6889,7 +6906,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6889
6906
|
};
|
|
6890
6907
|
const scheduleSsoRedirect = (ssoRedirectUrl, attempt) => {
|
|
6891
6908
|
setTimeout(() => {
|
|
6892
|
-
if (attempt === latestPreLoginAttempt && store.auth.loginState.step ===
|
|
6909
|
+
if (attempt === latestPreLoginAttempt && store.auth.loginState.step === _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.redirectToSSO) {
|
|
6893
6910
|
redirectToFullPage(ssoRedirectUrl);
|
|
6894
6911
|
}
|
|
6895
6912
|
}, SSO_REDIRECT_DELAY_MS);
|
|
@@ -6913,7 +6930,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6913
6930
|
loading: true
|
|
6914
6931
|
});
|
|
6915
6932
|
try {
|
|
6916
|
-
const tenantId = (0,
|
|
6933
|
+
const tenantId = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.getSearchParam)(_helpers__WEBPACK_IMPORTED_MODULE_10__.TENANT_ID_PARAM_KEY);
|
|
6917
6934
|
const preLoginResult = await api.auth.preLoginV2((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, email ? {
|
|
6918
6935
|
email
|
|
6919
6936
|
} : {}, username ? {
|
|
@@ -6927,7 +6944,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6927
6944
|
addressType
|
|
6928
6945
|
} = preLoginResult != null ? preLoginResult : {};
|
|
6929
6946
|
if (address) {
|
|
6930
|
-
if (addressType ===
|
|
6947
|
+
if (addressType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.PreLoginAddressType.External) {
|
|
6931
6948
|
// Domain-based routing: navigate to the vendor legacy login URL immediately,
|
|
6932
6949
|
// skipping the SSO interstitial and the SSO/OIDC-specific handling.
|
|
6933
6950
|
setLoginState({
|
|
@@ -6936,23 +6953,17 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6936
6953
|
redirectToFullPage(address);
|
|
6937
6954
|
return;
|
|
6938
6955
|
}
|
|
6939
|
-
|
|
6940
|
-
if (
|
|
6941
|
-
const {
|
|
6942
|
-
oidcRedirectUrl
|
|
6943
|
-
} = store.auth.routes;
|
|
6944
|
-
ssoRedirectUrl += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
|
|
6945
|
-
}
|
|
6946
|
-
if (_toolkit__WEBPACK_IMPORTED_MODULE_11__["default"].isLoginWithSSOAvailable()) {
|
|
6956
|
+
const ssoRedirectUrl = idpType === _SSOState_interfaces__WEBPACK_IMPORTED_MODULE_21__.SamlVendors.Oidc ? (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.withOidcRedirectUri)(address, store.auth.routes.oidcRedirectUrl) : address;
|
|
6957
|
+
if (_toolkit__WEBPACK_IMPORTED_MODULE_14__["default"].isLoginWithSSOAvailable()) {
|
|
6947
6958
|
var _ref4;
|
|
6948
|
-
|
|
6959
|
+
_toolkit__WEBPACK_IMPORTED_MODULE_14__["default"].loginWithSSO((_ref4 = email != null ? email : username) != null ? _ref4 : '');
|
|
6949
6960
|
setLoginState({
|
|
6950
6961
|
loading: false
|
|
6951
6962
|
});
|
|
6952
6963
|
callback == null ? void 0 : callback();
|
|
6953
6964
|
} else {
|
|
6954
6965
|
setLoginState({
|
|
6955
|
-
step:
|
|
6966
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.redirectToSSO,
|
|
6956
6967
|
loading: false,
|
|
6957
6968
|
ssoRedirectUrl
|
|
6958
6969
|
});
|
|
@@ -7017,7 +7028,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7017
7028
|
onRedirectTo(routes.authenticatedUrl);
|
|
7018
7029
|
}, 1000);
|
|
7019
7030
|
setLoginState({
|
|
7020
|
-
step:
|
|
7031
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithSSOFailed,
|
|
7021
7032
|
loading: false
|
|
7022
7033
|
});
|
|
7023
7034
|
}
|
|
@@ -7052,17 +7063,17 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7052
7063
|
onRedirectTo,
|
|
7053
7064
|
routes
|
|
7054
7065
|
} = store.auth;
|
|
7055
|
-
if ((0,
|
|
7056
|
-
const mfaRequiredState = await actions.getMfaRequiredState(user,
|
|
7066
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
|
|
7067
|
+
const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_17__.DEFAULT_RETRY_CONFIG, true, email);
|
|
7057
7068
|
actions.setAuthState(mfaRequiredState);
|
|
7058
7069
|
onRedirectTo(routes.loginUrl, {
|
|
7059
7070
|
preserveQueryParams: true
|
|
7060
7071
|
});
|
|
7061
7072
|
} else {
|
|
7062
7073
|
const [securityCenterLoginFlows] = await actions.getFeatureFlags(['security-center-show-login-flows']);
|
|
7063
|
-
if ((0,
|
|
7074
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isResetPasswordRequired)(user, store.root.appName)) {
|
|
7064
7075
|
setLoginState({
|
|
7065
|
-
step:
|
|
7076
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.passwordRotationExpired,
|
|
7066
7077
|
loading: false,
|
|
7067
7078
|
resetPasswordToken: user.resetPasswordToken,
|
|
7068
7079
|
userId: user.userId
|
|
@@ -7085,7 +7096,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7085
7096
|
loading: false,
|
|
7086
7097
|
error: undefined,
|
|
7087
7098
|
mfaToken: user.mfaToken,
|
|
7088
|
-
step: loginState.flow ===
|
|
7099
|
+
step: loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login ? _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.success : loginState.step,
|
|
7089
7100
|
tenants,
|
|
7090
7101
|
tenantsLoading: true,
|
|
7091
7102
|
isBreachedPassword: user.isBreachedPassword,
|
|
@@ -7107,25 +7118,25 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7107
7118
|
};
|
|
7108
7119
|
(0,_helpers__WEBPACK_IMPORTED_MODULE_22__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_22__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
|
|
7109
7120
|
}
|
|
7110
|
-
if (loginState.flow ===
|
|
7121
|
+
if (loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login) {
|
|
7111
7122
|
if (securityCenterLoginFlows && user.isBreachedPassword && !isAuthenticated) {
|
|
7112
7123
|
setLoginState({
|
|
7113
|
-
step:
|
|
7124
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.breachedPassword,
|
|
7114
7125
|
loading: false
|
|
7115
7126
|
});
|
|
7116
7127
|
} else {
|
|
7117
7128
|
if (isAuthenticated) {
|
|
7118
|
-
const shouldShowPasswordRotationPrompt = (0,
|
|
7129
|
+
const shouldShowPasswordRotationPrompt = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.shouldShowPasswordRotationPromptFunc)(user);
|
|
7119
7130
|
if (shouldShowPasswordRotationPrompt) {
|
|
7120
7131
|
setLoginState({
|
|
7121
|
-
step:
|
|
7132
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.passwordRotationNotification,
|
|
7122
7133
|
loading: false
|
|
7123
7134
|
});
|
|
7124
7135
|
} else {
|
|
7125
7136
|
const shouldShowPromptPasskeys = await actions.__shouldShowPromptPasskeys();
|
|
7126
7137
|
if (shouldShowPromptPasskeys) {
|
|
7127
7138
|
setLoginState({
|
|
7128
|
-
step:
|
|
7139
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.promptPasskeys,
|
|
7129
7140
|
loading: false
|
|
7130
7141
|
});
|
|
7131
7142
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -7140,8 +7151,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7140
7151
|
}
|
|
7141
7152
|
}
|
|
7142
7153
|
}
|
|
7143
|
-
if (
|
|
7144
|
-
|
|
7154
|
+
if (_toolkit__WEBPACK_IMPORTED_MODULE_14__["default"].isSuggestSavePasswordAvailable()) {
|
|
7155
|
+
_toolkit__WEBPACK_IMPORTED_MODULE_14__["default"].suggestSavePassword(email, password);
|
|
7145
7156
|
}
|
|
7146
7157
|
|
|
7147
7158
|
// TODO: extract item name to constants
|
|
@@ -7156,16 +7167,18 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7156
7167
|
callback == null ? void 0 : callback(false, e);
|
|
7157
7168
|
setLoginState({
|
|
7158
7169
|
email,
|
|
7159
|
-
error: (0,
|
|
7170
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e),
|
|
7160
7171
|
loading: false
|
|
7161
7172
|
});
|
|
7162
7173
|
}
|
|
7163
7174
|
};
|
|
7164
|
-
const clearLogoutLocalState = ({
|
|
7175
|
+
const clearLogoutLocalState = async ({
|
|
7165
7176
|
keepHostedOAuthState = false
|
|
7166
7177
|
} = {}) => {
|
|
7167
7178
|
if (contextHolder.isSessionPerTenantEnabled()) {
|
|
7168
|
-
(0,
|
|
7179
|
+
(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__.removeTabTenantFromSessionStorage)();
|
|
7180
|
+
// a pending SSO switch would put a tenant of the logged-out session back on the next page load
|
|
7181
|
+
await (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__.clearTabTenantBeforeSsoSwitch)(store.root.appName);
|
|
7169
7182
|
}
|
|
7170
7183
|
// Step-up re-login goes through silentLogout but still needs the hosted OAuth state to finish the client flow.
|
|
7171
7184
|
if (!keepHostedOAuthState) {
|
|
@@ -7186,7 +7199,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7186
7199
|
} catch {
|
|
7187
7200
|
/* empty */
|
|
7188
7201
|
}
|
|
7189
|
-
clearLogoutLocalState();
|
|
7202
|
+
await clearLogoutLocalState();
|
|
7190
7203
|
actions.resetAuthState();
|
|
7191
7204
|
await actions.requestAuthorize(true);
|
|
7192
7205
|
payload == null ? void 0 : payload();
|
|
@@ -7198,8 +7211,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7198
7211
|
} catch {
|
|
7199
7212
|
/* empty */
|
|
7200
7213
|
}
|
|
7201
|
-
const isStepUpInProgress = !!((_window2 = window) != null && _window2.localStorage.getItem(
|
|
7202
|
-
clearLogoutLocalState({
|
|
7214
|
+
const isStepUpInProgress = !!((_window2 = window) != null && _window2.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY));
|
|
7215
|
+
await clearLogoutLocalState({
|
|
7203
7216
|
keepHostedOAuthState: isStepUpInProgress
|
|
7204
7217
|
});
|
|
7205
7218
|
setTimeout(() => {
|
|
@@ -7217,7 +7230,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7217
7230
|
setLoginState({
|
|
7218
7231
|
loading: false,
|
|
7219
7232
|
error: undefined,
|
|
7220
|
-
step:
|
|
7233
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.preLogin
|
|
7221
7234
|
});
|
|
7222
7235
|
actions.setAuthState({
|
|
7223
7236
|
user: undefined,
|
|
@@ -7227,7 +7240,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7227
7240
|
} catch (e) {
|
|
7228
7241
|
var _payload$callback5;
|
|
7229
7242
|
setLoginState({
|
|
7230
|
-
error: (0,
|
|
7243
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e),
|
|
7231
7244
|
loading: false
|
|
7232
7245
|
});
|
|
7233
7246
|
(_payload$callback5 = payload.callback) == null ? void 0 : _payload$callback5.call(payload, false, e);
|
|
@@ -7246,10 +7259,10 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7246
7259
|
// TODO: fix @frontegg/rest-api return value
|
|
7247
7260
|
// @ts-ignore
|
|
7248
7261
|
const preloginRes = await api.auth.passwordlessPreLogin((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, payload, {
|
|
7249
|
-
type:
|
|
7262
|
+
type: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__.AuthStrategyEnum.SmsCode
|
|
7250
7263
|
}));
|
|
7251
7264
|
setLoginState({
|
|
7252
|
-
step:
|
|
7265
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithQuickSmsOtc,
|
|
7253
7266
|
loading: false,
|
|
7254
7267
|
phoneNumber: preloginRes == null ? void 0 : preloginRes.phoneNumber,
|
|
7255
7268
|
error: undefined
|
|
@@ -7257,7 +7270,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7257
7270
|
callback == null ? void 0 : callback(true);
|
|
7258
7271
|
} catch (e) {
|
|
7259
7272
|
setLoginState({
|
|
7260
|
-
error: (0,
|
|
7273
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e),
|
|
7261
7274
|
loading: false
|
|
7262
7275
|
});
|
|
7263
7276
|
callback == null ? void 0 : callback(false, e);
|
|
@@ -7277,13 +7290,13 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7277
7290
|
phoneNumber: payload.phoneNumber,
|
|
7278
7291
|
loading: false,
|
|
7279
7292
|
changePhoneId: changePhoneRes.changePhoneId,
|
|
7280
|
-
step:
|
|
7293
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.loginWithQuickSmsOtc,
|
|
7281
7294
|
error: undefined
|
|
7282
7295
|
});
|
|
7283
7296
|
callback == null ? void 0 : callback(true);
|
|
7284
7297
|
} catch (e) {
|
|
7285
7298
|
setLoginState({
|
|
7286
|
-
error: (0,
|
|
7299
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e),
|
|
7287
7300
|
loading: false
|
|
7288
7301
|
});
|
|
7289
7302
|
}
|
|
@@ -7304,7 +7317,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7304
7317
|
callback == null ? void 0 : callback(true);
|
|
7305
7318
|
} catch (e) {
|
|
7306
7319
|
setLoginState({
|
|
7307
|
-
error: (0,
|
|
7320
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e),
|
|
7308
7321
|
loading: false
|
|
7309
7322
|
});
|
|
7310
7323
|
}
|
|
@@ -7320,11 +7333,11 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7320
7333
|
loading: true
|
|
7321
7334
|
});
|
|
7322
7335
|
let email;
|
|
7323
|
-
if ((0,
|
|
7336
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isEmailPayload)(payload)) {
|
|
7324
7337
|
email = payload.email;
|
|
7325
7338
|
}
|
|
7326
7339
|
let username;
|
|
7327
|
-
if ((0,
|
|
7340
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isUsernamePayload)(payload)) {
|
|
7328
7341
|
username = payload.username;
|
|
7329
7342
|
}
|
|
7330
7343
|
// TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
@@ -7346,7 +7359,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7346
7359
|
callback == null ? void 0 : callback();
|
|
7347
7360
|
} catch (e) {
|
|
7348
7361
|
setLoginState({
|
|
7349
|
-
error: (0,
|
|
7362
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e),
|
|
7350
7363
|
loading: false
|
|
7351
7364
|
});
|
|
7352
7365
|
callback == null ? void 0 : callback(null, e);
|
|
@@ -7371,7 +7384,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7371
7384
|
routes,
|
|
7372
7385
|
onRedirectTo
|
|
7373
7386
|
} = store.auth;
|
|
7374
|
-
if ((0,
|
|
7387
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
|
|
7375
7388
|
const mfaRequiredState = await actions.getMfaRequiredState(user);
|
|
7376
7389
|
actions.setAuthState(mfaRequiredState);
|
|
7377
7390
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -7384,7 +7397,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7384
7397
|
var _events$userVerified;
|
|
7385
7398
|
const userVerifiedPayload = {
|
|
7386
7399
|
email: user.email,
|
|
7387
|
-
origin:
|
|
7400
|
+
origin: _interfaces__WEBPACK_IMPORTED_MODULE_19__.UserVerifiedOriginTypes.PASSWORDLESS,
|
|
7388
7401
|
id: user.id,
|
|
7389
7402
|
tenantId: user.tenantId,
|
|
7390
7403
|
createdAt: new Date(),
|
|
@@ -7416,11 +7429,11 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7416
7429
|
actions.setAuthState({
|
|
7417
7430
|
isLoading: false
|
|
7418
7431
|
});
|
|
7419
|
-
if (loginState.flow ===
|
|
7432
|
+
if (loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login) {
|
|
7420
7433
|
const shouldShowPrompt = await actions.__shouldShowPromptPasskeys();
|
|
7421
7434
|
if (shouldShowPrompt) {
|
|
7422
7435
|
actions.setLoginState({
|
|
7423
|
-
step:
|
|
7436
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.promptPasskeys,
|
|
7424
7437
|
loading: false
|
|
7425
7438
|
});
|
|
7426
7439
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -7430,12 +7443,12 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7430
7443
|
actions.setAuthState({
|
|
7431
7444
|
isAuthenticated: true
|
|
7432
7445
|
});
|
|
7433
|
-
if (_payload.type ===
|
|
7446
|
+
if (_payload.type === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__.AuthStrategyEnum.MagicLink) {
|
|
7434
7447
|
actions.setLoginState({
|
|
7435
|
-
step:
|
|
7448
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.magicLinkPostLoginSuccess,
|
|
7436
7449
|
loading: false
|
|
7437
7450
|
});
|
|
7438
|
-
await (0,
|
|
7451
|
+
await (0,_helpers__WEBPACK_IMPORTED_MODULE_16__.delay)(5000);
|
|
7439
7452
|
}
|
|
7440
7453
|
await actions.afterAuthNavigation();
|
|
7441
7454
|
}
|
|
@@ -7452,7 +7465,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7452
7465
|
return;
|
|
7453
7466
|
}
|
|
7454
7467
|
setLoginState({
|
|
7455
|
-
error: (0,
|
|
7468
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e, 'Failed to authenticate')
|
|
7456
7469
|
});
|
|
7457
7470
|
callback == null ? void 0 : callback(null, e);
|
|
7458
7471
|
} finally {
|
|
@@ -7476,7 +7489,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7476
7489
|
});
|
|
7477
7490
|
} catch (e) {
|
|
7478
7491
|
setLoginState({
|
|
7479
|
-
inviteTokenError: (0,
|
|
7492
|
+
inviteTokenError: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e, `We couldn't verify your invitation`)
|
|
7480
7493
|
});
|
|
7481
7494
|
} finally {
|
|
7482
7495
|
setLoginState({
|
|
@@ -7512,7 +7525,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7512
7525
|
callback == null ? void 0 : callback(options);
|
|
7513
7526
|
} catch (e) {
|
|
7514
7527
|
setLoginState({
|
|
7515
|
-
error: (0,
|
|
7528
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7516
7529
|
});
|
|
7517
7530
|
callback == null ? void 0 : callback(null);
|
|
7518
7531
|
} finally {
|
|
@@ -7549,7 +7562,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7549
7562
|
user
|
|
7550
7563
|
} = _await$api$auth$webAu,
|
|
7551
7564
|
rest = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_await$api$auth$webAu, _excluded9);
|
|
7552
|
-
if ((0,
|
|
7565
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
|
|
7553
7566
|
const {
|
|
7554
7567
|
routes,
|
|
7555
7568
|
onRedirectTo
|
|
@@ -7591,7 +7604,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7591
7604
|
return;
|
|
7592
7605
|
}
|
|
7593
7606
|
setLoginState({
|
|
7594
|
-
error: (0,
|
|
7607
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7595
7608
|
});
|
|
7596
7609
|
callback == null ? void 0 : callback(null);
|
|
7597
7610
|
} finally {
|
|
@@ -7622,7 +7635,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7622
7635
|
callback == null ? void 0 : callback(options);
|
|
7623
7636
|
} catch (e) {
|
|
7624
7637
|
setLoginState({
|
|
7625
|
-
error: (0,
|
|
7638
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7626
7639
|
});
|
|
7627
7640
|
callback == null ? void 0 : callback(null);
|
|
7628
7641
|
} finally {
|
|
@@ -7641,7 +7654,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7641
7654
|
loading: true
|
|
7642
7655
|
});
|
|
7643
7656
|
const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_25__.publicKeyCredentialToJSON)(body.publicKey);
|
|
7644
|
-
const deviceType = (publicKey == null ? void 0 : publicKey.authenticatorAttachment) === 'platform' ?
|
|
7657
|
+
const deviceType = (publicKey == null ? void 0 : publicKey.authenticatorAttachment) === 'platform' ? _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.WebAuthnDeviceType.Platform : _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.WebAuthnDeviceType.CrossPlatform;
|
|
7645
7658
|
await api.auth.verifyNewDeviceSession({
|
|
7646
7659
|
id: publicKey.id,
|
|
7647
7660
|
response: publicKey.response,
|
|
@@ -7650,7 +7663,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7650
7663
|
callback == null ? void 0 : callback(true);
|
|
7651
7664
|
} catch (e) {
|
|
7652
7665
|
setLoginState({
|
|
7653
|
-
error: (0,
|
|
7666
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7654
7667
|
});
|
|
7655
7668
|
callback == null ? void 0 : callback(null);
|
|
7656
7669
|
} finally {
|
|
@@ -7726,7 +7739,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7726
7739
|
} catch (e) {
|
|
7727
7740
|
setLoginState({
|
|
7728
7741
|
loading: false,
|
|
7729
|
-
error: (0,
|
|
7742
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7730
7743
|
});
|
|
7731
7744
|
callback == null ? void 0 : callback(null);
|
|
7732
7745
|
}
|
|
@@ -7755,7 +7768,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7755
7768
|
}
|
|
7756
7769
|
setLoginState({
|
|
7757
7770
|
loading: false,
|
|
7758
|
-
error: (0,
|
|
7771
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7759
7772
|
});
|
|
7760
7773
|
callback == null ? void 0 : callback(null);
|
|
7761
7774
|
}
|
|
@@ -7781,7 +7794,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7781
7794
|
}
|
|
7782
7795
|
setLoginState({
|
|
7783
7796
|
loading: false,
|
|
7784
|
-
error: (0,
|
|
7797
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7785
7798
|
});
|
|
7786
7799
|
callback == null ? void 0 : callback(null);
|
|
7787
7800
|
}
|
|
@@ -7808,7 +7821,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7808
7821
|
} catch (e) {
|
|
7809
7822
|
setLoginState({
|
|
7810
7823
|
loading: false,
|
|
7811
|
-
error: (0,
|
|
7824
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7812
7825
|
});
|
|
7813
7826
|
callback == null ? void 0 : callback(null);
|
|
7814
7827
|
}
|
|
@@ -7834,7 +7847,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7834
7847
|
}
|
|
7835
7848
|
setLoginState({
|
|
7836
7849
|
loading: false,
|
|
7837
|
-
error: (0,
|
|
7850
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7838
7851
|
});
|
|
7839
7852
|
callback == null ? void 0 : callback(null);
|
|
7840
7853
|
}
|
|
@@ -7874,7 +7887,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7874
7887
|
setLoginState({
|
|
7875
7888
|
loading: false,
|
|
7876
7889
|
error: undefined,
|
|
7877
|
-
step:
|
|
7890
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.breachedPasswordSuccess
|
|
7878
7891
|
});
|
|
7879
7892
|
actions.setAuthState({
|
|
7880
7893
|
isAuthenticated: false
|
|
@@ -7882,7 +7895,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7882
7895
|
} catch (e) {
|
|
7883
7896
|
setLoginState({
|
|
7884
7897
|
loading: false,
|
|
7885
|
-
error: (0,
|
|
7898
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_11__.errorHandler)(e)
|
|
7886
7899
|
});
|
|
7887
7900
|
}
|
|
7888
7901
|
};
|
|
@@ -7905,7 +7918,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7905
7918
|
return;
|
|
7906
7919
|
}
|
|
7907
7920
|
try {
|
|
7908
|
-
const tabTenantId = tenantId != null ? tenantId : (0,
|
|
7921
|
+
const tabTenantId = tenantId != null ? tenantId : (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_12__.getTabTenantFromSessionStorage)(store.root.appName);
|
|
7909
7922
|
const body = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({
|
|
7910
7923
|
grant_type: 'refresh_token',
|
|
7911
7924
|
refresh_token: currentUser == null ? void 0 : currentUser.refreshToken
|
|
@@ -7947,8 +7960,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7947
7960
|
user,
|
|
7948
7961
|
tenants = [],
|
|
7949
7962
|
activeTenant
|
|
7950
|
-
} = await (0,
|
|
7951
|
-
if ((0,
|
|
7963
|
+
} = await (0,_helpers__WEBPACK_IMPORTED_MODULE_13__.refreshTokenWithRetry)(() => api.auth.refreshTokenV3());
|
|
7964
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isMfaRequired)(user, store.root.appName)) {
|
|
7952
7965
|
const mfaRequiredState = await actions.getMfaRequiredState(user);
|
|
7953
7966
|
actions.setAuthState(mfaRequiredState);
|
|
7954
7967
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -7959,7 +7972,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7959
7972
|
const shouldShowPrompt = await actions.__shouldShowPromptPasskeys();
|
|
7960
7973
|
if (shouldShowPrompt) {
|
|
7961
7974
|
actions.setLoginState({
|
|
7962
|
-
step:
|
|
7975
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginStep.promptPasskeys,
|
|
7963
7976
|
loading: false
|
|
7964
7977
|
});
|
|
7965
7978
|
actions.afterAuthenticationStateUpdate({
|
|
@@ -7986,7 +7999,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7986
7999
|
}, {
|
|
7987
8000
|
loginState: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, loginState, {
|
|
7988
8001
|
quickLoginToRegister,
|
|
7989
|
-
flow: shouldNavigateToRegisterQuickLogin ?
|
|
8002
|
+
flow: shouldNavigateToRegisterQuickLogin ? _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.RegisterQuickLogin : _interfaces__WEBPACK_IMPORTED_MODULE_7__.LoginFlow.Login
|
|
7990
8003
|
}),
|
|
7991
8004
|
isAuthenticated: true
|
|
7992
8005
|
});
|
|
@@ -8047,7 +8060,6 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
8047
8060
|
refreshTokenForSocialLogins,
|
|
8048
8061
|
// protected
|
|
8049
8062
|
__refreshToken,
|
|
8050
|
-
__redirectToSsoForTenant,
|
|
8051
8063
|
__redirectToSsoIfRequired
|
|
8052
8064
|
}, (0,_hostedLoginAuthorize_actions__WEBPACK_IMPORTED_MODULE_27__["default"])(store, api, sharedActions), (0,_afterAuthNavigation_actions__WEBPACK_IMPORTED_MODULE_28__["default"])(store, api, sharedActions), (0,_handleVerifyMFAResponse_actions__WEBPACK_IMPORTED_MODULE_29__["default"])(store, api, sharedActions), (0,_mfaRequiredState_actions__WEBPACK_IMPORTED_MODULE_30__["default"])(store, api, sharedActions), (0,_mfaWithAuthenticator_actions__WEBPACK_IMPORTED_MODULE_31__["default"])(store, api, sharedActions), (0,_mfaWithEmailCode_actions__WEBPACK_IMPORTED_MODULE_32__["default"])(store, api, sharedActions), (0,_mfaWithSMS_actions__WEBPACK_IMPORTED_MODULE_33__["default"])(store, api, sharedActions), (0,_mfaWithWebAuthn_actions__WEBPACK_IMPORTED_MODULE_34__["default"])(store, api, sharedActions));
|
|
8053
8065
|
});
|
|
@@ -8834,7 +8846,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8834
8846
|
/* harmony export */ isEmailPayload: () => (/* binding */ isEmailPayload),
|
|
8835
8847
|
/* harmony export */ isOauthCallbackRoute: () => (/* binding */ isOauthCallbackRoute),
|
|
8836
8848
|
/* harmony export */ isUsernamePayload: () => (/* binding */ isUsernamePayload),
|
|
8837
|
-
/* harmony export */ shouldShowPasswordRotationPromptFunc: () => (/* binding */ shouldShowPasswordRotationPromptFunc)
|
|
8849
|
+
/* harmony export */ shouldShowPasswordRotationPromptFunc: () => (/* binding */ shouldShowPasswordRotationPromptFunc),
|
|
8850
|
+
/* harmony export */ withOidcRedirectUri: () => (/* binding */ withOidcRedirectUri)
|
|
8838
8851
|
/* harmony export */ });
|
|
8839
8852
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
|
|
8840
8853
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
@@ -8916,6 +8929,9 @@ const getSearchParam = key => {
|
|
|
8916
8929
|
return param != null ? param : undefined;
|
|
8917
8930
|
};
|
|
8918
8931
|
const TENANT_ID_PARAM_KEY = 'tenantId';
|
|
8932
|
+
|
|
8933
|
+
/** An OIDC SSO page without redirect_uri comes back to the OIDC callback, which completes the login with its code. */
|
|
8934
|
+
const withOidcRedirectUri = (address, oidcRedirectUrl) => address.includes('redirect_uri') ? address : `${address}&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
|
|
8919
8935
|
const getNumberOfMfaDevices = mfaDevices => {
|
|
8920
8936
|
// Count platform / cross-platform separately — matches the MFA picker options.
|
|
8921
8937
|
const numberOfWebAuthnDevices = Number(mfaDevices.webauthn.some(device => device.deviceType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.WebAuthnDeviceType.Platform)) + Number(mfaDevices.webauthn.some(device => device.deviceType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.WebAuthnDeviceType.CrossPlatform));
|
|
@@ -16470,12 +16486,11 @@ const isMfaIsNotEnrolledError = error => (error == null ? void 0 : error['messag
|
|
|
16470
16486
|
}
|
|
16471
16487
|
callback == null ? void 0 : callback(true);
|
|
16472
16488
|
} catch (e) {
|
|
16473
|
-
callback == null ? void 0 : callback(false);
|
|
16474
|
-
|
|
16475
16489
|
// the session's tenant requires SSO: its SSO login steps the user up, instead of logging them out
|
|
16476
16490
|
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
16477
16491
|
return;
|
|
16478
16492
|
}
|
|
16493
|
+
callback == null ? void 0 : callback(false);
|
|
16479
16494
|
await __handleStepUpError(e);
|
|
16480
16495
|
}
|
|
16481
16496
|
};
|
|
@@ -18483,8 +18498,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18483
18498
|
/* harmony export */ });
|
|
18484
18499
|
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/TenantsState/state.js");
|
|
18485
18500
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
|
|
18486
|
-
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/
|
|
18487
|
-
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/
|
|
18501
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
|
|
18502
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
18488
18503
|
|
|
18489
18504
|
|
|
18490
18505
|
|
|
@@ -18533,6 +18548,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18533
18548
|
});
|
|
18534
18549
|
}
|
|
18535
18550
|
} catch (e) {
|
|
18551
|
+
// the tab tenant the switch was refused from, read before any await: a parallel switch that passes moves the tab
|
|
18552
|
+
// while this one goes to SSO
|
|
18553
|
+
const tabTenantId = (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.getTabTenantFromSessionStorage)(store.root.appName);
|
|
18536
18554
|
silentReload ? actions.setTenantsState({
|
|
18537
18555
|
switchingTenant: false
|
|
18538
18556
|
}) : actions.setAuthState({
|
|
@@ -18540,8 +18558,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18540
18558
|
});
|
|
18541
18559
|
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
18542
18560
|
// the tab comes back from SSO in the target tenant, not the one the failed switch restored
|
|
18543
|
-
if (
|
|
18544
|
-
(0,
|
|
18561
|
+
if (_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(store.root.appName).isSessionPerTenantEnabled()) {
|
|
18562
|
+
(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.setTabTenantForSsoSwitch)(tenantId, tabTenantId);
|
|
18545
18563
|
}
|
|
18546
18564
|
return;
|
|
18547
18565
|
}
|
|
@@ -18554,7 +18572,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18554
18572
|
});
|
|
18555
18573
|
try {
|
|
18556
18574
|
var _payload$callback;
|
|
18557
|
-
const userTenantsResponseFunc = (0,
|
|
18575
|
+
const userTenantsResponseFunc = (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.getCurrentUserTenantsFunction)(store.root.appName);
|
|
18558
18576
|
const userTenantsResponse = await userTenantsResponseFunc();
|
|
18559
18577
|
setTenantsState({
|
|
18560
18578
|
tenants: userTenantsResponse.tenants,
|
|
@@ -18989,7 +19007,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18989
19007
|
/* harmony export */ isMfaRequired: () => (/* binding */ isMfaRequired),
|
|
18990
19008
|
/* harmony export */ isOauthCallbackRoute: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.isOauthCallbackRoute),
|
|
18991
19009
|
/* harmony export */ isOnAuthPageRoute: () => (/* binding */ isOnAuthPageRoute),
|
|
18992
|
-
/* harmony export */
|
|
19010
|
+
/* harmony export */ isOnLoginCodeCallbackRoute: () => (/* binding */ isOnLoginCodeCallbackRoute),
|
|
18993
19011
|
/* harmony export */ isResetPasswordRequired: () => (/* binding */ isResetPasswordRequired),
|
|
18994
19012
|
/* harmony export */ isSteppedUp: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.isSteppedUp),
|
|
18995
19013
|
/* harmony export */ isUsernamePayload: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.isUsernamePayload),
|
|
@@ -18998,7 +19016,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18998
19016
|
/* harmony export */ redirectByStepUpUrl: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.redirectByStepUpUrl),
|
|
18999
19017
|
/* harmony export */ restoreTabTenantUnlessSsoCallback: () => (/* binding */ restoreTabTenantUnlessSsoCallback),
|
|
19000
19018
|
/* harmony export */ setAfterAuthRedirectUrlForStepUp: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.setAfterAuthRedirectUrlForStepUp),
|
|
19001
|
-
/* harmony export */ shouldShowPasswordRotationPromptFunc: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.shouldShowPasswordRotationPromptFunc)
|
|
19019
|
+
/* harmony export */ shouldShowPasswordRotationPromptFunc: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.shouldShowPasswordRotationPromptFunc),
|
|
19020
|
+
/* harmony export */ withOidcRedirectUri: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.withOidcRedirectUri)
|
|
19002
19021
|
/* harmony export */ });
|
|
19003
19022
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
|
|
19004
19023
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
@@ -19077,24 +19096,27 @@ const getCurrentRoutes = urlStrategy => {
|
|
|
19077
19096
|
};
|
|
19078
19097
|
|
|
19079
19098
|
/**
|
|
19080
|
-
* On the OIDC callback the page still has to finish the
|
|
19081
|
-
* a reason to go
|
|
19099
|
+
* On the OIDC or hosted login callback the page still has to finish the login with its code: a refresh refused before
|
|
19100
|
+
* that is not a reason to go to SSO again. On the OIDC callback the IdP would send the user straight back here, forever;
|
|
19101
|
+
* on the hosted callback a new hosted login would replace the PKCE verifier the code exchange needs.
|
|
19082
19102
|
*/
|
|
19083
|
-
const
|
|
19103
|
+
const isOnLoginCodeCallbackRoute = store => {
|
|
19084
19104
|
var _store$root$urlStrate;
|
|
19085
19105
|
const {
|
|
19086
|
-
oidcRedirectUrl
|
|
19106
|
+
oidcRedirectUrl,
|
|
19107
|
+
hostedLoginRedirectUrl
|
|
19087
19108
|
} = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, _LoginState_consts__WEBPACK_IMPORTED_MODULE_6__.defaultFronteggRoutes, store.auth.routes);
|
|
19088
|
-
|
|
19109
|
+
const currentRoutes = getCurrentRoutes((_store$root$urlStrate = store.root.urlStrategy) != null ? _store$root$urlStrate : 'path');
|
|
19110
|
+
return [oidcRedirectUrl, hostedLoginRedirectUrl].some(route => !!route && currentRoutes.some(currentRoute => currentRoute.endsWith(route)));
|
|
19089
19111
|
};
|
|
19090
19112
|
|
|
19091
19113
|
/**
|
|
19092
19114
|
* After a switch refused for SSO the tab points at the SSO tenant. Its SSO login comes back on a callback route and
|
|
19093
19115
|
* keeps it; any other page load means the user didn't finish that login, so the tab goes back to its tenant.
|
|
19094
19116
|
*/
|
|
19095
|
-
const restoreTabTenantUnlessSsoCallback = store => {
|
|
19117
|
+
const restoreTabTenantUnlessSsoCallback = async store => {
|
|
19096
19118
|
var _store$root$urlStrate2;
|
|
19097
|
-
if (!
|
|
19119
|
+
if (!_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ContextHolder.for(store.root.appName).isSessionPerTenantEnabled()) {
|
|
19098
19120
|
return;
|
|
19099
19121
|
}
|
|
19100
19122
|
const {
|
|
@@ -19104,9 +19126,13 @@ const restoreTabTenantUnlessSsoCallback = store => {
|
|
|
19104
19126
|
} = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, _LoginState_consts__WEBPACK_IMPORTED_MODULE_6__.defaultFronteggRoutes, store.auth.routes);
|
|
19105
19127
|
// matched like login matches its callback pages: endsWith, so a basename before the route still counts
|
|
19106
19128
|
const currentRoutes = getCurrentRoutes((_store$root$urlStrate2 = store.root.urlStrategy) != null ? _store$root$urlStrate2 : 'path');
|
|
19107
|
-
|
|
19129
|
+
// a refused login comes back on its callback too, not finished: SAML with samlerrors (as SamlLoginSuccess reads them),
|
|
19130
|
+
// OIDC and hosted without a code (e.g. the IdP's error=access_denied), which their pages need to finish the login
|
|
19131
|
+
const params = new URLSearchParams(window.location.search);
|
|
19132
|
+
const callbackRoutes = [...(params.has('samlerrors') ? [] : [samlCallbackUrl]), ...(params.has('code') ? [oidcRedirectUrl, hostedLoginRedirectUrl] : [])];
|
|
19133
|
+
const isSsoCallback = callbackRoutes.some(route => !!route && currentRoutes.some(currentRoute => currentRoute.endsWith(route)));
|
|
19108
19134
|
if (!isSsoCallback) {
|
|
19109
|
-
(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_7__.restoreTabTenantBeforeSsoSwitch)();
|
|
19135
|
+
await (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_7__.restoreTabTenantBeforeSsoSwitch)(store.root.appName);
|
|
19110
19136
|
}
|
|
19111
19137
|
};
|
|
19112
19138
|
const prepareIdentifiersForSignup = payload => {
|
|
@@ -21439,7 +21465,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21439
21465
|
/* harmony export */ isMfaRequired: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isMfaRequired),
|
|
21440
21466
|
/* harmony export */ isOauthCallbackRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOauthCallbackRoute),
|
|
21441
21467
|
/* harmony export */ isOnAuthPageRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOnAuthPageRoute),
|
|
21442
|
-
/* harmony export */
|
|
21468
|
+
/* harmony export */ isOnLoginCodeCallbackRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOnLoginCodeCallbackRoute),
|
|
21443
21469
|
/* harmony export */ isPreferredMfaMethod: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.isPreferredMfaMethod),
|
|
21444
21470
|
/* harmony export */ isProxy: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.isProxy),
|
|
21445
21471
|
/* harmony export */ isResetPasswordRequired: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isResetPasswordRequired),
|
|
@@ -21468,6 +21494,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21468
21494
|
/* harmony export */ shouldShowPasswordRotationPromptFunc: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.shouldShowPasswordRotationPromptFunc),
|
|
21469
21495
|
/* harmony export */ snapshot: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.snapshot),
|
|
21470
21496
|
/* harmony export */ subscribe: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.subscribe),
|
|
21497
|
+
/* harmony export */ withOidcRedirectUri: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.withOidcRedirectUri),
|
|
21471
21498
|
/* harmony export */ withRetryConfig: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.withRetryConfig)
|
|
21472
21499
|
/* harmony export */ });
|
|
21473
21500
|
/* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toolkit */ "../../dist/@frontegg/redux-store/toolkit/index.js");
|
|
@@ -21479,7 +21506,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21479
21506
|
/* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
|
|
21480
21507
|
/* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
|
|
21481
21508
|
/* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
|
|
21482
|
-
/** @license Frontegg v7.131.0
|
|
21509
|
+
/** @license Frontegg v7.131.0
|
|
21483
21510
|
*
|
|
21484
21511
|
* This source code is licensed under the MIT license found in the
|
|
21485
21512
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -30026,6 +30053,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30026
30053
|
/* harmony export */ SecurityPolicyApi: () => (/* reexport safe */ _secutiry_poilicy__WEBPACK_IMPORTED_MODULE_2__.SecurityPolicyApi),
|
|
30027
30054
|
/* harmony export */ SignUpStrategyEnum: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.SignUpStrategyEnum),
|
|
30028
30055
|
/* harmony export */ SocialLoginProviders: () => (/* reexport safe */ _enums__WEBPACK_IMPORTED_MODULE_3__.SocialLoginProviders),
|
|
30056
|
+
/* harmony export */ clearTabTenantBeforeSsoSwitch: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.clearTabTenantBeforeSsoSwitch),
|
|
30029
30057
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
30030
30058
|
/* harmony export */ getCurrentUserTenantsFunction: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.getCurrentUserTenantsFunction),
|
|
30031
30059
|
/* harmony export */ getTabTenantFromSessionStorage: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.getTabTenantFromSessionStorage),
|
|
@@ -30118,7 +30146,7 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
|
|
|
30118
30146
|
const [me, currentUserTenants] = await Promise.all([this.getMeAndEntitlements(), (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getCurrentUserTenantsFunction)(this.appName)()]);
|
|
30119
30147
|
const decodedContent = accessToken ? (0,_jwt__WEBPACK_IMPORTED_MODULE_10__.jwtDecode)(accessToken) : {};
|
|
30120
30148
|
const user = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, loginResponse, decodedContent, me);
|
|
30121
|
-
const activeTenant = this.resolveSessionTenant(contextHolder, user, decodedContent, currentUserTenants);
|
|
30149
|
+
const activeTenant = await this.resolveSessionTenant(contextHolder, user, decodedContent, currentUserTenants);
|
|
30122
30150
|
contextHolder.setUser(user);
|
|
30123
30151
|
return {
|
|
30124
30152
|
user,
|
|
@@ -30153,7 +30181,7 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
|
|
|
30153
30181
|
}, decodedContent, me, {
|
|
30154
30182
|
expiresIn: oauthResponse.expires_in || 300
|
|
30155
30183
|
});
|
|
30156
|
-
const activeTenant = this.resolveSessionTenant(contextHolder, user, decodedContent, currentUserTenants);
|
|
30184
|
+
const activeTenant = await this.resolveSessionTenant(contextHolder, user, decodedContent, currentUserTenants);
|
|
30157
30185
|
contextHolder.setUser(user);
|
|
30158
30186
|
return {
|
|
30159
30187
|
user,
|
|
@@ -30889,7 +30917,7 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
|
|
|
30889
30917
|
const [shouldLoadAuthorization] = _feature_flags__WEBPACK_IMPORTED_MODULE_12__.FeatureFlags.getFeatureFlags([_interfaces__WEBPACK_IMPORTED_MODULE_13__.LOAD_AUTHORIZATION_FF], this.appName);
|
|
30890
30918
|
return shouldLoadAuthorization;
|
|
30891
30919
|
}
|
|
30892
|
-
resolveSessionTenant(contextHolder, user, decodedContent, currentUserTenants) {
|
|
30920
|
+
async resolveSessionTenant(contextHolder, user, decodedContent, currentUserTenants) {
|
|
30893
30921
|
let {
|
|
30894
30922
|
activeTenant
|
|
30895
30923
|
} = currentUserTenants;
|
|
@@ -30899,9 +30927,8 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
|
|
|
30899
30927
|
}
|
|
30900
30928
|
if (user.tenantId) {
|
|
30901
30929
|
(0,_utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)(user.tenantId);
|
|
30902
|
-
|
|
30903
|
-
|
|
30904
|
-
}
|
|
30930
|
+
// A confirmed session consumes the marker only while enforcement is enabled.
|
|
30931
|
+
await (0,_utils__WEBPACK_IMPORTED_MODULE_5__.clearTabTenantBeforeSsoSwitch)(this.appName);
|
|
30905
30932
|
// The server's activeTenant may reflect a different tab's tenant switch.
|
|
30906
30933
|
// Correct it to match the JWT's tenant for this tab.
|
|
30907
30934
|
const matchingTenant = currentUserTenants.tenants.find(t => t.tenantId === user.tenantId);
|
|
@@ -31190,7 +31217,9 @@ function setTabTenantInSessionStorage(tenantId) {
|
|
|
31190
31217
|
}
|
|
31191
31218
|
|
|
31192
31219
|
// The one place that reads enforce-sso-on-tenant-access: SSO enforcement on login, tenant switch and token refresh.
|
|
31193
|
-
|
|
31220
|
+
// The first refresh runs alongside the flags request: wait for it instead of reading the flag as off.
|
|
31221
|
+
async function isEnforceSsoOnTenantAccessEnabled(appName) {
|
|
31222
|
+
await _feature_flags__WEBPACK_IMPORTED_MODULE_1__.FeatureFlags.whenLoaded(appName);
|
|
31194
31223
|
const [isEnabled] = _feature_flags__WEBPACK_IMPORTED_MODULE_1__.FeatureFlags.getFeatureFlags([_interfaces__WEBPACK_IMPORTED_MODULE_2__.ENFORCE_SSO_ON_TENANT_ACCESS_FF], appName);
|
|
31195
31224
|
return isEnabled;
|
|
31196
31225
|
}
|
|
@@ -31201,26 +31230,40 @@ function removeTabTenantFromSessionStorage() {
|
|
|
31201
31230
|
/**
|
|
31202
31231
|
* Points the tab at the tenant whose SSO the user is sent to after a refused switch, keeping the tenant it had:
|
|
31203
31232
|
* a page load that isn't the SSO login's callback puts it back (see restoreTabTenantBeforeSsoSwitch).
|
|
31233
|
+
* @param tabTenantId the tab tenant the switch was refused from, read before any await: a parallel switch that passes
|
|
31234
|
+
* moves the tab meanwhile
|
|
31204
31235
|
*/
|
|
31205
|
-
function setTabTenantForSsoSwitch(tenantId) {
|
|
31206
|
-
|
|
31207
|
-
|
|
31236
|
+
function setTabTenantForSsoSwitch(tenantId, tabTenantId) {
|
|
31237
|
+
// a switch settles any earlier marker first, so one still here is from a parallel switch (double click): keep it,
|
|
31238
|
+
// the tab already points at that switch's target. Unless it is this SSO tenant: the tenant that refused is never the
|
|
31239
|
+
// one to put back
|
|
31240
|
+
const marker = sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH);
|
|
31241
|
+
if (marker === null || marker === tenantId) {
|
|
31242
|
+
sessionStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH, tabTenantId != null ? tabTenantId : '');
|
|
31243
|
+
}
|
|
31208
31244
|
setTabTenantInSessionStorage(tenantId);
|
|
31209
31245
|
}
|
|
31210
31246
|
|
|
31211
31247
|
/** Puts back the tab tenant of an SSO switch the user didn't finish. */
|
|
31212
|
-
function restoreTabTenantBeforeSsoSwitch() {
|
|
31248
|
+
async function restoreTabTenantBeforeSsoSwitch(appName) {
|
|
31249
|
+
// Ordinary refreshes must not wait for flags when no SSO switch is pending.
|
|
31250
|
+
if (sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH) === null || !(await isEnforceSsoOnTenantAccessEnabled(appName))) {
|
|
31251
|
+
return;
|
|
31252
|
+
}
|
|
31253
|
+
// A callback or another switch may have consumed the marker while flags loaded.
|
|
31213
31254
|
const previousTenantId = sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH);
|
|
31214
31255
|
if (previousTenantId === null) {
|
|
31215
31256
|
return;
|
|
31216
31257
|
}
|
|
31217
|
-
|
|
31258
|
+
sessionStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH);
|
|
31218
31259
|
previousTenantId ? setTabTenantInSessionStorage(previousTenantId) : removeTabTenantFromSessionStorage();
|
|
31219
31260
|
}
|
|
31220
31261
|
|
|
31221
31262
|
/** The tab got a session: nothing is left to put back. */
|
|
31222
|
-
function clearTabTenantBeforeSsoSwitch() {
|
|
31223
|
-
sessionStorage.
|
|
31263
|
+
async function clearTabTenantBeforeSsoSwitch(appName) {
|
|
31264
|
+
if (sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH) !== null && (await isEnforceSsoOnTenantAccessEnabled(appName))) {
|
|
31265
|
+
sessionStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH);
|
|
31266
|
+
}
|
|
31224
31267
|
}
|
|
31225
31268
|
function getTabTenantFromSessionStorage(appName) {
|
|
31226
31269
|
if (!_ContextHolder__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(appName).isSessionPerTenantEnabled()) {
|
|
@@ -31237,14 +31280,16 @@ function getCurrentUserTenantsFunction(appName) {
|
|
|
31237
31280
|
});
|
|
31238
31281
|
}
|
|
31239
31282
|
const usersApi = new _users__WEBPACK_IMPORTED_MODULE_4__.UsersApi(appName);
|
|
31240
|
-
|
|
31241
|
-
|
|
31242
|
-
|
|
31243
|
-
|
|
31244
|
-
|
|
31245
|
-
|
|
31246
|
-
|
|
31247
|
-
|
|
31283
|
+
return async () => {
|
|
31284
|
+
const enforceSsoOnTenantAccess = await isEnforceSsoOnTenantAccessEnabled(appName);
|
|
31285
|
+
const [useCurrentUserTenantsV1] = _feature_flags__WEBPACK_IMPORTED_MODULE_1__.FeatureFlags.getFeatureFlags([_constants__WEBPACK_IMPORTED_MODULE_0__.USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF], appName);
|
|
31286
|
+
// SSO recovery may retain the JWT tenant while the saved application tenant stays elsewhere.
|
|
31287
|
+
// The context-based endpoint also includes inherited tenant details outside the assigned list.
|
|
31288
|
+
if (_ContextHolder__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(appName).isSessionPerTenantEnabled() || enforceSsoOnTenantAccess) {
|
|
31289
|
+
return usersApi.getCurrentUserTenantsV1();
|
|
31290
|
+
}
|
|
31291
|
+
return useCurrentUserTenantsV1 ? usersApi.getCurrentUserTenantsV1() : usersApi.getCurrentUserTenantsV3();
|
|
31292
|
+
};
|
|
31248
31293
|
}
|
|
31249
31294
|
|
|
31250
31295
|
/***/ }),
|
|
@@ -31960,6 +32005,17 @@ class FeatureFlags {
|
|
|
31960
32005
|
FeatureFlags._instances[name] = featureFlagsInstance;
|
|
31961
32006
|
return featureFlagsInstance;
|
|
31962
32007
|
}
|
|
32008
|
+
|
|
32009
|
+
/** Registers the app's flags request, so a read that must not race it can wait for it (see whenLoaded). */
|
|
32010
|
+
static setLoading(loading, name = 'default') {
|
|
32011
|
+
FeatureFlags._loading[name] = loading;
|
|
32012
|
+
}
|
|
32013
|
+
|
|
32014
|
+
/** Resolves once the app's flags request settled, failed or not; at once when none was registered. */
|
|
32015
|
+
static async whenLoaded(name = 'default') {
|
|
32016
|
+
var _FeatureFlags$_loadin;
|
|
32017
|
+
await ((_FeatureFlags$_loadin = FeatureFlags._loading[name]) == null ? void 0 : _FeatureFlags$_loadin.catch(() => undefined));
|
|
32018
|
+
}
|
|
31963
32019
|
static getFeatureFlags(flags, name) {
|
|
31964
32020
|
const featureFlagsInstance = this.getInstance(name);
|
|
31965
32021
|
return flags.map(flag => (featureFlagsInstance == null ? void 0 : featureFlagsInstance._flags[flag]) === 'on');
|
|
@@ -31974,6 +32030,7 @@ class FeatureFlags {
|
|
|
31974
32030
|
}
|
|
31975
32031
|
}
|
|
31976
32032
|
FeatureFlags._instances = {};
|
|
32033
|
+
FeatureFlags._loading = {};
|
|
31977
32034
|
class FeatureFlagsApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_1__.BaseApiClient {
|
|
31978
32035
|
constructor(appName) {
|
|
31979
32036
|
super(appName);
|
|
@@ -32195,6 +32252,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32195
32252
|
/* harmony export */ UserManagedByEnum: () => (/* reexport safe */ _teams_interfaces__WEBPACK_IMPORTED_MODULE_5__.UserManagedByEnum),
|
|
32196
32253
|
/* harmony export */ WebAuthnDeviceType: () => (/* reexport safe */ _auth_interfaces__WEBPACK_IMPORTED_MODULE_1__.WebAuthnDeviceType),
|
|
32197
32254
|
/* harmony export */ api: () => (/* binding */ api),
|
|
32255
|
+
/* harmony export */ clearTabTenantBeforeSsoSwitch: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_3__.clearTabTenantBeforeSsoSwitch),
|
|
32198
32256
|
/* harmony export */ createApiClient: () => (/* binding */ createApiClient),
|
|
32199
32257
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
32200
32258
|
/* harmony export */ fetch: () => (/* reexport safe */ _FetchClient__WEBPACK_IMPORTED_MODULE_45__["default"]),
|
|
@@ -32264,7 +32322,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
32264
32322
|
/* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
|
|
32265
32323
|
/* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
|
|
32266
32324
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
|
|
32267
|
-
/** @license Frontegg v7.131.0
|
|
32325
|
+
/** @license Frontegg v7.131.0
|
|
32268
32326
|
*
|
|
32269
32327
|
* This source code is licensed under the MIT license found in the
|
|
32270
32328
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -33843,9 +33901,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33843
33901
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
33844
33902
|
/* harmony export */ });
|
|
33845
33903
|
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../node_modules/@babel/runtime/helpers/esm/extends.js");
|
|
33846
|
-
/* harmony import */ var
|
|
33847
|
-
/* harmony import */ var
|
|
33848
|
-
/* harmony import */ var
|
|
33904
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants */ "../../dist/@frontegg/rest-api/constants.js");
|
|
33905
|
+
/* harmony import */ var _auth_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../auth/utils */ "../../dist/@frontegg/rest-api/auth/utils.js");
|
|
33906
|
+
/* harmony import */ var _ContextHolder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ContextHolder */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
33849
33907
|
/* harmony import */ var _BaseApiClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../BaseApiClient */ "../../dist/@frontegg/rest-api/BaseApiClient.js");
|
|
33850
33908
|
|
|
33851
33909
|
|
|
@@ -33856,59 +33914,56 @@ class TenantsApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_1__.BaseApiClie
|
|
|
33856
33914
|
constructor(appName) {
|
|
33857
33915
|
super(appName);
|
|
33858
33916
|
this.switchTenant = async body => {
|
|
33859
|
-
if (
|
|
33860
|
-
return this.
|
|
33861
|
-
}
|
|
33862
|
-
if (_ContextHolder__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(this.appName).isSessionPerTenantEnabled()) {
|
|
33863
|
-
(0,_auth_utils__WEBPACK_IMPORTED_MODULE_2__.setTabTenantInSessionStorage)(body.tenantId);
|
|
33917
|
+
if (!_ContextHolder__WEBPACK_IMPORTED_MODULE_2__.ContextHolder.for(this.appName).isSessionPerTenantEnabled()) {
|
|
33918
|
+
return this.put(`${_constants__WEBPACK_IMPORTED_MODULE_3__.urls.identity.users.v1}/tenant`, body);
|
|
33864
33919
|
}
|
|
33865
|
-
|
|
33866
|
-
|
|
33867
|
-
|
|
33868
|
-
const previousTabTenantId = (0,_auth_utils__WEBPACK_IMPORTED_MODULE_2__.getTabTenantFromSessionStorage)(this.appName);
|
|
33869
|
-
(0,_auth_utils__WEBPACK_IMPORTED_MODULE_2__.setTabTenantInSessionStorage)(body.tenantId);
|
|
33870
|
-
try {
|
|
33871
|
-
return await this.put(`${_constants__WEBPACK_IMPORTED_MODULE_4__.urls.identity.users.v1}/tenant`, body);
|
|
33872
|
-
} catch (e) {
|
|
33873
|
-
previousTabTenantId ? (0,_auth_utils__WEBPACK_IMPORTED_MODULE_2__.setTabTenantInSessionStorage)(previousTabTenantId) : (0,_auth_utils__WEBPACK_IMPORTED_MODULE_2__.removeTabTenantFromSessionStorage)();
|
|
33874
|
-
throw e;
|
|
33920
|
+
if (!(await (0,_auth_utils__WEBPACK_IMPORTED_MODULE_4__.isEnforceSsoOnTenantAccessEnabled)(this.appName))) {
|
|
33921
|
+
(0,_auth_utils__WEBPACK_IMPORTED_MODULE_4__.setTabTenantInSessionStorage)(body.tenantId);
|
|
33922
|
+
return this.put(`${_constants__WEBPACK_IMPORTED_MODULE_3__.urls.identity.users.v1}/tenant`, body);
|
|
33875
33923
|
}
|
|
33924
|
+
// an SSO switch the user didn't finish (e.g. back from the IdP without a page load) gives the tab its tenant back
|
|
33925
|
+
// first: that is the tenant to keep if this switch is refused too
|
|
33926
|
+
await (0,_auth_utils__WEBPACK_IMPORTED_MODULE_4__.restoreTabTenantBeforeSsoSwitch)(this.appName);
|
|
33927
|
+
await this.put(`${_constants__WEBPACK_IMPORTED_MODULE_3__.urls.identity.users.v1}/tenant`, body);
|
|
33928
|
+
// the tab moves only once the switch passes: a refused one (e.g. the tenant requires SSO) leaves it where the
|
|
33929
|
+
// session is, and a parallel switch (double click) never reads a tenant the tab was only moved to
|
|
33930
|
+
(0,_auth_utils__WEBPACK_IMPORTED_MODULE_4__.setTabTenantInSessionStorage)(body.tenantId);
|
|
33876
33931
|
};
|
|
33877
33932
|
this.getTenants = async () => {
|
|
33878
|
-
return this.get(`${
|
|
33933
|
+
return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_3__.urls.identity.users.v2}/me/tenants`);
|
|
33879
33934
|
};
|
|
33880
33935
|
this.getSubTenants = async options => {
|
|
33881
|
-
return this.get(
|
|
33936
|
+
return this.get(_constants__WEBPACK_IMPORTED_MODULE_3__.urls.tenants.hierarchy.v1, undefined, {
|
|
33882
33937
|
headers: this.extractHeadersFromOptions(options)
|
|
33883
33938
|
});
|
|
33884
33939
|
};
|
|
33885
33940
|
this.getSubTenantsAsTree = async options => {
|
|
33886
|
-
return this.get(
|
|
33941
|
+
return this.get(_constants__WEBPACK_IMPORTED_MODULE_3__.urls.tenants.hierarchy.tree.v1, undefined, {
|
|
33887
33942
|
headers: this.extractHeadersFromOptions(options)
|
|
33888
33943
|
});
|
|
33889
33944
|
};
|
|
33890
33945
|
this.getParentTenants = async options => {
|
|
33891
|
-
return this.get(
|
|
33946
|
+
return this.get(_constants__WEBPACK_IMPORTED_MODULE_3__.urls.tenants.hierarchy.parents.v1, undefined, {
|
|
33892
33947
|
headers: this.extractHeadersFromOptions(options)
|
|
33893
33948
|
});
|
|
33894
33949
|
};
|
|
33895
33950
|
this.getParentTenantsById = async (tenantId, options) => {
|
|
33896
|
-
return this.get(`${
|
|
33951
|
+
return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_3__.urls.tenants.hierarchy.parents.v1}/${tenantId}`, undefined, {
|
|
33897
33952
|
headers: this.extractHeadersFromOptions(options)
|
|
33898
33953
|
});
|
|
33899
33954
|
};
|
|
33900
33955
|
this.getTenantsUsersCount = async (body, options) => {
|
|
33901
|
-
return this.post(`${
|
|
33956
|
+
return this.post(`${_constants__WEBPACK_IMPORTED_MODULE_3__.urls.identity.tenants.users.v1}/count`, body, {
|
|
33902
33957
|
headers: this.extractHeadersFromOptions(options)
|
|
33903
33958
|
});
|
|
33904
33959
|
};
|
|
33905
33960
|
this.searchSubTenants = async (params, options) => {
|
|
33906
|
-
return this.get(
|
|
33961
|
+
return this.get(_constants__WEBPACK_IMPORTED_MODULE_3__.urls.tenants.hierarchy.v2, params, {
|
|
33907
33962
|
headers: this.extractHeadersFromOptions(options)
|
|
33908
33963
|
});
|
|
33909
33964
|
};
|
|
33910
33965
|
this.getHierarchyMetadata = async (params, options) => {
|
|
33911
|
-
return this.get(
|
|
33966
|
+
return this.get(_constants__WEBPACK_IMPORTED_MODULE_3__.urls.tenants.hierarchy.metadata.v2, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, params, {
|
|
33912
33967
|
_tenantIds: params._tenantIds.join(',')
|
|
33913
33968
|
}), {
|
|
33914
33969
|
headers: this.extractHeadersFromOptions(options)
|
|
@@ -35119,7 +35174,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35119
35174
|
/* harmony export */ });
|
|
35120
35175
|
/* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
|
|
35121
35176
|
/* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
|
|
35122
|
-
/** @license Frontegg v7.131.0
|
|
35177
|
+
/** @license Frontegg v7.131.0
|
|
35123
35178
|
*
|
|
35124
35179
|
* This source code is licensed under the MIT license found in the
|
|
35125
35180
|
* LICENSE file in the root directory of this source tree.
|