@frontegg/redux-store 6.153.0-alpha.0 → 6.154.0-alpha.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/SSOState/index.d.ts +5 -5
- package/auth/index.d.ts +5 -5
- package/auth/reducer.d.ts +5 -5
- package/index.js +1 -1
- package/node/auth/ApiTokensState/saga.js +40 -22
- 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 : []
|
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>;
|
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/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 : []
|
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.154.0-alpha.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",
|