From a6d7d32156faa3f63bc1a85d994392793a2d58b5 Mon Sep 17 00:00:00 2001 From: Tuan Dang Date: Tue, 12 Mar 2024 09:37:28 -0700 Subject: [PATCH] Draft revamp org auth tab --- .../services/license/__mocks__/licence-fns.ts | 6 +- .../src/ee/services/license/licence-fns.ts | 6 +- .../src/ee/services/license/license-types.ts | 6 +- .../OrgSettingsPage/OrgSettingsPage.tsx | 2 +- .../components/OrgAuthTab/OrgAuthTab.tsx | 2 +- .../OrgAuthTab/OrgGeneralAuthSection.tsx | 49 +++++++--- .../components/OrgAuthTab/OrgLDAPSection.tsx | 76 +++++++-------- .../components/OrgAuthTab/OrgSCIMSection.tsx | 60 ++++++------ .../components/OrgAuthTab/OrgSSOSection.tsx | 95 ++++++++++--------- .../components/OrgTabGroup/OrgTabGroup.tsx | 2 +- 10 files changed, 165 insertions(+), 139 deletions(-) diff --git a/backend/src/ee/services/license/__mocks__/licence-fns.ts b/backend/src/ee/services/license/__mocks__/licence-fns.ts index 8f52939c5..0a466c57c 100644 --- a/backend/src/ee/services/license/__mocks__/licence-fns.ts +++ b/backend/src/ee/services/license/__mocks__/licence-fns.ts @@ -17,9 +17,9 @@ export const getDefaultOnPremFeatures = () => { customAlerts: false, auditLogs: false, auditLogsRetentionDays: 0, - samlSSO: false, - scim: false, - ldap: false, + samlSSO: true, + scim: true, + ldap: true, status: null, trial_end: null, has_used_trial: true, diff --git a/backend/src/ee/services/license/licence-fns.ts b/backend/src/ee/services/license/licence-fns.ts index 8dca96737..98f8c5f24 100644 --- a/backend/src/ee/services/license/licence-fns.ts +++ b/backend/src/ee/services/license/licence-fns.ts @@ -23,9 +23,9 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({ customAlerts: false, auditLogs: false, auditLogsRetentionDays: 0, - samlSSO: false, - scim: false, - ldap: false, + samlSSO: true, + scim: true, + ldap: true, status: null, trial_end: null, has_used_trial: true, diff --git a/backend/src/ee/services/license/license-types.ts b/backend/src/ee/services/license/license-types.ts index 80f422380..830cacf99 100644 --- a/backend/src/ee/services/license/license-types.ts +++ b/backend/src/ee/services/license/license-types.ts @@ -24,9 +24,9 @@ export type TFeatureSet = { customAlerts: false; auditLogs: false; auditLogsRetentionDays: 0; - samlSSO: false; - scim: false; - ldap: false; + samlSSO: true; + scim: true; + ldap: true; status: null; trial_end: null; has_used_trial: true; diff --git a/frontend/src/views/Settings/OrgSettingsPage/OrgSettingsPage.tsx b/frontend/src/views/Settings/OrgSettingsPage/OrgSettingsPage.tsx index 29e4eaff5..8c9a64222 100644 --- a/frontend/src/views/Settings/OrgSettingsPage/OrgSettingsPage.tsx +++ b/frontend/src/views/Settings/OrgSettingsPage/OrgSettingsPage.tsx @@ -7,7 +7,7 @@ export const OrgSettingsPage = () => { return (
-
+

{t("settings.org.title")}

diff --git a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgAuthTab.tsx b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgAuthTab.tsx index c4b03bae6..322798d16 100644 --- a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgAuthTab.tsx +++ b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgAuthTab.tsx @@ -9,7 +9,7 @@ import { OrgSSOSection } from "./OrgSSOSection"; export const OrgAuthTab = withPermission( () => { return ( -
+
diff --git a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx index ef81a6cab..57de34052 100644 --- a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx +++ b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx @@ -59,25 +59,44 @@ export const OrgGeneralAuthSection = () => { } return ( -
-

Settings

- - {(isAllowed) => ( - handleEnforceOrgAuthToggle(value)} - isChecked={currentOrg?.authEnforced ?? false} - isDisabled={!isAllowed} - > - Enforce SAML SSO - - )} - + <> +
+
+

Allow users to send invites

+ + {(isAllowed) => ( + handleEnforceOrgAuthToggle(value)} + isChecked={currentOrg?.authEnforced ?? false} + isDisabled={!isAllowed} + /> + )} + +
+

Allow members to invite new users to this organization

+
+
+
+

Enforce SAML SSO

+ + {(isAllowed) => ( + handleEnforceOrgAuthToggle(value)} + isChecked={currentOrg?.authEnforced ?? false} + isDisabled={!isAllowed} + /> + )} + +
+

Enforce members to authenticate via SAML to access this organization

+
handlePopUpToggle("upgradePlan", isOpen)} text="You can enforce SAML SSO if you switch to Infisical's Pro plan." /> -
+ ); } \ No newline at end of file diff --git a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgLDAPSection.tsx b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgLDAPSection.tsx index c1ac93db8..b7f957698 100644 --- a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgLDAPSection.tsx +++ b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgLDAPSection.tsx @@ -1,6 +1,3 @@ -import { faPlus } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; - import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { OrgPermissionCan } from "@app/components/permissions"; import { @@ -27,7 +24,7 @@ export const OrgLDAPSection = (): JSX.Element => { const { currentOrg } = useOrganization(); const { subscription } = useSubscription(); const { createNotification } = useNotificationContext(); - const { data, isLoading } = useGetLDAPConfig(currentOrg?.id ?? ""); + const { data } = useGetLDAPConfig(currentOrg?.id ?? ""); const { mutateAsync } = useUpdateLDAPConfig(); const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "addLDAP", @@ -88,50 +85,53 @@ export const OrgLDAPSection = (): JSX.Element => { }; return ( -
-
-

LDAP

- {!isLoading && ( + <> +
+
+
+

LDAP

{(isAllowed) => ( )} - )} -
- {data && ( -
- - {(isAllowed) => ( - handleLDAPToggle(value)} - isChecked={data ? data.isActive : false} - isDisabled={!isAllowed} - > - Enable - - )} -
- )} - - handlePopUpToggle("upgradePlan", isOpen)} - text="You can use LDAP authentication if you switch to Infisical's Enterprise plan." - /> -
+

Manage LDAP authentication configuration

+
+
+
+

Enable LDAP

+ + {(isAllowed) => ( + handleLDAPToggle(value)} + isChecked={data ? data.isActive : false} + isDisabled={!isAllowed} + > + Enable + + )} + +
+

Allow members to authenticate into Infisical with LDAP

+
+ + handlePopUpToggle("upgradePlan", isOpen)} + text="You can use LDAP authentication if you switch to Infisical's Enterprise plan." + /> + ); }; \ No newline at end of file diff --git a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgSCIMSection.tsx b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgSCIMSection.tsx index bb1f4ff94..f599bc07a 100644 --- a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgSCIMSection.tsx +++ b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgSCIMSection.tsx @@ -1,6 +1,3 @@ -import { faPlus } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; - import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { OrgPermissionCan } from "@app/components/permissions"; import { @@ -64,40 +61,47 @@ export const OrgScimSection = () => { } return ( -
-
-

SCIM

- + <> +
+
+
+

SCIM

+ {(isAllowed) => ( )} +
+

Manage SCIM configuration

+
+
+
+

Enable SCIM

+ + {(isAllowed) => ( + { + if (subscription?.scim) { + handleEnableSCIMToggle(value) + } else { + handlePopUpOpen("upgradePlan"); + } + }} + isChecked={currentOrg?.scimEnabled ?? false} + isDisabled={!isAllowed} + /> + )} + +
+

Allow member provisioning/deprovisioning with SCIM

- - {(isAllowed) => ( - { - if (subscription?.scim) { - handleEnableSCIMToggle(value) - } else { - handlePopUpOpen("upgradePlan"); - } - }} - isChecked={currentOrg?.scimEnabled ?? false} - isDisabled={!isAllowed} - > - Enable - - )} - { onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)} text="You can use SCIM Provisioning if you switch to Infisical's Enterprise plan." /> -
+ ); } \ No newline at end of file diff --git a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgSSOSection.tsx b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgSSOSection.tsx index 9f03bdc7f..240a1db2e 100644 --- a/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgSSOSection.tsx +++ b/frontend/src/views/Settings/OrgSettingsPage/components/OrgAuthTab/OrgSSOSection.tsx @@ -1,6 +1,3 @@ -import { faPlus } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; - import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { OrgPermissionCan } from "@app/components/permissions"; import { Button, Switch, UpgradePlanModal } from "@app/components/v2"; @@ -81,49 +78,55 @@ export const OrgSSOSection = (): JSX.Element => { }; return ( -
-
-

SAML

- {!isLoading && ( - - {(isAllowed) => ( - - )} - - )} -
- {/* {data && ( */} -
- - {(isAllowed) => ( - handleSamlSSOToggle(value)} - isChecked={data ? data.isActive : false} - isDisabled={!isAllowed} - > - Enable - - )} - + <> +
+
+
+

SAML

+ {!isLoading && ( + + {(isAllowed) => ( + + )} + + )}
- - handlePopUpToggle("upgradePlan", isOpen)} - text="You can use SAML SSO if you switch to Infisical's Pro plan." - /> -
+

Manage SAML authentication configuration

+
+
+
+

Enable SAML

+ {!isLoading && ( + + {(isAllowed) => ( + handleSamlSSOToggle(value)} + isChecked={data ? data.isActive : false} + isDisabled={!isAllowed} + /> + )} + + )} +
+

Allow members to authenticate into Infisical with SAML

+
+ + handlePopUpToggle("upgradePlan", isOpen)} + text="You can use SAML SSO if you switch to Infisical's Pro plan." + /> + ); }; diff --git a/frontend/src/views/Settings/OrgSettingsPage/components/OrgTabGroup/OrgTabGroup.tsx b/frontend/src/views/Settings/OrgSettingsPage/components/OrgTabGroup/OrgTabGroup.tsx index cacbf1b59..d4c01d0ef 100644 --- a/frontend/src/views/Settings/OrgSettingsPage/components/OrgTabGroup/OrgTabGroup.tsx +++ b/frontend/src/views/Settings/OrgSettingsPage/components/OrgTabGroup/OrgTabGroup.tsx @@ -6,7 +6,7 @@ import { OrgGeneralTab } from "../OrgGeneralTab"; const tabs = [ { name: "General", key: "tab-org-general" }, - { name: "Authentication", key: "tab-org-auth" } + { name: "Security", key: "tab-org-security" } ]; export const OrgTabGroup = () => { return (