@frontegg/js 7.130.0 → 7.131.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +598 -223
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +1 -1
- package/version.js +1 -1
|
@@ -1934,7 +1934,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1934
1934
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
1935
1935
|
/* harmony export */ });
|
|
1936
1936
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
1937
|
-
cdnVersion: '7.
|
|
1937
|
+
cdnVersion: '7.131.0-alpha.1'
|
|
1938
1938
|
});
|
|
1939
1939
|
|
|
1940
1940
|
/***/ }),
|
|
@@ -2943,6 +2943,9 @@ const _excluded = ["user"],
|
|
|
2943
2943
|
});
|
|
2944
2944
|
callback == null ? void 0 : callback(true);
|
|
2945
2945
|
} catch (e) {
|
|
2946
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
2947
|
+
return;
|
|
2948
|
+
}
|
|
2946
2949
|
setActivateState({
|
|
2947
2950
|
loading: false,
|
|
2948
2951
|
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
|
|
@@ -2980,6 +2983,9 @@ const _excluded = ["user"],
|
|
|
2980
2983
|
});
|
|
2981
2984
|
callback == null ? void 0 : callback(true);
|
|
2982
2985
|
} catch (e) {
|
|
2986
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
2987
|
+
return;
|
|
2988
|
+
}
|
|
2983
2989
|
setActivateState({
|
|
2984
2990
|
submitting: false,
|
|
2985
2991
|
loading: false,
|
|
@@ -6011,15 +6017,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6011
6017
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
6012
6018
|
/* harmony export */ });
|
|
6013
6019
|
/* 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");
|
|
6014
|
-
/* harmony import */ var
|
|
6015
|
-
/* harmony import */ var
|
|
6016
|
-
/* harmony import */ var
|
|
6017
|
-
/* harmony import */ var
|
|
6018
|
-
/* harmony import */ var
|
|
6019
|
-
/* harmony import */ var
|
|
6020
|
-
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*!
|
|
6021
|
-
/* harmony import */ var
|
|
6022
|
-
/* harmony import */ var
|
|
6020
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/refreshTokenRetry.js");
|
|
6021
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
6022
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/random.js");
|
|
6023
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
|
|
6024
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../constants */ "../../dist/@frontegg/redux-store/constants.js");
|
|
6025
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
|
|
6026
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
|
|
6027
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
|
|
6028
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
|
|
6029
|
+
/* harmony import */ var _StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../StepUpState/consts */ "../../dist/@frontegg/redux-store/auth/StepUpState/consts.js");
|
|
6030
|
+
/* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/toolkit/FronteggNativeModule.js");
|
|
6031
|
+
|
|
6023
6032
|
|
|
6024
6033
|
|
|
6025
6034
|
|
|
@@ -6036,14 +6045,29 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6036
6045
|
const __requestHostedLoginSilentAuthorize = async () => {
|
|
6037
6046
|
var _response;
|
|
6038
6047
|
let response;
|
|
6039
|
-
|
|
6048
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_1__.restoreTabTenantUnlessSsoCallback)(store);
|
|
6049
|
+
if (_toolkit__WEBPACK_IMPORTED_MODULE_2__["default"].isGetTokensAvailable()) {
|
|
6040
6050
|
const authApi = api.auth;
|
|
6041
|
-
response = await (0,
|
|
6042
|
-
const tokens = await
|
|
6051
|
+
response = await (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.refreshTokenWithRetry)(async () => {
|
|
6052
|
+
const tokens = await _toolkit__WEBPACK_IMPORTED_MODULE_2__["default"].getTokens();
|
|
6043
6053
|
return await authApi.silentOAuthRefreshTokenV3(tokens);
|
|
6044
6054
|
});
|
|
6045
6055
|
} else {
|
|
6046
|
-
|
|
6056
|
+
try {
|
|
6057
|
+
response = await api.auth.silentOAuthRefreshTokenV2();
|
|
6058
|
+
} catch (error) {
|
|
6059
|
+
var _store$auth$user, _error$errorContext;
|
|
6060
|
+
// the tenant requires SSO: hosted login for that tenant, not the plain one the caller falls back to
|
|
6061
|
+
if (await actions.__redirectToSsoIfRequired(error)) {
|
|
6062
|
+
return;
|
|
6063
|
+
}
|
|
6064
|
+
const tenantId = (_store$auth$user = store.auth.user) == null ? void 0 : _store$auth$user.tenantId;
|
|
6065
|
+
if (!(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_4__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) || !(0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isSsoEnforcementError)(error) || ((_error$errorContext = error.errorContext) == null ? void 0 : _error$errorContext.ssoRequired) !== false || !tenantId) {
|
|
6066
|
+
throw error;
|
|
6067
|
+
}
|
|
6068
|
+
// one retry for the tenant of the current token (a cold reload has no user yet: no retry)
|
|
6069
|
+
response = await api.auth.silentOAuthRefreshTokenV2(tenantId);
|
|
6070
|
+
}
|
|
6047
6071
|
}
|
|
6048
6072
|
if ((_response = response) != null && _response.user) {
|
|
6049
6073
|
await actions.afterAuthenticationStateUpdate(response, {
|
|
@@ -6054,7 +6078,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6054
6078
|
throw new Error(`couldn't refresh user token with oauth service`);
|
|
6055
6079
|
}
|
|
6056
6080
|
};
|
|
6057
|
-
|
|
6081
|
+
|
|
6082
|
+
/**
|
|
6083
|
+
* @param options.forceTenantId the tenantId in additionalParams wins over the resolved and the page's tenant
|
|
6084
|
+
* (sending the user to that tenant's SSO); other callers keep their custom login tenant
|
|
6085
|
+
*/
|
|
6086
|
+
const requestHostedLoginAuthorize = async (additionalParams, {
|
|
6087
|
+
forceTenantId = false
|
|
6088
|
+
} = {}) => {
|
|
6058
6089
|
var _store$auth$customLog;
|
|
6059
6090
|
const {
|
|
6060
6091
|
routes,
|
|
@@ -6064,7 +6095,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6064
6095
|
context,
|
|
6065
6096
|
urlStrategy
|
|
6066
6097
|
} = store.root;
|
|
6067
|
-
const activeUri = (0,
|
|
6098
|
+
const activeUri = (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.getUri)(urlStrategy);
|
|
6068
6099
|
if (activeUri === routes.hostedLoginRedirectUrl) {
|
|
6069
6100
|
console.debug('Calling loginWithRedirect while in hostedLoginCallback route');
|
|
6070
6101
|
return;
|
|
@@ -6073,13 +6104,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6073
6104
|
isLoading: true
|
|
6074
6105
|
});
|
|
6075
6106
|
// Generate the relevant params for the redirect
|
|
6076
|
-
const nonce = (0,
|
|
6077
|
-
const code_verifier = (0,
|
|
6078
|
-
const code_challenge = await (0,
|
|
6107
|
+
const nonce = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.createRandomString)();
|
|
6108
|
+
const code_verifier = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.createRandomString)();
|
|
6109
|
+
const code_challenge = await (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.generateCodeChallenge)(code_verifier);
|
|
6079
6110
|
|
|
6080
6111
|
// We are saving the verifier in session storage to be able to validate the response
|
|
6081
|
-
localStorage.setItem(
|
|
6082
|
-
const basename = (0,
|
|
6112
|
+
localStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_7__.HOSTED_LOGIN_VERIFIER_KEY, code_verifier);
|
|
6113
|
+
const basename = (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.getBaseNameWithoutSlashSuffix)(store);
|
|
6083
6114
|
let redirectUrl = `${window.location.origin}${urlStrategy === 'path' ? '' : '#'}${basename != null ? basename : ''}${routes.hostedLoginRedirectUrl}`;
|
|
6084
6115
|
await actions.loadCustomLoginRoutes();
|
|
6085
6116
|
const customLoginSearchParam = (_store$auth$customLog = store.auth.customLoginState) == null ? void 0 : _store$auth$customLog.customLoginSearchParams;
|
|
@@ -6101,19 +6132,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6101
6132
|
code_challenge_method: 'S256',
|
|
6102
6133
|
nonce
|
|
6103
6134
|
}, additionalParams);
|
|
6104
|
-
if (context.tenantResolver) {
|
|
6135
|
+
if (context.tenantResolver && !forceTenantId) {
|
|
6105
6136
|
var _context$tenantResolv;
|
|
6106
6137
|
const resolvedTenantResult = await ((_context$tenantResolv = context.tenantResolver) == null ? void 0 : _context$tenantResolv.call(context));
|
|
6107
6138
|
if (resolvedTenantResult != null && resolvedTenantResult.tenant) {
|
|
6108
6139
|
params['organization'] = resolvedTenantResult.tenant;
|
|
6109
6140
|
}
|
|
6110
6141
|
}
|
|
6111
|
-
const tenantId = (0,
|
|
6112
|
-
if (tenantId) {
|
|
6142
|
+
const tenantId = (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.getSearchParam)(_helpers__WEBPACK_IMPORTED_MODULE_8__.TENANT_ID_PARAM_KEY);
|
|
6143
|
+
if (tenantId && !forceTenantId) {
|
|
6113
6144
|
params['tenantId'] = tenantId;
|
|
6114
6145
|
}
|
|
6115
|
-
if (
|
|
6116
|
-
return
|
|
6146
|
+
if (_toolkit__WEBPACK_IMPORTED_MODULE_2__["default"].isAvailable('closeWindow')) {
|
|
6147
|
+
return _toolkit__WEBPACK_IMPORTED_MODULE_2__["default"].closeWindow('not_authorized');
|
|
6117
6148
|
}
|
|
6118
6149
|
const searchParams = new URLSearchParams(params);
|
|
6119
6150
|
const url = `${oauthUrl}?${searchParams.toString()}`;
|
|
@@ -6124,7 +6155,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6124
6155
|
const refreshOrRequestHostedLoginAuthorize = async additionalParams => {
|
|
6125
6156
|
var _localStorage;
|
|
6126
6157
|
// when the user pause the step up flow we may still have the key in the local storage in hosted - Remove it
|
|
6127
|
-
(_localStorage = localStorage) == null ? void 0 : _localStorage.removeItem(
|
|
6158
|
+
(_localStorage = localStorage) == null ? void 0 : _localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY);
|
|
6128
6159
|
const disableSilentRefresh = store.auth.disableSilentRefresh;
|
|
6129
6160
|
if ((additionalParams == null ? void 0 : additionalParams['prompt']) === 'login') {
|
|
6130
6161
|
return await requestHostedLoginAuthorize(additionalParams);
|
|
@@ -6148,19 +6179,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6148
6179
|
let {
|
|
6149
6180
|
additionalParams
|
|
6150
6181
|
} = payload != null ? payload : {};
|
|
6151
|
-
const urlDerivedStepUp = (0,
|
|
6152
|
-
const isNativeStepUp =
|
|
6182
|
+
const urlDerivedStepUp = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.getUrlDerivedStepUp)();
|
|
6183
|
+
const isNativeStepUp = _toolkit__WEBPACK_IMPORTED_MODULE_2__["default"].isGetTokensAvailable() && urlDerivedStepUp.isStepUpRequested;
|
|
6153
6184
|
if (!isNativeStepUp) {
|
|
6154
6185
|
var _localStorage2;
|
|
6155
|
-
(_localStorage2 = localStorage) == null ? void 0 : _localStorage2.removeItem(
|
|
6186
|
+
(_localStorage2 = localStorage) == null ? void 0 : _localStorage2.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY);
|
|
6156
6187
|
}
|
|
6157
6188
|
if (firstTime) {
|
|
6158
6189
|
const urlStrategy = store.root.urlStrategy;
|
|
6159
|
-
const activeUri = (0,
|
|
6190
|
+
const activeUri = (0,_helpers__WEBPACK_IMPORTED_MODULE_1__.getUri)(urlStrategy);
|
|
6160
6191
|
actions.setAuthState({
|
|
6161
6192
|
isLoading: true
|
|
6162
6193
|
});
|
|
6163
|
-
if ((0,
|
|
6194
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_8__.isOauthCallbackRoute)(activeUri)) {
|
|
6164
6195
|
return;
|
|
6165
6196
|
}
|
|
6166
6197
|
}
|
|
@@ -6169,13 +6200,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6169
6200
|
additionalParams = additionalParams || {};
|
|
6170
6201
|
additionalParams['login_direct_action'] = btoa(JSON.stringify(loginDirectAction));
|
|
6171
6202
|
}
|
|
6172
|
-
if (
|
|
6173
|
-
return
|
|
6203
|
+
if (_toolkit__WEBPACK_IMPORTED_MODULE_2__["default"].isAvailable('requestAuthorize')) {
|
|
6204
|
+
return _toolkit__WEBPACK_IMPORTED_MODULE_2__["default"].requestAuthorize(payload);
|
|
6174
6205
|
}
|
|
6175
6206
|
if (((_additionalParams = additionalParams) == null ? void 0 : _additionalParams['prompt']) === 'login') {
|
|
6176
6207
|
return await requestHostedLoginAuthorize(additionalParams);
|
|
6177
6208
|
}
|
|
6178
|
-
if (isNativeStepUp && !(0,
|
|
6209
|
+
if (isNativeStepUp && !(0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isSteppedUp)(store.auth.user, {
|
|
6179
6210
|
maxAge: urlDerivedStepUp.maxAge
|
|
6180
6211
|
})) {
|
|
6181
6212
|
const {
|
|
@@ -6183,11 +6214,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6183
6214
|
onRedirectTo
|
|
6184
6215
|
} = store.auth;
|
|
6185
6216
|
if (routes.stepUpUrl && !window.location.href.includes(routes.stepUpUrl)) {
|
|
6186
|
-
window.localStorage.setItem(
|
|
6217
|
+
window.localStorage.setItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY, 'true');
|
|
6187
6218
|
actions.setAuthState({
|
|
6188
6219
|
isLoading: true
|
|
6189
6220
|
});
|
|
6190
|
-
(0,
|
|
6221
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_10__.redirectByStepUpUrl)(routes.stepUpUrl, onRedirectTo, urlDerivedStepUp.maxAge);
|
|
6191
6222
|
return;
|
|
6192
6223
|
}
|
|
6193
6224
|
}
|
|
@@ -6209,10 +6240,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6209
6240
|
const handleHostedLoginCallback = async payload => {
|
|
6210
6241
|
var _store$auth$customLog2;
|
|
6211
6242
|
// Hard coded for now
|
|
6212
|
-
const code_verifier = localStorage.getItem(
|
|
6243
|
+
const code_verifier = localStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_7__.HOSTED_LOGIN_VERIFIER_KEY) || 'INVALID-CODE-VERIFIER';
|
|
6213
6244
|
const routes = store.auth.routes;
|
|
6214
6245
|
const urlStrategy = store.root.urlStrategy;
|
|
6215
|
-
const basename = (0,
|
|
6246
|
+
const basename = (0,_helpers__WEBPACK_IMPORTED_MODULE_8__.getBaseNameWithoutSlashSuffix)(store);
|
|
6216
6247
|
let redirectUrl = `${window.location.origin}${urlStrategy === 'path' ? '' : '#'}${basename != null ? basename : ''}${routes.hostedLoginRedirectUrl}`;
|
|
6217
6248
|
await actions.loadCustomLoginRoutes();
|
|
6218
6249
|
const customLoginSearchParam = (_store$auth$customLog2 = store.auth.customLoginState) == null ? void 0 : _store$auth$customLog2.customLoginSearchParams;
|
|
@@ -6228,7 +6259,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6228
6259
|
code_verifier,
|
|
6229
6260
|
grant_type: 'authorization_code'
|
|
6230
6261
|
};
|
|
6231
|
-
const isStepUpFlow = window.localStorage.getItem(
|
|
6262
|
+
const isStepUpFlow = window.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY);
|
|
6232
6263
|
try {
|
|
6233
6264
|
const response = await api.auth.exchangeOAuthTokensV2(body);
|
|
6234
6265
|
const user = response.user;
|
|
@@ -6245,7 +6276,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6245
6276
|
email: user == null ? void 0 : user.email,
|
|
6246
6277
|
name: user == null ? void 0 : user.name
|
|
6247
6278
|
};
|
|
6248
|
-
(0,
|
|
6279
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_11__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_11__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
|
|
6249
6280
|
}
|
|
6250
6281
|
} catch (e) {
|
|
6251
6282
|
actions.setAuthState({
|
|
@@ -6254,10 +6285,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6254
6285
|
console.error('Failed to exchangeOAuthTokens', e);
|
|
6255
6286
|
} finally {
|
|
6256
6287
|
const user = store.auth.user;
|
|
6257
|
-
window.localStorage.removeItem(
|
|
6288
|
+
window.localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_9__.SHOULD_STEP_UP_KEY);
|
|
6258
6289
|
|
|
6259
6290
|
// when the user pause the step up flow we may still have the key in the local storage in hosted. Ignore it.
|
|
6260
|
-
if (isStepUpFlow && (0,
|
|
6291
|
+
if (isStepUpFlow && (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.isSteppedUp)(user)) {
|
|
6261
6292
|
await actions.afterStepUpAuthNavigation();
|
|
6262
6293
|
} else {
|
|
6263
6294
|
await actions.afterAuthNavigation();
|
|
@@ -6288,38 +6319,39 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6288
6319
|
/* harmony export */ });
|
|
6289
6320
|
/* 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");
|
|
6290
6321
|
/* 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");
|
|
6291
|
-
/* harmony import */ var
|
|
6292
|
-
/* harmony import */ var
|
|
6293
|
-
/* harmony import */ var
|
|
6294
|
-
/* harmony import */ var
|
|
6295
|
-
/* harmony import */ var
|
|
6296
|
-
/* harmony import */ var
|
|
6297
|
-
/* harmony import */ var
|
|
6298
|
-
/* harmony import */ var
|
|
6299
|
-
/* harmony import */ var
|
|
6300
|
-
/* harmony import */ var
|
|
6301
|
-
/* harmony import */ var
|
|
6302
|
-
/* harmony import */ var
|
|
6303
|
-
/* harmony import */ var
|
|
6304
|
-
/* harmony import */ var
|
|
6305
|
-
/* harmony import */ var
|
|
6306
|
-
/* harmony import */ var
|
|
6322
|
+
/* harmony import */ var _afterAuthNavigation_actions__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./afterAuthNavigation.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/afterAuthNavigation.actions.js");
|
|
6323
|
+
/* harmony import */ var _handleVerifyMFAResponse_actions__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./handleVerifyMFAResponse.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/handleVerifyMFAResponse.actions.js");
|
|
6324
|
+
/* harmony import */ var _mfaRequiredState_actions__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./mfaRequiredState.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaRequiredState.actions.js");
|
|
6325
|
+
/* harmony import */ var _mfaWithAuthenticator_actions__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./mfaWithAuthenticator.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithAuthenticator.actions.js");
|
|
6326
|
+
/* harmony import */ var _mfaWithEmailCode_actions__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./mfaWithEmailCode.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithEmailCode.actions.js");
|
|
6327
|
+
/* harmony import */ var _mfaWithSMS_actions__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./mfaWithSMS.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/mfaWithSMS.actions.js");
|
|
6328
|
+
/* 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 _interfaces__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../interfaces */ "../../dist/@frontegg/redux-store/auth/LoginState/interfaces.js");
|
|
6330
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/handlers.js");
|
|
6331
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/refreshTokenRetry.js");
|
|
6332
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
|
|
6333
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/gtm.js");
|
|
6334
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/encoders.js");
|
|
6335
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../../../helpers */ "../../dist/@frontegg/redux-store/helpers/converters.js");
|
|
6336
|
+
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../state */ "../../dist/@frontegg/redux-store/auth/LoginState/state.js");
|
|
6337
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
|
|
6307
6338
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
6308
|
-
/* harmony import */ var
|
|
6309
|
-
/* harmony import */ var
|
|
6310
|
-
/* harmony import */ var
|
|
6311
|
-
/* harmony import */ var
|
|
6312
|
-
/* harmony import */ var
|
|
6313
|
-
/* harmony import */ var
|
|
6314
|
-
/* harmony import */ var
|
|
6315
|
-
/* harmony import */ var
|
|
6316
|
-
/* harmony import */ var
|
|
6317
|
-
/* harmony import */ var
|
|
6339
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
|
|
6340
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/feature-flags/index.js");
|
|
6341
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/enums.js");
|
|
6342
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
|
|
6343
|
+
/* harmony import */ var _hostedLoginAuthorize_actions__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./hostedLoginAuthorize.actions */ "../../dist/@frontegg/redux-store/auth/LoginState/actions/hostedLoginAuthorize.actions.js");
|
|
6344
|
+
/* harmony import */ var _oauthStorage__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../oauthStorage */ "../../dist/@frontegg/redux-store/auth/LoginState/oauthStorage.js");
|
|
6345
|
+
/* harmony import */ var _StepUpState_consts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../StepUpState/consts */ "../../dist/@frontegg/redux-store/auth/StepUpState/consts.js");
|
|
6346
|
+
/* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/toolkit/FronteggNativeModule.js");
|
|
6347
|
+
/* harmony import */ var _toolkit__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../toolkit */ "../../dist/@frontegg/redux-store/auth/Entitlements/helpers.js");
|
|
6348
|
+
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../interfaces */ "../../dist/@frontegg/redux-store/auth/interfaces.js");
|
|
6318
6349
|
/* harmony import */ var _consts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../consts */ "../../dist/@frontegg/redux-store/auth/LoginState/consts.js");
|
|
6319
|
-
/* harmony import */ var
|
|
6320
|
-
/* harmony import */ var
|
|
6321
|
-
/* harmony import */ var
|
|
6322
|
-
/* harmony import */ var
|
|
6350
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/helpers.js");
|
|
6351
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/auth/StepUpState/helpers.js");
|
|
6352
|
+
/* harmony import */ var _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../../MfaState/interfaces */ "../../dist/@frontegg/redux-store/auth/MfaState/interfaces.js");
|
|
6353
|
+
/* 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 _constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../../../constants */ "../../dist/@frontegg/redux-store/constants.js");
|
|
6323
6355
|
|
|
6324
6356
|
|
|
6325
6357
|
const _excluded = ["callback", "error"],
|
|
@@ -6365,8 +6397,114 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6365
6397
|
const actions = sharedActions;
|
|
6366
6398
|
const contextHolder = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(store.root.appName);
|
|
6367
6399
|
|
|
6400
|
+
/**
|
|
6401
|
+
* Sends the user to log in through the tenant's SSO and back to the current page afterwards.
|
|
6402
|
+
* @protected
|
|
6403
|
+
*/
|
|
6404
|
+
// 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
|
|
6406
|
+
let ssoRedirectInFlight = false;
|
|
6407
|
+
const __redirectToSsoForTenant = async ({
|
|
6408
|
+
tenantId,
|
|
6409
|
+
address
|
|
6410
|
+
}) => {
|
|
6411
|
+
if (ssoRedirectInFlight) {
|
|
6412
|
+
return;
|
|
6413
|
+
}
|
|
6414
|
+
ssoRedirectInFlight = true;
|
|
6415
|
+
try {
|
|
6416
|
+
await __redirectToSsoForTenantNow({
|
|
6417
|
+
tenantId,
|
|
6418
|
+
address
|
|
6419
|
+
});
|
|
6420
|
+
} finally {
|
|
6421
|
+
ssoRedirectInFlight = false;
|
|
6422
|
+
}
|
|
6423
|
+
};
|
|
6424
|
+
const __redirectToSsoForTenantNow = async ({
|
|
6425
|
+
tenantId,
|
|
6426
|
+
address
|
|
6427
|
+
}) => {
|
|
6428
|
+
var _store$root$urlStrate;
|
|
6429
|
+
// the login box shows login's "redirecting to SSO" step instead of the screen that was refused (its spinner and
|
|
6430
|
+
// a previous error)
|
|
6431
|
+
setLoginState({
|
|
6432
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.redirectToSSO,
|
|
6433
|
+
loading: false,
|
|
6434
|
+
error: undefined
|
|
6435
|
+
});
|
|
6436
|
+
// on an auth page (login, tenant chooser, social / magic link / SSO callback) keep the destination the login
|
|
6437
|
+
// already saved: the page itself is not one to come back to
|
|
6438
|
+
const urlStrategy = (_store$root$urlStrate = store.root.urlStrategy) != null ? _store$root$urlStrate : 'path';
|
|
6439
|
+
const isOnAuthPage = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isOnAuthPageRoute)(urlStrategy, store.auth.routes);
|
|
6440
|
+
if (!isOnAuthPage) {
|
|
6441
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_6__.setAfterAuthRedirectUrlForStepUp)(urlStrategy);
|
|
6442
|
+
}
|
|
6443
|
+
if (store.auth.hostedLoginBox) {
|
|
6444
|
+
var _window$localStorage;
|
|
6445
|
+
// as loginWithRedirect does, but the SSO tenant wins over the custom login tenant
|
|
6446
|
+
(_window$localStorage = window.localStorage) == null ? void 0 : _window$localStorage.removeItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_7__.SHOULD_STEP_UP_KEY);
|
|
6447
|
+
await actions.__requestHostedLoginAuthorize({
|
|
6448
|
+
prompt: 'login',
|
|
6449
|
+
tenantId
|
|
6450
|
+
}, {
|
|
6451
|
+
forceTenantId: true
|
|
6452
|
+
});
|
|
6453
|
+
return;
|
|
6454
|
+
}
|
|
6455
|
+
// as login does for an OIDC SSO page without redirect_uri; the refusal has no idpType, but an OIDC page asks for a code
|
|
6456
|
+
let ssoRedirectUrl = address;
|
|
6457
|
+
if (/[?&]response_type=code(&|$)/.test(address) && !address.includes('redirect_uri')) {
|
|
6458
|
+
ssoRedirectUrl += `&redirect_uri=${window.location.origin}${store.auth.routes.oidcRedirectUrl}`;
|
|
6459
|
+
}
|
|
6460
|
+
redirectToFullPage(ssoRedirectUrl);
|
|
6461
|
+
};
|
|
6462
|
+
|
|
6463
|
+
/**
|
|
6464
|
+
* Sends the user to the tenant's SSO when a login or tenant switch is refused because that tenant requires it
|
|
6465
|
+
* (e.g. an invitation into a tenant whose SSO covers the user's email). The SSO login lands in that tenant.
|
|
6466
|
+
* @returns true when redirected, so the caller doesn't show the error
|
|
6467
|
+
* @protected
|
|
6468
|
+
*/
|
|
6469
|
+
const __redirectToSsoIfRequired = async e => {
|
|
6470
|
+
var _e$errorContext;
|
|
6471
|
+
if (!(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) || !(0,_helpers__WEBPACK_IMPORTED_MODULE_9__.isSsoEnforcementError)(e) || !((_e$errorContext = e.errorContext) != null && _e$errorContext.ssoRequired)) {
|
|
6472
|
+
return false;
|
|
6473
|
+
}
|
|
6474
|
+
await __redirectToSsoForTenant(e.errorContext);
|
|
6475
|
+
return true;
|
|
6476
|
+
};
|
|
6477
|
+
/**
|
|
6478
|
+
* Handles a hosted (OAuth) token refresh refused because the tenant requires SSO.
|
|
6479
|
+
* ssoRequired: true sends the user to SSO, like login. ssoRequired: false renews once more for the tenant of the
|
|
6480
|
+
* current token, which keeps the session: OAuth doesn't use up the refresh token on this refusal.
|
|
6481
|
+
* @returns true when handled, false when the caller should log out
|
|
6482
|
+
* @private
|
|
6483
|
+
*/
|
|
6484
|
+
const __handleSsoEnforcementRefreshError = async (e, isSsoEnforcementRetry, refreshForTenant) => {
|
|
6485
|
+
var _store$auth$user;
|
|
6486
|
+
if (!(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) || !(0,_helpers__WEBPACK_IMPORTED_MODULE_9__.isSsoEnforcementError)(e)) {
|
|
6487
|
+
return false;
|
|
6488
|
+
}
|
|
6489
|
+
if (await __redirectToSsoIfRequired(e)) {
|
|
6490
|
+
return true;
|
|
6491
|
+
}
|
|
6492
|
+
const currentTenantId = (_store$auth$user = store.auth.user) == null ? void 0 : _store$auth$user.tenantId;
|
|
6493
|
+
if (isSsoEnforcementRetry || !currentTenantId) {
|
|
6494
|
+
return false;
|
|
6495
|
+
}
|
|
6496
|
+
if (contextHolder.isSessionPerTenantEnabled()) {
|
|
6497
|
+
(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.setTabTenantInSessionStorage)(currentTenantId);
|
|
6498
|
+
}
|
|
6499
|
+
await refreshForTenant(currentTenantId);
|
|
6500
|
+
return true;
|
|
6501
|
+
};
|
|
6502
|
+
|
|
6368
6503
|
/** @private */
|
|
6369
|
-
const __refreshTokenHosted = async (
|
|
6504
|
+
const __refreshTokenHosted = async ({
|
|
6505
|
+
tenantId,
|
|
6506
|
+
isSsoEnforcementRetry = false
|
|
6507
|
+
} = {}) => {
|
|
6370
6508
|
const user = store.auth.user;
|
|
6371
6509
|
if (!(user != null && user.refreshToken)) {
|
|
6372
6510
|
contextHolder.setAccessToken(null);
|
|
@@ -6378,7 +6516,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6378
6516
|
return;
|
|
6379
6517
|
}
|
|
6380
6518
|
try {
|
|
6381
|
-
const tabTenantId = (0,
|
|
6519
|
+
const tabTenantId = tenantId != null ? tenantId : (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.getTabTenantFromSessionStorage)(store.root.appName);
|
|
6382
6520
|
const body = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({
|
|
6383
6521
|
grant_type: 'refresh_token',
|
|
6384
6522
|
refresh_token: user == null ? void 0 : user.refreshToken
|
|
@@ -6393,6 +6531,13 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6393
6531
|
isAuthenticated: true
|
|
6394
6532
|
});
|
|
6395
6533
|
} catch (e) {
|
|
6534
|
+
const retry = tenantId => __refreshTokenHosted({
|
|
6535
|
+
tenantId,
|
|
6536
|
+
isSsoEnforcementRetry: true
|
|
6537
|
+
});
|
|
6538
|
+
if (await __handleSsoEnforcementRefreshError(e, isSsoEnforcementRetry, retry)) {
|
|
6539
|
+
return;
|
|
6540
|
+
}
|
|
6396
6541
|
contextHolder.setAccessToken(null);
|
|
6397
6542
|
contextHolder.setUser(null);
|
|
6398
6543
|
actions.setAuthState({
|
|
@@ -6423,8 +6568,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6423
6568
|
user,
|
|
6424
6569
|
tenants = [],
|
|
6425
6570
|
activeTenant
|
|
6426
|
-
} = await (0,
|
|
6427
|
-
if ((0,
|
|
6571
|
+
} = await (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.refreshTokenWithRetry)(() => api.auth.refreshTokenV3());
|
|
6572
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isMfaRequired)(user, store.root.appName)) {
|
|
6428
6573
|
const mfaRequiredState = await actions.getMfaRequiredState(user);
|
|
6429
6574
|
actions.setAuthState(mfaRequiredState);
|
|
6430
6575
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -6445,7 +6590,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6445
6590
|
}, {
|
|
6446
6591
|
loginState: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, loginState, {
|
|
6447
6592
|
quickLoginToRegister,
|
|
6448
|
-
flow: shouldNavigateToRegisterQuickLogin ?
|
|
6593
|
+
flow: shouldNavigateToRegisterQuickLogin ? _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginFlow.RegisterQuickLogin : _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginFlow.Login
|
|
6449
6594
|
}),
|
|
6450
6595
|
isAuthenticated: true
|
|
6451
6596
|
});
|
|
@@ -6454,6 +6599,11 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6454
6599
|
});
|
|
6455
6600
|
}
|
|
6456
6601
|
} catch (e) {
|
|
6602
|
+
// a refused identity refresh has already used up the refresh token: no retry, only the SSO redirect, except on
|
|
6603
|
+
// the OIDC callback, where the page itself completes the OIDC login
|
|
6604
|
+
if ((0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) && !(0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isOnOidcCallbackRoute)(store) && (await __redirectToSsoIfRequired(e))) {
|
|
6605
|
+
return;
|
|
6606
|
+
}
|
|
6457
6607
|
contextHolder.setAccessToken(null);
|
|
6458
6608
|
contextHolder.setUser(null);
|
|
6459
6609
|
actions.setAuthState({
|
|
@@ -6464,11 +6614,13 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6464
6614
|
};
|
|
6465
6615
|
|
|
6466
6616
|
/** @private */
|
|
6467
|
-
const __refreshTokenWithNativeTokens = async (
|
|
6617
|
+
const __refreshTokenWithNativeTokens = async ({
|
|
6618
|
+
isSsoEnforcementRetry = false
|
|
6619
|
+
} = {}) => {
|
|
6468
6620
|
try {
|
|
6469
6621
|
const authApi = api.auth;
|
|
6470
|
-
const response = await (0,
|
|
6471
|
-
const tokens = await
|
|
6622
|
+
const response = await (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.refreshTokenWithRetry)(async () => {
|
|
6623
|
+
const tokens = await _toolkit__WEBPACK_IMPORTED_MODULE_11__["default"].getTokens();
|
|
6472
6624
|
return await authApi.silentOAuthRefreshTokenV3(tokens);
|
|
6473
6625
|
});
|
|
6474
6626
|
const updatedUser = await __handleUnnecessaryEntitlementsUpdate(response.user);
|
|
@@ -6478,6 +6630,13 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6478
6630
|
isAuthenticated: true
|
|
6479
6631
|
});
|
|
6480
6632
|
} 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
|
+
}
|
|
6481
6640
|
contextHolder.setAccessToken(null);
|
|
6482
6641
|
contextHolder.setUser(null);
|
|
6483
6642
|
actions.setAuthState({
|
|
@@ -6489,7 +6648,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6489
6648
|
|
|
6490
6649
|
/** @protected */
|
|
6491
6650
|
const __refreshToken = async () => {
|
|
6492
|
-
|
|
6651
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_5__.restoreTabTenantUnlessSsoCallback)(store);
|
|
6652
|
+
if (_toolkit__WEBPACK_IMPORTED_MODULE_11__["default"].isGetTokensAvailable()) {
|
|
6493
6653
|
await __refreshTokenWithNativeTokens();
|
|
6494
6654
|
return;
|
|
6495
6655
|
}
|
|
@@ -6511,10 +6671,10 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6511
6671
|
* @private
|
|
6512
6672
|
*/
|
|
6513
6673
|
const __handleUnnecessaryEntitlementsUpdate = async updatedUser => {
|
|
6514
|
-
var _store$auth$
|
|
6674
|
+
var _store$auth$user2;
|
|
6515
6675
|
// @ts-ignore TODO: fix entitlements state type
|
|
6516
|
-
const oldEntitlements = (_store$auth$
|
|
6517
|
-
if ((0,
|
|
6676
|
+
const oldEntitlements = (_store$auth$user2 = store.auth.user) == null ? void 0 : _store$auth$user2.entitlements;
|
|
6677
|
+
if ((0,_toolkit__WEBPACK_IMPORTED_MODULE_12__.isEntitlementsDeeplyEqual)(oldEntitlements, updatedUser == null ? void 0 : updatedUser.entitlements)) {
|
|
6518
6678
|
// set the previous entitlements object
|
|
6519
6679
|
return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, updatedUser, {
|
|
6520
6680
|
entitlements: oldEntitlements
|
|
@@ -6534,7 +6694,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6534
6694
|
loginState,
|
|
6535
6695
|
onRedirectTo
|
|
6536
6696
|
} = store.auth;
|
|
6537
|
-
const [preventAuthRedirectOnSocialLogin] =
|
|
6697
|
+
const [preventAuthRedirectOnSocialLogin] = _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_13__.FeatureFlags.getFeatureFlags(['prevent-auth-redirect-on-social-login'], store.root.appName);
|
|
6538
6698
|
const invitationToken = url.searchParams.get('invitationToken');
|
|
6539
6699
|
const redirectRoutes = [routes.socialLoginCallbackUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl, routes.magicLinkCallbackUrl];
|
|
6540
6700
|
if (!invitationToken) {
|
|
@@ -6563,7 +6723,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6563
6723
|
var _payload$callback;
|
|
6564
6724
|
const {
|
|
6565
6725
|
isActive
|
|
6566
|
-
} = await (0,
|
|
6726
|
+
} = await (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.retryIfNeeded)(api.auth.getSSOPublicConfiguration, payload == null ? void 0 : payload.retryConfig);
|
|
6567
6727
|
actions.setAuthState({
|
|
6568
6728
|
isSSOAuth: isActive
|
|
6569
6729
|
});
|
|
@@ -6582,7 +6742,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6582
6742
|
let ssoACS;
|
|
6583
6743
|
try {
|
|
6584
6744
|
var _metadata$configurati;
|
|
6585
|
-
const metadata = await (0,
|
|
6745
|
+
const metadata = await (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.retryIfNeeded)(api.metadata.getSamlMetadata, payload == null ? void 0 : payload.retryConfig);
|
|
6586
6746
|
ssoACS = metadata == null ? void 0 : (_metadata$configurati = metadata.configuration) == null ? void 0 : _metadata$configurati.acsUrl;
|
|
6587
6747
|
} catch (e) {
|
|
6588
6748
|
console.error(e);
|
|
@@ -6608,8 +6768,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6608
6768
|
onRedirectTo,
|
|
6609
6769
|
routes
|
|
6610
6770
|
} = store.auth;
|
|
6611
|
-
if ((0,
|
|
6612
|
-
const mfaRequiredState = await actions.getMfaRequiredState(user,
|
|
6771
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isMfaRequired)(user, store.root.appName)) {
|
|
6772
|
+
const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_15__.DEFAULT_RETRY_CONFIG, true);
|
|
6613
6773
|
actions.setAuthState(mfaRequiredState);
|
|
6614
6774
|
onRedirectTo(routes.loginUrl, {
|
|
6615
6775
|
preserveQueryParams: true
|
|
@@ -6620,17 +6780,17 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6620
6780
|
Object.assign(store.auth.loginState, state);
|
|
6621
6781
|
};
|
|
6622
6782
|
const resetLoginState = () => {
|
|
6623
|
-
(0,
|
|
6783
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_14__.deepResetState)(store, ['auth', 'loginState'], _state__WEBPACK_IMPORTED_MODULE_16__.initialState);
|
|
6624
6784
|
};
|
|
6625
6785
|
const getRetryWithBlockingCallbackPayload = requestName => {
|
|
6626
6786
|
const callback = (_, error) => {
|
|
6627
6787
|
if (!error || error.statusCode < 500) return;
|
|
6628
6788
|
actions.setErrorByRequestName({
|
|
6629
6789
|
requestName,
|
|
6630
|
-
traceId: (0,
|
|
6790
|
+
traceId: (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.errorTraceId)(error)
|
|
6631
6791
|
});
|
|
6632
6792
|
};
|
|
6633
|
-
return (0,
|
|
6793
|
+
return (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)({
|
|
6634
6794
|
callback
|
|
6635
6795
|
});
|
|
6636
6796
|
};
|
|
@@ -6642,19 +6802,19 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6642
6802
|
actions.setAuthState({
|
|
6643
6803
|
isLoading: true
|
|
6644
6804
|
});
|
|
6645
|
-
calls.push(actions.loadSocialLoginsConfigurationV2((0,
|
|
6646
|
-
calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(
|
|
6647
|
-
calls.push(actions.loadPublicAuthStrategiesPolicy(getRetryWithBlockingCallbackPayload(
|
|
6805
|
+
calls.push(actions.loadSocialLoginsConfigurationV2((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
|
|
6806
|
+
calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_17__.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
|
|
6807
|
+
calls.push(actions.loadPublicAuthStrategiesPolicy(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_17__.REQUEST_NAME.LOAD_PUBLIC_AUTH_STRATEGIES_POLICY)));
|
|
6648
6808
|
calls.push(actions.loadSignUpStrategies());
|
|
6649
|
-
calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(
|
|
6650
|
-
calls.push(actions.loadVendorPublicInfo((0,
|
|
6651
|
-
calls.push(__refreshMetadata((0,
|
|
6809
|
+
calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_17__.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
|
|
6810
|
+
calls.push(actions.loadVendorPublicInfo((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
|
|
6811
|
+
calls.push(__refreshMetadata((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
|
|
6652
6812
|
/*
|
|
6653
6813
|
We will load custom login routes only if custom login is enabled
|
|
6654
6814
|
to check if custom login is enabled without the tenant alias (search-param/subdomain)
|
|
6655
6815
|
we have to wait for the user state (refreshToken request)
|
|
6656
6816
|
*/
|
|
6657
|
-
callsAfterRefresh.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(
|
|
6817
|
+
callsAfterRefresh.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_17__.REQUEST_NAME.LOAD_CUSTOM_LOGIN_ROUTES)));
|
|
6658
6818
|
}
|
|
6659
6819
|
await Promise.all(calls);
|
|
6660
6820
|
if (callsAfterRefresh.length > 0) {
|
|
@@ -6666,14 +6826,14 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6666
6826
|
};
|
|
6667
6827
|
const requestAuthorizeSSR = async payload => {
|
|
6668
6828
|
const calls = [];
|
|
6669
|
-
calls.push(actions.loadSocialLoginsConfigurationV2((0,
|
|
6670
|
-
calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(
|
|
6671
|
-
calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(
|
|
6829
|
+
calls.push(actions.loadSocialLoginsConfigurationV2((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
|
|
6830
|
+
calls.push(actions.loadAllowSignUps(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_17__.REQUEST_NAME.LOAD_ALLOW_SIGNUPS)));
|
|
6831
|
+
calls.push(__loadSSOPublicConfigurationFunction(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_17__.REQUEST_NAME.LOAD_SSO_PUBLIC_CONFIGURATION)));
|
|
6672
6832
|
calls.push(actions.loadSignUpStrategies());
|
|
6673
|
-
calls.push(actions.loadVendorPublicInfo((0,
|
|
6833
|
+
calls.push(actions.loadVendorPublicInfo((0,_helpers__WEBPACK_IMPORTED_MODULE_14__.withRetryConfig)()));
|
|
6674
6834
|
calls.push(__refreshMetadata());
|
|
6675
6835
|
calls.push(__isMFARequiredSSR(payload));
|
|
6676
|
-
calls.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(
|
|
6836
|
+
calls.push(actions.loadCustomLoginRoutes(getRetryWithBlockingCallbackPayload(_interfaces__WEBPACK_IMPORTED_MODULE_17__.REQUEST_NAME.LOAD_CUSTOM_LOGIN_ROUTES)));
|
|
6677
6837
|
await Promise.all(calls);
|
|
6678
6838
|
};
|
|
6679
6839
|
const ssoPreloginFailed = async _ref3 => {
|
|
@@ -6685,28 +6845,28 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6685
6845
|
const publicPolicy = store.auth.securityPolicyState.publicPolicy.policy;
|
|
6686
6846
|
if (!(publicPolicy != null && publicPolicy.authStrategy)) {
|
|
6687
6847
|
actions.setLoginState({
|
|
6688
|
-
step:
|
|
6848
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.loginWithPassword,
|
|
6689
6849
|
loading: false
|
|
6690
6850
|
});
|
|
6691
6851
|
callback == null ? void 0 : callback();
|
|
6692
6852
|
return;
|
|
6693
6853
|
}
|
|
6694
|
-
if ((publicPolicy == null ? void 0 : publicPolicy.authStrategy) ===
|
|
6854
|
+
if ((publicPolicy == null ? void 0 : publicPolicy.authStrategy) === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.AuthStrategyEnum.EmailAndPassword) {
|
|
6695
6855
|
actions.setLoginState({
|
|
6696
|
-
step:
|
|
6856
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.loginWithPassword,
|
|
6697
6857
|
loading: false
|
|
6698
6858
|
});
|
|
6699
6859
|
callback == null ? void 0 : callback();
|
|
6700
|
-
} else if ([
|
|
6860
|
+
} else if ([_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.AuthStrategyEnum.MagicLink, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.AuthStrategyEnum.Code, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.AuthStrategyEnum.SmsCode].includes(publicPolicy == null ? void 0 : publicPolicy.authStrategy)) {
|
|
6701
6861
|
await actions.passwordlessPreLogin((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, body, {
|
|
6702
6862
|
type: publicPolicy == null ? void 0 : publicPolicy.authStrategy,
|
|
6703
6863
|
callback
|
|
6704
6864
|
}));
|
|
6705
6865
|
} else {
|
|
6706
6866
|
actions.setLoginState({
|
|
6707
|
-
step:
|
|
6867
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.loginWithPassword,
|
|
6708
6868
|
loading: false,
|
|
6709
|
-
error: (0,
|
|
6869
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(error)
|
|
6710
6870
|
});
|
|
6711
6871
|
callback == null ? void 0 : callback();
|
|
6712
6872
|
}
|
|
@@ -6729,7 +6889,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6729
6889
|
};
|
|
6730
6890
|
const scheduleSsoRedirect = (ssoRedirectUrl, attempt) => {
|
|
6731
6891
|
setTimeout(() => {
|
|
6732
|
-
if (attempt === latestPreLoginAttempt && store.auth.loginState.step ===
|
|
6892
|
+
if (attempt === latestPreLoginAttempt && store.auth.loginState.step === _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.redirectToSSO) {
|
|
6733
6893
|
redirectToFullPage(ssoRedirectUrl);
|
|
6734
6894
|
}
|
|
6735
6895
|
}, SSO_REDIRECT_DELAY_MS);
|
|
@@ -6753,7 +6913,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6753
6913
|
loading: true
|
|
6754
6914
|
});
|
|
6755
6915
|
try {
|
|
6756
|
-
const tenantId = (0,
|
|
6916
|
+
const tenantId = (0,_helpers__WEBPACK_IMPORTED_MODULE_19__.getSearchParam)(_helpers__WEBPACK_IMPORTED_MODULE_19__.TENANT_ID_PARAM_KEY);
|
|
6757
6917
|
const preLoginResult = await api.auth.preLoginV2((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, email ? {
|
|
6758
6918
|
email
|
|
6759
6919
|
} : {}, username ? {
|
|
@@ -6767,7 +6927,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6767
6927
|
addressType
|
|
6768
6928
|
} = preLoginResult != null ? preLoginResult : {};
|
|
6769
6929
|
if (address) {
|
|
6770
|
-
if (addressType ===
|
|
6930
|
+
if (addressType === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__.PreLoginAddressType.External) {
|
|
6771
6931
|
// Domain-based routing: navigate to the vendor legacy login URL immediately,
|
|
6772
6932
|
// skipping the SSO interstitial and the SSO/OIDC-specific handling.
|
|
6773
6933
|
setLoginState({
|
|
@@ -6777,22 +6937,22 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6777
6937
|
return;
|
|
6778
6938
|
}
|
|
6779
6939
|
let ssoRedirectUrl = address;
|
|
6780
|
-
if (idpType ===
|
|
6940
|
+
if (idpType === _SSOState_interfaces__WEBPACK_IMPORTED_MODULE_21__.SamlVendors.Oidc && !ssoRedirectUrl.includes('redirect_uri')) {
|
|
6781
6941
|
const {
|
|
6782
6942
|
oidcRedirectUrl
|
|
6783
6943
|
} = store.auth.routes;
|
|
6784
6944
|
ssoRedirectUrl += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
|
|
6785
6945
|
}
|
|
6786
|
-
if (
|
|
6946
|
+
if (_toolkit__WEBPACK_IMPORTED_MODULE_11__["default"].isLoginWithSSOAvailable()) {
|
|
6787
6947
|
var _ref4;
|
|
6788
|
-
|
|
6948
|
+
_toolkit__WEBPACK_IMPORTED_MODULE_11__["default"].loginWithSSO((_ref4 = email != null ? email : username) != null ? _ref4 : '');
|
|
6789
6949
|
setLoginState({
|
|
6790
6950
|
loading: false
|
|
6791
6951
|
});
|
|
6792
6952
|
callback == null ? void 0 : callback();
|
|
6793
6953
|
} else {
|
|
6794
6954
|
setLoginState({
|
|
6795
|
-
step:
|
|
6955
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.redirectToSSO,
|
|
6796
6956
|
loading: false,
|
|
6797
6957
|
ssoRedirectUrl
|
|
6798
6958
|
});
|
|
@@ -6849,7 +7009,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6849
7009
|
email: user.email,
|
|
6850
7010
|
name: user.name
|
|
6851
7011
|
};
|
|
6852
|
-
(0,
|
|
7012
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_22__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_22__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
|
|
6853
7013
|
}
|
|
6854
7014
|
await actions.afterAuthNavigation();
|
|
6855
7015
|
} catch (e) {
|
|
@@ -6857,7 +7017,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6857
7017
|
onRedirectTo(routes.authenticatedUrl);
|
|
6858
7018
|
}, 1000);
|
|
6859
7019
|
setLoginState({
|
|
6860
|
-
step:
|
|
7020
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.loginWithSSOFailed,
|
|
6861
7021
|
loading: false
|
|
6862
7022
|
});
|
|
6863
7023
|
}
|
|
@@ -6892,17 +7052,17 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6892
7052
|
onRedirectTo,
|
|
6893
7053
|
routes
|
|
6894
7054
|
} = store.auth;
|
|
6895
|
-
if ((0,
|
|
6896
|
-
const mfaRequiredState = await actions.getMfaRequiredState(user,
|
|
7055
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isMfaRequired)(user, store.root.appName)) {
|
|
7056
|
+
const mfaRequiredState = await actions.getMfaRequiredState(user, _constants__WEBPACK_IMPORTED_MODULE_15__.DEFAULT_RETRY_CONFIG, true, email);
|
|
6897
7057
|
actions.setAuthState(mfaRequiredState);
|
|
6898
7058
|
onRedirectTo(routes.loginUrl, {
|
|
6899
7059
|
preserveQueryParams: true
|
|
6900
7060
|
});
|
|
6901
7061
|
} else {
|
|
6902
7062
|
const [securityCenterLoginFlows] = await actions.getFeatureFlags(['security-center-show-login-flows']);
|
|
6903
|
-
if ((0,
|
|
7063
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isResetPasswordRequired)(user, store.root.appName)) {
|
|
6904
7064
|
setLoginState({
|
|
6905
|
-
step:
|
|
7065
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.passwordRotationExpired,
|
|
6906
7066
|
loading: false,
|
|
6907
7067
|
resetPasswordToken: user.resetPasswordToken,
|
|
6908
7068
|
userId: user.userId
|
|
@@ -6925,7 +7085,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6925
7085
|
loading: false,
|
|
6926
7086
|
error: undefined,
|
|
6927
7087
|
mfaToken: user.mfaToken,
|
|
6928
|
-
step: loginState.flow ===
|
|
7088
|
+
step: loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginFlow.Login ? _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.success : loginState.step,
|
|
6929
7089
|
tenants,
|
|
6930
7090
|
tenantsLoading: true,
|
|
6931
7091
|
isBreachedPassword: user.isBreachedPassword,
|
|
@@ -6945,27 +7105,27 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6945
7105
|
email,
|
|
6946
7106
|
name: user.name
|
|
6947
7107
|
};
|
|
6948
|
-
(0,
|
|
7108
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_22__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_22__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
|
|
6949
7109
|
}
|
|
6950
|
-
if (loginState.flow ===
|
|
7110
|
+
if (loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginFlow.Login) {
|
|
6951
7111
|
if (securityCenterLoginFlows && user.isBreachedPassword && !isAuthenticated) {
|
|
6952
7112
|
setLoginState({
|
|
6953
|
-
step:
|
|
7113
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.breachedPassword,
|
|
6954
7114
|
loading: false
|
|
6955
7115
|
});
|
|
6956
7116
|
} else {
|
|
6957
7117
|
if (isAuthenticated) {
|
|
6958
|
-
const shouldShowPasswordRotationPrompt = (0,
|
|
7118
|
+
const shouldShowPasswordRotationPrompt = (0,_helpers__WEBPACK_IMPORTED_MODULE_19__.shouldShowPasswordRotationPromptFunc)(user);
|
|
6959
7119
|
if (shouldShowPasswordRotationPrompt) {
|
|
6960
7120
|
setLoginState({
|
|
6961
|
-
step:
|
|
7121
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.passwordRotationNotification,
|
|
6962
7122
|
loading: false
|
|
6963
7123
|
});
|
|
6964
7124
|
} else {
|
|
6965
7125
|
const shouldShowPromptPasskeys = await actions.__shouldShowPromptPasskeys();
|
|
6966
7126
|
if (shouldShowPromptPasskeys) {
|
|
6967
7127
|
setLoginState({
|
|
6968
|
-
step:
|
|
7128
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.promptPasskeys,
|
|
6969
7129
|
loading: false
|
|
6970
7130
|
});
|
|
6971
7131
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -6980,8 +7140,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6980
7140
|
}
|
|
6981
7141
|
}
|
|
6982
7142
|
}
|
|
6983
|
-
if (
|
|
6984
|
-
|
|
7143
|
+
if (_toolkit__WEBPACK_IMPORTED_MODULE_11__["default"].isSuggestSavePasswordAvailable()) {
|
|
7144
|
+
_toolkit__WEBPACK_IMPORTED_MODULE_11__["default"].suggestSavePassword(email, password);
|
|
6985
7145
|
}
|
|
6986
7146
|
|
|
6987
7147
|
// TODO: extract item name to constants
|
|
@@ -6990,10 +7150,13 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
6990
7150
|
} catch (e) {
|
|
6991
7151
|
contextHolder.setAccessToken(null);
|
|
6992
7152
|
contextHolder.setUser(null);
|
|
7153
|
+
if (await __redirectToSsoIfRequired(e)) {
|
|
7154
|
+
return;
|
|
7155
|
+
}
|
|
6993
7156
|
callback == null ? void 0 : callback(false, e);
|
|
6994
7157
|
setLoginState({
|
|
6995
7158
|
email,
|
|
6996
|
-
error: (0,
|
|
7159
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e),
|
|
6997
7160
|
loading: false
|
|
6998
7161
|
});
|
|
6999
7162
|
}
|
|
@@ -7002,11 +7165,11 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7002
7165
|
keepHostedOAuthState = false
|
|
7003
7166
|
} = {}) => {
|
|
7004
7167
|
if (contextHolder.isSessionPerTenantEnabled()) {
|
|
7005
|
-
(0,
|
|
7168
|
+
(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.removeTabTenantFromSessionStorage)();
|
|
7006
7169
|
}
|
|
7007
7170
|
// Step-up re-login goes through silentLogout but still needs the hosted OAuth state to finish the client flow.
|
|
7008
7171
|
if (!keepHostedOAuthState) {
|
|
7009
|
-
(0,
|
|
7172
|
+
(0,_oauthStorage__WEBPACK_IMPORTED_MODULE_23__.clearHostedOAuthState)();
|
|
7010
7173
|
}
|
|
7011
7174
|
};
|
|
7012
7175
|
const logout = async payload => {
|
|
@@ -7035,7 +7198,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7035
7198
|
} catch {
|
|
7036
7199
|
/* empty */
|
|
7037
7200
|
}
|
|
7038
|
-
const isStepUpInProgress = !!((_window2 = window) != null && _window2.localStorage.getItem(
|
|
7201
|
+
const isStepUpInProgress = !!((_window2 = window) != null && _window2.localStorage.getItem(_StepUpState_consts__WEBPACK_IMPORTED_MODULE_7__.SHOULD_STEP_UP_KEY));
|
|
7039
7202
|
clearLogoutLocalState({
|
|
7040
7203
|
keepHostedOAuthState: isStepUpInProgress
|
|
7041
7204
|
});
|
|
@@ -7054,7 +7217,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7054
7217
|
setLoginState({
|
|
7055
7218
|
loading: false,
|
|
7056
7219
|
error: undefined,
|
|
7057
|
-
step:
|
|
7220
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.preLogin
|
|
7058
7221
|
});
|
|
7059
7222
|
actions.setAuthState({
|
|
7060
7223
|
user: undefined,
|
|
@@ -7064,7 +7227,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7064
7227
|
} catch (e) {
|
|
7065
7228
|
var _payload$callback5;
|
|
7066
7229
|
setLoginState({
|
|
7067
|
-
error: (0,
|
|
7230
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e),
|
|
7068
7231
|
loading: false
|
|
7069
7232
|
});
|
|
7070
7233
|
(_payload$callback5 = payload.callback) == null ? void 0 : _payload$callback5.call(payload, false, e);
|
|
@@ -7083,10 +7246,10 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7083
7246
|
// TODO: fix @frontegg/rest-api return value
|
|
7084
7247
|
// @ts-ignore
|
|
7085
7248
|
const preloginRes = await api.auth.passwordlessPreLogin((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, payload, {
|
|
7086
|
-
type:
|
|
7249
|
+
type: _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.AuthStrategyEnum.SmsCode
|
|
7087
7250
|
}));
|
|
7088
7251
|
setLoginState({
|
|
7089
|
-
step:
|
|
7252
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.loginWithQuickSmsOtc,
|
|
7090
7253
|
loading: false,
|
|
7091
7254
|
phoneNumber: preloginRes == null ? void 0 : preloginRes.phoneNumber,
|
|
7092
7255
|
error: undefined
|
|
@@ -7094,7 +7257,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7094
7257
|
callback == null ? void 0 : callback(true);
|
|
7095
7258
|
} catch (e) {
|
|
7096
7259
|
setLoginState({
|
|
7097
|
-
error: (0,
|
|
7260
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e),
|
|
7098
7261
|
loading: false
|
|
7099
7262
|
});
|
|
7100
7263
|
callback == null ? void 0 : callback(false, e);
|
|
@@ -7114,13 +7277,13 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7114
7277
|
phoneNumber: payload.phoneNumber,
|
|
7115
7278
|
loading: false,
|
|
7116
7279
|
changePhoneId: changePhoneRes.changePhoneId,
|
|
7117
|
-
step:
|
|
7280
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.loginWithQuickSmsOtc,
|
|
7118
7281
|
error: undefined
|
|
7119
7282
|
});
|
|
7120
7283
|
callback == null ? void 0 : callback(true);
|
|
7121
7284
|
} catch (e) {
|
|
7122
7285
|
setLoginState({
|
|
7123
|
-
error: (0,
|
|
7286
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e),
|
|
7124
7287
|
loading: false
|
|
7125
7288
|
});
|
|
7126
7289
|
}
|
|
@@ -7141,7 +7304,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7141
7304
|
callback == null ? void 0 : callback(true);
|
|
7142
7305
|
} catch (e) {
|
|
7143
7306
|
setLoginState({
|
|
7144
|
-
error: (0,
|
|
7307
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e),
|
|
7145
7308
|
loading: false
|
|
7146
7309
|
});
|
|
7147
7310
|
}
|
|
@@ -7157,11 +7320,11 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7157
7320
|
loading: true
|
|
7158
7321
|
});
|
|
7159
7322
|
let email;
|
|
7160
|
-
if ((0,
|
|
7323
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_19__.isEmailPayload)(payload)) {
|
|
7161
7324
|
email = payload.email;
|
|
7162
7325
|
}
|
|
7163
7326
|
let username;
|
|
7164
|
-
if ((0,
|
|
7327
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_19__.isUsernamePayload)(payload)) {
|
|
7165
7328
|
username = payload.username;
|
|
7166
7329
|
}
|
|
7167
7330
|
// TODO: [Typescript 4.8] fix @frontegg/rest-api return value
|
|
@@ -7183,7 +7346,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7183
7346
|
callback == null ? void 0 : callback();
|
|
7184
7347
|
} catch (e) {
|
|
7185
7348
|
setLoginState({
|
|
7186
|
-
error: (0,
|
|
7349
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e),
|
|
7187
7350
|
loading: false
|
|
7188
7351
|
});
|
|
7189
7352
|
callback == null ? void 0 : callback(null, e);
|
|
@@ -7208,7 +7371,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7208
7371
|
routes,
|
|
7209
7372
|
onRedirectTo
|
|
7210
7373
|
} = store.auth;
|
|
7211
|
-
if ((0,
|
|
7374
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isMfaRequired)(user, store.root.appName)) {
|
|
7212
7375
|
const mfaRequiredState = await actions.getMfaRequiredState(user);
|
|
7213
7376
|
actions.setAuthState(mfaRequiredState);
|
|
7214
7377
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -7221,14 +7384,14 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7221
7384
|
var _events$userVerified;
|
|
7222
7385
|
const userVerifiedPayload = {
|
|
7223
7386
|
email: user.email,
|
|
7224
|
-
origin:
|
|
7387
|
+
origin: _interfaces__WEBPACK_IMPORTED_MODULE_17__.UserVerifiedOriginTypes.PASSWORDLESS,
|
|
7225
7388
|
id: user.id,
|
|
7226
7389
|
tenantId: user.tenantId,
|
|
7227
7390
|
createdAt: new Date(),
|
|
7228
7391
|
name: user.name
|
|
7229
7392
|
};
|
|
7230
7393
|
events == null ? void 0 : (_events$userVerified = events.userVerified) == null ? void 0 : _events$userVerified.call(events, userVerifiedPayload);
|
|
7231
|
-
(0,
|
|
7394
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_22__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_22__.GTMEventAction.USER_VERIFIED, userVerifiedPayload);
|
|
7232
7395
|
}
|
|
7233
7396
|
const loginCompletedPayload = {
|
|
7234
7397
|
tenantId: user.tenantId,
|
|
@@ -7238,7 +7401,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7238
7401
|
email: user.email,
|
|
7239
7402
|
name: user.name
|
|
7240
7403
|
};
|
|
7241
|
-
(0,
|
|
7404
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_22__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_22__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
|
|
7242
7405
|
if (user.id) {
|
|
7243
7406
|
localStorage.setItem('userId', user.id);
|
|
7244
7407
|
}
|
|
@@ -7253,11 +7416,11 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7253
7416
|
actions.setAuthState({
|
|
7254
7417
|
isLoading: false
|
|
7255
7418
|
});
|
|
7256
|
-
if (loginState.flow ===
|
|
7419
|
+
if (loginState.flow === _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginFlow.Login) {
|
|
7257
7420
|
const shouldShowPrompt = await actions.__shouldShowPromptPasskeys();
|
|
7258
7421
|
if (shouldShowPrompt) {
|
|
7259
7422
|
actions.setLoginState({
|
|
7260
|
-
step:
|
|
7423
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.promptPasskeys,
|
|
7261
7424
|
loading: false
|
|
7262
7425
|
});
|
|
7263
7426
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -7267,12 +7430,12 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7267
7430
|
actions.setAuthState({
|
|
7268
7431
|
isAuthenticated: true
|
|
7269
7432
|
});
|
|
7270
|
-
if (_payload.type ===
|
|
7433
|
+
if (_payload.type === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_18__.AuthStrategyEnum.MagicLink) {
|
|
7271
7434
|
actions.setLoginState({
|
|
7272
|
-
step:
|
|
7435
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.magicLinkPostLoginSuccess,
|
|
7273
7436
|
loading: false
|
|
7274
7437
|
});
|
|
7275
|
-
await (0,
|
|
7438
|
+
await (0,_helpers__WEBPACK_IMPORTED_MODULE_14__.delay)(5000);
|
|
7276
7439
|
}
|
|
7277
7440
|
await actions.afterAuthNavigation();
|
|
7278
7441
|
}
|
|
@@ -7285,8 +7448,11 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7285
7448
|
callback == null ? void 0 : callback(true);
|
|
7286
7449
|
}
|
|
7287
7450
|
} catch (e) {
|
|
7451
|
+
if (await __redirectToSsoIfRequired(e)) {
|
|
7452
|
+
return;
|
|
7453
|
+
}
|
|
7288
7454
|
setLoginState({
|
|
7289
|
-
error: (0,
|
|
7455
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e, 'Failed to authenticate')
|
|
7290
7456
|
});
|
|
7291
7457
|
callback == null ? void 0 : callback(null, e);
|
|
7292
7458
|
} finally {
|
|
@@ -7310,7 +7476,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7310
7476
|
});
|
|
7311
7477
|
} catch (e) {
|
|
7312
7478
|
setLoginState({
|
|
7313
|
-
inviteTokenError: (0,
|
|
7479
|
+
inviteTokenError: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e, `We couldn't verify your invitation`)
|
|
7314
7480
|
});
|
|
7315
7481
|
} finally {
|
|
7316
7482
|
setLoginState({
|
|
@@ -7336,9 +7502,9 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7336
7502
|
const {
|
|
7337
7503
|
options
|
|
7338
7504
|
} = await api.auth.webAuthnPreLogin(body);
|
|
7339
|
-
options.challenge = (0,
|
|
7505
|
+
options.challenge = (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(options.challenge);
|
|
7340
7506
|
options.allowCredentials = (_options$allowCredent = options.allowCredentials) == null ? void 0 : _options$allowCredent.map(credentials => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, credentials, {
|
|
7341
|
-
id: (0,
|
|
7507
|
+
id: (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(credentials.id)
|
|
7342
7508
|
}));
|
|
7343
7509
|
setLoginState({
|
|
7344
7510
|
error: undefined
|
|
@@ -7346,7 +7512,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7346
7512
|
callback == null ? void 0 : callback(options);
|
|
7347
7513
|
} catch (e) {
|
|
7348
7514
|
setLoginState({
|
|
7349
|
-
error: (0,
|
|
7515
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7350
7516
|
});
|
|
7351
7517
|
callback == null ? void 0 : callback(null);
|
|
7352
7518
|
} finally {
|
|
@@ -7371,7 +7537,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7371
7537
|
setLoginState({
|
|
7372
7538
|
loading: true
|
|
7373
7539
|
});
|
|
7374
|
-
const publicKey = (0,
|
|
7540
|
+
const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_25__.publicKeyCredentialToJSON)(body.publicKey);
|
|
7375
7541
|
const _await$api$auth$webAu = await api.auth.webAuthnPostLoginV2((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, publicKey, {
|
|
7376
7542
|
response: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, publicKey.response, {
|
|
7377
7543
|
userHandle: (_publicKey$response$u = publicKey.response.userHandle) != null ? _publicKey$response$u : undefined
|
|
@@ -7383,7 +7549,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7383
7549
|
user
|
|
7384
7550
|
} = _await$api$auth$webAu,
|
|
7385
7551
|
rest = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_await$api$auth$webAu, _excluded9);
|
|
7386
|
-
if ((0,
|
|
7552
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isMfaRequired)(user, store.root.appName)) {
|
|
7387
7553
|
const {
|
|
7388
7554
|
routes,
|
|
7389
7555
|
onRedirectTo
|
|
@@ -7414,15 +7580,18 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7414
7580
|
email: user.email,
|
|
7415
7581
|
name: user.name
|
|
7416
7582
|
};
|
|
7417
|
-
(0,
|
|
7583
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_22__.reportGTMEvent)(_helpers__WEBPACK_IMPORTED_MODULE_22__.GTMEventAction.LOGIN_COMPLETED, loginCompletedPayload);
|
|
7418
7584
|
await actions.afterAuthNavigation();
|
|
7419
7585
|
// TODO: Itamar why moving callback to inside the else block
|
|
7420
7586
|
callback == null ? void 0 : callback(true);
|
|
7421
7587
|
}
|
|
7422
7588
|
// callback?.(true);
|
|
7423
7589
|
} catch (e) {
|
|
7590
|
+
if (await __redirectToSsoIfRequired(e)) {
|
|
7591
|
+
return;
|
|
7592
|
+
}
|
|
7424
7593
|
setLoginState({
|
|
7425
|
-
error: (0,
|
|
7594
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7426
7595
|
});
|
|
7427
7596
|
callback == null ? void 0 : callback(null);
|
|
7428
7597
|
} finally {
|
|
@@ -7447,13 +7616,13 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7447
7616
|
const {
|
|
7448
7617
|
options
|
|
7449
7618
|
} = await api.auth.webAuthnCreateNewDeviceSession();
|
|
7450
|
-
options.user.id = (0,
|
|
7451
|
-
options.challenge = (0,
|
|
7619
|
+
options.user.id = (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(options.user.id);
|
|
7620
|
+
options.challenge = (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(options.challenge);
|
|
7452
7621
|
options.excludeCredentials = [];
|
|
7453
7622
|
callback == null ? void 0 : callback(options);
|
|
7454
7623
|
} catch (e) {
|
|
7455
7624
|
setLoginState({
|
|
7456
|
-
error: (0,
|
|
7625
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7457
7626
|
});
|
|
7458
7627
|
callback == null ? void 0 : callback(null);
|
|
7459
7628
|
} finally {
|
|
@@ -7471,8 +7640,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7471
7640
|
setLoginState({
|
|
7472
7641
|
loading: true
|
|
7473
7642
|
});
|
|
7474
|
-
const publicKey = (0,
|
|
7475
|
-
const deviceType = (publicKey == null ? void 0 : publicKey.authenticatorAttachment) === 'platform' ?
|
|
7643
|
+
const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_25__.publicKeyCredentialToJSON)(body.publicKey);
|
|
7644
|
+
const deviceType = (publicKey == null ? void 0 : publicKey.authenticatorAttachment) === 'platform' ? _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__.WebAuthnDeviceType.Platform : _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_20__.WebAuthnDeviceType.CrossPlatform;
|
|
7476
7645
|
await api.auth.verifyNewDeviceSession({
|
|
7477
7646
|
id: publicKey.id,
|
|
7478
7647
|
response: publicKey.response,
|
|
@@ -7481,7 +7650,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7481
7650
|
callback == null ? void 0 : callback(true);
|
|
7482
7651
|
} catch (e) {
|
|
7483
7652
|
setLoginState({
|
|
7484
|
-
error: (0,
|
|
7653
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7485
7654
|
});
|
|
7486
7655
|
callback == null ? void 0 : callback(null);
|
|
7487
7656
|
} finally {
|
|
@@ -7539,12 +7708,12 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7539
7708
|
var _data$options$exclude;
|
|
7540
7709
|
const data = await api.auth.preEnrollMFAWebAuthnForLogin(payload);
|
|
7541
7710
|
const options = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, data.options, {
|
|
7542
|
-
challenge: (0,
|
|
7711
|
+
challenge: (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(data.options.challenge),
|
|
7543
7712
|
user: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, data.options.user, {
|
|
7544
|
-
id: (0,
|
|
7713
|
+
id: (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(data.options.user.id)
|
|
7545
7714
|
}),
|
|
7546
7715
|
excludeCredentials: (_data$options$exclude = data.options.excludeCredentials) == null ? void 0 : _data$options$exclude.map(credentials => (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, credentials, {
|
|
7547
|
-
id: (0,
|
|
7716
|
+
id: (0,_helpers__WEBPACK_IMPORTED_MODULE_24__.base64urlDecode)(credentials.id)
|
|
7548
7717
|
}))
|
|
7549
7718
|
});
|
|
7550
7719
|
setLoginState({
|
|
@@ -7557,7 +7726,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7557
7726
|
} catch (e) {
|
|
7558
7727
|
setLoginState({
|
|
7559
7728
|
loading: false,
|
|
7560
|
-
error: (0,
|
|
7729
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7561
7730
|
});
|
|
7562
7731
|
callback == null ? void 0 : callback(null);
|
|
7563
7732
|
}
|
|
@@ -7571,7 +7740,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7571
7740
|
loading: true
|
|
7572
7741
|
});
|
|
7573
7742
|
try {
|
|
7574
|
-
const publicKey = (0,
|
|
7743
|
+
const publicKey = (0,_helpers__WEBPACK_IMPORTED_MODULE_25__.publicKeyCredentialToJSON)(payload.publicKey);
|
|
7575
7744
|
const data = await api.auth.enrollMFAWebAuthnForLoginV2((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, payload, {
|
|
7576
7745
|
options: publicKey
|
|
7577
7746
|
}));
|
|
@@ -7581,9 +7750,12 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7581
7750
|
});
|
|
7582
7751
|
callback == null ? void 0 : callback(true);
|
|
7583
7752
|
} catch (e) {
|
|
7753
|
+
if (await __redirectToSsoIfRequired(e)) {
|
|
7754
|
+
return;
|
|
7755
|
+
}
|
|
7584
7756
|
setLoginState({
|
|
7585
7757
|
loading: false,
|
|
7586
|
-
error: (0,
|
|
7758
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7587
7759
|
});
|
|
7588
7760
|
callback == null ? void 0 : callback(null);
|
|
7589
7761
|
}
|
|
@@ -7604,9 +7776,12 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7604
7776
|
});
|
|
7605
7777
|
callback == null ? void 0 : callback(true);
|
|
7606
7778
|
} catch (e) {
|
|
7779
|
+
if (await __redirectToSsoIfRequired(e)) {
|
|
7780
|
+
return;
|
|
7781
|
+
}
|
|
7607
7782
|
setLoginState({
|
|
7608
7783
|
loading: false,
|
|
7609
|
-
error: (0,
|
|
7784
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7610
7785
|
});
|
|
7611
7786
|
callback == null ? void 0 : callback(null);
|
|
7612
7787
|
}
|
|
@@ -7623,7 +7798,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7623
7798
|
const data = await api.auth.preEnrollMFASMSForLogin(payload);
|
|
7624
7799
|
actions.setMfaState({
|
|
7625
7800
|
otcToken: data.otcToken,
|
|
7626
|
-
step:
|
|
7801
|
+
step: _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_26__.MFAStep.smsVerifyCode,
|
|
7627
7802
|
phoneNumber: data.phoneNumber
|
|
7628
7803
|
});
|
|
7629
7804
|
setLoginState({
|
|
@@ -7633,7 +7808,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7633
7808
|
} catch (e) {
|
|
7634
7809
|
setLoginState({
|
|
7635
7810
|
loading: false,
|
|
7636
|
-
error: (0,
|
|
7811
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7637
7812
|
});
|
|
7638
7813
|
callback == null ? void 0 : callback(null);
|
|
7639
7814
|
}
|
|
@@ -7654,9 +7829,12 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7654
7829
|
});
|
|
7655
7830
|
callback == null ? void 0 : callback(true);
|
|
7656
7831
|
} catch (e) {
|
|
7832
|
+
if (await __redirectToSsoIfRequired(e)) {
|
|
7833
|
+
return;
|
|
7834
|
+
}
|
|
7657
7835
|
setLoginState({
|
|
7658
7836
|
loading: false,
|
|
7659
|
-
error: (0,
|
|
7837
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7660
7838
|
});
|
|
7661
7839
|
callback == null ? void 0 : callback(null);
|
|
7662
7840
|
}
|
|
@@ -7668,7 +7846,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7668
7846
|
activeTenant
|
|
7669
7847
|
} = payload;
|
|
7670
7848
|
const mfaState = {
|
|
7671
|
-
step:
|
|
7849
|
+
step: _MfaState_interfaces__WEBPACK_IMPORTED_MODULE_26__.MFAStep.recoveryCode,
|
|
7672
7850
|
loading: false,
|
|
7673
7851
|
error: undefined,
|
|
7674
7852
|
saving: false
|
|
@@ -7696,7 +7874,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7696
7874
|
setLoginState({
|
|
7697
7875
|
loading: false,
|
|
7698
7876
|
error: undefined,
|
|
7699
|
-
step:
|
|
7877
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.breachedPasswordSuccess
|
|
7700
7878
|
});
|
|
7701
7879
|
actions.setAuthState({
|
|
7702
7880
|
isAuthenticated: false
|
|
@@ -7704,13 +7882,16 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7704
7882
|
} catch (e) {
|
|
7705
7883
|
setLoginState({
|
|
7706
7884
|
loading: false,
|
|
7707
|
-
error: (0,
|
|
7885
|
+
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_9__.errorHandler)(e)
|
|
7708
7886
|
});
|
|
7709
7887
|
}
|
|
7710
7888
|
};
|
|
7711
7889
|
|
|
7712
7890
|
/** @private */
|
|
7713
|
-
const __refreshTokenHostedSocialLogins = async (
|
|
7891
|
+
const __refreshTokenHostedSocialLogins = async ({
|
|
7892
|
+
tenantId,
|
|
7893
|
+
isSsoEnforcementRetry = false
|
|
7894
|
+
} = {}) => {
|
|
7714
7895
|
const {
|
|
7715
7896
|
user: currentUser
|
|
7716
7897
|
} = store.auth;
|
|
@@ -7724,7 +7905,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7724
7905
|
return;
|
|
7725
7906
|
}
|
|
7726
7907
|
try {
|
|
7727
|
-
const tabTenantId = (0,
|
|
7908
|
+
const tabTenantId = tenantId != null ? tenantId : (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_8__.getTabTenantFromSessionStorage)(store.root.appName);
|
|
7728
7909
|
const body = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({
|
|
7729
7910
|
grant_type: 'refresh_token',
|
|
7730
7911
|
refresh_token: currentUser == null ? void 0 : currentUser.refreshToken
|
|
@@ -7739,6 +7920,13 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7739
7920
|
isAuthenticated: true
|
|
7740
7921
|
});
|
|
7741
7922
|
} catch (e) {
|
|
7923
|
+
const retry = tenantId => __refreshTokenHostedSocialLogins({
|
|
7924
|
+
tenantId,
|
|
7925
|
+
isSsoEnforcementRetry: true
|
|
7926
|
+
});
|
|
7927
|
+
if (await __handleSsoEnforcementRefreshError(e, isSsoEnforcementRetry, retry)) {
|
|
7928
|
+
return;
|
|
7929
|
+
}
|
|
7742
7930
|
contextHolder.setAccessToken(null);
|
|
7743
7931
|
contextHolder.setUser(null);
|
|
7744
7932
|
actions.setAuthState({
|
|
@@ -7759,8 +7947,8 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7759
7947
|
user,
|
|
7760
7948
|
tenants = [],
|
|
7761
7949
|
activeTenant
|
|
7762
|
-
} = await (0,
|
|
7763
|
-
if ((0,
|
|
7950
|
+
} = await (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.refreshTokenWithRetry)(() => api.auth.refreshTokenV3());
|
|
7951
|
+
if ((0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isMfaRequired)(user, store.root.appName)) {
|
|
7764
7952
|
const mfaRequiredState = await actions.getMfaRequiredState(user);
|
|
7765
7953
|
actions.setAuthState(mfaRequiredState);
|
|
7766
7954
|
onRedirectTo(routes.loginUrl, {
|
|
@@ -7771,7 +7959,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7771
7959
|
const shouldShowPrompt = await actions.__shouldShowPromptPasskeys();
|
|
7772
7960
|
if (shouldShowPrompt) {
|
|
7773
7961
|
actions.setLoginState({
|
|
7774
|
-
step:
|
|
7962
|
+
step: _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginStep.promptPasskeys,
|
|
7775
7963
|
loading: false
|
|
7776
7964
|
});
|
|
7777
7965
|
actions.afterAuthenticationStateUpdate({
|
|
@@ -7798,7 +7986,7 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7798
7986
|
}, {
|
|
7799
7987
|
loginState: (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, loginState, {
|
|
7800
7988
|
quickLoginToRegister,
|
|
7801
|
-
flow: shouldNavigateToRegisterQuickLogin ?
|
|
7989
|
+
flow: shouldNavigateToRegisterQuickLogin ? _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginFlow.RegisterQuickLogin : _interfaces__WEBPACK_IMPORTED_MODULE_4__.LoginFlow.Login
|
|
7802
7990
|
}),
|
|
7803
7991
|
isAuthenticated: true
|
|
7804
7992
|
});
|
|
@@ -7809,6 +7997,9 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7809
7997
|
}
|
|
7810
7998
|
}
|
|
7811
7999
|
} catch (e) {
|
|
8000
|
+
if (await __redirectToSsoIfRequired(e)) {
|
|
8001
|
+
return;
|
|
8002
|
+
}
|
|
7812
8003
|
contextHolder.setAccessToken(null);
|
|
7813
8004
|
contextHolder.setUser(null);
|
|
7814
8005
|
actions.setAuthState({
|
|
@@ -7855,8 +8046,10 @@ const isUsableRedirect = onRedirectTo => typeof onRedirectTo === 'function' && o
|
|
|
7855
8046
|
resetBreachedPassword,
|
|
7856
8047
|
refreshTokenForSocialLogins,
|
|
7857
8048
|
// protected
|
|
7858
|
-
__refreshToken
|
|
7859
|
-
|
|
8049
|
+
__refreshToken,
|
|
8050
|
+
__redirectToSsoForTenant,
|
|
8051
|
+
__redirectToSsoIfRequired
|
|
8052
|
+
}, (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));
|
|
7860
8053
|
});
|
|
7861
8054
|
|
|
7862
8055
|
/***/ }),
|
|
@@ -8122,6 +8315,9 @@ const _excluded = ["callback"];
|
|
|
8122
8315
|
}
|
|
8123
8316
|
return await __postLoginMfaAuthenticator(isAuthenticated, user, callback);
|
|
8124
8317
|
} catch (e) {
|
|
8318
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
8319
|
+
return;
|
|
8320
|
+
}
|
|
8125
8321
|
setLoadingAction({
|
|
8126
8322
|
loading: false,
|
|
8127
8323
|
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_7__.errorHandler)(e)
|
|
@@ -8234,6 +8430,9 @@ const _excluded = ["callback"],
|
|
|
8234
8430
|
});
|
|
8235
8431
|
callback == null ? void 0 : callback(true);
|
|
8236
8432
|
} catch (e) {
|
|
8433
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
8434
|
+
return;
|
|
8435
|
+
}
|
|
8237
8436
|
setLoadingAction({
|
|
8238
8437
|
loading: false,
|
|
8239
8438
|
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.errorHandler)(e)
|
|
@@ -8360,6 +8559,9 @@ const _excluded = ["callback", "deviceId"],
|
|
|
8360
8559
|
});
|
|
8361
8560
|
callback == null ? void 0 : callback(true);
|
|
8362
8561
|
} catch (e) {
|
|
8562
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
8563
|
+
return;
|
|
8564
|
+
}
|
|
8363
8565
|
setLoadingAction({
|
|
8364
8566
|
loading: false,
|
|
8365
8567
|
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_2__.errorHandler)(e)
|
|
@@ -8505,6 +8707,9 @@ const _excluded = ["callback", "deviceId"],
|
|
|
8505
8707
|
});
|
|
8506
8708
|
callback == null ? void 0 : callback(true);
|
|
8507
8709
|
} catch (e) {
|
|
8710
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
8711
|
+
return;
|
|
8712
|
+
}
|
|
8508
8713
|
setLoadingAction({
|
|
8509
8714
|
loading: false,
|
|
8510
8715
|
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.errorHandler)(e)
|
|
@@ -10963,6 +11168,9 @@ const _excluded = ["callback"],
|
|
|
10963
11168
|
}
|
|
10964
11169
|
callback == null ? void 0 : callback(mfaState.recoveryCode);
|
|
10965
11170
|
} catch (e) {
|
|
11171
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
11172
|
+
return;
|
|
11173
|
+
}
|
|
10966
11174
|
setMfaState({
|
|
10967
11175
|
loading: false,
|
|
10968
11176
|
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.errorHandler)(e)
|
|
@@ -16106,6 +16314,9 @@ const _excluded = ["authorizationUrl"],
|
|
|
16106
16314
|
loading: false
|
|
16107
16315
|
});
|
|
16108
16316
|
} catch (e) {
|
|
16317
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
16318
|
+
return;
|
|
16319
|
+
}
|
|
16109
16320
|
setSocialLoginsState({
|
|
16110
16321
|
loading: false,
|
|
16111
16322
|
error: (0,_helpers__WEBPACK_IMPORTED_MODULE_4__.errorHandler)(e, 'Failed to authenticate'),
|
|
@@ -16260,6 +16471,11 @@ const isMfaIsNotEnrolledError = error => (error == null ? void 0 : error['messag
|
|
|
16260
16471
|
callback == null ? void 0 : callback(true);
|
|
16261
16472
|
} catch (e) {
|
|
16262
16473
|
callback == null ? void 0 : callback(false);
|
|
16474
|
+
|
|
16475
|
+
// the session's tenant requires SSO: its SSO login steps the user up, instead of logging them out
|
|
16476
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
16477
|
+
return;
|
|
16478
|
+
}
|
|
16263
16479
|
await __handleStepUpError(e);
|
|
16264
16480
|
}
|
|
16265
16481
|
};
|
|
@@ -16547,9 +16763,10 @@ const getUrlDerivedStepUp = () => {
|
|
|
16547
16763
|
|
|
16548
16764
|
/**
|
|
16549
16765
|
* Set the url and query params in the local storage FRONTEGG_AFTER_AUTH_REDIRECT_URL value
|
|
16766
|
+
* @param urlStrategy 'hash' saves the route in the hash, which is the page the app shows
|
|
16550
16767
|
*/
|
|
16551
|
-
function setAfterAuthRedirectUrlForStepUp() {
|
|
16552
|
-
const encodedRedirectUrl = window.location.pathname + window.location.search;
|
|
16768
|
+
function setAfterAuthRedirectUrlForStepUp(urlStrategy = 'path') {
|
|
16769
|
+
const encodedRedirectUrl = urlStrategy === 'hash' ? window.location.hash.substring(1) || '/' : window.location.pathname + window.location.search;
|
|
16553
16770
|
window.localStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_1__.FRONTEGG_AFTER_AUTH_REDIRECT_URL, encodedRedirectUrl);
|
|
16554
16771
|
}
|
|
16555
16772
|
|
|
@@ -18266,7 +18483,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18266
18483
|
/* harmony export */ });
|
|
18267
18484
|
/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "../../dist/@frontegg/redux-store/auth/TenantsState/state.js");
|
|
18268
18485
|
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../helpers */ "../../dist/@frontegg/redux-store/helpers/common.js");
|
|
18269
|
-
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/
|
|
18486
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
18487
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
|
|
18270
18488
|
|
|
18271
18489
|
|
|
18272
18490
|
|
|
@@ -18320,6 +18538,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18320
18538
|
}) : actions.setAuthState({
|
|
18321
18539
|
isLoading: false
|
|
18322
18540
|
});
|
|
18541
|
+
if (await actions.__redirectToSsoIfRequired(e)) {
|
|
18542
|
+
// the tab comes back from SSO in the target tenant, not the one the failed switch restored
|
|
18543
|
+
if (_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_2__.ContextHolder.for(store.root.appName).isSessionPerTenantEnabled()) {
|
|
18544
|
+
(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__.setTabTenantForSsoSwitch)(tenantId);
|
|
18545
|
+
}
|
|
18546
|
+
return;
|
|
18547
|
+
}
|
|
18323
18548
|
callback == null ? void 0 : callback(false, e);
|
|
18324
18549
|
}
|
|
18325
18550
|
};
|
|
@@ -18329,7 +18554,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18329
18554
|
});
|
|
18330
18555
|
try {
|
|
18331
18556
|
var _payload$callback;
|
|
18332
|
-
const userTenantsResponseFunc = (0,
|
|
18557
|
+
const userTenantsResponseFunc = (0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_3__.getCurrentUserTenantsFunction)(store.root.appName);
|
|
18333
18558
|
const userTenantsResponse = await userTenantsResponseFunc();
|
|
18334
18559
|
setTenantsState({
|
|
18335
18560
|
tenants: userTenantsResponse.tenants,
|
|
@@ -18763,18 +18988,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18763
18988
|
/* harmony export */ isEntitlementsDeeplyEqual: () => (/* reexport safe */ _Entitlements_helpers__WEBPACK_IMPORTED_MODULE_2__.isEntitlementsDeeplyEqual),
|
|
18764
18989
|
/* harmony export */ isMfaRequired: () => (/* binding */ isMfaRequired),
|
|
18765
18990
|
/* harmony export */ isOauthCallbackRoute: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.isOauthCallbackRoute),
|
|
18991
|
+
/* harmony export */ isOnAuthPageRoute: () => (/* binding */ isOnAuthPageRoute),
|
|
18992
|
+
/* harmony export */ isOnOidcCallbackRoute: () => (/* binding */ isOnOidcCallbackRoute),
|
|
18766
18993
|
/* harmony export */ isResetPasswordRequired: () => (/* binding */ isResetPasswordRequired),
|
|
18767
18994
|
/* harmony export */ isSteppedUp: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.isSteppedUp),
|
|
18768
18995
|
/* harmony export */ isUsernamePayload: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.isUsernamePayload),
|
|
18769
18996
|
/* harmony export */ mapMetaDataObjectToActions: () => (/* binding */ mapMetaDataObjectToActions),
|
|
18770
18997
|
/* harmony export */ prepareIdentifiersForSignup: () => (/* binding */ prepareIdentifiersForSignup),
|
|
18771
18998
|
/* harmony export */ redirectByStepUpUrl: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.redirectByStepUpUrl),
|
|
18999
|
+
/* harmony export */ restoreTabTenantUnlessSsoCallback: () => (/* binding */ restoreTabTenantUnlessSsoCallback),
|
|
18772
19000
|
/* harmony export */ setAfterAuthRedirectUrlForStepUp: () => (/* reexport safe */ _StepUpState_helpers__WEBPACK_IMPORTED_MODULE_4__.setAfterAuthRedirectUrlForStepUp),
|
|
18773
19001
|
/* harmony export */ shouldShowPasswordRotationPromptFunc: () => (/* reexport safe */ _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__.shouldShowPasswordRotationPromptFunc)
|
|
18774
19002
|
/* harmony export */ });
|
|
18775
|
-
/* harmony import */ var
|
|
18776
|
-
/* harmony import */ var
|
|
19003
|
+
/* 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
|
+
/* 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");
|
|
18777
19005
|
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
19006
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/auth/utils.js");
|
|
18778
19007
|
/* harmony import */ var _LoginState_consts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./LoginState/consts */ "../../dist/@frontegg/redux-store/auth/LoginState/consts.js");
|
|
18779
19008
|
/* harmony import */ var _Entitlements_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Entitlements/helpers */ "../../dist/@frontegg/redux-store/auth/Entitlements/helpers.js");
|
|
18780
19009
|
/* harmony import */ var _LoginState_helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LoginState/helpers */ "../../dist/@frontegg/redux-store/auth/LoginState/helpers.js");
|
|
@@ -18834,13 +19063,59 @@ const getUri = urlStrategy => {
|
|
|
18834
19063
|
}
|
|
18835
19064
|
}
|
|
18836
19065
|
};
|
|
19066
|
+
|
|
19067
|
+
/**
|
|
19068
|
+
* The route the app shows and the page's path. With hash routing they differ: the app's pages live in the hash, but
|
|
19069
|
+
* SAML, OIDC, social and magic link callbacks come back on the path, which is where login matches them.
|
|
19070
|
+
*/
|
|
19071
|
+
const getCurrentRoutes = urlStrategy => {
|
|
19072
|
+
const hashOrPathRoute = getUri(urlStrategy);
|
|
19073
|
+
const {
|
|
19074
|
+
pathname
|
|
19075
|
+
} = window.location;
|
|
19076
|
+
return hashOrPathRoute === pathname ? [pathname] : [hashOrPathRoute, pathname];
|
|
19077
|
+
};
|
|
19078
|
+
|
|
19079
|
+
/**
|
|
19080
|
+
* On the OIDC callback the page still has to finish the OIDC login with its code: a refresh refused before that is not
|
|
19081
|
+
* a reason to go back to the IdP, which would send the user straight back here, forever.
|
|
19082
|
+
*/
|
|
19083
|
+
const isOnOidcCallbackRoute = store => {
|
|
19084
|
+
var _store$root$urlStrate;
|
|
19085
|
+
const {
|
|
19086
|
+
oidcRedirectUrl
|
|
19087
|
+
} = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, _LoginState_consts__WEBPACK_IMPORTED_MODULE_6__.defaultFronteggRoutes, store.auth.routes);
|
|
19088
|
+
return !!oidcRedirectUrl && getCurrentRoutes((_store$root$urlStrate = store.root.urlStrategy) != null ? _store$root$urlStrate : 'path').some(currentRoute => currentRoute.endsWith(oidcRedirectUrl));
|
|
19089
|
+
};
|
|
19090
|
+
|
|
19091
|
+
/**
|
|
19092
|
+
* After a switch refused for SSO the tab points at the SSO tenant. Its SSO login comes back on a callback route and
|
|
19093
|
+
* keeps it; any other page load means the user didn't finish that login, so the tab goes back to its tenant.
|
|
19094
|
+
*/
|
|
19095
|
+
const restoreTabTenantUnlessSsoCallback = store => {
|
|
19096
|
+
var _store$root$urlStrate2;
|
|
19097
|
+
if (!(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_7__.isEnforceSsoOnTenantAccessEnabled)(store.root.appName) || !_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_5__.ContextHolder.for(store.root.appName).isSessionPerTenantEnabled()) {
|
|
19098
|
+
return;
|
|
19099
|
+
}
|
|
19100
|
+
const {
|
|
19101
|
+
samlCallbackUrl,
|
|
19102
|
+
oidcRedirectUrl,
|
|
19103
|
+
hostedLoginRedirectUrl
|
|
19104
|
+
} = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, _LoginState_consts__WEBPACK_IMPORTED_MODULE_6__.defaultFronteggRoutes, store.auth.routes);
|
|
19105
|
+
// matched like login matches its callback pages: endsWith, so a basename before the route still counts
|
|
19106
|
+
const currentRoutes = getCurrentRoutes((_store$root$urlStrate2 = store.root.urlStrategy) != null ? _store$root$urlStrate2 : 'path');
|
|
19107
|
+
const isSsoCallback = [samlCallbackUrl, oidcRedirectUrl, hostedLoginRedirectUrl].some(route => !!route && currentRoutes.some(currentRoute => currentRoute.endsWith(route)));
|
|
19108
|
+
if (!isSsoCallback) {
|
|
19109
|
+
(0,_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_7__.restoreTabTenantBeforeSsoSwitch)();
|
|
19110
|
+
}
|
|
19111
|
+
};
|
|
18837
19112
|
const prepareIdentifiersForSignup = payload => {
|
|
18838
19113
|
const {
|
|
18839
19114
|
phoneNumber,
|
|
18840
19115
|
email,
|
|
18841
19116
|
username
|
|
18842
19117
|
} = payload,
|
|
18843
|
-
finalDto = (0,
|
|
19118
|
+
finalDto = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(payload, _excluded);
|
|
18844
19119
|
if (email != null && email.length) {
|
|
18845
19120
|
Object.assign(finalDto, {
|
|
18846
19121
|
email
|
|
@@ -18858,9 +19133,21 @@ const prepareIdentifiersForSignup = payload => {
|
|
|
18858
19133
|
}
|
|
18859
19134
|
return finalDto;
|
|
18860
19135
|
};
|
|
19136
|
+
|
|
19137
|
+
// Pages the user lands on after login or sign-up: destinations, not auth pages.
|
|
19138
|
+
const AFTER_AUTH_DESTINATION_ROUTES = ['authenticatedUrl', 'signUpSuccessUrl', 'accountSignUpSuccessUrl', 'userSignUpSuccessUrl', 'customLoginAuthenticatedUrl'];
|
|
19139
|
+
|
|
19140
|
+
/**
|
|
19141
|
+
* Whether the current route is an auth page (login, tenant chooser, social / magic link / SSO callback), not one to come
|
|
19142
|
+
* back to. Unlike isAuthRoute: after-login / sign-up destinations don't count, and endsWith lets a basename prefix it.
|
|
19143
|
+
*/
|
|
19144
|
+
const isOnAuthPageRoute = (urlStrategy, routes) => {
|
|
19145
|
+
const currentRoutes = getCurrentRoutes(urlStrategy);
|
|
19146
|
+
return Object.entries((0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, _LoginState_consts__WEBPACK_IMPORTED_MODULE_6__.defaultFronteggRoutes, routes)).some(([name, route]) => !AFTER_AUTH_DESTINATION_ROUTES.includes(name) && typeof route === 'string' && !!route && currentRoutes.some(currentRoute => currentRoute.endsWith(route)));
|
|
19147
|
+
};
|
|
18861
19148
|
const isAuthRoute = (path, routes) => {
|
|
18862
|
-
const _defaultFronteggRoute = (0,
|
|
18863
|
-
authRoutes = (0,
|
|
19149
|
+
const _defaultFronteggRoute = (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__["default"])({}, _LoginState_consts__WEBPACK_IMPORTED_MODULE_6__.defaultFronteggRoutes, routes),
|
|
19150
|
+
authRoutes = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_defaultFronteggRoute, _excluded2);
|
|
18864
19151
|
return Object.values(authRoutes).includes(path);
|
|
18865
19152
|
};
|
|
18866
19153
|
|
|
@@ -20392,12 +20679,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
20392
20679
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
20393
20680
|
/* harmony export */ errorHandler: () => (/* binding */ errorHandler),
|
|
20394
20681
|
/* harmony export */ isError: () => (/* binding */ isError),
|
|
20395
|
-
/* harmony export */ isFronteggApiError: () => (/* binding */ isFronteggApiError)
|
|
20682
|
+
/* harmony export */ isFronteggApiError: () => (/* binding */ isFronteggApiError),
|
|
20683
|
+
/* harmony export */ isSsoEnforcementError: () => (/* binding */ isSsoEnforcementError)
|
|
20396
20684
|
/* harmony export */ });
|
|
20397
|
-
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/
|
|
20398
|
-
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/
|
|
20685
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/constants.js");
|
|
20686
|
+
/* harmony import */ var _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @frontegg/rest-api */ "../../dist/@frontegg/rest-api/error.js");
|
|
20399
20687
|
|
|
20400
20688
|
const isFronteggApiError = error => Boolean(error == null ? void 0 : error.statusCode);
|
|
20689
|
+
|
|
20690
|
+
// ER-01079 (disabled user / expired tenant) is not this: it still logs out
|
|
20691
|
+
const isSsoEnforcementError = error => isFronteggApiError(error) && error.errorCode === _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.SSO_REQUIRED_FOR_TENANT_ERROR_CODE;
|
|
20401
20692
|
const isError = error => {
|
|
20402
20693
|
if (error instanceof Error) {
|
|
20403
20694
|
return true;
|
|
@@ -20419,7 +20710,7 @@ const errorHandler = (error, fallback) => {
|
|
|
20419
20710
|
} else if (typeof error === 'string') {
|
|
20420
20711
|
console.error(error);
|
|
20421
20712
|
}
|
|
20422
|
-
return fallback != null ? fallback : new
|
|
20713
|
+
return fallback != null ? fallback : new _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_1__.FronteggApiError(_frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.GENERIC_ERROR_MESSAGE, 500, null, _frontegg_rest_api__WEBPACK_IMPORTED_MODULE_0__.GENERIC_ERROR_CODE);
|
|
20423
20714
|
};
|
|
20424
20715
|
|
|
20425
20716
|
/***/ }),
|
|
@@ -20450,6 +20741,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
20450
20741
|
/* harmony export */ isError: () => (/* reexport safe */ _handlers__WEBPACK_IMPORTED_MODULE_1__.isError),
|
|
20451
20742
|
/* harmony export */ isFronteggApiError: () => (/* reexport safe */ _handlers__WEBPACK_IMPORTED_MODULE_1__.isFronteggApiError),
|
|
20452
20743
|
/* harmony export */ isProxy: () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.isProxy),
|
|
20744
|
+
/* harmony export */ isSsoEnforcementError: () => (/* reexport safe */ _handlers__WEBPACK_IMPORTED_MODULE_1__.isSsoEnforcementError),
|
|
20453
20745
|
/* harmony export */ omitProps: () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.omitProps),
|
|
20454
20746
|
/* harmony export */ publicKeyCredentialToJSON: () => (/* reexport safe */ _converters__WEBPACK_IMPORTED_MODULE_2__.publicKeyCredentialToJSON),
|
|
20455
20747
|
/* harmony export */ readFileAsText: () => (/* reexport safe */ _converters__WEBPACK_IMPORTED_MODULE_2__.readFileAsText),
|
|
@@ -21146,9 +21438,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21146
21438
|
/* harmony export */ isHostedOAuthStateExpired: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.isHostedOAuthStateExpired),
|
|
21147
21439
|
/* harmony export */ isMfaRequired: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isMfaRequired),
|
|
21148
21440
|
/* harmony export */ isOauthCallbackRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOauthCallbackRoute),
|
|
21441
|
+
/* harmony export */ isOnAuthPageRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOnAuthPageRoute),
|
|
21442
|
+
/* harmony export */ isOnOidcCallbackRoute: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isOnOidcCallbackRoute),
|
|
21149
21443
|
/* harmony export */ isPreferredMfaMethod: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.isPreferredMfaMethod),
|
|
21150
21444
|
/* harmony export */ isProxy: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.isProxy),
|
|
21151
21445
|
/* harmony export */ isResetPasswordRequired: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isResetPasswordRequired),
|
|
21446
|
+
/* harmony export */ isSsoEnforcementError: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.isSsoEnforcementError),
|
|
21152
21447
|
/* harmony export */ isSteppedUp: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isSteppedUp),
|
|
21153
21448
|
/* harmony export */ isUsernamePayload: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.isUsernamePayload),
|
|
21154
21449
|
/* harmony export */ mapMetaDataObjectToActions: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.mapMetaDataObjectToActions),
|
|
@@ -21162,6 +21457,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21162
21457
|
/* harmony export */ refreshTokenWithRetry: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.refreshTokenWithRetry),
|
|
21163
21458
|
/* harmony export */ reportGTMEvent: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.reportGTMEvent),
|
|
21164
21459
|
/* harmony export */ resolvePreferredMfa: () => (/* reexport safe */ _toolkit__WEBPACK_IMPORTED_MODULE_0__.resolvePreferredMfa),
|
|
21460
|
+
/* harmony export */ restoreTabTenantUnlessSsoCallback: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.restoreTabTenantUnlessSsoCallback),
|
|
21165
21461
|
/* harmony export */ retry: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.retry),
|
|
21166
21462
|
/* harmony export */ retryIfNeeded: () => (/* reexport safe */ _helpers__WEBPACK_IMPORTED_MODULE_2__.retryIfNeeded),
|
|
21167
21463
|
/* harmony export */ setAfterAuthRedirectUrlForStepUp: () => (/* reexport safe */ _auth_helpers__WEBPACK_IMPORTED_MODULE_3__.setAfterAuthRedirectUrlForStepUp),
|
|
@@ -21183,7 +21479,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
21183
21479
|
/* harmony import */ var _subscriptions_interfaces__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./subscriptions/interfaces */ "../../dist/@frontegg/redux-store/subscriptions/interfaces.js");
|
|
21184
21480
|
/* harmony import */ var _vendor__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./vendor */ "../../dist/@frontegg/redux-store/vendor/index.js");
|
|
21185
21481
|
/* harmony import */ var _audits__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./audits */ "../../dist/@frontegg/redux-store/audits/index.js");
|
|
21186
|
-
/** @license Frontegg v7.
|
|
21482
|
+
/** @license Frontegg v7.131.0-alpha.1
|
|
21187
21483
|
*
|
|
21188
21484
|
* This source code is licensed under the MIT license found in the
|
|
21189
21485
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -29636,9 +29932,11 @@ class AuditsApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_1__.BaseApiClien
|
|
|
29636
29932
|
__webpack_require__.r(__webpack_exports__);
|
|
29637
29933
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
29638
29934
|
/* harmony export */ FRONTEGG_SEPARATE_TABS_BY_TENANT: () => (/* binding */ FRONTEGG_SEPARATE_TABS_BY_TENANT),
|
|
29935
|
+
/* harmony export */ FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH: () => (/* binding */ FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH),
|
|
29639
29936
|
/* harmony export */ USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF: () => (/* binding */ USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF)
|
|
29640
29937
|
/* harmony export */ });
|
|
29641
29938
|
const FRONTEGG_SEPARATE_TABS_BY_TENANT = 'FRONTEGG_SEPARATE_TABS_BY_TENANT';
|
|
29939
|
+
const FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH = 'FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH';
|
|
29642
29940
|
/**
|
|
29643
29941
|
* use current user tenant v1 feature flag
|
|
29644
29942
|
*/
|
|
@@ -29731,7 +30029,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
29731
30029
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
29732
30030
|
/* harmony export */ getCurrentUserTenantsFunction: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.getCurrentUserTenantsFunction),
|
|
29733
30031
|
/* harmony export */ getTabTenantFromSessionStorage: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.getTabTenantFromSessionStorage),
|
|
30032
|
+
/* harmony export */ isEnforceSsoOnTenantAccessEnabled: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.isEnforceSsoOnTenantAccessEnabled),
|
|
29734
30033
|
/* harmony export */ removeTabTenantFromSessionStorage: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.removeTabTenantFromSessionStorage),
|
|
30034
|
+
/* harmony export */ restoreTabTenantBeforeSsoSwitch: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.restoreTabTenantBeforeSsoSwitch),
|
|
30035
|
+
/* harmony export */ setTabTenantForSsoSwitch: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantForSsoSwitch),
|
|
29735
30036
|
/* harmony export */ setTabTenantInSessionStorage: () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)
|
|
29736
30037
|
/* harmony export */ });
|
|
29737
30038
|
/* 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");
|
|
@@ -30421,10 +30722,10 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
|
|
|
30421
30722
|
const data = await this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.oauth.v1}/token`, body);
|
|
30422
30723
|
return this.generateLoginResponseFromOAuthResponseV2(data);
|
|
30423
30724
|
};
|
|
30424
|
-
this.silentOAuthRefreshTokenV2 = async
|
|
30725
|
+
this.silentOAuthRefreshTokenV2 = async tenantId => {
|
|
30425
30726
|
const tabTenantId = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.getTabTenantFromSessionStorage)(this.appName);
|
|
30426
30727
|
const data = await this.post(`${_constants__WEBPACK_IMPORTED_MODULE_11__.urls.oauth.v1}/authorize/silent`, {
|
|
30427
|
-
tenantId: tabTenantId
|
|
30728
|
+
tenantId: tenantId != null ? tenantId : tabTenantId
|
|
30428
30729
|
});
|
|
30429
30730
|
return this.generateLoginResponseFromOAuthResponseV2(data);
|
|
30430
30731
|
};
|
|
@@ -30598,6 +30899,9 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
|
|
|
30598
30899
|
}
|
|
30599
30900
|
if (user.tenantId) {
|
|
30600
30901
|
(0,_utils__WEBPACK_IMPORTED_MODULE_5__.setTabTenantInSessionStorage)(user.tenantId);
|
|
30902
|
+
if ((0,_utils__WEBPACK_IMPORTED_MODULE_5__.isEnforceSsoOnTenantAccessEnabled)(this.appName)) {
|
|
30903
|
+
(0,_utils__WEBPACK_IMPORTED_MODULE_5__.clearTabTenantBeforeSsoSwitch)();
|
|
30904
|
+
}
|
|
30601
30905
|
// The server's activeTenant may reflect a different tab's tenant switch.
|
|
30602
30906
|
// Correct it to match the JWT's tenant for this tab.
|
|
30603
30907
|
const matchingTenant = currentUserTenants.tenants.find(t => t.tenantId === user.tenantId);
|
|
@@ -30622,6 +30926,7 @@ class AuthenticationApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_6__.Base
|
|
|
30622
30926
|
"use strict";
|
|
30623
30927
|
__webpack_require__.r(__webpack_exports__);
|
|
30624
30928
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
30929
|
+
/* harmony export */ ENFORCE_SSO_ON_TENANT_ACCESS_FF: () => (/* binding */ ENFORCE_SSO_ON_TENANT_ACCESS_FF),
|
|
30625
30930
|
/* harmony export */ LOAD_AUTHORIZATION_FF: () => (/* binding */ LOAD_AUTHORIZATION_FF),
|
|
30626
30931
|
/* harmony export */ MFAStrategyEnum: () => (/* binding */ MFAStrategyEnum),
|
|
30627
30932
|
/* harmony export */ PreLoginAddressType: () => (/* binding */ PreLoginAddressType),
|
|
@@ -30663,6 +30968,13 @@ let MFAStrategyEnum;
|
|
|
30663
30968
|
MFAStrategyEnum["EmailCode"] = "EmailCode";
|
|
30664
30969
|
})(MFAStrategyEnum || (MFAStrategyEnum = {}));
|
|
30665
30970
|
const LOAD_AUTHORIZATION_FF = 'admin_portal_should_load_authorization';
|
|
30971
|
+
const ENFORCE_SSO_ON_TENANT_ACCESS_FF = 'enforce-sso-on-tenant-access';
|
|
30972
|
+
|
|
30973
|
+
/**
|
|
30974
|
+
* errorContext of a login, tenant switch or token refresh refused because the tenant requires SSO.
|
|
30975
|
+
* ssoRequired: true - the user must log in through the tenant's SSO at `address`.
|
|
30976
|
+
* ssoRequired: false - refused with no SSO to send the user to (no tenantId when a login is refused everywhere).
|
|
30977
|
+
*/
|
|
30666
30978
|
|
|
30667
30979
|
/***/ }),
|
|
30668
30980
|
|
|
@@ -30842,16 +31154,22 @@ let RestrictionType;
|
|
|
30842
31154
|
"use strict";
|
|
30843
31155
|
__webpack_require__.r(__webpack_exports__);
|
|
30844
31156
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
31157
|
+
/* harmony export */ clearTabTenantBeforeSsoSwitch: () => (/* binding */ clearTabTenantBeforeSsoSwitch),
|
|
30845
31158
|
/* harmony export */ executeConditionalPromise: () => (/* binding */ executeConditionalPromise),
|
|
30846
31159
|
/* harmony export */ getCurrentUserTenantsFunction: () => (/* binding */ getCurrentUserTenantsFunction),
|
|
30847
31160
|
/* harmony export */ getTabTenantFromSessionStorage: () => (/* binding */ getTabTenantFromSessionStorage),
|
|
31161
|
+
/* harmony export */ isEnforceSsoOnTenantAccessEnabled: () => (/* binding */ isEnforceSsoOnTenantAccessEnabled),
|
|
30848
31162
|
/* harmony export */ removeTabTenantFromSessionStorage: () => (/* binding */ removeTabTenantFromSessionStorage),
|
|
31163
|
+
/* harmony export */ restoreTabTenantBeforeSsoSwitch: () => (/* binding */ restoreTabTenantBeforeSsoSwitch),
|
|
31164
|
+
/* harmony export */ setTabTenantForSsoSwitch: () => (/* binding */ setTabTenantForSsoSwitch),
|
|
30849
31165
|
/* harmony export */ setTabTenantInSessionStorage: () => (/* binding */ setTabTenantInSessionStorage)
|
|
30850
31166
|
/* harmony export */ });
|
|
30851
|
-
/* harmony import */ var
|
|
31167
|
+
/* harmony import */ var _ContextHolder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ContextHolder */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
30852
31168
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/auth/constants.js");
|
|
30853
|
-
/* harmony import */ var
|
|
30854
|
-
/* harmony import */ var
|
|
31169
|
+
/* harmony import */ var _feature_flags__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../feature-flags */ "../../dist/@frontegg/rest-api/feature-flags/index.js");
|
|
31170
|
+
/* harmony import */ var _users__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../users */ "../../dist/@frontegg/rest-api/users/index.js");
|
|
31171
|
+
/* harmony import */ var _interfaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interfaces */ "../../dist/@frontegg/rest-api/auth/interfaces.js");
|
|
31172
|
+
|
|
30855
31173
|
|
|
30856
31174
|
|
|
30857
31175
|
|
|
@@ -30870,26 +31188,60 @@ function setTabTenantInSessionStorage(tenantId) {
|
|
|
30870
31188
|
}
|
|
30871
31189
|
sessionStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_SEPARATE_TABS_BY_TENANT, tenantId);
|
|
30872
31190
|
}
|
|
31191
|
+
|
|
31192
|
+
// The one place that reads enforce-sso-on-tenant-access: SSO enforcement on login, tenant switch and token refresh.
|
|
31193
|
+
function isEnforceSsoOnTenantAccessEnabled(appName) {
|
|
31194
|
+
const [isEnabled] = _feature_flags__WEBPACK_IMPORTED_MODULE_1__.FeatureFlags.getFeatureFlags([_interfaces__WEBPACK_IMPORTED_MODULE_2__.ENFORCE_SSO_ON_TENANT_ACCESS_FF], appName);
|
|
31195
|
+
return isEnabled;
|
|
31196
|
+
}
|
|
30873
31197
|
function removeTabTenantFromSessionStorage() {
|
|
30874
31198
|
sessionStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_SEPARATE_TABS_BY_TENANT);
|
|
30875
31199
|
}
|
|
31200
|
+
|
|
31201
|
+
/**
|
|
31202
|
+
* Points the tab at the tenant whose SSO the user is sent to after a refused switch, keeping the tenant it had:
|
|
31203
|
+
* a page load that isn't the SSO login's callback puts it back (see restoreTabTenantBeforeSsoSwitch).
|
|
31204
|
+
*/
|
|
31205
|
+
function setTabTenantForSsoSwitch(tenantId) {
|
|
31206
|
+
var _sessionStorage$getIt;
|
|
31207
|
+
sessionStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH, (_sessionStorage$getIt = sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_SEPARATE_TABS_BY_TENANT)) != null ? _sessionStorage$getIt : '');
|
|
31208
|
+
setTabTenantInSessionStorage(tenantId);
|
|
31209
|
+
}
|
|
31210
|
+
|
|
31211
|
+
/** Puts back the tab tenant of an SSO switch the user didn't finish. */
|
|
31212
|
+
function restoreTabTenantBeforeSsoSwitch() {
|
|
31213
|
+
const previousTenantId = sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH);
|
|
31214
|
+
if (previousTenantId === null) {
|
|
31215
|
+
return;
|
|
31216
|
+
}
|
|
31217
|
+
clearTabTenantBeforeSsoSwitch();
|
|
31218
|
+
previousTenantId ? setTabTenantInSessionStorage(previousTenantId) : removeTabTenantFromSessionStorage();
|
|
31219
|
+
}
|
|
31220
|
+
|
|
31221
|
+
/** The tab got a session: nothing is left to put back. */
|
|
31222
|
+
function clearTabTenantBeforeSsoSwitch() {
|
|
31223
|
+
sessionStorage.removeItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_TAB_TENANT_BEFORE_SSO_SWITCH);
|
|
31224
|
+
}
|
|
30876
31225
|
function getTabTenantFromSessionStorage(appName) {
|
|
30877
|
-
if (!
|
|
31226
|
+
if (!_ContextHolder__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(appName).isSessionPerTenantEnabled()) {
|
|
30878
31227
|
return null;
|
|
30879
31228
|
}
|
|
30880
31229
|
return sessionStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.FRONTEGG_SEPARATE_TABS_BY_TENANT);
|
|
30881
31230
|
}
|
|
30882
31231
|
function getCurrentUserTenantsFunction(appName) {
|
|
30883
|
-
const skipUserLoading =
|
|
31232
|
+
const skipUserLoading = _ContextHolder__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(appName).shouldSkipUserLoad();
|
|
30884
31233
|
if (skipUserLoading) {
|
|
30885
31234
|
return async () => ({
|
|
30886
31235
|
tenants: [],
|
|
30887
31236
|
activeTenant: {}
|
|
30888
31237
|
});
|
|
30889
31238
|
}
|
|
30890
|
-
const usersApi = new
|
|
30891
|
-
const [useCurrentUserTenantsV1] =
|
|
30892
|
-
|
|
31239
|
+
const usersApi = new _users__WEBPACK_IMPORTED_MODULE_4__.UsersApi(appName);
|
|
31240
|
+
const [useCurrentUserTenantsV1] = _feature_flags__WEBPACK_IMPORTED_MODULE_1__.FeatureFlags.getFeatureFlags([_constants__WEBPACK_IMPORTED_MODULE_0__.USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF], appName);
|
|
31241
|
+
const enforceSsoOnTenantAccess = isEnforceSsoOnTenantAccessEnabled(appName);
|
|
31242
|
+
// SSO recovery may retain the JWT tenant while the saved application tenant stays elsewhere.
|
|
31243
|
+
// The context-based endpoint also includes inherited tenant details outside the assigned list.
|
|
31244
|
+
if (_ContextHolder__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(appName).isSessionPerTenantEnabled() || enforceSsoOnTenantAccess) {
|
|
30893
31245
|
return usersApi.getCurrentUserTenantsV1;
|
|
30894
31246
|
}
|
|
30895
31247
|
return useCurrentUserTenantsV1 ? usersApi.getCurrentUserTenantsV1 : usersApi.getCurrentUserTenantsV3;
|
|
@@ -31057,6 +31409,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
31057
31409
|
/* harmony export */ INVITATION_LINK_CREATION_TENANT_LOCKED_ERROR_CODE: () => (/* binding */ INVITATION_LINK_CREATION_TENANT_LOCKED_ERROR_CODE),
|
|
31058
31410
|
/* harmony export */ INVITATION_TENANT_LOCKED_ERROR_CODE: () => (/* binding */ INVITATION_TENANT_LOCKED_ERROR_CODE),
|
|
31059
31411
|
/* harmony export */ SSO_EMAIL_MISMATCH_ERROR_CODE: () => (/* binding */ SSO_EMAIL_MISMATCH_ERROR_CODE),
|
|
31412
|
+
/* harmony export */ SSO_REQUIRED_FOR_TENANT_ERROR_CODE: () => (/* binding */ SSO_REQUIRED_FOR_TENANT_ERROR_CODE),
|
|
31060
31413
|
/* harmony export */ urls: () => (/* binding */ urls)
|
|
31061
31414
|
/* harmony export */ });
|
|
31062
31415
|
const urls = {
|
|
@@ -31388,6 +31741,10 @@ const INVALID_SSO_EMAIL_DOMAIN_ERROR_CODE = 'ER-01248';
|
|
|
31388
31741
|
// Returned on the SAML callback when the email returned by the IdP differs from the one that started the login.
|
|
31389
31742
|
const SSO_EMAIL_MISMATCH_ERROR_CODE = 'ER-01249';
|
|
31390
31743
|
|
|
31744
|
+
// Returned by identity-service when a login, tenant switch or token refresh is refused because the target tenant
|
|
31745
|
+
// requires SSO (HTTP 400 Bad Request, IdentityErrorCodes.SsoRequiredForTenantException with an errorContext).
|
|
31746
|
+
const SSO_REQUIRED_FOR_TENANT_ERROR_CODE = 'ER-01253';
|
|
31747
|
+
|
|
31391
31748
|
/***/ }),
|
|
31392
31749
|
|
|
31393
31750
|
/***/ "../../dist/@frontegg/rest-api/directory/index.js":
|
|
@@ -31790,6 +32147,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
31790
32147
|
/* harmony export */ ContextHolder: () => (/* reexport safe */ _ContextHolder__WEBPACK_IMPORTED_MODULE_46__.ContextHolder),
|
|
31791
32148
|
/* harmony export */ DirectoryApi: () => (/* reexport safe */ _directory_index__WEBPACK_IMPORTED_MODULE_11__.DirectoryApi),
|
|
31792
32149
|
/* harmony export */ EIdentifierType: () => (/* reexport safe */ _auth_enums__WEBPACK_IMPORTED_MODULE_2__.EIdentifierType),
|
|
32150
|
+
/* harmony export */ ENFORCE_SSO_ON_TENANT_ACCESS_FF: () => (/* reexport safe */ _auth_interfaces__WEBPACK_IMPORTED_MODULE_1__.ENFORCE_SSO_ON_TENANT_ACCESS_FF),
|
|
31793
32151
|
/* harmony export */ FRONTEGG_SEPARATE_TABS_BY_TENANT: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_4__.FRONTEGG_SEPARATE_TABS_BY_TENANT),
|
|
31794
32152
|
/* harmony export */ FeatureFlags: () => (/* reexport safe */ _feature_flags_index__WEBPACK_IMPORTED_MODULE_10__.FeatureFlags),
|
|
31795
32153
|
/* harmony export */ FeatureFlagsApi: () => (/* reexport safe */ _feature_flags_index__WEBPACK_IMPORTED_MODULE_10__.FeatureFlagsApi),
|
|
@@ -31824,6 +32182,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
31824
32182
|
/* harmony export */ RequestSource: () => (/* reexport safe */ _interfaces__WEBPACK_IMPORTED_MODULE_0__.RequestSource),
|
|
31825
32183
|
/* harmony export */ RestrictionType: () => (/* reexport safe */ _auth_interfaces__WEBPACK_IMPORTED_MODULE_1__.RestrictionType),
|
|
31826
32184
|
/* harmony export */ SSO_EMAIL_MISMATCH_ERROR_CODE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_18__.SSO_EMAIL_MISMATCH_ERROR_CODE),
|
|
32185
|
+
/* harmony export */ SSO_REQUIRED_FOR_TENANT_ERROR_CODE: () => (/* reexport safe */ _constants__WEBPACK_IMPORTED_MODULE_18__.SSO_REQUIRED_FOR_TENANT_ERROR_CODE),
|
|
31827
32186
|
/* harmony export */ ScimConnectionSource: () => (/* reexport safe */ _directory_interfaces__WEBPACK_IMPORTED_MODULE_12__.ScimConnectionSource),
|
|
31828
32187
|
/* harmony export */ SecondaryAuthStrategy: () => (/* reexport safe */ _auth_interfaces__WEBPACK_IMPORTED_MODULE_1__.SecondaryAuthStrategy),
|
|
31829
32188
|
/* harmony export */ SecurityCategory: () => (/* reexport safe */ _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__.SecurityCategory),
|
|
@@ -31849,8 +32208,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
31849
32208
|
/* harmony export */ fronteggUsersUrl: () => (/* reexport safe */ _routers__WEBPACK_IMPORTED_MODULE_9__.fronteggUsersUrl),
|
|
31850
32209
|
/* harmony export */ getCurrentUserTenantsFunction: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_3__.getCurrentUserTenantsFunction),
|
|
31851
32210
|
/* harmony export */ getTabTenantFromSessionStorage: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_3__.getTabTenantFromSessionStorage),
|
|
32211
|
+
/* harmony export */ isEnforceSsoOnTenantAccessEnabled: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_3__.isEnforceSsoOnTenantAccessEnabled),
|
|
31852
32212
|
/* harmony export */ providersArray: () => (/* reexport safe */ _users_interfaces__WEBPACK_IMPORTED_MODULE_14__.providersArray),
|
|
31853
32213
|
/* harmony export */ removeTabTenantFromSessionStorage: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_3__.removeTabTenantFromSessionStorage),
|
|
32214
|
+
/* harmony export */ restoreTabTenantBeforeSsoSwitch: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_3__.restoreTabTenantBeforeSsoSwitch),
|
|
32215
|
+
/* harmony export */ setTabTenantForSsoSwitch: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_3__.setTabTenantForSsoSwitch),
|
|
31854
32216
|
/* harmony export */ setTabTenantInSessionStorage: () => (/* reexport safe */ _auth__WEBPACK_IMPORTED_MODULE_3__.setTabTenantInSessionStorage)
|
|
31855
32217
|
/* harmony export */ });
|
|
31856
32218
|
/* harmony import */ var _auth_enums__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./auth/enums */ "../../dist/@frontegg/rest-api/auth/enums.js");
|
|
@@ -31902,7 +32264,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
31902
32264
|
/* harmony import */ var _security_center_interfaces__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./security-center/interfaces */ "../../dist/@frontegg/rest-api/security-center/interfaces.js");
|
|
31903
32265
|
/* harmony import */ var _applications_interfaces__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./applications/interfaces */ "../../dist/@frontegg/rest-api/applications/interfaces.js");
|
|
31904
32266
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./constants */ "../../dist/@frontegg/rest-api/constants.js");
|
|
31905
|
-
/** @license Frontegg v7.
|
|
32267
|
+
/** @license Frontegg v7.131.0-alpha.1
|
|
31906
32268
|
*
|
|
31907
32269
|
* This source code is licensed under the MIT license found in the
|
|
31908
32270
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -33482,8 +33844,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33482
33844
|
/* harmony export */ });
|
|
33483
33845
|
/* 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");
|
|
33484
33846
|
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../constants */ "../../dist/@frontegg/rest-api/constants.js");
|
|
33485
|
-
/* harmony import */ var
|
|
33486
|
-
/* harmony import */ var
|
|
33847
|
+
/* harmony import */ var _auth_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../auth/utils */ "../../dist/@frontegg/rest-api/auth/utils.js");
|
|
33848
|
+
/* harmony import */ var _ContextHolder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ContextHolder */ "../../dist/@frontegg/rest-api/ContextHolder/index.js");
|
|
33487
33849
|
/* harmony import */ var _BaseApiClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../BaseApiClient */ "../../dist/@frontegg/rest-api/BaseApiClient.js");
|
|
33488
33850
|
|
|
33489
33851
|
|
|
@@ -33494,11 +33856,24 @@ class TenantsApi extends _BaseApiClient__WEBPACK_IMPORTED_MODULE_1__.BaseApiClie
|
|
|
33494
33856
|
constructor(appName) {
|
|
33495
33857
|
super(appName);
|
|
33496
33858
|
this.switchTenant = async body => {
|
|
33497
|
-
if (
|
|
33498
|
-
|
|
33859
|
+
if ((0,_auth_utils__WEBPACK_IMPORTED_MODULE_2__.isEnforceSsoOnTenantAccessEnabled)(this.appName) && _ContextHolder__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(this.appName).isSessionPerTenantEnabled()) {
|
|
33860
|
+
return this.switchTabTenantKeepingItOnRefusal(body);
|
|
33861
|
+
}
|
|
33862
|
+
if (_ContextHolder__WEBPACK_IMPORTED_MODULE_3__.ContextHolder.for(this.appName).isSessionPerTenantEnabled()) {
|
|
33863
|
+
(0,_auth_utils__WEBPACK_IMPORTED_MODULE_2__.setTabTenantInSessionStorage)(body.tenantId);
|
|
33499
33864
|
}
|
|
33500
33865
|
return this.put(`${_constants__WEBPACK_IMPORTED_MODULE_4__.urls.identity.users.v1}/tenant`, body);
|
|
33501
33866
|
};
|
|
33867
|
+
this.switchTabTenantKeepingItOnRefusal = async body => {
|
|
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;
|
|
33875
|
+
}
|
|
33876
|
+
};
|
|
33502
33877
|
this.getTenants = async () => {
|
|
33503
33878
|
return this.get(`${_constants__WEBPACK_IMPORTED_MODULE_4__.urls.identity.users.v2}/me/tenants`);
|
|
33504
33879
|
};
|
|
@@ -34744,7 +35119,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34744
35119
|
/* harmony export */ });
|
|
34745
35120
|
/* harmony import */ var _ThemeOptions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThemeOptions */ "../../dist/@frontegg/types/ThemeOptions/index.js");
|
|
34746
35121
|
/* harmony import */ var _Metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Metadata */ "../../dist/@frontegg/types/Metadata/index.js");
|
|
34747
|
-
/** @license Frontegg v7.
|
|
35122
|
+
/** @license Frontegg v7.131.0-alpha.1
|
|
34748
35123
|
*
|
|
34749
35124
|
* This source code is licensed under the MIT license found in the
|
|
34750
35125
|
* LICENSE file in the root directory of this source tree.
|