@frontegg/redux-store 6.152.0 → 6.153.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/ApiTokensState/interfaces.d.ts +4 -1
- package/auth/ApiTokensState/saga.js +42 -24
- package/auth/CustomLoginState/saga.d.ts +2 -2
- package/auth/CustomLoginState/saga.js +4 -6
- package/auth/SSOState/index.d.ts +5 -5
- package/auth/Security/SecurityCenterState/saga.d.ts +2 -2
- package/auth/Security/SecurityPolicyState/saga.d.ts +4 -4
- package/auth/SignUp/saga.d.ts +1 -1
- package/auth/SignUp/saga.js +16 -6
- package/auth/index.d.ts +5 -5
- package/auth/interfaces.d.ts +1 -0
- package/auth/reducer.d.ts +5 -5
- package/index.js +1 -1
- package/node/auth/ApiTokensState/saga.js +40 -22
- package/node/auth/CustomLoginState/saga.js +4 -6
- package/node/auth/SignUp/saga.js +16 -6
- package/node/index.js +1 -1
- package/package.json +2 -2
|
@@ -35,7 +35,9 @@ export interface IApiTokensData {
|
|
|
35
35
|
id?: string;
|
|
36
36
|
title?: string;
|
|
37
37
|
}
|
|
38
|
-
export
|
|
38
|
+
export interface IUserApiTokensData extends IApiTokensData {
|
|
39
|
+
type?: MachineToMachineAuthStrategy;
|
|
40
|
+
}
|
|
39
41
|
export interface IUserApiAccessTokensData {
|
|
40
42
|
accessTokens: IUserApiTokensData[];
|
|
41
43
|
}
|
|
@@ -43,6 +45,7 @@ export interface ITenantApiTokensData extends IApiTokensData {
|
|
|
43
45
|
roleIds: string[];
|
|
44
46
|
tenantId: string;
|
|
45
47
|
createdByUserId: string;
|
|
48
|
+
type?: MachineToMachineAuthStrategy;
|
|
46
49
|
}
|
|
47
50
|
export interface ITenantApiAccessTokensData {
|
|
48
51
|
accessTokens: ITenantApiTokensData[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { call,
|
|
3
|
-
import { api } from '@frontegg/rest-api';
|
|
2
|
+
import { all, call, delay, put, select, takeEvery, takeLatest, takeLeading } from 'redux-saga/effects';
|
|
3
|
+
import { api, MachineToMachineAuthStrategy } from '@frontegg/rest-api';
|
|
4
4
|
import { actions } from '../reducer';
|
|
5
5
|
import { ApiStateKeys } from './interfaces';
|
|
6
6
|
import { apiTokensDataDemo, apiTokensDataTenantDemo } from '../dummy';
|
|
@@ -17,26 +17,29 @@ function* addUserApiToken({
|
|
|
17
17
|
const {
|
|
18
18
|
apiTokensDataUser
|
|
19
19
|
} = yield select(state => state.auth.apiTokensState);
|
|
20
|
+
const {
|
|
21
|
+
policy
|
|
22
|
+
} = yield select(state => state.auth.securityPolicyState.publicPolicy);
|
|
23
|
+
const isAccessToken = (policy == null ? void 0 : policy.machineToMachineAuthStrategy) === MachineToMachineAuthStrategy.AccessToken;
|
|
20
24
|
try {
|
|
21
25
|
yield put(actions.setApiTokensLoader({
|
|
22
26
|
key: ApiStateKeys.ADD_API_TOKEN,
|
|
23
27
|
value: true
|
|
24
28
|
}));
|
|
25
29
|
let data;
|
|
26
|
-
let expiresInMinutes;
|
|
27
|
-
if (expires
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
expiresInMinutes = expires * 1440;
|
|
32
|
-
}
|
|
30
|
+
let expiresInMinutes = null;
|
|
31
|
+
if (expires) {
|
|
32
|
+
expiresInMinutes = expires * 1440;
|
|
33
|
+
}
|
|
34
|
+
if (isAccessToken) {
|
|
33
35
|
data = yield call(api.auth.createUserAccessToken, {
|
|
34
36
|
description,
|
|
35
37
|
expiresInMinutes
|
|
36
38
|
});
|
|
37
39
|
} else {
|
|
38
40
|
data = yield call(api.auth.updateUserApiTokensData, {
|
|
39
|
-
description
|
|
41
|
+
description,
|
|
42
|
+
expiresInMinutes
|
|
40
43
|
});
|
|
41
44
|
}
|
|
42
45
|
yield put(actions.setApiTokensState({
|
|
@@ -44,11 +47,13 @@ function* addUserApiToken({
|
|
|
44
47
|
}));
|
|
45
48
|
yield delay(200);
|
|
46
49
|
yield put(actions.setApiTokensState({
|
|
47
|
-
apiTokensDataUser: [data,
|
|
50
|
+
apiTokensDataUser: [_extends({}, data, {
|
|
51
|
+
type: isAccessToken ? MachineToMachineAuthStrategy.AccessToken : MachineToMachineAuthStrategy.ClientCredentials
|
|
52
|
+
}), ...apiTokensDataUser],
|
|
48
53
|
successDialog: {
|
|
49
54
|
open: true,
|
|
50
55
|
secret: data.secret,
|
|
51
|
-
clientId:
|
|
56
|
+
clientId: !isAccessToken ? data.clientId : undefined
|
|
52
57
|
}
|
|
53
58
|
}));
|
|
54
59
|
yield put(actions.setApiTokensLoader({
|
|
@@ -80,19 +85,21 @@ function* addTenantApiToken({
|
|
|
80
85
|
const {
|
|
81
86
|
apiTokensDataTenant
|
|
82
87
|
} = yield select(state => state.auth.apiTokensState);
|
|
88
|
+
const {
|
|
89
|
+
policy
|
|
90
|
+
} = yield select(state => state.auth.securityPolicyState.publicPolicy);
|
|
91
|
+
const isAccessToken = (policy == null ? void 0 : policy.machineToMachineAuthStrategy) === MachineToMachineAuthStrategy.AccessToken;
|
|
83
92
|
try {
|
|
84
93
|
yield put(actions.setApiTokensLoader({
|
|
85
94
|
key: ApiStateKeys.ADD_API_TOKEN,
|
|
86
95
|
value: true
|
|
87
96
|
}));
|
|
88
97
|
let data;
|
|
89
|
-
let expiresInMinutes;
|
|
90
|
-
if (expires
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
expiresInMinutes = expires * 1440;
|
|
95
|
-
}
|
|
98
|
+
let expiresInMinutes = null;
|
|
99
|
+
if (expires) {
|
|
100
|
+
expiresInMinutes = expires * 1440;
|
|
101
|
+
}
|
|
102
|
+
if (isAccessToken) {
|
|
96
103
|
data = yield call(api.auth.createTenantAccessToken, {
|
|
97
104
|
description,
|
|
98
105
|
expiresInMinutes,
|
|
@@ -101,7 +108,8 @@ function* addTenantApiToken({
|
|
|
101
108
|
} else {
|
|
102
109
|
data = yield call(api.auth.updateTenantApiTokensData, {
|
|
103
110
|
description,
|
|
104
|
-
roleIds
|
|
111
|
+
roleIds,
|
|
112
|
+
expiresInMinutes
|
|
105
113
|
});
|
|
106
114
|
}
|
|
107
115
|
yield put(actions.setApiTokensState({
|
|
@@ -109,11 +117,13 @@ function* addTenantApiToken({
|
|
|
109
117
|
}));
|
|
110
118
|
yield delay(200);
|
|
111
119
|
yield put(actions.setApiTokensState({
|
|
112
|
-
apiTokensDataTenant: [data,
|
|
120
|
+
apiTokensDataTenant: [_extends({}, data, {
|
|
121
|
+
type: isAccessToken ? MachineToMachineAuthStrategy.AccessToken : MachineToMachineAuthStrategy.ClientCredentials
|
|
122
|
+
}), ...apiTokensDataTenant],
|
|
113
123
|
successDialog: {
|
|
114
124
|
open: true,
|
|
115
125
|
secret: data.secret,
|
|
116
|
-
clientId:
|
|
126
|
+
clientId: !isAccessToken ? data.clientId : undefined
|
|
117
127
|
}
|
|
118
128
|
}));
|
|
119
129
|
yield put(actions.setApiTokensLoader({
|
|
@@ -277,7 +287,11 @@ function* loadUserApiTokens({
|
|
|
277
287
|
const apiTokensData = yield (_call = call(api.auth.getUserApiTokensData)) != null ? _call : [];
|
|
278
288
|
const accessTokensData = yield (_call2 = call(api.auth.getUserAccessTokensData)) != null ? _call2 : [];
|
|
279
289
|
const accessTokens = (_accessTokensData$acc = accessTokensData.accessTokens) != null ? _accessTokensData$acc : [];
|
|
280
|
-
const allTokens = accessTokens.
|
|
290
|
+
const allTokens = accessTokens.map(item => _extends({}, item, {
|
|
291
|
+
type: MachineToMachineAuthStrategy.AccessToken
|
|
292
|
+
})).concat(apiTokensData.map(item => _extends({}, item, {
|
|
293
|
+
type: MachineToMachineAuthStrategy.ClientCredentials
|
|
294
|
+
})));
|
|
281
295
|
const sortedTokensByDate = allTokens.sort((date1, date2) => new Date(date2.createdAt) - new Date(date1.createdAt));
|
|
282
296
|
yield put(actions.setApiTokensState({
|
|
283
297
|
apiTokensDataUser: sortedTokensByDate != null ? sortedTokensByDate : []
|
|
@@ -314,7 +328,11 @@ function* loadTenantApiTokens({
|
|
|
314
328
|
const apiTokensData = yield (_call3 = call(api.auth.getTenantApiTokensData)) != null ? _call3 : [];
|
|
315
329
|
const accessTokensData = yield (_call4 = call(api.auth.getTenantAccessTokensData)) != null ? _call4 : [];
|
|
316
330
|
const accessTokens = (_accessTokensData$acc2 = accessTokensData == null ? void 0 : accessTokensData.accessTokens) != null ? _accessTokensData$acc2 : [];
|
|
317
|
-
const allTokens = accessTokens.
|
|
331
|
+
const allTokens = accessTokens.map(item => _extends({}, item, {
|
|
332
|
+
type: MachineToMachineAuthStrategy.AccessToken
|
|
333
|
+
})).concat(apiTokensData.map(item => _extends({}, item, {
|
|
334
|
+
type: MachineToMachineAuthStrategy.ClientCredentials
|
|
335
|
+
})));
|
|
318
336
|
const sortedTokensByDate = allTokens.sort((date1, date2) => new Date(date2.createdAt) - new Date(date1.createdAt));
|
|
319
337
|
yield put(actions.setApiTokensState({
|
|
320
338
|
apiTokensDataTenant: sortedTokensByDate != null ? sortedTokensByDate : []
|
|
@@ -4,11 +4,11 @@ export declare function loadTenantMetadata(): Generator<import("redux-saga/effec
|
|
|
4
4
|
payload: Partial<CustomLoginState>;
|
|
5
5
|
type: string;
|
|
6
6
|
}> | import("redux-saga/effects").CallEffect<any>, void, any>;
|
|
7
|
-
export declare function customLoginEnabled(): Generator<import("redux-saga/effects").SelectEffect | import("
|
|
7
|
+
export declare function customLoginEnabled(): Generator<import("redux-saga/effects").SelectEffect | import("@frontegg/rest-api").ResolvedTenantResult | Promise<import("@frontegg/rest-api").ResolvedTenantResult> | undefined, boolean, boolean>;
|
|
8
8
|
export declare function loadCustomLoginRoutes(): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").PutEffect<{
|
|
9
9
|
payload: Partial<CustomLoginState>;
|
|
10
10
|
type: string;
|
|
11
|
-
}> | import("redux-saga/effects").CallEffect<
|
|
11
|
+
}> | import("redux-saga/effects").CallEffect<Generator<import("redux-saga/effects").SelectEffect | import("@frontegg/rest-api").ResolvedTenantResult | Promise<import("@frontegg/rest-api").ResolvedTenantResult> | undefined, boolean, boolean>> | import("redux-saga/effects").CallEffect<import("@frontegg/rest-api").ISettingsResponse | import("@frontegg/rest-api").IPublicSettingsResponse> | import("redux-saga/effects").PutEffect<{
|
|
12
12
|
payload: Partial<AuthState>;
|
|
13
13
|
type: string;
|
|
14
14
|
}>, void, (false & {
|
|
@@ -8,7 +8,6 @@ import { actions } from '../reducer';
|
|
|
8
8
|
import { delay } from '../utils';
|
|
9
9
|
import { mapMetaDataObjectToActions } from './utils';
|
|
10
10
|
import { errorHandler } from '../../utils';
|
|
11
|
-
import { getFeatureFlags } from '../../helpers';
|
|
12
11
|
import { getSearchParamsFromUrl } from '../LoginState/utils';
|
|
13
12
|
export function* loadTenantMetadata() {
|
|
14
13
|
yield put(actions.setCustomLoginState({
|
|
@@ -61,9 +60,7 @@ function* updateTenantMetadata(_ref) {
|
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
export function* customLoginEnabled() {
|
|
64
|
-
var _ContextHolder$getCon;
|
|
65
|
-
const [loginPerTenantFeatureFlag] = yield call(getFeatureFlags, ['admin_portal_login_per_tenant']);
|
|
66
|
-
const hasTenantResolver = !!((_ContextHolder$getCon = ContextHolder.getContext()) != null && _ContextHolder$getCon.tenantResolver);
|
|
63
|
+
var _yield$ContextHolder$, _ContextHolder$getCon, _ContextHolder$getCon2;
|
|
67
64
|
const isAuthenticated = yield select(state => state.auth.isAuthenticated);
|
|
68
65
|
if (isAuthenticated) {
|
|
69
66
|
var _select;
|
|
@@ -73,9 +70,10 @@ export function* customLoginEnabled() {
|
|
|
73
70
|
var _auth$tenantsState$ac;
|
|
74
71
|
return (_auth$tenantsState$ac = auth.tenantsState.activeTenant) == null ? void 0 : _auth$tenantsState$ac.hasCustomLogin;
|
|
75
72
|
})) != null ? _select : false;
|
|
76
|
-
return
|
|
73
|
+
return tenantHasCustomLogin;
|
|
77
74
|
}
|
|
78
|
-
|
|
75
|
+
const resolvedTenant = (_yield$ContextHolder$ = yield (_ContextHolder$getCon = ContextHolder.getContext()) == null ? void 0 : (_ContextHolder$getCon2 = _ContextHolder$getCon.tenantResolver) == null ? void 0 : _ContextHolder$getCon2.call(_ContextHolder$getCon)) == null ? void 0 : _yield$ContextHolder$.tenant;
|
|
76
|
+
return !!resolvedTenant;
|
|
79
77
|
}
|
|
80
78
|
export function* loadCustomLoginRoutes() {
|
|
81
79
|
try {
|
package/auth/SSOState/index.d.ts
CHANGED
|
@@ -124,10 +124,10 @@ declare const reducers: {
|
|
|
124
124
|
};
|
|
125
125
|
declare const actions: {
|
|
126
126
|
loadSSOConfigurationsV2: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
127
|
-
saveSSOConfigurationV2: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "
|
|
128
|
-
updateSSOConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "
|
|
127
|
+
saveSSOConfigurationV2: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">>, import("@frontegg/rest-api").ISSOConfiguration>], WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">>, import("@frontegg/rest-api").ISSOConfiguration>, string, never, never>;
|
|
128
|
+
updateSSOConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">> & {
|
|
129
129
|
ssoConfigId: string;
|
|
130
|
-
}, import("@frontegg/rest-api").ISSOConfiguration>], WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "
|
|
130
|
+
}, import("@frontegg/rest-api").ISSOConfiguration>], WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">> & {
|
|
131
131
|
ssoConfigId: string;
|
|
132
132
|
}, import("@frontegg/rest-api").ISSOConfiguration>, string, never, never>;
|
|
133
133
|
deleteSSOConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<{
|
|
@@ -191,9 +191,9 @@ declare const actions: {
|
|
|
191
191
|
}, import("@frontegg/rest-api").ISSOConfiguration>, string, never, never>;
|
|
192
192
|
loadSSOConfigurations: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
193
193
|
loadSSOAuthorizationRoles: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
194
|
-
saveSSOConfigurations: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"
|
|
194
|
+
saveSSOConfigurations: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "type" | "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"> & {
|
|
195
195
|
samlVendor: import("./interfaces").SamlVendors;
|
|
196
|
-
}>, boolean>], WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"
|
|
196
|
+
}>, boolean>], WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "type" | "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"> & {
|
|
197
197
|
samlVendor: import("./interfaces").SamlVendors;
|
|
198
198
|
}>, boolean>, string, never, never>;
|
|
199
199
|
saveSSOConfigurationsFile: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[File[]], File[], string, never, never>;
|
|
@@ -12,7 +12,7 @@ import { IUserV3 } from '../../TeamState/interfaces';
|
|
|
12
12
|
* in order to keep the recommendations and insights updated.
|
|
13
13
|
* @param action - saga to execute
|
|
14
14
|
*/
|
|
15
|
-
export declare function securityCenterSagaWrapper<T>(action: (props: T) => void): (props: T) => Generator<void |
|
|
15
|
+
export declare function securityCenterSagaWrapper<T>(action: (props: T) => void): (props: T) => Generator<void | Generator<import("redux-saga/effects").PutEffect<{
|
|
16
16
|
payload: import("./types").SecurityCenterStateIndicator;
|
|
17
17
|
type: string;
|
|
18
18
|
}> | import("redux-saga/effects").CallEffect<GetRecommendationsResponse> | import("redux-saga/effects").PutEffect<{
|
|
@@ -24,7 +24,7 @@ export declare function securityCenterSagaWrapper<T>(action: (props: T) => void)
|
|
|
24
24
|
}> | import("redux-saga/effects").PutEffect<{
|
|
25
25
|
payload: Partial<import("./interfaces").SecurityCenterState>;
|
|
26
26
|
type: string;
|
|
27
|
-
}> | import("redux-saga/effects").CallEffect<GetInsightsResponse>, void, GetInsightsResponse>, void, boolean[]>;
|
|
27
|
+
}> | import("redux-saga/effects").CallEffect<GetInsightsResponse>, void, GetInsightsResponse> | import("redux-saga/effects").CallEffect<boolean[]>, void, boolean[]>;
|
|
28
28
|
export declare function loadRecommendations(): Generator<import("redux-saga/effects").PutEffect<{
|
|
29
29
|
payload: import("./types").SecurityCenterStateIndicator;
|
|
30
30
|
type: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IVendorConfig } from '@frontegg/rest-api';
|
|
2
2
|
import { IAuthStrategiesConfig } from '@frontegg/rest-api';
|
|
3
|
-
export declare function getSecurityPolicyPublicStateWithCustomLogin(securityPolicyPublicState?: IVendorConfig): Generator<import("redux-saga/effects").CallEffect<
|
|
3
|
+
export declare function getSecurityPolicyPublicStateWithCustomLogin(securityPolicyPublicState?: IVendorConfig): Generator<import("redux-saga/effects").CallEffect<Generator<import("redux-saga/effects").SelectEffect | import("@frontegg/rest-api").ResolvedTenantResult | Promise<import("@frontegg/rest-api").ResolvedTenantResult> | undefined, boolean, boolean>> | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig>, IVendorConfig | {
|
|
4
4
|
authStrategy: import("@frontegg/rest-api").AuthStrategyEnum;
|
|
5
5
|
} | undefined, (false & IAuthStrategiesConfig) | (true & IAuthStrategiesConfig)>;
|
|
6
|
-
export declare function setSecurityPolicyPublicStateForCustomLogin(authStrategy?: IVendorConfig['authStrategy']): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").CallEffect<
|
|
6
|
+
export declare function setSecurityPolicyPublicStateForCustomLogin(authStrategy?: IVendorConfig['authStrategy']): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").CallEffect<Generator<import("redux-saga/effects").SelectEffect | import("@frontegg/rest-api").ResolvedTenantResult | Promise<import("@frontegg/rest-api").ResolvedTenantResult> | undefined, boolean, boolean>> | import("redux-saga/effects").PutEffect<{
|
|
7
7
|
payload: Partial<import("../../../interfaces").WithStatus & {
|
|
8
8
|
policy?: IVendorConfig | undefined;
|
|
9
9
|
}>;
|
|
@@ -13,7 +13,7 @@ export declare function setSecurityPolicyPublicStateForCustomLogin(authStrategy?
|
|
|
13
13
|
}>) | (true & Required<import("../../../interfaces").WithStatus & {
|
|
14
14
|
policy?: IVendorConfig | undefined;
|
|
15
15
|
}>)>;
|
|
16
|
-
export declare function loadPublicSecurityPolicy(): Generator<Generator<import("redux-saga/effects").CallEffect<
|
|
16
|
+
export declare function loadPublicSecurityPolicy(): Generator<Generator<import("redux-saga/effects").CallEffect<Generator<import("redux-saga/effects").SelectEffect | import("@frontegg/rest-api").ResolvedTenantResult | Promise<import("@frontegg/rest-api").ResolvedTenantResult> | undefined, boolean, boolean>> | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig>, IVendorConfig | {
|
|
17
17
|
authStrategy: import("@frontegg/rest-api").AuthStrategyEnum;
|
|
18
18
|
} | undefined, (false & IAuthStrategiesConfig) | (true & IAuthStrategiesConfig)> | import("redux-saga/effects").PutEffect<{
|
|
19
19
|
payload: Partial<import("../../../interfaces").WithStatus & {
|
|
@@ -22,7 +22,7 @@ export declare function loadPublicSecurityPolicy(): Generator<Generator<import("
|
|
|
22
22
|
type: string;
|
|
23
23
|
}> | import("redux-saga/effects").CallEffect<IVendorConfig>, void, IVendorConfig>;
|
|
24
24
|
export declare function getAuthStrategy(): Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig>, IAuthStrategiesConfig, (false & IAuthStrategiesConfig) | (true & IAuthStrategiesConfig)>;
|
|
25
|
-
export declare function loadPublicAuthStrategiesPolicy(): Generator<import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").CallEffect<
|
|
25
|
+
export declare function loadPublicAuthStrategiesPolicy(): Generator<import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").CallEffect<Generator<import("redux-saga/effects").SelectEffect | import("@frontegg/rest-api").ResolvedTenantResult | Promise<import("@frontegg/rest-api").ResolvedTenantResult> | undefined, boolean, boolean>> | import("redux-saga/effects").PutEffect<{
|
|
26
26
|
payload: Partial<import("../../../interfaces").WithStatus & {
|
|
27
27
|
policy?: IVendorConfig | undefined;
|
|
28
28
|
}>;
|
package/auth/SignUp/saga.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { PayloadAction } from '@reduxjs/toolkit';
|
|
|
2
2
|
import { ISignUpResponse, IVendorConfig } from '@frontegg/rest-api';
|
|
3
3
|
import { ISignUpUserPayload } from './interfaces';
|
|
4
4
|
import { AuthState } from '../interfaces';
|
|
5
|
-
export declare function loadAllowSignUps(): Generator<Generator<import("redux-saga/effects").CallEffect<
|
|
5
|
+
export declare function loadAllowSignUps(): Generator<Generator<import("redux-saga/effects").CallEffect<Generator<import("redux-saga/effects").SelectEffect | import("@frontegg/rest-api").ResolvedTenantResult | Promise<import("@frontegg/rest-api").ResolvedTenantResult> | undefined, boolean, boolean>> | import("redux-saga/effects").CallEffect<import("@frontegg/rest-api").IAuthStrategiesConfig>, IVendorConfig | {
|
|
6
6
|
authStrategy: import("@frontegg/rest-api").AuthStrategyEnum;
|
|
7
7
|
} | undefined, (false & import("@frontegg/rest-api").IAuthStrategiesConfig) | (true & import("@frontegg/rest-api").IAuthStrategiesConfig)> | import("redux-saga/effects").PutEffect<{
|
|
8
8
|
payload: Partial<import("../../interfaces").WithStatus & {
|
package/auth/SignUp/saga.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["phoneNumber"],
|
|
4
|
+
_excluded2 = ["events", "url"];
|
|
4
5
|
import { call, put, select, takeLeading } from 'redux-saga/effects';
|
|
5
6
|
import { api, ContextHolder } from '@frontegg/rest-api';
|
|
6
7
|
import { actions } from '../reducer';
|
|
@@ -39,14 +40,18 @@ export function* loadAllowSignUps() {
|
|
|
39
40
|
}));
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
const extractPhoneNumber = _ref => {
|
|
44
|
+
let rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
45
|
+
return rest;
|
|
46
|
+
};
|
|
47
|
+
export function* signUpUser(_ref2) {
|
|
43
48
|
let {
|
|
44
49
|
payload: {
|
|
45
50
|
events,
|
|
46
51
|
url
|
|
47
52
|
}
|
|
48
|
-
} =
|
|
49
|
-
payload = _objectWithoutPropertiesLoose(
|
|
53
|
+
} = _ref2,
|
|
54
|
+
payload = _objectWithoutPropertiesLoose(_ref2.payload, _excluded2);
|
|
50
55
|
yield put(actions.setSignUpState({
|
|
51
56
|
loading: true
|
|
52
57
|
}));
|
|
@@ -62,19 +67,24 @@ export function* signUpUser(_ref) {
|
|
|
62
67
|
userId,
|
|
63
68
|
tenants = [],
|
|
64
69
|
activeTenant
|
|
65
|
-
} = yield call(api.auth.signUpUser,
|
|
70
|
+
} = yield call(api.auth.signUpUser,
|
|
71
|
+
//Currently we are not supporting phone number in signup in the backend
|
|
72
|
+
//Remove this line when we will support it (also make sure when field is optional no empty string is sent)
|
|
73
|
+
extractPhoneNumber(payload));
|
|
66
74
|
if (!payload.invitationToken) {
|
|
67
75
|
var _events$signUpComplet;
|
|
68
76
|
const {
|
|
69
77
|
email,
|
|
70
78
|
name,
|
|
71
|
-
companyName
|
|
79
|
+
companyName,
|
|
80
|
+
phoneNumber
|
|
72
81
|
} = payload;
|
|
73
82
|
const signUpCompletePayload = {
|
|
74
83
|
email,
|
|
75
84
|
name,
|
|
76
85
|
companyName,
|
|
77
86
|
url,
|
|
87
|
+
phoneNumber: phoneNumber || undefined,
|
|
78
88
|
authenticationType: AuthenticationTypes.PASSWORD,
|
|
79
89
|
id: userId,
|
|
80
90
|
tenantId,
|
package/auth/index.d.ts
CHANGED
|
@@ -345,10 +345,10 @@ declare const _default: {
|
|
|
345
345
|
}, import("./LoginState/interfaces").IPreVerifyMFAWebAuthNForLoginResponse>, string, never, never>;
|
|
346
346
|
disableMfaWebAuthn: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("./MfaState/interfaces").IDisableMFAWebAuthnPayload], import("./MfaState/interfaces").IDisableMFAWebAuthnPayload, string, never, never>;
|
|
347
347
|
loadSSOConfigurationsV2: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
348
|
-
saveSSOConfigurationV2: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration, "roleIds" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "
|
|
349
|
-
updateSSOConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration, "roleIds" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "
|
|
348
|
+
saveSSOConfigurationV2: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">>, import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">>, import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration>, string, never, never>;
|
|
349
|
+
updateSSOConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">> & {
|
|
350
350
|
ssoConfigId: string;
|
|
351
|
-
}, import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration, "roleIds" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "
|
|
351
|
+
}, import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">> & {
|
|
352
352
|
ssoConfigId: string;
|
|
353
353
|
}, import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration>, string, never, never>;
|
|
354
354
|
deleteSSOConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<{
|
|
@@ -412,9 +412,9 @@ declare const _default: {
|
|
|
412
412
|
}, import("@frontegg/rest-api/auth/interfaces").ISSOConfiguration>, string, never, never>;
|
|
413
413
|
loadSSOConfigurations: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
414
414
|
loadSSOAuthorizationRoles: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
415
|
-
saveSSOConfigurations: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"
|
|
415
|
+
saveSSOConfigurations: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "type" | "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"> & {
|
|
416
416
|
samlVendor: import("./SSOState/interfaces").SamlVendors;
|
|
417
|
-
}>, boolean>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"
|
|
417
|
+
}>, boolean>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "type" | "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"> & {
|
|
418
418
|
samlVendor: import("./SSOState/interfaces").SamlVendors;
|
|
419
419
|
}>, boolean>, string, never, never>;
|
|
420
420
|
saveSSOConfigurationsFile: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[File[]], File[], string, never, never>;
|
package/auth/interfaces.d.ts
CHANGED
package/auth/reducer.d.ts
CHANGED
|
@@ -304,10 +304,10 @@ declare const actions: {
|
|
|
304
304
|
}, import(".").IPreVerifyMFAWebAuthNForLoginResponse>, string, never, never>;
|
|
305
305
|
disableMfaWebAuthn: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import(".").IDisableMFAWebAuthnPayload], import(".").IDisableMFAWebAuthnPayload, string, never, never>;
|
|
306
306
|
loadSSOConfigurationsV2: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
307
|
-
saveSSOConfigurationV2: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "
|
|
308
|
-
updateSSOConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "
|
|
307
|
+
saveSSOConfigurationV2: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">>, import("@frontegg/rest-api").ISSOConfiguration>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">>, import("@frontegg/rest-api").ISSOConfiguration>, string, never, never>;
|
|
308
|
+
updateSSOConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">> & {
|
|
309
309
|
ssoConfigId: string;
|
|
310
|
-
}, import("@frontegg/rest-api").ISSOConfiguration>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "
|
|
310
|
+
}, import("@frontegg/rest-api").ISSOConfiguration>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISSOConfiguration, "roleIds" | "type" | "generatedVerification" | "enabled" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "oidcClientId" | "oidcSecret" | "groups" | "skipEmailDomainValidation">> & {
|
|
311
311
|
ssoConfigId: string;
|
|
312
312
|
}, import("@frontegg/rest-api").ISSOConfiguration>, string, never, never>;
|
|
313
313
|
deleteSSOConfiguration: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<{
|
|
@@ -371,9 +371,9 @@ declare const actions: {
|
|
|
371
371
|
}, import("@frontegg/rest-api").ISSOConfiguration>, string, never, never>;
|
|
372
372
|
loadSSOConfigurations: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
373
373
|
loadSSOAuthorizationRoles: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
374
|
-
saveSSOConfigurations: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"
|
|
374
|
+
saveSSOConfigurations: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "type" | "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"> & {
|
|
375
375
|
samlVendor: import(".").SamlVendors;
|
|
376
|
-
}>, boolean>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"
|
|
376
|
+
}>, boolean>], import("..").WithCallback<Partial<Pick<import("@frontegg/rest-api").ISamlConfiguration, "type" | "enabled" | "domain" | "ssoEndpoint" | "publicCertificate" | "signRequest" | "acsUrl" | "spEntityId" | "isSamlActive" | "oidcClientId" | "oidcSecret"> & {
|
|
377
377
|
samlVendor: import(".").SamlVendors;
|
|
378
378
|
}>, boolean>, string, never, never>;
|
|
379
379
|
saveSSOConfigurationsFile: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[File[]], File[], string, never, never>;
|
package/index.js
CHANGED
|
@@ -25,26 +25,29 @@ function* addUserApiToken({
|
|
|
25
25
|
const {
|
|
26
26
|
apiTokensDataUser
|
|
27
27
|
} = yield (0, _effects.select)(state => state.auth.apiTokensState);
|
|
28
|
+
const {
|
|
29
|
+
policy
|
|
30
|
+
} = yield (0, _effects.select)(state => state.auth.securityPolicyState.publicPolicy);
|
|
31
|
+
const isAccessToken = (policy == null ? void 0 : policy.machineToMachineAuthStrategy) === _restApi.MachineToMachineAuthStrategy.AccessToken;
|
|
28
32
|
try {
|
|
29
33
|
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
30
34
|
key: _interfaces.ApiStateKeys.ADD_API_TOKEN,
|
|
31
35
|
value: true
|
|
32
36
|
}));
|
|
33
37
|
let data;
|
|
34
|
-
let expiresInMinutes;
|
|
35
|
-
if (expires
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
expiresInMinutes = expires * 1440;
|
|
40
|
-
}
|
|
38
|
+
let expiresInMinutes = null;
|
|
39
|
+
if (expires) {
|
|
40
|
+
expiresInMinutes = expires * 1440;
|
|
41
|
+
}
|
|
42
|
+
if (isAccessToken) {
|
|
41
43
|
data = yield (0, _effects.call)(_restApi.api.auth.createUserAccessToken, {
|
|
42
44
|
description,
|
|
43
45
|
expiresInMinutes
|
|
44
46
|
});
|
|
45
47
|
} else {
|
|
46
48
|
data = yield (0, _effects.call)(_restApi.api.auth.updateUserApiTokensData, {
|
|
47
|
-
description
|
|
49
|
+
description,
|
|
50
|
+
expiresInMinutes
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
@@ -52,11 +55,13 @@ function* addUserApiToken({
|
|
|
52
55
|
}));
|
|
53
56
|
yield (0, _effects.delay)(200);
|
|
54
57
|
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
55
|
-
apiTokensDataUser: [data,
|
|
58
|
+
apiTokensDataUser: [(0, _extends2.default)({}, data, {
|
|
59
|
+
type: isAccessToken ? _restApi.MachineToMachineAuthStrategy.AccessToken : _restApi.MachineToMachineAuthStrategy.ClientCredentials
|
|
60
|
+
}), ...apiTokensDataUser],
|
|
56
61
|
successDialog: {
|
|
57
62
|
open: true,
|
|
58
63
|
secret: data.secret,
|
|
59
|
-
clientId:
|
|
64
|
+
clientId: !isAccessToken ? data.clientId : undefined
|
|
60
65
|
}
|
|
61
66
|
}));
|
|
62
67
|
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
@@ -88,19 +93,21 @@ function* addTenantApiToken({
|
|
|
88
93
|
const {
|
|
89
94
|
apiTokensDataTenant
|
|
90
95
|
} = yield (0, _effects.select)(state => state.auth.apiTokensState);
|
|
96
|
+
const {
|
|
97
|
+
policy
|
|
98
|
+
} = yield (0, _effects.select)(state => state.auth.securityPolicyState.publicPolicy);
|
|
99
|
+
const isAccessToken = (policy == null ? void 0 : policy.machineToMachineAuthStrategy) === _restApi.MachineToMachineAuthStrategy.AccessToken;
|
|
91
100
|
try {
|
|
92
101
|
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
93
102
|
key: _interfaces.ApiStateKeys.ADD_API_TOKEN,
|
|
94
103
|
value: true
|
|
95
104
|
}));
|
|
96
105
|
let data;
|
|
97
|
-
let expiresInMinutes;
|
|
98
|
-
if (expires
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
expiresInMinutes = expires * 1440;
|
|
103
|
-
}
|
|
106
|
+
let expiresInMinutes = null;
|
|
107
|
+
if (expires) {
|
|
108
|
+
expiresInMinutes = expires * 1440;
|
|
109
|
+
}
|
|
110
|
+
if (isAccessToken) {
|
|
104
111
|
data = yield (0, _effects.call)(_restApi.api.auth.createTenantAccessToken, {
|
|
105
112
|
description,
|
|
106
113
|
expiresInMinutes,
|
|
@@ -109,7 +116,8 @@ function* addTenantApiToken({
|
|
|
109
116
|
} else {
|
|
110
117
|
data = yield (0, _effects.call)(_restApi.api.auth.updateTenantApiTokensData, {
|
|
111
118
|
description,
|
|
112
|
-
roleIds
|
|
119
|
+
roleIds,
|
|
120
|
+
expiresInMinutes
|
|
113
121
|
});
|
|
114
122
|
}
|
|
115
123
|
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
@@ -117,11 +125,13 @@ function* addTenantApiToken({
|
|
|
117
125
|
}));
|
|
118
126
|
yield (0, _effects.delay)(200);
|
|
119
127
|
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
120
|
-
apiTokensDataTenant: [data,
|
|
128
|
+
apiTokensDataTenant: [(0, _extends2.default)({}, data, {
|
|
129
|
+
type: isAccessToken ? _restApi.MachineToMachineAuthStrategy.AccessToken : _restApi.MachineToMachineAuthStrategy.ClientCredentials
|
|
130
|
+
}), ...apiTokensDataTenant],
|
|
121
131
|
successDialog: {
|
|
122
132
|
open: true,
|
|
123
133
|
secret: data.secret,
|
|
124
|
-
clientId:
|
|
134
|
+
clientId: !isAccessToken ? data.clientId : undefined
|
|
125
135
|
}
|
|
126
136
|
}));
|
|
127
137
|
yield (0, _effects.put)(_reducer.actions.setApiTokensLoader({
|
|
@@ -285,7 +295,11 @@ function* loadUserApiTokens({
|
|
|
285
295
|
const apiTokensData = yield (_call = (0, _effects.call)(_restApi.api.auth.getUserApiTokensData)) != null ? _call : [];
|
|
286
296
|
const accessTokensData = yield (_call2 = (0, _effects.call)(_restApi.api.auth.getUserAccessTokensData)) != null ? _call2 : [];
|
|
287
297
|
const accessTokens = (_accessTokensData$acc = accessTokensData.accessTokens) != null ? _accessTokensData$acc : [];
|
|
288
|
-
const allTokens = accessTokens.
|
|
298
|
+
const allTokens = accessTokens.map(item => (0, _extends2.default)({}, item, {
|
|
299
|
+
type: _restApi.MachineToMachineAuthStrategy.AccessToken
|
|
300
|
+
})).concat(apiTokensData.map(item => (0, _extends2.default)({}, item, {
|
|
301
|
+
type: _restApi.MachineToMachineAuthStrategy.ClientCredentials
|
|
302
|
+
})));
|
|
289
303
|
const sortedTokensByDate = allTokens.sort((date1, date2) => new Date(date2.createdAt) - new Date(date1.createdAt));
|
|
290
304
|
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
291
305
|
apiTokensDataUser: sortedTokensByDate != null ? sortedTokensByDate : []
|
|
@@ -322,7 +336,11 @@ function* loadTenantApiTokens({
|
|
|
322
336
|
const apiTokensData = yield (_call3 = (0, _effects.call)(_restApi.api.auth.getTenantApiTokensData)) != null ? _call3 : [];
|
|
323
337
|
const accessTokensData = yield (_call4 = (0, _effects.call)(_restApi.api.auth.getTenantAccessTokensData)) != null ? _call4 : [];
|
|
324
338
|
const accessTokens = (_accessTokensData$acc2 = accessTokensData == null ? void 0 : accessTokensData.accessTokens) != null ? _accessTokensData$acc2 : [];
|
|
325
|
-
const allTokens = accessTokens.
|
|
339
|
+
const allTokens = accessTokens.map(item => (0, _extends2.default)({}, item, {
|
|
340
|
+
type: _restApi.MachineToMachineAuthStrategy.AccessToken
|
|
341
|
+
})).concat(apiTokensData.map(item => (0, _extends2.default)({}, item, {
|
|
342
|
+
type: _restApi.MachineToMachineAuthStrategy.ClientCredentials
|
|
343
|
+
})));
|
|
326
344
|
const sortedTokensByDate = allTokens.sort((date1, date2) => new Date(date2.createdAt) - new Date(date1.createdAt));
|
|
327
345
|
yield (0, _effects.put)(_reducer.actions.setApiTokensState({
|
|
328
346
|
apiTokensDataTenant: sortedTokensByDate != null ? sortedTokensByDate : []
|
|
@@ -17,7 +17,6 @@ var _reducer = require("../reducer");
|
|
|
17
17
|
var _utils = require("../utils");
|
|
18
18
|
var _utils2 = require("./utils");
|
|
19
19
|
var _utils3 = require("../../utils");
|
|
20
|
-
var _helpers = require("../../helpers");
|
|
21
20
|
var _utils4 = require("../LoginState/utils");
|
|
22
21
|
const _excluded = ["callback"],
|
|
23
22
|
_excluded2 = ["callback"];
|
|
@@ -72,9 +71,7 @@ function* updateTenantMetadata(_ref) {
|
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
function* customLoginEnabled() {
|
|
75
|
-
var _ContextHolder$getCon;
|
|
76
|
-
const [loginPerTenantFeatureFlag] = yield (0, _effects.call)(_helpers.getFeatureFlags, ['admin_portal_login_per_tenant']);
|
|
77
|
-
const hasTenantResolver = !!((_ContextHolder$getCon = _restApi.ContextHolder.getContext()) != null && _ContextHolder$getCon.tenantResolver);
|
|
74
|
+
var _yield$ContextHolder$, _ContextHolder$getCon, _ContextHolder$getCon2;
|
|
78
75
|
const isAuthenticated = yield (0, _effects.select)(state => state.auth.isAuthenticated);
|
|
79
76
|
if (isAuthenticated) {
|
|
80
77
|
var _select;
|
|
@@ -84,9 +81,10 @@ function* customLoginEnabled() {
|
|
|
84
81
|
var _auth$tenantsState$ac;
|
|
85
82
|
return (_auth$tenantsState$ac = auth.tenantsState.activeTenant) == null ? void 0 : _auth$tenantsState$ac.hasCustomLogin;
|
|
86
83
|
})) != null ? _select : false;
|
|
87
|
-
return
|
|
84
|
+
return tenantHasCustomLogin;
|
|
88
85
|
}
|
|
89
|
-
|
|
86
|
+
const resolvedTenant = (_yield$ContextHolder$ = yield (_ContextHolder$getCon = _restApi.ContextHolder.getContext()) == null ? void 0 : (_ContextHolder$getCon2 = _ContextHolder$getCon.tenantResolver) == null ? void 0 : _ContextHolder$getCon2.call(_ContextHolder$getCon)) == null ? void 0 : _yield$ContextHolder$.tenant;
|
|
87
|
+
return !!resolvedTenant;
|
|
90
88
|
}
|
|
91
89
|
function* loadCustomLoginRoutes() {
|
|
92
90
|
try {
|
package/node/auth/SignUp/saga.js
CHANGED
|
@@ -19,7 +19,8 @@ var _mfaRequiredState = require("../LoginState/mfaRequiredState.saga");
|
|
|
19
19
|
var _utils = require("../../utils");
|
|
20
20
|
var _utils2 = require("../LoginState/utils");
|
|
21
21
|
var _saga = require("../Security/SecurityPolicyState/saga");
|
|
22
|
-
const _excluded = ["
|
|
22
|
+
const _excluded = ["phoneNumber"],
|
|
23
|
+
_excluded2 = ["events", "url"];
|
|
23
24
|
function* loadAllowSignUps() {
|
|
24
25
|
yield (0, _effects.put)(_reducer.actions.setSignUpState({
|
|
25
26
|
loading: true
|
|
@@ -49,14 +50,18 @@ function* loadAllowSignUps() {
|
|
|
49
50
|
}));
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
+
const extractPhoneNumber = _ref => {
|
|
54
|
+
let rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
55
|
+
return rest;
|
|
56
|
+
};
|
|
57
|
+
function* signUpUser(_ref2) {
|
|
53
58
|
let {
|
|
54
59
|
payload: {
|
|
55
60
|
events,
|
|
56
61
|
url
|
|
57
62
|
}
|
|
58
|
-
} =
|
|
59
|
-
payload = (0, _objectWithoutPropertiesLoose2.default)(
|
|
63
|
+
} = _ref2,
|
|
64
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref2.payload, _excluded2);
|
|
60
65
|
yield (0, _effects.put)(_reducer.actions.setSignUpState({
|
|
61
66
|
loading: true
|
|
62
67
|
}));
|
|
@@ -72,19 +77,24 @@ function* signUpUser(_ref) {
|
|
|
72
77
|
userId,
|
|
73
78
|
tenants = [],
|
|
74
79
|
activeTenant
|
|
75
|
-
} = yield (0, _effects.call)(_restApi.api.auth.signUpUser,
|
|
80
|
+
} = yield (0, _effects.call)(_restApi.api.auth.signUpUser,
|
|
81
|
+
//Currently we are not supporting phone number in signup in the backend
|
|
82
|
+
//Remove this line when we will support it (also make sure when field is optional no empty string is sent)
|
|
83
|
+
extractPhoneNumber(payload));
|
|
76
84
|
if (!payload.invitationToken) {
|
|
77
85
|
var _events$signUpComplet;
|
|
78
86
|
const {
|
|
79
87
|
email,
|
|
80
88
|
name,
|
|
81
|
-
companyName
|
|
89
|
+
companyName,
|
|
90
|
+
phoneNumber
|
|
82
91
|
} = payload;
|
|
83
92
|
const signUpCompletePayload = {
|
|
84
93
|
email,
|
|
85
94
|
name,
|
|
86
95
|
companyName,
|
|
87
96
|
url,
|
|
97
|
+
phoneNumber: phoneNumber || undefined,
|
|
88
98
|
authenticationType: _interfaces2.AuthenticationTypes.PASSWORD,
|
|
89
99
|
id: userId,
|
|
90
100
|
tenantId,
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.153.0",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
9
|
"@frontegg/entitlements-javascript-commons": "1.0.1",
|
|
10
|
-
"@frontegg/rest-api": "3.1.
|
|
10
|
+
"@frontegg/rest-api": "3.1.48",
|
|
11
11
|
"@reduxjs/toolkit": "1.8.5",
|
|
12
12
|
"fast-deep-equal": "3.1.3",
|
|
13
13
|
"redux-saga": "^1.2.1",
|