@frontegg/redux-store 6.6.1 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/AcceptInvitationState/index.d.ts +4 -0
- package/auth/AccountSettingsState/index.d.ts +12 -0
- package/auth/ActivateState/index.d.ts +9 -12
- package/auth/ApiTokensState/index.d.ts +4 -0
- package/auth/ForgotPasswordState/index.d.ts +4 -0
- package/auth/LoginState/index.d.ts +10 -0
- package/auth/LoginState/index.js +3 -0
- package/auth/LoginState/saga.js +67 -1
- package/auth/MfaState/index.d.ts +6 -8
- package/auth/ProfileState/index.d.ts +4 -0
- package/auth/ResetPhoneNumberState/index.d.ts +4 -0
- package/auth/RestrictionsState/index.d.ts +124 -0
- package/auth/RestrictionsState/index.js +49 -0
- package/auth/RestrictionsState/interfaces.d.ts +14 -0
- package/auth/RestrictionsState/interfaces.js +1 -0
- package/auth/RestrictionsState/saga.d.ts +2 -0
- package/auth/RestrictionsState/saga.js +464 -0
- package/auth/RolesState/index.d.ts +4 -0
- package/auth/SSOState/index.d.ts +4 -0
- package/auth/SecurityPolicyState/index.d.ts +22 -0
- package/auth/SessionsPolicyState/index.d.ts +4 -0
- package/auth/SessionsState/index.d.ts +4 -8
- package/auth/SignUp/index.d.ts +4 -0
- package/auth/SocialLogins/index.d.ts +4 -0
- package/auth/TeamState/index.d.ts +4 -0
- package/auth/TenantsState/index.d.ts +4 -0
- package/auth/dummy.d.ts +3 -1
- package/auth/dummy.js +39 -2
- package/auth/index.d.ts +23 -0
- package/auth/index.js +2 -0
- package/auth/initialState.js +3 -1
- package/auth/interfaces.d.ts +3 -0
- package/auth/reducer.d.ts +23 -1
- package/auth/reducer.js +3 -2
- package/auth/saga.js +3 -2
- package/auth/utils.d.ts +8 -0
- package/index.js +1 -1
- package/node/auth/LoginState/index.js +3 -0
- package/node/auth/LoginState/saga.js +66 -0
- package/node/auth/RestrictionsState/index.js +62 -0
- package/node/auth/RestrictionsState/interfaces.js +5 -0
- package/node/auth/RestrictionsState/saga.js +478 -0
- package/node/auth/dummy.js +41 -2
- package/node/auth/index.js +28 -0
- package/node/auth/initialState.js +4 -1
- package/node/auth/reducer.js +4 -2
- package/node/auth/saga.js +4 -2
- package/node/index.js +1 -1
- package/package.json +2 -2
- package/toolkit/index.d.ts +1 -1
|
@@ -13,6 +13,7 @@ declare const reducers: {
|
|
|
13
13
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
14
14
|
error?: any;
|
|
15
15
|
isAuthenticated: boolean;
|
|
16
|
+
userIp?: string | undefined;
|
|
16
17
|
isLoading: boolean;
|
|
17
18
|
keepSessionAlive?: boolean | undefined;
|
|
18
19
|
user?: import("..").User | null | undefined;
|
|
@@ -37,6 +38,7 @@ declare const reducers: {
|
|
|
37
38
|
sessionsState: import("..").SessionsState;
|
|
38
39
|
hostedLoginBox?: boolean | undefined;
|
|
39
40
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
41
|
+
restrictionsState: import("..").RestrictionsState;
|
|
40
42
|
routes: import("..").AuthPageRoutes;
|
|
41
43
|
header?: any;
|
|
42
44
|
loaderComponent?: any;
|
|
@@ -46,6 +48,7 @@ declare const reducers: {
|
|
|
46
48
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
47
49
|
error?: any;
|
|
48
50
|
isAuthenticated: boolean;
|
|
51
|
+
userIp?: string | undefined;
|
|
49
52
|
isLoading: boolean;
|
|
50
53
|
keepSessionAlive?: boolean | undefined;
|
|
51
54
|
user?: import("..").User | null | undefined;
|
|
@@ -70,6 +73,7 @@ declare const reducers: {
|
|
|
70
73
|
sessionsState: import("..").SessionsState;
|
|
71
74
|
hostedLoginBox?: boolean | undefined;
|
|
72
75
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
76
|
+
restrictionsState: import("..").RestrictionsState;
|
|
73
77
|
routes: import("..").AuthPageRoutes;
|
|
74
78
|
header?: any;
|
|
75
79
|
loaderComponent?: any;
|
|
@@ -14,6 +14,7 @@ declare const reducers: {
|
|
|
14
14
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
15
15
|
error?: any;
|
|
16
16
|
isAuthenticated: boolean;
|
|
17
|
+
userIp?: string | undefined;
|
|
17
18
|
isLoading: boolean;
|
|
18
19
|
keepSessionAlive?: boolean | undefined;
|
|
19
20
|
user?: import("..").User | null | undefined;
|
|
@@ -38,6 +39,11 @@ declare const reducers: {
|
|
|
38
39
|
sessionsState: import("..").SessionsState;
|
|
39
40
|
hostedLoginBox?: boolean | undefined;
|
|
40
41
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
42
|
+
restrictionsState: import("..").RestrictionsState;
|
|
43
|
+
/**
|
|
44
|
+
* if you see error in matcher that's mean the DispatchAction does not
|
|
45
|
+
* contains the same functions in reducers and actions
|
|
46
|
+
*/
|
|
41
47
|
routes: import("..").AuthPageRoutes;
|
|
42
48
|
header?: any;
|
|
43
49
|
loaderComponent?: any;
|
|
@@ -47,6 +53,7 @@ declare const reducers: {
|
|
|
47
53
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
48
54
|
error?: any;
|
|
49
55
|
isAuthenticated: boolean;
|
|
56
|
+
userIp?: string | undefined;
|
|
50
57
|
isLoading: boolean;
|
|
51
58
|
keepSessionAlive?: boolean | undefined;
|
|
52
59
|
user?: import("..").User | null | undefined;
|
|
@@ -71,6 +78,11 @@ declare const reducers: {
|
|
|
71
78
|
sessionsState: import("..").SessionsState;
|
|
72
79
|
hostedLoginBox?: boolean | undefined;
|
|
73
80
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
81
|
+
restrictionsState: import("..").RestrictionsState;
|
|
82
|
+
/**
|
|
83
|
+
* if you see error in matcher that's mean the DispatchAction does not
|
|
84
|
+
* contains the same functions in reducers and actions
|
|
85
|
+
*/
|
|
74
86
|
routes: import("..").AuthPageRoutes;
|
|
75
87
|
header?: any;
|
|
76
88
|
loaderComponent?: any;
|
|
@@ -14,11 +14,9 @@ declare const reducers: {
|
|
|
14
14
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
15
15
|
error?: any;
|
|
16
16
|
isAuthenticated: boolean;
|
|
17
|
+
userIp?: string | undefined;
|
|
17
18
|
isLoading: boolean;
|
|
18
|
-
keepSessionAlive?: boolean | undefined;
|
|
19
|
-
* To be used for actions types after dispatch, and should contains
|
|
20
|
-
* the reducers and actions as standalone function
|
|
21
|
-
*/
|
|
19
|
+
keepSessionAlive?: boolean | undefined;
|
|
22
20
|
user?: import("..").User | null | undefined;
|
|
23
21
|
isSSOAuth: boolean;
|
|
24
22
|
ssoACS?: string | undefined;
|
|
@@ -41,6 +39,7 @@ declare const reducers: {
|
|
|
41
39
|
sessionsState: import("..").SessionsState;
|
|
42
40
|
hostedLoginBox?: boolean | undefined;
|
|
43
41
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
42
|
+
restrictionsState: import("..").RestrictionsState;
|
|
44
43
|
routes: import("..").AuthPageRoutes;
|
|
45
44
|
header?: any;
|
|
46
45
|
loaderComponent?: any;
|
|
@@ -50,11 +49,9 @@ declare const reducers: {
|
|
|
50
49
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
51
50
|
error?: any;
|
|
52
51
|
isAuthenticated: boolean;
|
|
52
|
+
userIp?: string | undefined;
|
|
53
53
|
isLoading: boolean;
|
|
54
|
-
keepSessionAlive?: boolean | undefined;
|
|
55
|
-
* To be used for actions types after dispatch, and should contains
|
|
56
|
-
* the reducers and actions as standalone function
|
|
57
|
-
*/
|
|
54
|
+
keepSessionAlive?: boolean | undefined;
|
|
58
55
|
user?: import("..").User | null | undefined;
|
|
59
56
|
isSSOAuth: boolean;
|
|
60
57
|
ssoACS?: string | undefined;
|
|
@@ -77,6 +74,7 @@ declare const reducers: {
|
|
|
77
74
|
sessionsState: import("..").SessionsState;
|
|
78
75
|
hostedLoginBox?: boolean | undefined;
|
|
79
76
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
77
|
+
restrictionsState: import("..").RestrictionsState;
|
|
80
78
|
routes: import("..").AuthPageRoutes;
|
|
81
79
|
header?: any;
|
|
82
80
|
loaderComponent?: any;
|
|
@@ -92,11 +90,9 @@ declare const reducers: {
|
|
|
92
90
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
93
91
|
error?: any;
|
|
94
92
|
isAuthenticated: boolean;
|
|
93
|
+
userIp?: string | undefined;
|
|
95
94
|
isLoading: boolean;
|
|
96
|
-
keepSessionAlive?: boolean | undefined;
|
|
97
|
-
* To be used for actions types after dispatch, and should contains
|
|
98
|
-
* the reducers and actions as standalone function
|
|
99
|
-
*/
|
|
95
|
+
keepSessionAlive?: boolean | undefined;
|
|
100
96
|
user?: import("..").User | null | undefined;
|
|
101
97
|
isSSOAuth: boolean;
|
|
102
98
|
ssoACS?: string | undefined;
|
|
@@ -119,6 +115,7 @@ declare const reducers: {
|
|
|
119
115
|
sessionsState: import("..").SessionsState;
|
|
120
116
|
hostedLoginBox?: boolean | undefined;
|
|
121
117
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
118
|
+
restrictionsState: import("..").RestrictionsState;
|
|
122
119
|
routes: import("..").AuthPageRoutes;
|
|
123
120
|
header?: any;
|
|
124
121
|
loaderComponent?: any;
|
|
@@ -31,6 +31,7 @@ declare const reducers: {
|
|
|
31
31
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
32
32
|
error?: any;
|
|
33
33
|
isAuthenticated: boolean;
|
|
34
|
+
userIp?: string | undefined;
|
|
34
35
|
isLoading: boolean;
|
|
35
36
|
keepSessionAlive?: boolean | undefined;
|
|
36
37
|
user?: import("..").User | null | undefined;
|
|
@@ -55,6 +56,7 @@ declare const reducers: {
|
|
|
55
56
|
sessionsState: import("..").SessionsState;
|
|
56
57
|
hostedLoginBox?: boolean | undefined;
|
|
57
58
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
59
|
+
restrictionsState: import("..").RestrictionsState;
|
|
58
60
|
routes: import("..").AuthPageRoutes;
|
|
59
61
|
header?: any;
|
|
60
62
|
loaderComponent?: any;
|
|
@@ -64,6 +66,7 @@ declare const reducers: {
|
|
|
64
66
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
65
67
|
error?: any;
|
|
66
68
|
isAuthenticated: boolean;
|
|
69
|
+
userIp?: string | undefined;
|
|
67
70
|
isLoading: boolean;
|
|
68
71
|
keepSessionAlive?: boolean | undefined;
|
|
69
72
|
user?: import("..").User | null | undefined;
|
|
@@ -88,6 +91,7 @@ declare const reducers: {
|
|
|
88
91
|
sessionsState: import("..").SessionsState;
|
|
89
92
|
hostedLoginBox?: boolean | undefined;
|
|
90
93
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
94
|
+
restrictionsState: import("..").RestrictionsState;
|
|
91
95
|
routes: import("..").AuthPageRoutes;
|
|
92
96
|
header?: any;
|
|
93
97
|
loaderComponent?: any;
|
|
@@ -14,6 +14,7 @@ declare const reducers: {
|
|
|
14
14
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
15
15
|
error?: any;
|
|
16
16
|
isAuthenticated: boolean;
|
|
17
|
+
userIp?: string | undefined;
|
|
17
18
|
isLoading: boolean;
|
|
18
19
|
keepSessionAlive?: boolean | undefined;
|
|
19
20
|
user?: import("..").User | null | undefined;
|
|
@@ -38,6 +39,7 @@ declare const reducers: {
|
|
|
38
39
|
sessionsState: import("..").SessionsState;
|
|
39
40
|
hostedLoginBox?: boolean | undefined;
|
|
40
41
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
42
|
+
restrictionsState: import("..").RestrictionsState;
|
|
41
43
|
routes: import("..").AuthPageRoutes;
|
|
42
44
|
header?: any;
|
|
43
45
|
loaderComponent?: any;
|
|
@@ -47,6 +49,7 @@ declare const reducers: {
|
|
|
47
49
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
48
50
|
error?: any;
|
|
49
51
|
isAuthenticated: boolean;
|
|
52
|
+
userIp?: string | undefined;
|
|
50
53
|
isLoading: boolean;
|
|
51
54
|
keepSessionAlive?: boolean | undefined;
|
|
52
55
|
user?: import("..").User | null | undefined;
|
|
@@ -71,6 +74,7 @@ declare const reducers: {
|
|
|
71
74
|
sessionsState: import("..").SessionsState;
|
|
72
75
|
hostedLoginBox?: boolean | undefined;
|
|
73
76
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
77
|
+
restrictionsState: import("..").RestrictionsState;
|
|
74
78
|
routes: import("..").AuthPageRoutes;
|
|
75
79
|
header?: any;
|
|
76
80
|
loaderComponent?: any;
|
|
@@ -15,6 +15,7 @@ declare const reducers: {
|
|
|
15
15
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
16
16
|
error?: any;
|
|
17
17
|
isAuthenticated: boolean;
|
|
18
|
+
userIp?: string | undefined;
|
|
18
19
|
isLoading: boolean;
|
|
19
20
|
keepSessionAlive?: boolean | undefined;
|
|
20
21
|
user?: import("..").User | null | undefined;
|
|
@@ -39,6 +40,7 @@ declare const reducers: {
|
|
|
39
40
|
sessionsState: import("..").SessionsState;
|
|
40
41
|
hostedLoginBox?: boolean | undefined;
|
|
41
42
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
43
|
+
restrictionsState: import("..").RestrictionsState;
|
|
42
44
|
routes: import("..").AuthPageRoutes;
|
|
43
45
|
header?: any;
|
|
44
46
|
loaderComponent?: any;
|
|
@@ -48,6 +50,7 @@ declare const reducers: {
|
|
|
48
50
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
49
51
|
error?: any;
|
|
50
52
|
isAuthenticated: boolean;
|
|
53
|
+
userIp?: string | undefined;
|
|
51
54
|
isLoading: boolean;
|
|
52
55
|
keepSessionAlive?: boolean | undefined;
|
|
53
56
|
user?: import("..").User | null | undefined;
|
|
@@ -72,6 +75,7 @@ declare const reducers: {
|
|
|
72
75
|
sessionsState: import("..").SessionsState;
|
|
73
76
|
hostedLoginBox?: boolean | undefined;
|
|
74
77
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
78
|
+
restrictionsState: import("..").RestrictionsState;
|
|
75
79
|
routes: import("..").AuthPageRoutes;
|
|
76
80
|
header?: any;
|
|
77
81
|
loaderComponent?: any;
|
|
@@ -119,6 +123,11 @@ declare const actions: {
|
|
|
119
123
|
callback?: ((data: ICreateNewDeviceSessionResponse | null, error?: string | undefined) => void) | undefined;
|
|
120
124
|
}, string, never, never>;
|
|
121
125
|
webAuthnVerifyNewDeviceSession: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[IVerifyNewWebAuthnDevicePayload], IVerifyNewWebAuthnDevicePayload, string, never, never>;
|
|
126
|
+
getUserIP: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
|
|
127
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
128
|
+
}], {
|
|
129
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
130
|
+
}, string, never, never>;
|
|
122
131
|
};
|
|
123
132
|
/**
|
|
124
133
|
* To be used for actions types after dispatch, and should contains
|
|
@@ -157,6 +166,7 @@ declare type DispatchedActions = {
|
|
|
157
166
|
webAuthnPostLogin: (payload: IWebAuthnPostLoginPayload) => void;
|
|
158
167
|
webAuthnCreateNewDeviceSession: (payload: WithCallback<{}, ICreateNewDeviceSessionResponse | null>) => void;
|
|
159
168
|
webAuthnVerifyNewDeviceSession: (payload: IVerifyNewWebAuthnDevicePayload) => void;
|
|
169
|
+
getUserIP: (payload: WithCallback) => void;
|
|
160
170
|
};
|
|
161
171
|
export declare type LoginActions = DispatchedActions;
|
|
162
172
|
export { loginState, reducers as loginReducers, actions as loginActions };
|
package/auth/LoginState/index.js
CHANGED
|
@@ -82,6 +82,9 @@ const actions = {
|
|
|
82
82
|
})),
|
|
83
83
|
webAuthnVerifyNewDeviceSession: createAction(`${authStoreName}/webAuthnVerifyNewDeviceSession`, payload => ({
|
|
84
84
|
payload
|
|
85
|
+
})),
|
|
86
|
+
getUserIP: createAction(`${authStoreName}/getUserIP`, payload => ({
|
|
87
|
+
payload
|
|
85
88
|
}))
|
|
86
89
|
};
|
|
87
90
|
/**
|
package/auth/LoginState/saga.js
CHANGED
|
@@ -17,7 +17,7 @@ import { UserVeirifedOriginTypes } from '../interfaces';
|
|
|
17
17
|
import { LoginFlow, LoginStep } from './interfaces';
|
|
18
18
|
import { loadAllowSignUps } from '../SignUp/saga';
|
|
19
19
|
import { MFAStep } from '../MfaState/interfaces';
|
|
20
|
-
import { userDemo } from '../dummy';
|
|
20
|
+
import { dummyIps, userDemo } from '../dummy';
|
|
21
21
|
import { SamlVendors } from '../SSOState/interfaces';
|
|
22
22
|
import { loadVendorPublicInfo } from '../../vendor/saga';
|
|
23
23
|
import { createRandomString, generateCodeChallenge } from '../../helpers';
|
|
@@ -277,6 +277,24 @@ function* refreshTokenEmbedded() {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
function* getUserIP({
|
|
281
|
+
payload: {
|
|
282
|
+
callback
|
|
283
|
+
}
|
|
284
|
+
}) {
|
|
285
|
+
try {
|
|
286
|
+
const {
|
|
287
|
+
ip
|
|
288
|
+
} = yield call(api.metadata.getCurrentUserIpMetadata);
|
|
289
|
+
yield put(actions.setState({
|
|
290
|
+
userIp: ip
|
|
291
|
+
}));
|
|
292
|
+
callback == null ? void 0 : callback(true);
|
|
293
|
+
} catch (e) {
|
|
294
|
+
callback == null ? void 0 : callback(false);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
280
298
|
function* requestAuthorize({
|
|
281
299
|
payload: firstTime
|
|
282
300
|
}) {
|
|
@@ -369,6 +387,24 @@ function* requestAuthorizeSSR({
|
|
|
369
387
|
}));
|
|
370
388
|
}
|
|
371
389
|
|
|
390
|
+
const getUri = urlStrategy => {
|
|
391
|
+
if (urlStrategy === 'path') {
|
|
392
|
+
var _window3;
|
|
393
|
+
|
|
394
|
+
return ((_window3 = window) != null ? _window3 : document).location.pathname;
|
|
395
|
+
} else {
|
|
396
|
+
var _window4;
|
|
397
|
+
|
|
398
|
+
let uri = (((_window4 = window) != null ? _window4 : document).location.hash || '#').substring(1);
|
|
399
|
+
|
|
400
|
+
if (uri.indexOf('?') !== -1) {
|
|
401
|
+
return uri.substring(0, uri.indexOf('?'));
|
|
402
|
+
} else {
|
|
403
|
+
return uri;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
372
408
|
function* requestHostedLoginAuthorize({
|
|
373
409
|
payload: additionalParams
|
|
374
410
|
}) {
|
|
@@ -382,6 +418,16 @@ function* requestHostedLoginAuthorize({
|
|
|
382
418
|
onRedirectTo: state.auth.onRedirectTo,
|
|
383
419
|
context: state.root.context,
|
|
384
420
|
urlStrategy: state.root.urlStrategy
|
|
421
|
+
}));
|
|
422
|
+
const activeUri = getUri(urlStrategy);
|
|
423
|
+
|
|
424
|
+
if (activeUri === routes.hostedLoginRedirectUrl) {
|
|
425
|
+
console.debug('Calling loginWithRedirect while in hostedLoginCallback route');
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
yield put(actions.setState({
|
|
430
|
+
isLoading: true
|
|
385
431
|
})); // Generate the relevant params for the redirect
|
|
386
432
|
|
|
387
433
|
const nonce = createRandomString();
|
|
@@ -1257,6 +1303,7 @@ export function* loginSagas() {
|
|
|
1257
1303
|
yield takeLeading(actions.webAuthnCreateNewDeviceSession, webAuthnCreateNewDeviceSession);
|
|
1258
1304
|
yield takeLeading(actions.webAuthnVerifyNewDeviceSession, webAuthnVerifyNewDeviceSession);
|
|
1259
1305
|
yield takeLeading(actions.afterAuthNavigation, afterAuthNavigation);
|
|
1306
|
+
yield takeLeading(actions.getUserIP, getUserIP);
|
|
1260
1307
|
}
|
|
1261
1308
|
/*********************************
|
|
1262
1309
|
* Preview Sagas
|
|
@@ -1280,7 +1327,26 @@ function* requestAuthorizeMock({
|
|
|
1280
1327
|
}));
|
|
1281
1328
|
}
|
|
1282
1329
|
|
|
1330
|
+
function* getUserIPMock({
|
|
1331
|
+
payload: {
|
|
1332
|
+
callback
|
|
1333
|
+
}
|
|
1334
|
+
}) {
|
|
1335
|
+
try {
|
|
1336
|
+
const {
|
|
1337
|
+
ip
|
|
1338
|
+
} = dummyIps[0];
|
|
1339
|
+
yield put(actions.setState({
|
|
1340
|
+
userIp: ip
|
|
1341
|
+
}));
|
|
1342
|
+
callback == null ? void 0 : callback(true, ip);
|
|
1343
|
+
} catch (e) {
|
|
1344
|
+
callback == null ? void 0 : callback(false, e);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1283
1348
|
export function* loginSagasMock() {
|
|
1284
1349
|
yield takeLeading(actions.requestAuthorize, requestAuthorizeMock);
|
|
1285
1350
|
yield takeLeading(actions.afterAuthNavigation, afterAuthNavigation);
|
|
1351
|
+
yield takeLeading(actions.getUserIP, getUserIPMock);
|
|
1286
1352
|
}
|
package/auth/MfaState/index.d.ts
CHANGED
|
@@ -12,11 +12,9 @@ declare const reducers: {
|
|
|
12
12
|
type: string;
|
|
13
13
|
}) => {
|
|
14
14
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
15
|
-
error?: any;
|
|
16
|
-
* if you see error in matcher that's mean the DispatchAction does not
|
|
17
|
-
* contains the same functions in reducers and actions
|
|
18
|
-
*/
|
|
15
|
+
error?: any;
|
|
19
16
|
isAuthenticated: boolean;
|
|
17
|
+
userIp?: string | undefined;
|
|
20
18
|
isLoading: boolean;
|
|
21
19
|
keepSessionAlive?: boolean | undefined;
|
|
22
20
|
user?: import("..").User | null | undefined;
|
|
@@ -41,6 +39,7 @@ declare const reducers: {
|
|
|
41
39
|
sessionsState: import("..").SessionsState;
|
|
42
40
|
hostedLoginBox?: boolean | undefined;
|
|
43
41
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
42
|
+
restrictionsState: import("..").RestrictionsState;
|
|
44
43
|
routes: import("..").AuthPageRoutes;
|
|
45
44
|
header?: any;
|
|
46
45
|
loaderComponent?: any;
|
|
@@ -48,11 +47,9 @@ declare const reducers: {
|
|
|
48
47
|
};
|
|
49
48
|
resetMfaState: (state: import("..").AuthState) => {
|
|
50
49
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
51
|
-
error?: any;
|
|
52
|
-
* if you see error in matcher that's mean the DispatchAction does not
|
|
53
|
-
* contains the same functions in reducers and actions
|
|
54
|
-
*/
|
|
50
|
+
error?: any;
|
|
55
51
|
isAuthenticated: boolean;
|
|
52
|
+
userIp?: string | undefined;
|
|
56
53
|
isLoading: boolean;
|
|
57
54
|
keepSessionAlive?: boolean | undefined;
|
|
58
55
|
user?: import("..").User | null | undefined;
|
|
@@ -77,6 +74,7 @@ declare const reducers: {
|
|
|
77
74
|
sessionsState: import("..").SessionsState;
|
|
78
75
|
hostedLoginBox?: boolean | undefined;
|
|
79
76
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
77
|
+
restrictionsState: import("..").RestrictionsState;
|
|
80
78
|
routes: import("..").AuthPageRoutes;
|
|
81
79
|
header?: any;
|
|
82
80
|
loaderComponent?: any;
|
|
@@ -14,6 +14,7 @@ declare const reducers: {
|
|
|
14
14
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
15
15
|
error?: any;
|
|
16
16
|
isAuthenticated: boolean;
|
|
17
|
+
userIp?: string | undefined;
|
|
17
18
|
isLoading: boolean;
|
|
18
19
|
keepSessionAlive?: boolean | undefined;
|
|
19
20
|
user?: import("..").User | null | undefined;
|
|
@@ -38,6 +39,7 @@ declare const reducers: {
|
|
|
38
39
|
sessionsState: import("..").SessionsState;
|
|
39
40
|
hostedLoginBox?: boolean | undefined;
|
|
40
41
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
42
|
+
restrictionsState: import("..").RestrictionsState;
|
|
41
43
|
routes: import("..").AuthPageRoutes;
|
|
42
44
|
header?: any;
|
|
43
45
|
loaderComponent?: any;
|
|
@@ -47,6 +49,7 @@ declare const reducers: {
|
|
|
47
49
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
48
50
|
error?: any;
|
|
49
51
|
isAuthenticated: boolean;
|
|
52
|
+
userIp?: string | undefined;
|
|
50
53
|
isLoading: boolean;
|
|
51
54
|
keepSessionAlive?: boolean | undefined;
|
|
52
55
|
user?: import("..").User | null | undefined;
|
|
@@ -71,6 +74,7 @@ declare const reducers: {
|
|
|
71
74
|
sessionsState: import("..").SessionsState;
|
|
72
75
|
hostedLoginBox?: boolean | undefined;
|
|
73
76
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
77
|
+
restrictionsState: import("..").RestrictionsState;
|
|
74
78
|
routes: import("..").AuthPageRoutes;
|
|
75
79
|
header?: any;
|
|
76
80
|
loaderComponent?: any;
|
|
@@ -14,6 +14,7 @@ declare const reducers: {
|
|
|
14
14
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
15
15
|
error?: any;
|
|
16
16
|
isAuthenticated: boolean;
|
|
17
|
+
userIp?: string | undefined;
|
|
17
18
|
isLoading: boolean;
|
|
18
19
|
keepSessionAlive?: boolean | undefined;
|
|
19
20
|
user?: import("..").User | null | undefined;
|
|
@@ -38,6 +39,7 @@ declare const reducers: {
|
|
|
38
39
|
sessionsState: import("..").SessionsState;
|
|
39
40
|
hostedLoginBox?: boolean | undefined;
|
|
40
41
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
42
|
+
restrictionsState: import("..").RestrictionsState;
|
|
41
43
|
routes: import("..").AuthPageRoutes;
|
|
42
44
|
header?: any;
|
|
43
45
|
loaderComponent?: any;
|
|
@@ -47,6 +49,7 @@ declare const reducers: {
|
|
|
47
49
|
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
48
50
|
error?: any;
|
|
49
51
|
isAuthenticated: boolean;
|
|
52
|
+
userIp?: string | undefined;
|
|
50
53
|
isLoading: boolean;
|
|
51
54
|
keepSessionAlive?: boolean | undefined;
|
|
52
55
|
user?: import("..").User | null | undefined;
|
|
@@ -71,6 +74,7 @@ declare const reducers: {
|
|
|
71
74
|
sessionsState: import("..").SessionsState;
|
|
72
75
|
hostedLoginBox?: boolean | undefined;
|
|
73
76
|
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
77
|
+
restrictionsState: import("..").RestrictionsState;
|
|
74
78
|
routes: import("..").AuthPageRoutes;
|
|
75
79
|
header?: any;
|
|
76
80
|
loaderComponent?: any;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { WithCallback } from '../../interfaces';
|
|
2
|
+
import { IPRestrictionsState, RestrictionsState } from './interfaces';
|
|
3
|
+
import { CreateIpRestriction, IPRestrictionsConfig } from '@frontegg/rest-api';
|
|
4
|
+
declare const restrictionsState: RestrictionsState;
|
|
5
|
+
declare const reducers: {
|
|
6
|
+
setRestrictionsState: {
|
|
7
|
+
prepare: (payload: Partial<RestrictionsState>) => {
|
|
8
|
+
payload: Partial<RestrictionsState>;
|
|
9
|
+
};
|
|
10
|
+
reducer: (state: import("..").AuthState, { payload }: {
|
|
11
|
+
payload: Partial<RestrictionsState>;
|
|
12
|
+
type: string;
|
|
13
|
+
}) => {
|
|
14
|
+
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
15
|
+
error?: any;
|
|
16
|
+
isAuthenticated: boolean;
|
|
17
|
+
userIp?: string | undefined;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
keepSessionAlive?: boolean | undefined;
|
|
20
|
+
user?: import("..").User | null | undefined;
|
|
21
|
+
isSSOAuth: boolean;
|
|
22
|
+
ssoACS?: string | undefined;
|
|
23
|
+
loginState: import("..").LoginState;
|
|
24
|
+
activateState: import("..").ActivateAccountState;
|
|
25
|
+
acceptInvitationState: import("..").AcceptInvitationState;
|
|
26
|
+
forgotPasswordState: import("..").ForgotPasswordState;
|
|
27
|
+
resetPhoneNumberState: import("..").ResetPhoneNumberState;
|
|
28
|
+
ssoState: import("..").SSOState;
|
|
29
|
+
profileState: import("..").ProfileState;
|
|
30
|
+
mfaState: import("..").MFAState;
|
|
31
|
+
teamState: import("..").TeamState;
|
|
32
|
+
socialLoginState: import("..").SocialLoginState;
|
|
33
|
+
signUpState: import("..").SignUpState;
|
|
34
|
+
apiTokensState: import("..").ApiTokensState;
|
|
35
|
+
securityPolicyState: import("..").SecurityPolicyState;
|
|
36
|
+
accountSettingsState: import("..").AccountSettingsState;
|
|
37
|
+
tenantsState: import("..").TenantsState;
|
|
38
|
+
rolesState: import("..").RolesState;
|
|
39
|
+
sessionsState: import("..").SessionsState;
|
|
40
|
+
hostedLoginBox?: boolean | undefined;
|
|
41
|
+
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
42
|
+
restrictionsState: RestrictionsState;
|
|
43
|
+
routes: import("..").AuthPageRoutes;
|
|
44
|
+
header?: any;
|
|
45
|
+
loaderComponent?: any;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
setIpRestrictionsState: {
|
|
49
|
+
prepare: (payload: Partial<IPRestrictionsState>) => {
|
|
50
|
+
payload: Partial<IPRestrictionsState>;
|
|
51
|
+
};
|
|
52
|
+
reducer: (state: import("..").AuthState, { payload }: {
|
|
53
|
+
payload: Partial<IPRestrictionsState>;
|
|
54
|
+
type: string;
|
|
55
|
+
}) => {
|
|
56
|
+
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
57
|
+
error?: any;
|
|
58
|
+
isAuthenticated: boolean;
|
|
59
|
+
userIp?: string | undefined;
|
|
60
|
+
isLoading: boolean;
|
|
61
|
+
keepSessionAlive?: boolean | undefined;
|
|
62
|
+
user?: import("..").User | null | undefined;
|
|
63
|
+
isSSOAuth: boolean;
|
|
64
|
+
ssoACS?: string | undefined;
|
|
65
|
+
loginState: import("..").LoginState;
|
|
66
|
+
activateState: import("..").ActivateAccountState;
|
|
67
|
+
acceptInvitationState: import("..").AcceptInvitationState;
|
|
68
|
+
forgotPasswordState: import("..").ForgotPasswordState;
|
|
69
|
+
resetPhoneNumberState: import("..").ResetPhoneNumberState;
|
|
70
|
+
ssoState: import("..").SSOState;
|
|
71
|
+
profileState: import("..").ProfileState;
|
|
72
|
+
mfaState: import("..").MFAState;
|
|
73
|
+
teamState: import("..").TeamState;
|
|
74
|
+
socialLoginState: import("..").SocialLoginState;
|
|
75
|
+
signUpState: import("..").SignUpState;
|
|
76
|
+
apiTokensState: import("..").ApiTokensState;
|
|
77
|
+
securityPolicyState: import("..").SecurityPolicyState;
|
|
78
|
+
accountSettingsState: import("..").AccountSettingsState;
|
|
79
|
+
tenantsState: import("..").TenantsState;
|
|
80
|
+
rolesState: import("..").RolesState;
|
|
81
|
+
sessionsState: import("..").SessionsState;
|
|
82
|
+
hostedLoginBox?: boolean | undefined;
|
|
83
|
+
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
84
|
+
restrictionsState: RestrictionsState;
|
|
85
|
+
routes: import("..").AuthPageRoutes;
|
|
86
|
+
header?: any;
|
|
87
|
+
loaderComponent?: any;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
declare const actions: {
|
|
92
|
+
checkIfUserIpValid: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
93
|
+
addCurrentUserIpAndActivate: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
|
|
94
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
95
|
+
}], {
|
|
96
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
97
|
+
}, string, never, never>;
|
|
98
|
+
loadIpRestrictions: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
99
|
+
saveIpRestriction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<CreateIpRestriction, boolean>], WithCallback<CreateIpRestriction, boolean>, string, never, never>;
|
|
100
|
+
saveIpRestrictionsConfig: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IPRestrictionsConfig, boolean>], WithCallback<IPRestrictionsConfig, boolean>, string, never, never>;
|
|
101
|
+
deleteIpRestriction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<{
|
|
102
|
+
id: string;
|
|
103
|
+
}, boolean>], WithCallback<{
|
|
104
|
+
id: string;
|
|
105
|
+
}, boolean>, string, never, never>;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* To be used for actions types after dispatch, and should contains
|
|
109
|
+
* the reducers and actions as standalone function
|
|
110
|
+
*/
|
|
111
|
+
declare type DispatchedActions = {
|
|
112
|
+
setRestrictionsState: (state: Partial<RestrictionsState>) => void;
|
|
113
|
+
setIpRestrictionsState: (state: Partial<IPRestrictionsState>) => void;
|
|
114
|
+
loadIpRestrictions: () => void;
|
|
115
|
+
saveIpRestriction: (payload: WithCallback<CreateIpRestriction>) => void;
|
|
116
|
+
saveIpRestrictionsConfig: (payload: WithCallback<IPRestrictionsConfig>) => void;
|
|
117
|
+
deleteIpRestriction: (payload: WithCallback<{
|
|
118
|
+
id: string;
|
|
119
|
+
}>) => void;
|
|
120
|
+
checkIfUserIpValid: () => void;
|
|
121
|
+
addCurrentUserIpAndActivate: (payload: WithCallback) => void;
|
|
122
|
+
};
|
|
123
|
+
export declare type RestrictionsActions = DispatchedActions;
|
|
124
|
+
export { restrictionsState, reducers as restrictionsReducers, actions as restrictionsActions };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { typeReducerForKey, typeReducerNestedKey } from '../utils';
|
|
3
|
+
import { authStoreName } from '../../constants';
|
|
4
|
+
import { RestrictionType } from '@frontegg/rest-api';
|
|
5
|
+
const restrictionsState = {
|
|
6
|
+
ipRestrictions: {
|
|
7
|
+
loading: false,
|
|
8
|
+
pagination: {
|
|
9
|
+
_offset: 0,
|
|
10
|
+
_limit: 4,
|
|
11
|
+
_filter: RestrictionType.ALLOW
|
|
12
|
+
},
|
|
13
|
+
totalPages: 1,
|
|
14
|
+
userIpValid: false
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const reducers = {
|
|
18
|
+
setRestrictionsState: typeReducerForKey('restrictionsState'),
|
|
19
|
+
setIpRestrictionsState: typeReducerNestedKey('restrictionsState', 'ipRestrictions')
|
|
20
|
+
};
|
|
21
|
+
const actions = {
|
|
22
|
+
checkIfUserIpValid: createAction(`${authStoreName}/checkIfUserIpValid`),
|
|
23
|
+
addCurrentUserIpAndActivate: createAction(`${authStoreName}/addCurrentUserIpAndActivate`, payload => ({
|
|
24
|
+
payload
|
|
25
|
+
})),
|
|
26
|
+
loadIpRestrictions: createAction(`${authStoreName}/loadIpRestrictions`),
|
|
27
|
+
saveIpRestriction: createAction(`${authStoreName}/saveIpRestriction`, payload => ({
|
|
28
|
+
payload
|
|
29
|
+
})),
|
|
30
|
+
saveIpRestrictionsConfig: createAction(`${authStoreName}/saveIpRestrictionsConfig`, payload => ({
|
|
31
|
+
payload
|
|
32
|
+
})),
|
|
33
|
+
deleteIpRestriction: createAction(`${authStoreName}/deleteIpRestriction`, payload => ({
|
|
34
|
+
payload
|
|
35
|
+
}))
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* To be used for actions types after dispatch, and should contains
|
|
39
|
+
* the reducers and actions as standalone function
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
// noinspection JSUnusedLocalSymbols
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* if you see error in matcher that's mean the DispatchAction does not
|
|
46
|
+
* contains the same functions in reducers and actions
|
|
47
|
+
*/
|
|
48
|
+
const Matcher = {};
|
|
49
|
+
export { restrictionsState, reducers as restrictionsReducers, actions as restrictionsActions };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WithStatus } from '../../interfaces';
|
|
2
|
+
import { IPRestrictionsConfig, IpRestriction, GetIPRestrictionsParams } from '@frontegg/rest-api';
|
|
3
|
+
export declare type IPRestrictionsState = WithStatus & {
|
|
4
|
+
data?: {
|
|
5
|
+
config: IPRestrictionsConfig;
|
|
6
|
+
restrictions: IpRestriction[];
|
|
7
|
+
};
|
|
8
|
+
pagination: GetIPRestrictionsParams;
|
|
9
|
+
totalPages: number;
|
|
10
|
+
userIpValid: boolean;
|
|
11
|
+
};
|
|
12
|
+
export interface RestrictionsState {
|
|
13
|
+
ipRestrictions: IPRestrictionsState;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|