import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal"; import { createNotification } from "@app/components/notifications"; import { OrgPermissionCan } from "@app/components/permissions"; import { Button, Switch } from "@app/components/v2"; import { OrgPermissionActions, OrgPermissionSubjects, useOrganization, useSubscription } from "@app/context"; import { useCreateSSOConfig, useGetSSOConfig, useUpdateSSOConfig } from "@app/hooks/api"; import { usePopUp } from "@app/hooks/usePopUp"; import { SSOModal } from "./SSOModal"; export const OrgSSOSection = (): JSX.Element => { const { currentOrg } = useOrganization(); const { subscription } = useSubscription(); const { data, isPending } = useGetSSOConfig(currentOrg?.id ?? ""); const { mutateAsync } = useUpdateSSOConfig(); const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "upgradePlan", "addSSO" ] as const); const { mutateAsync: createMutateAsync } = useCreateSSOConfig(); const handleSamlSSOToggle = async (value: boolean) => { try { if (!currentOrg?.id) return; if (!subscription?.samlSSO) { handlePopUpOpen("upgradePlan"); 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" }); } }; const addSSOBtnClick = async () => { try { if (subscription?.samlSSO && currentOrg) { if (!data) { // case: SAML SSO is not configured // -> initialize empty SAML SSO configuration await createMutateAsync({ organizationId: currentOrg.id, authProvider: "okta-saml", isActive: false, entryPoint: "", issuer: "", cert: "" }); } handlePopUpOpen("addSSO"); } else { handlePopUpOpen("upgradePlan"); } } catch (err) { console.error(err); } }; return (
SAML
Manage SAML authentication configuration
Allow members to authenticate into Infisical with SAML