@frontegg/rest-api 3.0.84 → 3.0.86

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "./secutiry-poilicy";
2
2
  export * from "./enums";
3
3
  import { ISamlRolesGroup } from "../teams/interfaces";
4
- import { IAcceptInvitation, IActivateAccount, 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 } from "./interfaces";
4
+ import { IAcceptInvitation, IActivateAccount, 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 } from './interfaces';
5
5
  /*****************************************
6
6
  * Authentication
7
7
  *****************************************/
@@ -367,6 +367,11 @@ export declare function getSocialLoginProviders(): Promise<ISocialLoginProviderC
367
367
  * @return array of providers configurations
368
368
  */
369
369
  export declare function getSocialLoginProvidersV2(): Promise<ISocialLoginProviderConfigurationV2[]>;
370
+ /**
371
+ * Get social logins custom providers configurations
372
+ * @return array of custom providers configurations
373
+ */
374
+ export declare function getCustomSocialLoginProvidersV1(): Promise<ICustomSocialLoginProviderConfigurationV1>;
370
375
  /**
371
376
  * Login using social login
372
377
  * @return cookie with refresh token
package/auth/index.js CHANGED
@@ -270,6 +270,9 @@ export async function getSocialLoginProviders() {
270
270
  export async function getSocialLoginProvidersV2() {
271
271
  return Get(urls.identity.sso.v2);
272
272
  }
273
+ export async function getCustomSocialLoginProvidersV1() {
274
+ return Get(urls.identity.sso.custom.v1);
275
+ }
273
276
  export async function loginViaSocialLogin({
274
277
  provider,
275
278
  code,
@@ -149,6 +149,21 @@ export interface ISocialLoginProviderConfigurationV2 {
149
149
  options?: Record<string, unknown>;
150
150
  customised: boolean;
151
151
  }
152
+ export interface ICustomSocialLoginProviderConfigurationV1 {
153
+ providers: {
154
+ id: string;
155
+ type: string;
156
+ clientId: string;
157
+ redirectUrl: string;
158
+ redirectUrlPattern: string;
159
+ authorizationUrl: string;
160
+ userInfoUrl: string;
161
+ scopes: string;
162
+ ssoLogoUrl: string | null;
163
+ displayName: string;
164
+ active: boolean;
165
+ }[];
166
+ }
152
167
  export interface ILoginViaSocialLogin {
153
168
  code?: string;
154
169
  idToken?: string;
package/constants.d.ts CHANGED
@@ -46,6 +46,9 @@ export declare const urls: {
46
46
  sso: {
47
47
  v1: string;
48
48
  v2: string;
49
+ custom: {
50
+ v1: string;
51
+ };
49
52
  };
50
53
  permissions: {
51
54
  v1: string;
package/constants.js CHANGED
@@ -45,7 +45,10 @@ export const urls = {
45
45
  },
46
46
  sso: {
47
47
  v1: '/identity/resources/sso/v1',
48
- v2: '/identity/resources/sso/v2'
48
+ v2: '/identity/resources/sso/v2',
49
+ custom: {
50
+ v1: '/identity/resources/sso/custom/v1'
51
+ }
49
52
  },
50
53
  permissions: {
51
54
  v1: '/identity/resources/permissions/v1'
package/fetch.js CHANGED
@@ -98,6 +98,17 @@ async function getAdditionalHeaders(context) {
98
98
  output = await context.additionalHeadersResolver();
99
99
  }
100
100
 
101
+ if (context.tenantResolver) {
102
+ const resolvedTenantResult = await context.tenantResolver();
103
+
104
+ if (!!(resolvedTenantResult != null && resolvedTenantResult.tenant)) {
105
+ output.push({
106
+ key: 'frontegg-login-alias',
107
+ value: resolvedTenantResult.tenant
108
+ });
109
+ }
110
+ }
111
+
101
112
  return output;
102
113
  }
103
114
 
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.84
1
+ /** @license Frontegg v3.0.86
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/interfaces.d.ts CHANGED
@@ -17,11 +17,19 @@ export interface KeyValuePair {
17
17
  key: string;
18
18
  value: string;
19
19
  }
20
+ export interface ResolvedTenantResult {
21
+ tenant: string | null;
22
+ }
20
23
  export declare type LogLevel = 'warn' | 'error';
21
24
  export interface ContextOptions {
22
25
  baseUrl: string | ((url: string) => string);
23
26
  clientId?: string;
24
27
  tokenResolver?: () => Promise<string> | string;
28
+ /**
29
+ * custom login header value
30
+ * @returns `{ tenant: string | null }`
31
+ */
32
+ tenantResolver?: () => Promise<ResolvedTenantResult> | ResolvedTenantResult;
25
33
  additionalQueryParamsResolver?: () => Promise<KeyValuePair[]> | KeyValuePair[];
26
34
  additionalHeadersResolver?: () => Promise<KeyValuePair[]> | KeyValuePair[];
27
35
  currentUserRoles?: string[];
@@ -69,6 +69,7 @@ var _exportNames = {
69
69
  getSSOPublicConfiguration: true,
70
70
  getSocialLoginProviders: true,
71
71
  getSocialLoginProvidersV2: true,
72
+ getCustomSocialLoginProvidersV1: true,
72
73
  loginViaSocialLogin: true,
73
74
  getVendorConfig: true,
74
75
  signUpUser: true,
@@ -171,6 +172,7 @@ exports.generateLoginResponseV2 = generateLoginResponseV2;
171
172
  exports.getActivateAccountStrategy = getActivateAccountStrategy;
172
173
  exports.getCurrentUserSession = getCurrentUserSession;
173
174
  exports.getCurrentUserSessions = getCurrentUserSessions;
175
+ exports.getCustomSocialLoginProvidersV1 = getCustomSocialLoginProvidersV1;
174
176
  exports.getMFADevices = getMFADevices;
175
177
  exports.getMFAStrategiesConfig = getMFAStrategiesConfig;
176
178
  exports.getOidcConfiguration = getOidcConfiguration;
@@ -622,6 +624,10 @@ async function getSocialLoginProvidersV2() {
622
624
  return (0, _fetch.Get)(_constants.urls.identity.sso.v2);
623
625
  }
624
626
 
627
+ async function getCustomSocialLoginProvidersV1() {
628
+ return (0, _fetch.Get)(_constants.urls.identity.sso.custom.v1);
629
+ }
630
+
625
631
  async function loginViaSocialLogin({
626
632
  provider,
627
633
  code,
package/node/constants.js CHANGED
@@ -51,7 +51,10 @@ const urls = {
51
51
  },
52
52
  sso: {
53
53
  v1: '/identity/resources/sso/v1',
54
- v2: '/identity/resources/sso/v2'
54
+ v2: '/identity/resources/sso/v2',
55
+ custom: {
56
+ v1: '/identity/resources/sso/custom/v1'
57
+ }
55
58
  },
56
59
  permissions: {
57
60
  v1: '/identity/resources/permissions/v1'
package/node/fetch.js CHANGED
@@ -111,6 +111,17 @@ async function getAdditionalHeaders(context) {
111
111
  output = await context.additionalHeadersResolver();
112
112
  }
113
113
 
114
+ if (context.tenantResolver) {
115
+ const resolvedTenantResult = await context.tenantResolver();
116
+
117
+ if (!!(resolvedTenantResult != null && resolvedTenantResult.tenant)) {
118
+ output.push({
119
+ key: 'frontegg-login-alias',
120
+ value: resolvedTenantResult.tenant
121
+ });
122
+ }
123
+ }
124
+
114
125
  return output;
115
126
  }
116
127
 
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.0.84
1
+ /** @license Frontegg v3.0.86
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.0.84",
3
+ "version": "3.0.86",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {