@frontegg/rest-api 7.66.0 → 7.67.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/enums.d.ts +4 -0
- package/auth/enums.js +6 -1
- package/auth/index.d.ts +11 -1
- package/auth/index.js +32 -0
- package/auth/interfaces.d.ts +9 -2
- package/constants.d.ts +5 -0
- package/constants.js +5 -0
- package/index.js +1 -1
- package/node/auth/enums.js +8 -2
- package/node/auth/index.js +32 -0
- package/node/constants.js +5 -0
- package/node/index.js +1 -1
- package/package.json +1 -1
package/auth/enums.d.ts
CHANGED
package/auth/enums.js
CHANGED
|
@@ -20,4 +20,9 @@ export let MachineToMachineAuthStrategy;
|
|
|
20
20
|
(function (MachineToMachineAuthStrategy) {
|
|
21
21
|
MachineToMachineAuthStrategy["ClientCredentials"] = "ClientCredentials";
|
|
22
22
|
MachineToMachineAuthStrategy["AccessToken"] = "AccessToken";
|
|
23
|
-
})(MachineToMachineAuthStrategy || (MachineToMachineAuthStrategy = {}));
|
|
23
|
+
})(MachineToMachineAuthStrategy || (MachineToMachineAuthStrategy = {}));
|
|
24
|
+
export let SignUpStrategyEnum;
|
|
25
|
+
(function (SignUpStrategyEnum) {
|
|
26
|
+
SignUpStrategyEnum["Email"] = "email";
|
|
27
|
+
SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
|
|
28
|
+
})(SignUpStrategyEnum || (SignUpStrategyEnum = {}));
|
package/auth/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from './enums';
|
|
|
3
3
|
export { FRONTEGG_SEPARATE_TABS_BY_TENANT } from './constants';
|
|
4
4
|
export { setTabTenantInSessionStorage, getTabTenantFromSessionStorage, getCurrentUserTenantsFunction, removeTabTenantFromSessionStorage, } from './utils';
|
|
5
5
|
import { ISamlRolesGroup } from '../teams/interfaces';
|
|
6
|
-
import { IAcceptInvitation, IAcceptInvitationWithOTC, IActivateAccount, IActivateAccountWithOTC, IAllowedToRememberMfaDevice, ICreateSamlGroup, IDeleteApiToken, IDisableMfa, IEnrollMfaResponse, IForgotPassword, IGetActivateAccountStrategy, IGetActivateAccountStrategyResponse, IGetUserById, IGetUserPasswordConfig, ILogin, ILoginResponse, ILoginViaSocialLogin, ILoginViaSocialLoginResponse, ILoginWithMfa, IOidcPostLogin, IOidcConfiguration, IPostLogin, IPreLogin, IRecoverMFAToken, IResendActivationEmail, IResetPassword, ISamlConfiguration, ISamlVendorConfigResponse, ISignUpResponse, ISignUpUser, ISocialLoginProviderConfiguration, ITenantApiTokensData, IUpdateSamlConfiguration, IUpdateSamlGroup, IUpdateSamlRoles, IUpdateSamlVendorMetadata, IUpdateTenantApiTokensData, IUpdateUserApiTokensData, IUserApiTokensData, IUserIdResponse, IVendorConfig, IVerifyMfa, IVerifyMfaResponse, TestConfig, ISSOPublicConfiguration, IPreLoginWithIdpTypeResponse, IPasswordlessPreLogin, IPasswordlessPostLogin, ICreateSSODomain, IVerifyInviteToken, ISSODomain, ISSOConfigurationDefaultRoles, ISSOConfiguration, IUpdateSSOConfiguration, IOidcPostLoginV2, IExchangeOAuthTokens, IOAuthTokenResponse, ISocialLoginProviderConfigurationV2, ILoginResponseV2, IResetPhoneNumber, IVerifyResetPhoneNumber, IChangePhoneNumber, IVerifyResetPhoneNumberResponse, IResetPhoneNumberResponse, IWebAuthnPreLogin, IWebAuthnPostLogin, IVerifyNewWebAuthnDevice, IWebAuthnPreLoginResponse, ICreateNewDeviceSessionResponse, IAuthStrategiesConfig, ISessionResponse, IChangePhoneNumberWithVerification, IChangePhoneNumberWithVerificationResponse, IVerifyChangePhoneNumber, ISessionConfigurations, IResendInvitationEmail, IPreEnrollMFA, IEnrollMFAAuthenticatorApp, IPreEnrollMFASMS, IEnrollMFASMS, IEnrollMFAWebAuthn, IPreEnrollMFAAuthenticatorAppResponse, IPreEnrollMFAWebAuthnResponse, IVerifyMFAAuthenticatorApp, IPreVerifyMFA, IPreVerifyMFASMSResponse, IVerifyMFASMS, IPreVerifyMFAWebAuthnResponse, IVerifyMFAWebAuthn, IPreEnrollMFASMSResponse, IPreDisableMFASMSResponse, IDisableMFASMS, IDisableMFAWebAuthn, IPreDisableMFAWebAuthnResponse, UserMFADevicesResponse, WithoutMFAToken, IMFAStrategiesResponse, IOAuthLogout, IGetUserAccessTokens, IGetTenantAccessTokens, IDeleteAccessToken, ICreateTenantAccessTokenData, ICreateUserAccessTokenData, IWebAuthnDevices, ICustomSocialLoginProviderConfigurationV1, ILoginResponseV3, IPreVerifyMFAEmailCodeResponse, IVerifyMFAEmailCode, ICreateOrUpdateSSOConfigurationByMetadataUrl, GenerateStepUpRequest, GenerateStepUpResponse } from './interfaces';
|
|
6
|
+
import { IAcceptInvitation, IAcceptInvitationWithOTC, IActivateAccount, IActivateAccountWithOTC, IAllowedToRememberMfaDevice, ICreateSamlGroup, IDeleteApiToken, IDisableMfa, IEnrollMfaResponse, IForgotPassword, IGetActivateAccountStrategy, IGetActivateAccountStrategyResponse, IGetUserById, IGetUserPasswordConfig, ILogin, ILoginResponse, ILoginViaSocialLogin, ILoginViaSocialLoginResponse, ILoginWithMfa, IOidcPostLogin, IOidcConfiguration, IPostLogin, IPreLogin, IRecoverMFAToken, IResendActivationEmail, IResetPassword, ISamlConfiguration, ISamlVendorConfigResponse, ISignUpResponse, ISignUpUser, ISocialLoginProviderConfiguration, ITenantApiTokensData, IUpdateSamlConfiguration, IUpdateSamlGroup, IUpdateSamlRoles, IUpdateSamlVendorMetadata, IUpdateTenantApiTokensData, IUpdateUserApiTokensData, IUserApiTokensData, IUserIdResponse, IVendorConfig, IVerifyMfa, IVerifyMfaResponse, TestConfig, ISSOPublicConfiguration, IPreLoginWithIdpTypeResponse, IPasswordlessPreLogin, IPasswordlessPostLogin, ICreateSSODomain, IVerifyInviteToken, ISSODomain, ISSOConfigurationDefaultRoles, ISSOConfiguration, IUpdateSSOConfiguration, IOidcPostLoginV2, IExchangeOAuthTokens, IOAuthTokenResponse, ISocialLoginProviderConfigurationV2, ILoginResponseV2, IResetPhoneNumber, IVerifyResetPhoneNumber, IChangePhoneNumber, IVerifyResetPhoneNumberResponse, IResetPhoneNumberResponse, IWebAuthnPreLogin, IWebAuthnPostLogin, IVerifyNewWebAuthnDevice, IWebAuthnPreLoginResponse, ICreateNewDeviceSessionResponse, IAuthStrategiesConfig, ISessionResponse, IChangePhoneNumberWithVerification, IChangePhoneNumberWithVerificationResponse, IVerifyChangePhoneNumber, ISessionConfigurations, IResendInvitationEmail, IPreEnrollMFA, IEnrollMFAAuthenticatorApp, IPreEnrollMFASMS, IEnrollMFASMS, IEnrollMFAWebAuthn, IPreEnrollMFAAuthenticatorAppResponse, IPreEnrollMFAWebAuthnResponse, IVerifyMFAAuthenticatorApp, IPreVerifyMFA, IPreVerifyMFASMSResponse, IVerifyMFASMS, IPreVerifyMFAWebAuthnResponse, IVerifyMFAWebAuthn, IPreEnrollMFASMSResponse, IPreDisableMFASMSResponse, IDisableMFASMS, IDisableMFAWebAuthn, IPreDisableMFAWebAuthnResponse, UserMFADevicesResponse, WithoutMFAToken, IMFAStrategiesResponse, IOAuthLogout, IGetUserAccessTokens, IGetTenantAccessTokens, IDeleteAccessToken, ICreateTenantAccessTokenData, ICreateUserAccessTokenData, IWebAuthnDevices, ICustomSocialLoginProviderConfigurationV1, ILoginResponseV3, IPreVerifyMFAEmailCodeResponse, IVerifyMFAEmailCode, ICreateOrUpdateSSOConfigurationByMetadataUrl, GenerateStepUpRequest, GenerateStepUpResponse, TSignupStrategyResponse } from './interfaces';
|
|
7
7
|
import { IGetUserAuthorizationResponse, IUserProfile } from '../users/interfaces';
|
|
8
8
|
import { BaseApiClient } from '../BaseApiClient';
|
|
9
9
|
import { SecurityPolicyApi } from './secutiry-poilicy';
|
|
@@ -161,6 +161,10 @@ export declare class AuthenticationApi extends BaseApiClient {
|
|
|
161
161
|
* load password configuration for user.
|
|
162
162
|
*/
|
|
163
163
|
loadPasswordConfig: (params?: IGetUserPasswordConfig) => Promise<Partial<TestConfig> | null>;
|
|
164
|
+
/**
|
|
165
|
+
* load sign up strategies
|
|
166
|
+
*/
|
|
167
|
+
getSignUpStrategies: () => Promise<TSignupStrategyResponse>;
|
|
164
168
|
/**
|
|
165
169
|
* recover Multi-Factor authentication by providing the recoveryCode
|
|
166
170
|
* that has been received when activated it
|
|
@@ -470,6 +474,12 @@ export declare class AuthenticationApi extends BaseApiClient {
|
|
|
470
474
|
* @param body - The sign-up data
|
|
471
475
|
*/
|
|
472
476
|
signUpUser: (body: ISignUpUser) => Promise<ISignUpResponse>;
|
|
477
|
+
/**
|
|
478
|
+
* Sign up a new user and create a new tenant.
|
|
479
|
+
*
|
|
480
|
+
* @param body - The sign-up data
|
|
481
|
+
*/
|
|
482
|
+
signUpUserWithPhoneNumber: (body: ISignUpUser) => Promise<ISignUpResponse>;
|
|
473
483
|
/**
|
|
474
484
|
* Get all current user active sessions.
|
|
475
485
|
*/
|
package/auth/index.js
CHANGED
|
@@ -212,6 +212,9 @@ export class AuthenticationApi extends BaseApiClient {
|
|
|
212
212
|
this.loadPasswordConfig = async params => {
|
|
213
213
|
return this.get(`${urls.identity.users.v1}/passwords/config`, params);
|
|
214
214
|
};
|
|
215
|
+
this.getSignUpStrategies = async () => {
|
|
216
|
+
return this.get(`${urls.identity.signup.v1.strategies}`);
|
|
217
|
+
};
|
|
215
218
|
this.recoverMfaToken = async body => {
|
|
216
219
|
return this.post(`${urls.identity.auth.v1}/user/mfa/recover`, body);
|
|
217
220
|
};
|
|
@@ -452,6 +455,35 @@ export class AuthenticationApi extends BaseApiClient {
|
|
|
452
455
|
activationToken
|
|
453
456
|
});
|
|
454
457
|
};
|
|
458
|
+
this.signUpUserWithPhoneNumber = async body => {
|
|
459
|
+
const {
|
|
460
|
+
shouldActivate,
|
|
461
|
+
authResponse,
|
|
462
|
+
userId,
|
|
463
|
+
tenantId,
|
|
464
|
+
activationToken
|
|
465
|
+
} = await this.post(`${urls.identity.users.v1}/signUp/phoneNumber`, body);
|
|
466
|
+
const response = {
|
|
467
|
+
shouldActivate,
|
|
468
|
+
userId,
|
|
469
|
+
tenantId
|
|
470
|
+
};
|
|
471
|
+
if (!shouldActivate && authResponse) {
|
|
472
|
+
const {
|
|
473
|
+
user,
|
|
474
|
+
tenants,
|
|
475
|
+
activeTenant
|
|
476
|
+
} = await this.generateLoginResponseV3(authResponse);
|
|
477
|
+
return _extends({}, response, {
|
|
478
|
+
user,
|
|
479
|
+
tenants,
|
|
480
|
+
activeTenant
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
return _extends({}, response, {
|
|
484
|
+
activationToken
|
|
485
|
+
});
|
|
486
|
+
};
|
|
455
487
|
this.getCurrentUserSessions = async () => {
|
|
456
488
|
return this.get(urls.identity.users.sessions.currentUser.v1);
|
|
457
489
|
};
|
package/auth/interfaces.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserEntitlementsContext as UserEntitlementsResponseV2 } from '@frontegg/entitlements-javascript-commons';
|
|
2
2
|
import { ITenantsResponse, IUserProfile } from '..';
|
|
3
|
-
import { AuthStrategyEnum, MachineToMachineAuthStrategy, SocialLoginProviders } from './enums';
|
|
3
|
+
import { AuthStrategyEnum, MachineToMachineAuthStrategy, SignUpStrategyEnum, SocialLoginProviders } from './enums';
|
|
4
4
|
import { ISamlRolesGroup } from '../teams/interfaces';
|
|
5
5
|
export * from './secutiry-poilicy/interfaces';
|
|
6
6
|
export type IPreLogin = {
|
|
@@ -32,6 +32,7 @@ export type ILogin = {
|
|
|
32
32
|
invitationToken?: string;
|
|
33
33
|
};
|
|
34
34
|
export type ILoginResponse = IUserProfile & {
|
|
35
|
+
otcToken?: string;
|
|
35
36
|
mfaRequired: boolean;
|
|
36
37
|
accessToken: string;
|
|
37
38
|
refreshToken: string;
|
|
@@ -229,7 +230,7 @@ export interface IVendorConfig {
|
|
|
229
230
|
machineToMachineAuthStrategy: MachineToMachineAuthStrategy;
|
|
230
231
|
}
|
|
231
232
|
export interface ISignUpUser {
|
|
232
|
-
email
|
|
233
|
+
email?: string;
|
|
233
234
|
companyName: string;
|
|
234
235
|
recaptchaToken?: string;
|
|
235
236
|
name?: string;
|
|
@@ -707,3 +708,9 @@ export interface IMFAStrategiesResponse {
|
|
|
707
708
|
strategies: IMFAStrategyResponse[];
|
|
708
709
|
}
|
|
709
710
|
export declare const LOAD_AUTHORIZATION_FF = "admin_portal_should_load_authorization";
|
|
711
|
+
export type TSignupStrategy = {
|
|
712
|
+
strategy: SignUpStrategyEnum;
|
|
713
|
+
isActive: boolean;
|
|
714
|
+
isRequired: boolean;
|
|
715
|
+
};
|
|
716
|
+
export type TSignupStrategyResponse = Array<TSignupStrategy>;
|
package/constants.d.ts
CHANGED
package/constants.js
CHANGED
package/index.js
CHANGED
package/node/auth/enums.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SocialLoginProviders = exports.MachineToMachineAuthStrategy = exports.AuthStrategyEnum = void 0;
|
|
6
|
+
exports.SocialLoginProviders = exports.SignUpStrategyEnum = exports.MachineToMachineAuthStrategy = exports.AuthStrategyEnum = void 0;
|
|
7
7
|
let SocialLoginProviders;
|
|
8
8
|
exports.SocialLoginProviders = SocialLoginProviders;
|
|
9
9
|
(function (SocialLoginProviders) {
|
|
@@ -29,4 +29,10 @@ exports.MachineToMachineAuthStrategy = MachineToMachineAuthStrategy;
|
|
|
29
29
|
(function (MachineToMachineAuthStrategy) {
|
|
30
30
|
MachineToMachineAuthStrategy["ClientCredentials"] = "ClientCredentials";
|
|
31
31
|
MachineToMachineAuthStrategy["AccessToken"] = "AccessToken";
|
|
32
|
-
})(MachineToMachineAuthStrategy || (exports.MachineToMachineAuthStrategy = MachineToMachineAuthStrategy = {}));
|
|
32
|
+
})(MachineToMachineAuthStrategy || (exports.MachineToMachineAuthStrategy = MachineToMachineAuthStrategy = {}));
|
|
33
|
+
let SignUpStrategyEnum;
|
|
34
|
+
exports.SignUpStrategyEnum = SignUpStrategyEnum;
|
|
35
|
+
(function (SignUpStrategyEnum) {
|
|
36
|
+
SignUpStrategyEnum["Email"] = "email";
|
|
37
|
+
SignUpStrategyEnum["PhoneNumber"] = "phoneNumber";
|
|
38
|
+
})(SignUpStrategyEnum || (exports.SignUpStrategyEnum = SignUpStrategyEnum = {}));
|
package/node/auth/index.js
CHANGED
|
@@ -278,6 +278,9 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
|
|
|
278
278
|
this.loadPasswordConfig = async params => {
|
|
279
279
|
return this.get(`${_constants2.urls.identity.users.v1}/passwords/config`, params);
|
|
280
280
|
};
|
|
281
|
+
this.getSignUpStrategies = async () => {
|
|
282
|
+
return this.get(`${_constants2.urls.identity.signup.v1.strategies}`);
|
|
283
|
+
};
|
|
281
284
|
this.recoverMfaToken = async body => {
|
|
282
285
|
return this.post(`${_constants2.urls.identity.auth.v1}/user/mfa/recover`, body);
|
|
283
286
|
};
|
|
@@ -518,6 +521,35 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
|
|
|
518
521
|
activationToken
|
|
519
522
|
});
|
|
520
523
|
};
|
|
524
|
+
this.signUpUserWithPhoneNumber = async body => {
|
|
525
|
+
const {
|
|
526
|
+
shouldActivate,
|
|
527
|
+
authResponse,
|
|
528
|
+
userId,
|
|
529
|
+
tenantId,
|
|
530
|
+
activationToken
|
|
531
|
+
} = await this.post(`${_constants2.urls.identity.users.v1}/signUp/phoneNumber`, body);
|
|
532
|
+
const response = {
|
|
533
|
+
shouldActivate,
|
|
534
|
+
userId,
|
|
535
|
+
tenantId
|
|
536
|
+
};
|
|
537
|
+
if (!shouldActivate && authResponse) {
|
|
538
|
+
const {
|
|
539
|
+
user,
|
|
540
|
+
tenants,
|
|
541
|
+
activeTenant
|
|
542
|
+
} = await this.generateLoginResponseV3(authResponse);
|
|
543
|
+
return (0, _extends2.default)({}, response, {
|
|
544
|
+
user,
|
|
545
|
+
tenants,
|
|
546
|
+
activeTenant
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
return (0, _extends2.default)({}, response, {
|
|
550
|
+
activationToken
|
|
551
|
+
});
|
|
552
|
+
};
|
|
521
553
|
this.getCurrentUserSessions = async () => {
|
|
522
554
|
return this.get(_constants2.urls.identity.users.sessions.currentUser.v1);
|
|
523
555
|
};
|
package/node/constants.js
CHANGED
|
@@ -7,6 +7,11 @@ exports.urls = exports.GENERIC_ERROR_MESSAGE = exports.GENERIC_ERROR_CODE = expo
|
|
|
7
7
|
const urls = {
|
|
8
8
|
vendor: '/vendors',
|
|
9
9
|
identity: {
|
|
10
|
+
signup: {
|
|
11
|
+
v1: {
|
|
12
|
+
strategies: '/identity/resources/configurations/v1/sign-up/strategies'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
10
15
|
webAuthnDevices: {
|
|
11
16
|
v1: '/identity/resources/users/webauthn/v1/devices'
|
|
12
17
|
},
|
package/node/index.js
CHANGED