import { faInfoCircle, faWarning } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal"; import { createNotification } from "@app/components/notifications"; import { OrgPermissionCan } from "@app/components/permissions"; import { Button, Switch, Tooltip } from "@app/components/v2"; import { OrgPermissionActions, OrgPermissionSubjects, useOrganization, useSubscription } from "@app/context"; import { useGetOIDCConfig, useLogoutUser, useUpdateOrg } from "@app/hooks/api"; import { useUpdateOIDCConfig } from "@app/hooks/api/oidcConfig/mutations"; import { usePopUp } from "@app/hooks/usePopUp"; import { OIDCModal } from "./OIDCModal"; export const OrgOIDCSection = (): JSX.Element => { const { currentOrg } = useOrganization(); const { subscription } = useSubscription(); const { data, isPending } = useGetOIDCConfig(currentOrg?.id ?? ""); const { mutateAsync } = useUpdateOIDCConfig(); const { mutateAsync: updateOrg } = useUpdateOrg(); const logout = useLogoutUser(); const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "addOIDC", "upgradePlan" ] as const); const handleOIDCToggle = async (value: boolean) => { try { if (!currentOrg?.id) return; if (!subscription?.oidcSSO) { handlePopUpOpen("upgradePlan"); return; } await mutateAsync({ organizationId: currentOrg?.id, isActive: value }); createNotification({ text: `Successfully ${value ? "enabled" : "disabled"} OIDC SSO`, type: "success" }); } catch (err) { console.error(err); } }; const handleEnforceOrgAuthToggle = async (value: boolean) => { try { if (!currentOrg?.id) return; if (!subscription?.oidcSSO) { handlePopUpOpen("upgradePlan"); return; } await updateOrg({ orgId: currentOrg?.id, authEnforced: value }); createNotification({ text: `Successfully ${value ? "enforced" : "un-enforced"} org-level auth`, type: "success" }); if (value) { await logout.mutateAsync(); window.open(`/api/v1/sso/oidc/login?orgSlug=${currentOrg.slug}`); window.close(); } } catch (err) { console.error(err); } }; const handleEnableBypassOrgAuthToggle = async (value: boolean) => { try { if (!currentOrg?.id) return; if (!subscription?.oidcSSO) { handlePopUpOpen("upgradePlan"); return; } await updateOrg({ orgId: currentOrg?.id, bypassOrgAuthEnabled: value }); createNotification({ text: `Successfully ${value ? "enabled" : "disabled"} admin bypassing of org-level auth`, type: "success" }); } catch (err) { console.error(err); } }; const handleOIDCGroupManagement = async (value: boolean) => { try { if (!currentOrg?.id) return; if (!subscription?.oidcSSO) { handlePopUpOpen("upgradePlan"); return; } await mutateAsync({ organizationId: currentOrg?.id, manageGroupMemberships: value }); createNotification({ text: `Successfully ${value ? "enabled" : "disabled"} OIDC group membership mapping`, type: "success" }); } catch (err) { console.error(err); } }; const addOidcButtonClick = async () => { if (subscription?.oidcSSO && currentOrg) { handlePopUpOpen("addOIDC"); } else { handlePopUpOpen("upgradePlan"); } }; return (

OIDC

{!isPending && ( {(isAllowed) => ( )} )}

Manage OIDC authentication configuration

{data && (

Enable OIDC

{!isPending && ( {(isAllowed) => ( handleOIDCToggle(value)} isChecked={data ? data.isActive : false} isDisabled={!isAllowed} /> )} )}

Allow members to authenticate into Infisical with OIDC

)}
Enforce OIDC SSO
{(isAllowed) => ( handleEnforceOrgAuthToggle(value)} isDisabled={!isAllowed} /> )}

Enforce users to authenticate via OIDC to access this organization.

{currentOrg?.authEnforced && (
Enable Admin SSO Bypass When this is enabled, we strongly recommend enforcing MFA at the organization level.

In case of a lockout, admins can use the{" "} Admin Login Portal {" "} at{" "} {window.location.origin}/login/admin

} >
{(isAllowed) => ( handleEnableBypassOrgAuthToggle(value)} isDisabled={!isAllowed} /> )}

Allow organization admins to bypass OIDC enforcement when SSO is unavailable, misconfigured, or inaccessible.

)}
OIDC Group Membership Mapping

When this feature is enabled, Infisical will automatically sync group memberships between the OIDC provider and Infisical. Users will be added to Infisical groups that match their OIDC group names, and removed from any Infisical groups not present in their groups claim. When enabled, manual management of Infisical group memberships will be disabled.

To use this feature you must include group claims in the OIDC token.

See your OIDC provider docs for details.

Group membership changes in the OIDC provider only sync with Infisical when a user logs in via OIDC. For example, if you remove a user from a group in the OIDC provider, this change will not be reflected in Infisical until their next OIDC login. To ensure this behavior, Infisical recommends enabling Enforce OIDC SSO.

} >
{(isAllowed) => ( handleOIDCGroupManagement(value)} isDisabled={!isAllowed} /> )}

Infisical will manage user group memberships based on the OIDC provider

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