import { faPlus } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider"; import { Button, Switch, UpgradePlanModal } from "@app/components/v2"; import { useOrganization, useSubscription } from "@app/context"; import { useGetSSOConfig, useUpdateSSOConfig } from "@app/hooks/api"; import { usePopUp } from "@app/hooks/usePopUp"; import { SSOModal } from "./SSOModal"; const ssoAuthProviderMap: { [key: string]: string } = { "okta-saml": "Okta SAML 2.0" } export const OrgSSOSection = (): JSX.Element => { const { currentOrg } = useOrganization(); const { subscription } = useSubscription(); const { createNotification } = useNotificationContext(); const { data, isLoading } = useGetSSOConfig(currentOrg?._id ?? ""); const { mutateAsync } = useUpdateSSOConfig(); const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "upgradePlan", "addSSO" ] as const); const handleSamlSSOToggle = async (value: boolean) => { try { if (!currentOrg?._id) return; await mutateAsync({ organizationId: currentOrg?._id, isActive: value }); createNotification({ text: `Successfully ${value ? "enabled" : "disabled"} SAML SSO`, type: "success" }); } catch (err) { console.error(err); createNotification({ text: `Failed to ${value ? "enable" : "disable"} SAML SSO`, type: "error" }); } } return (

SAML SSO Configuration

{!isLoading && ( )}
{!isLoading && data && ( <>
handleSamlSSOToggle(value)} isChecked={data.isActive} > Enable SAML SSO

SSO identifier

{data._id}

Type

{ssoAuthProviderMap[data.authProvider]}

Audience

{data.audience}

Entrypoint

{data.entryPoint}

Issuer

{data.issuer}

)} handlePopUpToggle("upgradePlan", isOpen)} text="You can use SAML SSO if you switch to Infisical's Pro plan." />
); };