@frontegg/redux-store 6.166.0-alpha.0 → 6.166.0-alpha.2
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/auth/StepUpState/stepUpHostedLogin.saga.d.ts +2 -2
- package/auth/StepUpState/stepUpHostedLogin.saga.js +10 -0
- package/auth/StepUpState/utils.js +5 -2
- package/index.js +1 -1
- package/node/auth/StepUpState/stepUpHostedLogin.saga.js +10 -0
- package/node/auth/StepUpState/utils.js +5 -2
- package/node/index.js +1 -1
- package/package.json +1 -1
|
@@ -4,9 +4,9 @@ import { IStepUpHostedLogin } from './interfaces';
|
|
|
4
4
|
* Step up for hosted login apps
|
|
5
5
|
* @param payload.maxAge
|
|
6
6
|
*/
|
|
7
|
-
export declare function stepUpHostedLogin({ payload }: PayloadAction<IStepUpHostedLogin>): Generator<Generator<any, void, {
|
|
7
|
+
export declare function stepUpHostedLogin({ payload }: PayloadAction<IStepUpHostedLogin>): Generator<import("redux-saga/effects").SelectEffect | Generator<any, void, {
|
|
8
8
|
routes: any;
|
|
9
9
|
context: any;
|
|
10
10
|
onRedirectTo: any;
|
|
11
11
|
urlStrategy: any;
|
|
12
|
-
} & string & import("@frontegg/rest-api").ResolvedTenantResult>, void,
|
|
12
|
+
} & string & import("@frontegg/rest-api").ResolvedTenantResult>, void, string | undefined>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { requestHostedLoginAuthorize } from '../LoginState/saga';
|
|
2
2
|
import { ACR_VALUE, SHOULD_STEP_UP_KEY } from './consts';
|
|
3
3
|
import { setAfterAuthRedirectUrlForStepUp } from './utils';
|
|
4
|
+
import { select } from 'redux-saga/effects';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Step up for hosted login apps
|
|
@@ -18,6 +19,15 @@ export function* stepUpHostedLogin({
|
|
|
18
19
|
if (maxAge !== undefined) {
|
|
19
20
|
params.max_age = maxAge.toString();
|
|
20
21
|
}
|
|
22
|
+
const alias = yield select(({
|
|
23
|
+
auth
|
|
24
|
+
}) => {
|
|
25
|
+
var _auth$tenantsState, _auth$tenantsState$ac;
|
|
26
|
+
return (_auth$tenantsState = auth.tenantsState) == null ? void 0 : (_auth$tenantsState$ac = _auth$tenantsState.activeTenant) == null ? void 0 : _auth$tenantsState$ac.alias;
|
|
27
|
+
});
|
|
28
|
+
if (alias) {
|
|
29
|
+
params.organization = alias;
|
|
30
|
+
}
|
|
21
31
|
setAfterAuthRedirectUrlForStepUp();
|
|
22
32
|
window.localStorage.setItem(SHOULD_STEP_UP_KEY, 'true');
|
|
23
33
|
yield requestHostedLoginAuthorize(params);
|
|
@@ -44,8 +44,11 @@ export function setAfterAuthRedirectUrlForStepUp() {
|
|
|
44
44
|
*/
|
|
45
45
|
export const redirectByStepUpUrl = (stepUpUrl, onRedirectTo, maxAge) => {
|
|
46
46
|
setAfterAuthRedirectUrlForStepUp();
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
48
|
+
if (maxAge) {
|
|
49
|
+
searchParams.set(STEP_UP_MAX_AGE_PARAM_NAME, maxAge.toString());
|
|
50
|
+
}
|
|
51
|
+
onRedirectTo(`${stepUpUrl}${searchParams ? `?${searchParams}` : ''}`, {
|
|
49
52
|
refresh: false
|
|
50
53
|
});
|
|
51
54
|
};
|
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.stepUpHostedLogin = stepUpHostedLogin;
|
|
|
7
7
|
var _saga = require("../LoginState/saga");
|
|
8
8
|
var _consts = require("./consts");
|
|
9
9
|
var _utils = require("./utils");
|
|
10
|
+
var _effects = require("redux-saga/effects");
|
|
10
11
|
/**
|
|
11
12
|
* Step up for hosted login apps
|
|
12
13
|
* @param payload.maxAge
|
|
@@ -23,6 +24,15 @@ function* stepUpHostedLogin({
|
|
|
23
24
|
if (maxAge !== undefined) {
|
|
24
25
|
params.max_age = maxAge.toString();
|
|
25
26
|
}
|
|
27
|
+
const alias = yield (0, _effects.select)(({
|
|
28
|
+
auth
|
|
29
|
+
}) => {
|
|
30
|
+
var _auth$tenantsState, _auth$tenantsState$ac;
|
|
31
|
+
return (_auth$tenantsState = auth.tenantsState) == null ? void 0 : (_auth$tenantsState$ac = _auth$tenantsState.activeTenant) == null ? void 0 : _auth$tenantsState$ac.alias;
|
|
32
|
+
});
|
|
33
|
+
if (alias) {
|
|
34
|
+
params.organization = alias;
|
|
35
|
+
}
|
|
26
36
|
(0, _utils.setAfterAuthRedirectUrlForStepUp)();
|
|
27
37
|
window.localStorage.setItem(_consts.SHOULD_STEP_UP_KEY, 'true');
|
|
28
38
|
yield (0, _saga.requestHostedLoginAuthorize)(params);
|
|
@@ -52,8 +52,11 @@ function setAfterAuthRedirectUrlForStepUp() {
|
|
|
52
52
|
*/
|
|
53
53
|
const redirectByStepUpUrl = (stepUpUrl, onRedirectTo, maxAge) => {
|
|
54
54
|
setAfterAuthRedirectUrlForStepUp();
|
|
55
|
-
const
|
|
56
|
-
|
|
55
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
56
|
+
if (maxAge) {
|
|
57
|
+
searchParams.set(_consts.STEP_UP_MAX_AGE_PARAM_NAME, maxAge.toString());
|
|
58
|
+
}
|
|
59
|
+
onRedirectTo(`${stepUpUrl}${searchParams ? `?${searchParams}` : ''}`, {
|
|
57
60
|
refresh: false
|
|
58
61
|
});
|
|
59
62
|
};
|
package/node/index.js
CHANGED