Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement: re-vamp sso tab to v3 component and improve ui/ux

Scott Wilson4c41dd537754
diff --git a/DESIGN.md b/DESIGN.md
index ccd82b0ee0..653ae50cf8 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -118,7 +118,8 @@ Tailwind's default scale.
| Button | `text-sm` (md/sm/lg), `text-xs` (xs) | Auto via `Button` sizing |
Sentence case for descriptions, helper text, and empty states. Title Case for
-page titles and button labels. See §8 for voice rules on copy itself.
+page titles, card titles, dialog titles, sheet titles, button labels, badge
+labels, and dropdown menu items. See §8 for voice rules on copy itself.
## 4. Component Stylings
@@ -176,8 +177,8 @@ variants, sizes, and class lists, open the source or its `*.stories.tsx`
| Component | Reach for this when… |
| --- | --- |
| [`Card`](frontend/src/components/v3/generic/Card/Card.tsx) | Default section container — tables, filters, forms, empty states all live in a Card. |
-| [`Sheet`](frontend/src/components/v3/generic/Sheet/Sheet.tsx) | Right-side panel — **use for create/edit forms (not Dialog)**. |
-| [`Dialog`](frontend/src/components/v3/generic/Dialog/Dialog.tsx) | Centered modal — short interactive prompts. Prefer Sheet for forms. |
+| [`Sheet`](frontend/src/components/v3/generic/Sheet/Sheet.tsx) | Right-side panel — **use for large create/edit forms** (multiple fields, multi-step, scrollable detail). |
+| [`Dialog`](frontend/src/components/v3/generic/Dialog/Dialog.tsx) | Centered modal — **use for small create/edit forms** (1–2 fields, single confirmation prompt) and short interactive prompts. |
| [`AlertDialog`](frontend/src/components/v3/generic/AlertDialog/AlertDialog.tsx) | Confirm an action (destructive included). Replaces `confirm()`. |
| [`Popover`](frontend/src/components/v3/generic/Popover/Popover.tsx) | Anchored floating panel — filters, pickers, contextual UI. |
| [`Tooltip`](frontend/src/components/v3/generic/Tooltip/Tooltip.tsx) | Small floating annotation on hover/focus. |
@@ -224,8 +225,8 @@ host component; don't override unless necessary.
- **Page container** — `max-w-8xl` (88rem) centered, `bg-bunker-800`.
- **Page header** — `PageHeader` with scope icon + underlined `h1` + description. See [`PageHeader.tsx`](frontend/src/components/v2/PageHeader/PageHeader.tsx). Always set `scope` to the correct hierarchy level.
- **Section** — one `Card` per logical section. Title + optional `DocumentationLinkBadge` in `CardHeader`; primary action in `CardAction` (top-right).
-- **Tables inside Cards** — filters and search sit in the `CardHeader` above the table; pagination sits in the `CardFooter` or bottom of `CardContent`.
-- **Forms inside Sheets/Dialog** — create / edit flows open in a right-side Sheet or Dialog, never inline, never as a full-page route. Multi-step forms remain inside the Sheet.
+- **Tables inside Cards** — filters and search sit in the `CardHeader` above the table; pagination sits in the `CardFooter` or bottom of `CardContent`. **Empty state** — when the table has no rows (and isn't loading), hide the `Table` entirely and render `Empty` in its place; never leave a column header floating above a blank body. Add `className="border"` to `Empty` whenever it's nested in a `Card`, `Sheet`, or `Dialog` so the dashed frame is visible against the parent surface (the component ships dashed-but-borderless on purpose for page-level use).
+- **Forms inside Sheets/Dialog** — create / edit flows open in a Sheet or Dialog, never inline, never as a full-page route. **Pick by form size:** small forms (1–2 fields, e.g. "Add domain", "Rename") go in a centered `Dialog`; large or multi-step forms (multiple fields, scrollable detail, file uploads, wizard steps) go in a right-side `Sheet`. When in doubt, default to Dialog — Sheet is for cases where Dialog feels cramped.
- **Spacing rhythm** — `gap-1.5` (intra-element), `gap-2 / gap-3` (adjacent elements), `p-4 / p-5` (section padding). Card = `p-5 gap-5`; Sheet header/footer = `p-4`.
## 6. Depth & Elevation
@@ -290,6 +291,9 @@ and the voice reflects that.
- **Labels & buttons** — Title Case, imperative: "Add Secret", "Revoke
Access", "Rotate Key".
+- **Title Case applies to** — buttons, badges, dropdown menu items, card
+ titles, dialog titles, sheet titles, page titles, tab labels, table column
+ headers. Anything that names a thing or an action is Title Case.
- **Descriptions & helper text** — sentence case, one short sentence.
- **Empty states** — state what's missing, then the next action:
"No secrets yet. Add your first secret to get started."
@@ -327,11 +331,16 @@ Pasteable prompt fragments for AI coding agents producing new UI.
> table or content in `CardContent`.
**A new create/edit form:**
-> Put the form in a right-side `Sheet` (`Sheet`, `SheetContent`,
+> Pick the container by form size. **Small forms (1–2 fields, e.g. "Add
+> domain", "Rename"):** centered `Dialog` (`Dialog`, `DialogContent`,
+> `DialogHeader` with `DialogTitle` + `DialogDescription`, `DialogFooter`
+> with the action buttons). **Large or multi-step forms (many fields,
+> scrollable detail, wizards):** right-side `Sheet` (`Sheet`, `SheetContent`,
> `SheetHeader` with `SheetTitle` + `SheetDescription`, `SheetFooter` with
-> the action buttons). Use `react-hook-form` with a Zod resolver. Each input
-> is wrapped in `Field` + `FieldLabel` + `FieldContent` + `FieldError`. Primary button is
-> variant is scope dependent `project`, secondary is `outline`, cancel is `ghost`.
+> the action buttons). Use `react-hook-form` with a Zod resolver in both
+> cases. Each input is wrapped in `Field` + `FieldLabel` + `FieldContent` +
+> `FieldError`. Primary button variant is scope dependent (`project` /
+> `org` / `sub-org`), cancel is `ghost`.
**A status indicator:**
> Use `Badge` from `@app/components/v3`. Pick the variant by intent:
diff --git a/REVIEW.md b/REVIEW.md
new file mode 100644
index 0000000000..18b89aee56
--- /dev/null
+++ b/REVIEW.md
@@ -0,0 +1,58 @@
+# Review instructions
+
+These rules tune Anthropic Code Review for this repo. Keep them tight: long files dilute the rules that matter most. General architecture and patterns live in the `CLAUDE.md` files; this file is for review-only guidance.
+
+## What Important means here
+
+Reserve 🔴 Important for findings that would break behavior in production, leak data, or block a rollback. Specifically:
+
+- Defects in auth, session, MFA, refresh-token, cookie, or permission-check code paths
+- Migrations that aren't reversible, that silently swallow foreign-key or unique-constraint violations, or that fail to restore session-level settings (`statement_timeout`, `lock_timeout`) on the error path
+- Code branched on `LICENSE_SERVER_KEY`, EE flags, or other cloud-vs-self-hosted signals where one branch is unreachable, untested, or skipped entirely (e.g. seeds that early-return on cloud)
+- Logic that mutates persistent state — membership, billing, secrets, identities — before the preceding step has succeeded (canonical case: promoting an invited user before MFA completes)
+- Inconsistent sanitization of string-typed domain values (emails, paths, identifiers) across call sites; bonus Important if the same value is sanitized in one path and passed raw in another
+- New backend dependencies that plausibly affect FIPS compatibility or materially increase the standalone container size
+
+Style, naming, refactoring suggestions, and missing-test observations are 🟡 Nit at most.
+
+## Always check
+
+- Every new API route, mutation, or state transition has a CASL permission check that is exercised by a test — not just present on inspection
+- After a rename, signature change, or move, every call site is updated and types are tightened so the compiler enforces the new contract; flag any remaining string-keyed or stringly-typed access
+- Email / path / identifier sanitization is consistent across every code path; prefer branded types (e.g. `SanitizedEmail`) over a sanitize-on-each-call convention
+- Cookie path consistency: logout must clear what login set. Watch for `/` vs `/api` mismatches on refresh-token cookies
+- Function references in boolean position (`if (!isValidEmailDomain)` where `if (!isValidEmailDomain(domain))` was meant)
+- Falsy checks on strings that can legally be `"0"`, `"30s"`, or other truthy-looking-but-treated-as-empty values; flag `Number(s)` coercions that lose information silently
+- Feature flags added in mock license-fns must also be added in non-mock license-fns; flag asymmetric edits
+- Code touching tokens, cookies, or session state should have considered multi-tab / refresh-grace / revocation-race scenarios; flag changes that don't
+- State-machine flows (signup → MFA → org promotion, invite → accept → membership active): side effects must commit only after the step they belong to
+- Auth methods (email/password, OAuth, SAML, OIDC, LDAP, SCIM) and MFA types (email OTP, TOTP, WebAuthn) — when one path changes, flag the others if they share the touched code
+
+## Do not report
+
+- Anything CI already enforces: ESLint, Prettier, TypeScript type errors, conventional-commit title format, schema validation
+- Generated files: `**/dist/**`, `**/build/**`, `*.lock`, `package-lock.json`, files under `backend/src/db/schemas/` that are emitted by `npm run generate:schema`
+- Documentation under `docs/` unless the change is factually wrong about current product behavior
+- Test-only code that intentionally violates production rules
+- Storybook stories, fixtures, and mock data
+- Suggestions to add unit or e2e tests as standalone Important findings — note them in the summary or as Nits, not as blockers
+
+## Cap the nits
+
+Report at most five 🟡 Nits per review. If you found more, append "plus N similar items" to the summary instead of posting them inline. If every finding is a Nit, open the summary with "No blocking issues."
+
+## On re-review
+
+After the first review of a PR, suppress new Nits and post 🔴 Important findings only. A one-line fix should not reach round seven on style. Pre-existing 🟣 findings discovered on a re-review can still be reported.
+
+## Summary shape
+
+Open the review body with a one-line tally:
+
+> `N important, M nits` — or `No blocking issues` when all findings are nits or none were found.
+
+Lead with the shape, then the details.
+
+## Verification bar
+
+Behavior claims need a `file:line` citation in the source, not an inference from naming or comment text. Do not post a finding that says "function X probably does Y" without grounding it in code that has been read. If verification couldn't confirm the issue, demote to Nit or drop it.
diff --git a/frontend/src/components/v3/generic/Field/Field.tsx b/frontend/src/components/v3/generic/Field/Field.tsx
index f687f897c6..73869b9d44 100644
--- a/frontend/src/components/v3/generic/Field/Field.tsx
+++ b/frontend/src/components/v3/generic/Field/Field.tsx
@@ -94,7 +94,7 @@ const fieldLabelVariants = cva(
cn(
"group/field-label peer/field-label flex w-fit items-center gap-1.5 border-border text-xs leading-snug text-accent transition-colors duration-75 group-data-[disabled=true]/field:opacity-50",
"has-[>[data-slot=field]]:cursor-pointer has-[>[data-slot=field]]:rounded-md",
- "has-[>[data-slot=field]]:border has-[>[data-slot=field]]:bg-container/25 has-[>[data-slot=field]]:hover:bg-container-hover [&>*]:data-[slot=field]:p-2.5 [&>svg]:size-3",
+ "has-[>[data-slot=field]]:border has-[>[data-slot=field]]:bg-transparent has-[>[data-slot=field]]:hover:bg-container-hover [&>*]:data-[slot=field]:p-2.5 [&>svg]:size-3",
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col"
),
{
@@ -133,7 +133,7 @@ function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
<div
data-slot="field-label"
className={cn(
- "flex w-fit items-center gap-2 text-sm leading-snug font-medium text-foreground group-data-[disabled=true]/field:opacity-50",
+ "flex w-fit items-center gap-2 text-sm leading-snug font-medium text-foreground group-data-[disabled=true]/field:opacity-50 [&>svg]:mb-px [&>svg]:size-3.5 [&>svg]:text-muted",
className
)}
{...props}
diff --git a/frontend/src/components/v3/generic/HoverCard/HoverCard.stories.tsx b/frontend/src/components/v3/generic/HoverCard/HoverCard.stories.tsx
new file mode 100644
index 0000000000..c6dc173259
--- /dev/null
+++ b/frontend/src/components/v3/generic/HoverCard/HoverCard.stories.tsx
@@ -0,0 +1,176 @@
+import type { Meta, StoryObj } from "@storybook/react-vite";
+import { ExternalLinkIcon } from "lucide-react";
+
+import { Button } from "../Button";
+import { HoverCard, HoverCardContent, HoverCardTrigger } from "./HoverCard";
+
+/**
+ * Reach for `HoverCard` when a hover gesture should reveal a *rich preview* of
+ * something the user can already see — a profile chip, a referenced resource,
+ * a documentation link. Use `Tooltip` for short label-style hints, `Popover`
+ * when the content is interactive and the user clicks to open it.
+ *
+ * Compose three parts:
+ * - `HoverCard` — the root that owns open state. Accepts `openDelay` (default
+ * `700ms`) and `closeDelay` (default `300ms`) to tune how forgiving the
+ * open/close gesture is.
+ * - `HoverCardTrigger` — the element being hovered. Pair with `asChild` to
+ * forward props onto an inline link, badge, or button rather than rendering
+ * an extra wrapper.
+ * - `HoverCardContent` — the floating panel. Accepts `align`, `side`, and
+ * `sideOffset`, just like `Popover`.
+ *
+ * **Don't** put interactive controls (form fields, primary actions) inside a
+ * hover card — the hover-then-click flow is fragile, and the panel is
+ * unreachable on touch devices. If the content needs interaction, use
+ * `Popover` instead.
+ */
+const meta = {
+ title: "Generic/HoverCard",
+ component: HoverCard,
+ parameters: {
+ layout: "centered"
+ },
+ tags: ["autodocs"],
+ argTypes: {
+ openDelay: { control: "number" },
+ closeDelay: { control: "number" },
+ defaultOpen: { control: "boolean" },
+ open: { table: { disable: true } },
+ onOpenChange: { table: { disable: true } },
+ children: { table: { disable: true } }
+ },
+ args: { openDelay: 200, closeDelay: 150, defaultOpen: false }
+} satisfies Meta<typeof HoverCard>;
+
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+export const Default: Story = {
+ name: "Example: Default",
+ parameters: {
+ docs: {
+ description: {
+ story:
+ "The canonical pairing — wrap an inline documentation link to show the user where they're about to navigate before they click. Pair with `ExternalLinkIcon` for off-site destinations."
+ }
+ }
+ },
+ render: (args) => (
+ <p className="max-w-sm text-sm text-foreground">
+ See{" "}
+ <HoverCard {...args}>
+ <HoverCardTrigger asChild>
+ <a
+ href="https://infisical.com/docs/documentation/platform/sso/overview"
+ target="_blank"
+ rel="noreferrer"
+ className="inline-flex items-center gap-1 underline underline-offset-4 hover:text-foreground"
+ >
+ SSO overview
+ <ExternalLinkIcon className="size-3" />
+ </a>
+ </HoverCardTrigger>
+ <HoverCardContent className="w-72" align="start">
+ <div className="flex flex-col gap-2">
+ <span className="text-sm font-medium text-foreground">SSO overview</span>
+ <p className="text-xs text-muted">
+ How Infisical&apos;s SSO works across SAML, OIDC, and Google OAuth — including the
+ break-glass admin login portal.
+ </p>
+ <span className="text-xs text-accent">infisical.com/docs</span>
+ </div>
+ </HoverCardContent>
+ </HoverCard>{" "}
+ for the full setup guide.
+ </p>
+ )
+};
+
+export const Alignment: Story = {
+ name: "Example: Alignment",
+ parameters: {
+ docs: {
+ description: {
+ story:
+ "`align` controls horizontal placement relative to the trigger edge — `start`, `center` (default), or `end`. Match the trigger's position in the layout so the panel doesn't push off-screen on narrow viewports."
+ }
+ }
+ },
+ render: () => (
+ <div className="flex items-center gap-3">
+ <HoverCard openDelay={150} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <Button variant="outline">align=&quot;start&quot;</Button>
+ </HoverCardTrigger>
+ <HoverCardContent align="start">
+ <p className="text-sm">Panel aligned to the trigger&apos;s leading edge.</p>
+ </HoverCardContent>
+ </HoverCard>
+ <HoverCard openDelay={150} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <Button variant="outline">align=&quot;center&quot;</Button>
+ </HoverCardTrigger>
+ <HoverCardContent align="center">
+ <p className="text-sm">Panel centered on the trigger.</p>
+ </HoverCardContent>
+ </HoverCard>
+ <HoverCard openDelay={150} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <Button variant="outline">align=&quot;end&quot;</Button>
+ </HoverCardTrigger>
+ <HoverCardContent align="end">
+ <p className="text-sm">Panel aligned to the trigger&apos;s trailing edge.</p>
+ </HoverCardContent>
+ </HoverCard>
+ </div>
+ )
+};
+
+export const Sides: Story = {
+ name: "Example: Sides",
+ parameters: {
+ docs: {
+ description: {
+ story:
+ "`side` controls which edge of the trigger the panel opens from — `top`, `right`, `bottom` (default), or `left`. Bump `sideOffset` (default `4`) to give the panel breathing room. Radix flips automatically if there isn't space."
+ }
+ }
+ },
+ render: () => (
+ <div className="grid grid-cols-2 gap-3 p-12">
+ <HoverCard openDelay={150} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <Button variant="outline">side=&quot;top&quot;</Button>
+ </HoverCardTrigger>
+ <HoverCardContent side="top">
+ <p className="text-sm">Opens above the trigger.</p>
+ </HoverCardContent>
+ </HoverCard>
+ <HoverCard openDelay={150} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <Button variant="outline">side=&quot;right&quot;</Button>
+ </HoverCardTrigger>
+ <HoverCardContent side="right" sideOffset={8}>
+ <p className="text-sm">Opens to the right with `sideOffset={8}`.</p>
+ </HoverCardContent>
+ </HoverCard>
+ <HoverCard openDelay={150} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <Button variant="outline">side=&quot;bottom&quot;</Button>
+ </HoverCardTrigger>
+ <HoverCardContent side="bottom">
+ <p className="text-sm">Opens below the trigger (default).</p>
+ </HoverCardContent>
+ </HoverCard>
+ <HoverCard openDelay={150} closeDelay={100}>
+ <HoverCardTrigger asChild>
+ <Button variant="outline">side=&quot;left&quot;</Button>
+ </HoverCardTrigger>
+ <HoverCardContent side="left" sideOffset={8}>
+ <p className="text-sm">Opens to the left with `sideOffset={8}`.</p>
+ </HoverCardContent>
+ </HoverCard>
+ </div>
+ )
+};
diff --git a/frontend/src/components/v3/generic/HoverCard/HoverCard.tsx b/frontend/src/components/v3/generic/HoverCard/HoverCard.tsx
new file mode 100644
index 0000000000..90642dbe9c
--- /dev/null
+++ b/frontend/src/components/v3/generic/HoverCard/HoverCard.tsx
@@ -0,0 +1,43 @@
+/* eslint-disable react/prop-types */
+
+import * as React from "react";
+import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
+
+import { cn } from "../../utils";
+
+function HoverCard({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
+ return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
+}
+
+function HoverCardTrigger({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
+ return <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />;
+}
+
+function HoverCardContent({
+ className,
+ align = "center",
+ sideOffset = 4,
+ ...props
+}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
+ return (
+ <HoverCardPrimitive.Portal data-slot="hover-card-portal">
+ <HoverCardPrimitive.Content
+ data-slot="hover-card-content"
+ align={align}
+ sideOffset={sideOffset}
+ className={cn(
+ "z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-lg bg-popover p-2.5",
+ "border border-border text-sm text-foreground/90 shadow-md outline-hidden",
+ "duration-100 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
+ "data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2",
+ "data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
+ "data-[side=top]:slide-in-from-bottom-2",
+ className
+ )}
+ {...props}
+ />
+ </HoverCardPrimitive.Portal>
+ );
+}
+
+export { HoverCard, HoverCardContent, HoverCardTrigger };
diff --git a/frontend/src/components/v3/generic/HoverCard/index.ts b/frontend/src/components/v3/generic/HoverCard/index.ts
new file mode 100644
index 0000000000..f7accbdb47
--- /dev/null
+++ b/frontend/src/components/v3/generic/HoverCard/index.ts
@@ -0,0 +1 @@
+export * from "./HoverCard";
diff --git a/frontend/src/components/v3/generic/Tooltip/Tooltip.stories.tsx b/frontend/src/components/v3/generic/Tooltip/Tooltip.stories.tsx
index 2e9e11e80d..4130eb072a 100644
--- a/frontend/src/components/v3/generic/Tooltip/Tooltip.stories.tsx
+++ b/frontend/src/components/v3/generic/Tooltip/Tooltip.stories.tsx
@@ -16,6 +16,13 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "./Tooltip";
* with `asChild` to forward the trigger props onto a `Button`, `IconButton`,
* or any focusable element — keep tooltip content to a single short sentence,
* and never put interactive controls inside it.
+ *
+ * **Prefer `HoverCard`** when the hint needs rich content — multi-paragraph
+ * descriptions, links, structured metadata about a referenced entity. Tooltip
+ * content disappears the moment the cursor leaves the trigger, so any link or
+ * action inside is fragile; `HoverCard` keeps the panel open as the cursor
+ * moves into it. Reach for `Popover` instead when the user must click to
+ * commit an interaction (forms, pickers, action menus).
*/
const meta = {
title: "Generic/Tooltip",
diff --git a/frontend/src/components/v3/generic/index.ts b/frontend/src/components/v3/generic/index.ts
index d5ca60d35f..d40e145809 100644
--- a/frontend/src/components/v3/generic/index.ts
+++ b/frontend/src/components/v3/generic/index.ts
@@ -16,6 +16,7 @@ export * from "./Dialog";
export * from "./Dropdown";
export * from "./Empty";
export * from "./Field";
+export * from "./HoverCard";
export * from "./IconButton";
export * from "./Input";
export * from "./InputGroup";
diff --git a/frontend/src/hooks/api/ldapConfig/mutations.tsx b/frontend/src/hooks/api/ldapConfig/mutations.tsx
index 12fc4e1897..0d1c881bcb 100644
--- a/frontend/src/hooks/api/ldapConfig/mutations.tsx
+++ b/frontend/src/hooks/api/ldapConfig/mutations.tsx
@@ -1,6 +1,8 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
+import { oidcConfigKeys } from "@app/hooks/api/oidcConfig/queries";
+import { ssoConfigKeys } from "@app/hooks/api/ssoConfig/queries";
import { ldapConfigKeys } from "./queries";
@@ -50,6 +52,8 @@ export const useCreateLDAPConfig = () => {
},
onSuccess(_, dto) {
queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: oidcConfigKeys.getOIDCConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: ssoConfigKeys.getSSOConfig(dto.organizationId) });
}
});
};
@@ -100,6 +104,8 @@ export const useUpdateLDAPConfig = () => {
},
onSuccess(_, dto) {
queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: oidcConfigKeys.getOIDCConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: ssoConfigKeys.getSSOConfig(dto.organizationId) });
}
});
};
diff --git a/frontend/src/hooks/api/oidcConfig/mutations.tsx b/frontend/src/hooks/api/oidcConfig/mutations.tsx
index 2150a17bc8..c15f8b6b2f 100644
--- a/frontend/src/hooks/api/oidcConfig/mutations.tsx
+++ b/frontend/src/hooks/api/oidcConfig/mutations.tsx
@@ -1,6 +1,8 @@
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
+import { ldapConfigKeys } from "@app/hooks/api/ldapConfig/queries";
+import { ssoConfigKeys } from "@app/hooks/api/ssoConfig/queries";
import { organizationKeys } from "../organization/queries";
import { oidcConfigKeys } from "./queries";
@@ -61,6 +63,8 @@ export const useUpdateOIDCConfig = () => {
},
onSuccess(_, dto) {
queryClient.invalidateQueries({ queryKey: oidcConfigKeys.getOIDCConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: ssoConfigKeys.getSSOConfig(dto.organizationId) });
queryClient.invalidateQueries({ queryKey: organizationKeys.getUserOrganizations });
}
});
@@ -121,6 +125,8 @@ export const useCreateOIDCConfig = () => {
},
onSuccess(_, dto) {
queryClient.invalidateQueries({ queryKey: oidcConfigKeys.getOIDCConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: ssoConfigKeys.getSSOConfig(dto.organizationId) });
}
});
};
diff --git a/frontend/src/hooks/api/ssoConfig/queries.tsx b/frontend/src/hooks/api/ssoConfig/queries.tsx
index 3ee5ec1b11..95d10996d2 100644
--- a/frontend/src/hooks/api/ssoConfig/queries.tsx
+++ b/frontend/src/hooks/api/ssoConfig/queries.tsx
@@ -1,9 +1,11 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
+import { ldapConfigKeys } from "@app/hooks/api/ldapConfig/queries";
+import { oidcConfigKeys } from "@app/hooks/api/oidcConfig/queries";
import { organizationKeys } from "@app/hooks/api/organization/queries";
-const ssoConfigKeys = {
+export const ssoConfigKeys = {
getSSOConfig: (orgId: string) => [{ orgId }, "organization-saml-sso"] as const
};
@@ -59,6 +61,8 @@ export const useCreateSSOConfig = () => {
},
onSuccess(_, dto) {
queryClient.invalidateQueries({ queryKey: ssoConfigKeys.getSSOConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPConfig(dto.organizationId) });
+ queryClient.invalidateQueries({ queryKey: oidcConfigKeys.getOIDCConfig(dto.organizationId) });
}
});
};
@@ -101,6 +105,8 @@ export const useUpdateSSOConfig = () => {
}
queryClient.invalidateQueries({ queryKey: ssoConfigKeys.getSSOConfig(organizationId) });
+ queryClient.invalidateQueries({ queryKey: ldapConfigKeys.getLDAPConfig(organizationId) });
+ queryClient.invalidateQueries({ queryKey: oidcConfigKeys.getOIDCConfig(organizationId) });
}
});
};
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts
index b814da5e15..0980872872 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/submenus.ts
@@ -16,6 +16,7 @@ import {
HardDrive,
IdCardLanyard,
Key,
+ LayoutDashboard,
Lock,
MapPin,
Plug,
@@ -125,6 +126,7 @@ export const getOrgSettingsSubmenu = ({
...(!isSubOrganization
? [
{ label: "SSO", icon: ShieldUser, tab: "sso-settings" },
+ { label: "SSO Dashboard", icon: LayoutDashboard, tab: "sso-dashboard" },
{ label: "Provisioning", icon: Route, tab: "provisioning-settings" },
{ label: "Security", icon: ShieldCheck, tab: "tab-org-security" }
]
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPGroupMapModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPGroupMapModal.tsx
index 9687c5d4d4..eb5ea4f142 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPGroupMapModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPGroupMapModal.tsx
@@ -1,32 +1,49 @@
import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
-import { faUsers, faXmark } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
import { useNavigate } from "@tanstack/react-router";
+import { Trash2 } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
Button,
- DeleteActionModal,
- EmptyState,
- FormControl,
+ Empty,
+ EmptyContent,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
+ Field,
+ FieldError,
+ FieldLabel,
IconButton,
Input,
- Modal,
- ModalContent,
Select,
+ SelectContent,
SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Sheet,
+ SheetContent,
+ SheetHeader,
+ SheetTitle,
+ Skeleton,
Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
- Tr
-} from "@app/components/v2";
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow
+} from "@app/components/v3";
import { useOrganization } from "@app/context";
import {
useCreateLDAPGroupMapping,
@@ -124,155 +141,197 @@ export const LDAPGroupMapModal = ({ popUp, handlePopUpOpen, handlePopUpToggle }:
}, [groups, popUp.ldapGroupMap.isOpen]);
return (
- <Modal
- isOpen={popUp?.ldapGroupMap?.isOpen}
- onOpenChange={(isOpen) => {
- handlePopUpToggle("ldapGroupMap", isOpen);
- reset();
- }}
- >
- <ModalContent title="Manage LDAP Group Mappings">
- {groups && groups.length > 0 && (
- <>
- <h2 className="mb-4">New Group Mapping</h2>
- <form onSubmit={handleSubmit(onFormSubmit)} className="mb-8">
- <div className="flex">
- <Controller
- control={control}
- name="ldapGroupCN"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="LDAP Group CN"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input {...field} placeholder="Engineering" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="groupSlug"
- defaultValue=""
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl
- label="Infisical Group"
- errorText={error?.message}
- isError={Boolean(error)}
- className="ml-4 w-full"
- >
- <div className="flex">
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- {(groups || []).map(({ name, id, slug }) => (
- <SelectItem value={slug} key={`internal-group-${id}`}>
- {name}
- </SelectItem>
+ <>
+ <Sheet
+ open={popUp?.ldapGroupMap?.isOpen}
+ onOpenChange={(isOpen) => {
+ handlePopUpToggle("ldapGroupMap", isOpen);
+ reset();
+ }}
+ >
+ <SheetContent className="sm:max-w-2xl">
+ <div className="flex h-full min-h-0 flex-col">
+ <SheetHeader>
+ <SheetTitle>Manage LDAP Group Mappings</SheetTitle>
+ </SheetHeader>
+ <div className="thin-scrollbar flex-1 overflow-y-auto px-4 py-4">
+ {groups && groups.length > 0 && (
+ <>
+ <form onSubmit={handleSubmit(onFormSubmit)} className="mb-6">
+ <div className="flex items-end gap-3">
+ <Controller
+ control={control}
+ name="ldapGroupCN"
+ render={({ field, fieldState: { error } }) => (
+ <Field className="flex-1">
+ <FieldLabel htmlFor="ldap-group-cn">LDAP Group CN</FieldLabel>
+ <Input
+ id="ldap-group-cn"
+ placeholder="Engineering"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="groupSlug"
+ defaultValue=""
+ render={({ field: { onChange, value }, fieldState: { error } }) => (
+ <Field className="flex-1">
+ <FieldLabel htmlFor="ldap-group-slug">Infisical Group</FieldLabel>
+ <Select value={value} onValueChange={onChange}>
+ <SelectTrigger
+ id="ldap-group-slug"
+ isError={Boolean(error)}
+ className="w-full"
+ >
+ <SelectValue placeholder="Select group" />
+ </SelectTrigger>
+ <SelectContent>
+ {(groups || []).map(({ name, id, slug }) => (
+ <SelectItem value={slug} key={`internal-group-${id}`}>
+ {name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Button type="submit" variant="org" isPending={createIsLoading}>
+ Add Mapping
+ </Button>
+ </div>
+ </form>
+ {(isPending || (groupMaps && groupMaps.length > 0)) && (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>LDAP Group CN</TableHead>
+ <TableHead>Infisical Group</TableHead>
+ <TableHead className="w-px text-right" aria-label="Actions" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {isPending &&
+ Array.from({ length: 3 }).map((_, idx) => (
+ // eslint-disable-next-line react/no-array-index-key
+ <TableRow key={`ldap-group-map-skeleton-${idx}`}>
+ <TableCell colSpan={3}>
+ <Skeleton className="h-5 w-full" />
+ </TableCell>
+ </TableRow>
+ ))}
+ {!isPending &&
+ groupMaps?.map(({ id, ldapGroupCN, group }) => (
+ <TableRow key={`ldap-group-map-${id}`}>
+ <TableCell className="font-medium text-foreground">
+ {ldapGroupCN}
+ </TableCell>
+ <TableCell>{group.name}</TableCell>
+ <TableCell className="text-right">
+ <IconButton
+ variant="ghost"
+ size="xs"
+ aria-label={`Delete mapping for ${ldapGroupCN}`}
+ onClick={() =>
+ handlePopUpOpen("deleteLdapGroupMap", {
+ ldapGroupMapId: id,
+ ldapGroupCN
+ })
+ }
+ >
+ <Trash2 />
+ </IconButton>
+ </TableCell>
+ </TableRow>
))}
- </Select>
- <Button
- className="ml-4"
- size="sm"
- type="submit"
- isLoading={createIsLoading}
- >
- Add mapping
- </Button>
- </div>
- </FormControl>
+ </TableBody>
+ </Table>
+ )}
+ {!isPending && groupMaps?.length === 0 && (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No LDAP group mappings</EmptyTitle>
+ <EmptyDescription>
+ Add a mapping above to assign LDAP groups to Infisical groups.
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
)}
- />
- </div>
- </form>
- <h2 className="mb-4">Group Mappings</h2>
- <TableContainer>
- <Table>
- <THead>
- <Tr>
- <Th>LDAP Group CN</Th>
- <Th>Infisical Group</Th>
- <Th className="w-5" />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={3} innerKey="ldap-group-maps" />}
- {!isPending &&
- groupMaps?.map(({ id, ldapGroupCN, group }) => {
- return (
- <Tr className="h-10 items-center" key={`ldap-group-map-${id}`}>
- <Td>{ldapGroupCN}</Td>
- <Td>{group.name}</Td>
- <Td>
- <IconButton
- onClick={() => {
- handlePopUpOpen("deleteLdapGroupMap", {
- ldapGroupMapId: id,
- ldapGroupCN
- });
- }}
- size="lg"
- colorSchema="danger"
- variant="plain"
- ariaLabel="update"
- >
- <FontAwesomeIcon icon={faXmark} />
- </IconButton>
- </Td>
- </Tr>
- );
- })}
- </TBody>
- </Table>
- {groupMaps?.length === 0 && (
- <EmptyState title="No LDAP group mappings found" icon={faUsers} />
+ </>
)}
- </TableContainer>
- <DeleteActionModal
- isOpen={popUp.deleteLdapGroupMap.isOpen}
- title={`Are you sure you want to delete the group mapping for ${
- (popUp?.deleteLdapGroupMap?.data as { ldapGroupCN: string })?.ldapGroupCN || ""
- }?`}
- onChange={(isOpen) => handlePopUpToggle("deleteLdapGroupMap", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={() => {
- const deleteLdapGroupMapData = popUp?.deleteLdapGroupMap?.data as {
+ {groups && groups.length === 0 && (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No Infisical groups</EmptyTitle>
+ <EmptyDescription>
+ Create an Infisical group in your organization before mapping LDAP groups.
+ </EmptyDescription>
+ <EmptyContent>
+ <Button
+ variant="org"
+ onClick={() =>
+ navigate({
+ to: "/organizations/$orgId/access-management",
+ params: { orgId: currentOrg.id }
+ })
+ }
+ >
+ Create group
+ </Button>
+ </EmptyContent>
+ </EmptyHeader>
+ </Empty>
+ )}
+ </div>
+ </div>
+ </SheetContent>
+ </Sheet>
+
+ <AlertDialog
+ open={popUp.deleteLdapGroupMap.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteLdapGroupMap", isOpen)}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <Trash2 />
+ </AlertDialogMedia>
+ <AlertDialogTitle>
+ Delete group mapping for &quot;
+ {(popUp?.deleteLdapGroupMap?.data as { ldapGroupCN: string })?.ldapGroupCN || ""}
+ &quot;?
+ </AlertDialogTitle>
+ <AlertDialogDescription>
+ Members of this LDAP group will no longer be added to the mapped Infisical group.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction
+ variant="danger"
+ onClick={() => {
+ const data = popUp?.deleteLdapGroupMap?.data as {
ldapGroupMapId: string;
ldapGroupCN: string;
};
return onDeleteGroupMapSubmit({
ldapConfigId: ldapConfig?.id ?? "",
- ldapGroupMapId: deleteLdapGroupMapData.ldapGroupMapId,
- ldapGroupCN: deleteLdapGroupMapData.ldapGroupCN
+ ldapGroupMapId: data.ldapGroupMapId,
+ ldapGroupCN: data.ldapGroupCN
});
}}
- />
- </>
- )}
- {groups && groups.length === 0 && (
- <div>
- <div>
- You do not have any Infisical groups in your organization. Create one in order to
- proceed.
- </div>
- <Button
- className="mt-4"
- size="sm"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/access-management",
- params: { orgId: currentOrg.id }
- })
- }
>
- Create
- </Button>
- </div>
- )}
- </ModalContent>
- </Modal>
+ Delete
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx
index 01429f5120..6c75776878 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/LDAPModal.tsx
@@ -1,18 +1,34 @@
import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
+import { Trash2 } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
Button,
- DeleteActionModal,
- FormControl,
+ DocumentationLinkBadge,
+ Field,
+ FieldError,
+ FieldGroup,
+ FieldLabel,
Input,
- Modal,
- ModalContent,
+ Sheet,
+ SheetContent,
+ SheetFooter,
+ SheetHeader,
+ SheetTitle,
TextArea
-} from "@app/components/v2";
+} from "@app/components/v3";
import { useOrganization } from "@app/context";
import { useToggle } from "@app/hooks";
import {
@@ -24,13 +40,13 @@ import {
import { UsePopUpState } from "@app/hooks/usePopUp";
const LDAPFormSchema = z.object({
- url: z.string().default(""),
- bindDN: z.string().default(""),
- bindPass: z.string().default(""),
- searchBase: z.string().default(""),
+ url: z.string().trim().min(1, "URL is required"),
+ bindDN: z.string().trim().min(1, "Bind DN is required"),
+ bindPass: z.string().min(1, "Bind Pass is required"),
+ searchBase: z.string().trim().min(1, "User Search Base is required"),
+ groupSearchBase: z.string().default(""),
searchFilter: z.string().default(""),
uniqueUserAttribute: z.string().default(""),
- groupSearchBase: z.string().default(""),
groupSearchFilter: z.string().default(""),
caCert: z.string().optional()
});
@@ -57,6 +73,7 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
});
const [isDeletePopupOpen, setIsDeletePopupOpen] = useToggle();
+ const [isBindPassFocused, setIsBindPassFocused] = useToggle();
const handleLdapSoftDelete = async () => {
if (!currentOrg) {
@@ -77,7 +94,7 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
});
createNotification({
- text: "Successfully deleted OIDC configuration.",
+ text: "Successfully deleted LDAP configuration.",
type: "success"
});
};
@@ -112,9 +129,8 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
searchFilter,
groupSearchBase,
groupSearchFilter,
- caCert,
- shouldCloseModal = true
- }: TLDAPFormData & { shouldCloseModal?: boolean }) => {
+ caCert
+ }: TLDAPFormData) => {
if (!currentOrg) return;
if (!data) {
@@ -146,9 +162,7 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
});
}
- if (shouldCloseModal) {
- handlePopUpClose("addLDAP");
- }
+ handlePopUpClose("addLDAP");
createNotification({
text: `Successfully ${!data ? "added" : "updated"} LDAP configuration`,
@@ -170,155 +184,246 @@ export const LDAPModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
});
};
+ const isPending = createIsLoading || updateIsLoading;
+ const isExistingConfig = Boolean(data?.url);
+
return (
<>
- <Modal
- isOpen={popUp?.addLDAP?.isOpen}
+ <Sheet
+ open={popUp?.addLDAP?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("addLDAP", isOpen);
reset();
}}
>
- <ModalContent title="Manage LDAP configuration">
- <form onSubmit={handleSubmit(onSSOModalSubmit)}>
- <Controller
- control={control}
- name="url"
- render={({ field, fieldState: { error } }) => (
- <FormControl label="URL" errorText={error?.message} isError={Boolean(error)}>
- <Input {...field} placeholder="ldaps://ldap.myorg.com:636" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="bindDN"
- render={({ field, fieldState: { error } }) => (
- <FormControl label="Bind DN" errorText={error?.message} isError={Boolean(error)}>
- <Input {...field} placeholder="cn=infisical,ou=Users,dc=example,dc=com" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="bindPass"
- render={({ field, fieldState: { error } }) => (
- <FormControl label="Bind Pass" errorText={error?.message} isError={Boolean(error)}>
- <Input {...field} type="password" placeholder="********" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="searchBase"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="User Search Base / User DN"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input {...field} placeholder="ou=people,dc=acme,dc=com" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="uniqueUserAttribute"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Unique User Attribute (Optional)"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input {...field} placeholder="uidNumber" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="searchFilter"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="User Search Filter (Optional)"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input {...field} placeholder="(uid={{username}})" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="groupSearchBase"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Group Search Base / Group DN (Optional)"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input {...field} placeholder="ou=groups,dc=acme,dc=com" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="groupSearchFilter"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Group Filter (Optional)"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input
- {...field}
- placeholder="(&(objectClass=posixGroup)(memberUid={{.Username}}))"
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="caCert"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="CA Certificate"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <TextArea {...field} placeholder="-----BEGIN CERTIFICATE----- ..." />
- </FormControl>
- )}
- />
- <div className="mt-8 flex justify-between">
- <div className="flex items-center">
- <Button
- className="mr-4"
- size="sm"
- type="submit"
- isLoading={createIsLoading || updateIsLoading}
- >
- {!data ? "Add" : "Update"}
+ <SheetContent className="sm:max-w-xl">
+ <form onSubmit={handleSubmit(onSSOModalSubmit)} className="flex h-full min-h-0 flex-col">
+ <SheetHeader>
+ <SheetTitle className="flex items-center gap-x-2">
+ Manage LDAP Configuration
+ <DocumentationLinkBadge href="https://infisical.com/docs/integrations/user-authentication" />
+ </SheetTitle>
+ </SheetHeader>
+ <div className="flex thin-scrollbar flex-1 flex-col overflow-y-auto px-4">
+ <FieldGroup className="mb-auto">
+ <Controller
+ control={control}
+ name="url"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="ldap-url">URL</FieldLabel>
+ <Input
+ id="ldap-url"
+ placeholder="ldaps://ldap.myorg.com:636"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="bindDN"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="ldap-bind-dn">Bind DN</FieldLabel>
+ <Input
+ id="ldap-bind-dn"
+ placeholder="cn=infisical,ou=Users,dc=example,dc=com"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="bindPass"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="ldap-bind-pass">Bind Pass</FieldLabel>
+ <Input
+ id="ldap-bind-pass"
+ placeholder="********"
+ type={isBindPassFocused ? "text" : "password"}
+ autoComplete="off"
+ isError={Boolean(error)}
+ onFocus={() => setIsBindPassFocused.on()}
+ {...field}
+ onBlur={() => {
+ field.onBlur();
+ setIsBindPassFocused.off();
+ }}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="searchBase"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="ldap-search-base">User Search Base / User DN</FieldLabel>
+ <Input
+ id="ldap-search-base"
+ placeholder="ou=people,dc=acme,dc=com"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="uniqueUserAttribute"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="ldap-unique-user-attribute">
+ Unique User Attribute (Optional)
+ </FieldLabel>
+ <Input
+ id="ldap-unique-user-attribute"
+ placeholder="uidNumber"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="searchFilter"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="ldap-search-filter">
+ User Search Filter (Optional)
+ </FieldLabel>
+ <Input
+ id="ldap-search-filter"
+ placeholder="(uid={{username}})"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="groupSearchBase"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="ldap-group-search-base">
+ Group Search Base / Group DN (Optional)
+ </FieldLabel>
+ <Input
+ id="ldap-group-search-base"
+ placeholder="ou=groups,dc=acme,dc=com"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="groupSearchFilter"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="ldap-group-search-filter">
+ Group Filter (Optional)
+ </FieldLabel>
+ <Input
+ id="ldap-group-search-filter"
+ placeholder="(&(objectClass=posixGroup)(memberUid={{.Username}}))"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="caCert"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="ldap-ca-cert">CA Certificate</FieldLabel>
+ <TextArea
+ id="ldap-ca-cert"
+ placeholder="-----BEGIN CERTIFICATE----- ..."
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ </FieldGroup>
+ <Button
+ type="button"
+ variant="outline"
+ isFullWidth
+ size="lg"
+ className="my-4"
+ onClick={handleTestLDAPConnection}
+ isDisabled={!watchUrl || !watchBindDN || !watchBindPass}
+ >
+ Test Connection
+ </Button>
+ </div>
+ <SheetFooter className="justify-between border-t">
+ <div className="flex gap-2">
+ <Button type="submit" variant="org" isPending={isPending}>
+ {isExistingConfig ? "Update" : "Configure LDAP"}
</Button>
- <Button colorSchema="secondary" onClick={handleTestLDAPConnection}>
- Test Connection
+ <Button type="button" variant="ghost" onClick={() => handlePopUpClose("addLDAP")}>
+ Cancel
</Button>
</div>
{!hideDelete && (
- <Button colorSchema="danger" onClick={() => setIsDeletePopupOpen.on()}>
+ <Button type="button" variant="danger" onClick={() => setIsDeletePopupOpen.on()}>
Delete
</Button>
)}
- </div>
+ </SheetFooter>
</form>
- </ModalContent>
- </Modal>
- <DeleteActionModal
- isOpen={isDeletePopupOpen}
- title="Are you sure you want to delete LDAP?"
- onChange={() => setIsDeletePopupOpen.toggle()}
- deleteKey="confirm"
- onDeleteApproved={handleLdapSoftDelete}
- />
+ </SheetContent>
+ </Sheet>
+
+ <AlertDialog open={isDeletePopupOpen} onOpenChange={() => setIsDeletePopupOpen.toggle()}>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <Trash2 />
+ </AlertDialogMedia>
+ <AlertDialogTitle>Delete LDAP Configuration?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This clears the LDAP connection. Members will no longer be able to sign in via LDAP
+ until it&apos;s reconfigured.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction variant="danger" onClick={handleLdapSoftDelete}>
+ Delete
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
</>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx
index be5d8e840d..fc4bd7a889 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OIDCModal.tsx
@@ -1,19 +1,39 @@
import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
+import { Trash2 } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
Button,
- DeleteActionModal,
- FormControl,
+ DocumentationLinkBadge,
+ Field,
+ FieldDescription,
+ FieldError,
+ FieldGroup,
+ FieldLabel,
Input,
- Modal,
- ModalContent,
Select,
- SelectItem
-} from "@app/components/v2";
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Sheet,
+ SheetContent,
+ SheetFooter,
+ SheetHeader,
+ SheetTitle
+} from "@app/components/v3";
import { useOrganization } from "@app/context";
import { useToggle } from "@app/hooks";
import { useGetOIDCConfig } from "@app/hooks/api";
@@ -36,16 +56,16 @@ type Props = {
const schema = z
.object({
configurationType: z.string(),
- issuer: z.string().optional(),
- discoveryURL: z.string().optional(),
- authorizationEndpoint: z.string().optional(),
- jwksUri: z.string().optional(),
- tokenEndpoint: z.string().optional(),
- userinfoEndpoint: z.string().optional(),
- clientId: z.string().min(1),
- clientSecret: z.string().min(1),
- allowedEmailDomains: z.string().optional(),
- jwtSignatureAlgorithm: z.nativeEnum(OIDCJWTSignatureAlgorithm).optional()
+ issuer: z.string().nullish(),
+ discoveryURL: z.string().nullish(),
+ authorizationEndpoint: z.string().nullish(),
+ jwksUri: z.string().nullish(),
+ tokenEndpoint: z.string().nullish(),
+ userinfoEndpoint: z.string().nullish(),
+ clientId: z.string().min(1, "Client ID is required"),
+ clientSecret: z.string().min(1, "Client Secret is required"),
+ allowedEmailDomains: z.string().nullish(),
+ jwtSignatureAlgorithm: z.nativeEnum(OIDCJWTSignatureAlgorithm).nullish()
})
.superRefine((data, ctx) => {
if (data.configurationType === ConfigurationType.CUSTOM) {
@@ -84,15 +104,12 @@ const schema = z
code: z.ZodIssueCode.custom
});
}
- } else {
- // eslint-disable-next-line no-lonely-if
- if (!data.discoveryURL) {
- ctx.addIssue({
- path: ["discoveryURL"],
- message: "Discovery URL is required",
- code: z.ZodIssueCode.custom
- });
- }
+ } else if (!data.discoveryURL) {
+ ctx.addIssue({
+ path: ["discoveryURL"],
+ message: "Discovery URL is required",
+ code: z.ZodIssueCode.custom
+ });
}
});
@@ -107,21 +124,22 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
const { data } = useGetOIDCConfig(currentOrg?.id ?? "");
- const { control, handleSubmit, reset, setValue, watch } = useForm<OIDCFormData>({
+ const { control, handleSubmit, reset, setValue, watch, formState } = useForm<OIDCFormData>({
resolver: zodResolver(schema),
defaultValues: {
configurationType: ConfigurationType.DISCOVERY_URL
}
});
+ console.log("state", formState.errors);
+
const [isClientIdFocused, setIsClientIdFocused] = useToggle();
const [isClientSecretFocused, setIsClientSecretFocused] = useToggle();
const configurationTypeValue = watch("configurationType");
+
const handleOidcSoftDelete = async () => {
- if (!currentOrg) {
- return;
- }
+ if (!currentOrg) return;
await updateMutateAsync({
issuer: "",
discoveryURL: "",
@@ -171,303 +189,340 @@ export const OIDCModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDele
clientSecret,
jwtSignatureAlgorithm
}: OIDCFormData) => {
- if (!currentOrg) {
- return;
- }
+ if (!currentOrg) return;
+
+ const payload = {
+ issuer,
+ configurationType,
+ discoveryURL,
+ authorizationEndpoint,
+ allowedEmailDomains,
+ jwksUri,
+ tokenEndpoint,
+ userinfoEndpoint,
+ clientId,
+ clientSecret,
+ isActive: true,
+ organizationId: currentOrg.id,
+ jwtSignatureAlgorithm
+ };
if (!data) {
- await createMutateAsync({
- issuer,
- configurationType,
- discoveryURL,
- authorizationEndpoint,
- allowedEmailDomains,
- jwksUri,
- tokenEndpoint,
- userinfoEndpoint,
- clientId,
- clientSecret,
- isActive: true,
- organizationId: currentOrg.id,
- jwtSignatureAlgorithm
- });
+ await createMutateAsync(payload);
} else {
- await updateMutateAsync({
- issuer,
- configurationType,
- discoveryURL,
- authorizationEndpoint,
- allowedEmailDomains,
- jwksUri,
- tokenEndpoint,
- userinfoEndpoint,
- clientId,
- clientSecret,
- isActive: true,
- organizationId: currentOrg.id,
- jwtSignatureAlgorithm
- });
+ await updateMutateAsync(payload);
}
handlePopUpClose("addOIDC");
createNotification({
- text: `Successfully ${!data ? "added" : "updated"} OIDC SSO configuration`,
+ text: `Successfully ${data?.isActive ? "updated" : "added"} OIDC SSO configuration`,
type: "success"
});
};
+ const isPending = createIsLoading || updateIsLoading;
+ const isExistingConfig = Boolean(data?.isActive);
+
return (
<>
- <Modal
- isOpen={popUp?.addOIDC?.isOpen}
+ <Sheet
+ open={popUp?.addOIDC?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("addOIDC", isOpen);
reset();
}}
>
- <ModalContent title="Manage OIDC configuration">
- <form onSubmit={handleSubmit(onOIDCModalSubmit)}>
- <Controller
- control={control}
- name="configurationType"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl
- label="Configuration Type"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Select
- className="w-full"
- defaultValue="discoveryURL"
- {...field}
- onValueChange={(e) => onChange(e)}
- >
- <SelectItem value={ConfigurationType.DISCOVERY_URL}>Discovery URL</SelectItem>
- <SelectItem value={ConfigurationType.CUSTOM}>Custom</SelectItem>
- </Select>
- </FormControl>
- )}
- />
- {configurationTypeValue === ConfigurationType.DISCOVERY_URL && (
- <Controller
- control={control}
- name="discoveryURL"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Discovery Document URL"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input
- {...field}
- placeholder="https://accounts.google.com/.well-known/openid-configuration"
- autoComplete="off"
- />
- </FormControl>
- )}
- />
- )}
- {configurationTypeValue === ConfigurationType.CUSTOM && (
- <>
+ <SheetContent className="sm:max-w-xl">
+ <form onSubmit={handleSubmit(onOIDCModalSubmit)} className="flex h-full min-h-0 flex-col">
+ <SheetHeader>
+ <SheetTitle className="flex items-center gap-x-2">
+ Manage OIDC Configuration
+ <DocumentationLinkBadge href="https://infisical.com/docs/integrations/user-authentication" />
+ </SheetTitle>
+ </SheetHeader>
+ <div className="thin-scrollbar flex-1 overflow-y-auto px-4">
+ <FieldGroup>
<Controller
control={control}
- name="issuer"
- render={({ field, fieldState: { error } }) => (
- <FormControl label="Issuer" errorText={error?.message} isError={Boolean(error)}>
- <Input
- {...field}
- placeholder="https://accounts.google.com"
- autoComplete="off"
- />
- </FormControl>
+ name="configurationType"
+ render={({ field: { onChange, value }, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="oidc-configuration-type">Configuration Type</FieldLabel>
+ <Select value={value} onValueChange={onChange}>
+ <SelectTrigger
+ id="oidc-configuration-type"
+ className="w-full"
+ isError={Boolean(error)}
+ >
+ <SelectValue placeholder="Select configuration type" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value={ConfigurationType.DISCOVERY_URL}>
+ Discovery URL
+ </SelectItem>
+ <SelectItem value={ConfigurationType.CUSTOM}>Custom</SelectItem>
+ </SelectContent>
+ </Select>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
+ {configurationTypeValue === ConfigurationType.DISCOVERY_URL && (
+ <Controller
+ control={control}
+ name="discoveryURL"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="oidc-discovery-url">Discovery Document URL</FieldLabel>
+ <Input
+ id="oidc-discovery-url"
+ placeholder="https://accounts.google.com/.well-known/openid-configuration"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ )}
+ {configurationTypeValue === ConfigurationType.CUSTOM && (
+ <>
+ <Controller
+ control={control}
+ name="issuer"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="oidc-issuer">Issuer</FieldLabel>
+ <Input
+ id="oidc-issuer"
+ placeholder="https://accounts.google.com"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="authorizationEndpoint"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="oidc-authorization-endpoint">
+ Authorization Endpoint
+ </FieldLabel>
+ <Input
+ id="oidc-authorization-endpoint"
+ placeholder="https://accounts.google.com/o/oauth2/v2/auth"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="tokenEndpoint"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="oidc-token-endpoint">Token Endpoint</FieldLabel>
+ <Input
+ id="oidc-token-endpoint"
+ placeholder="https://oauth2.googleapis.com/token"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="userinfoEndpoint"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="oidc-userinfo-endpoint">
+ Userinfo Endpoint
+ </FieldLabel>
+ <Input
+ id="oidc-userinfo-endpoint"
+ placeholder="https://openidconnect.googleapis.com/v1/userinfo"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="jwksUri"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="oidc-jwks-uri">JWKS URI</FieldLabel>
+ <Input
+ id="oidc-jwks-uri"
+ placeholder="https://www.googleapis.com/oauth2/v3/certs"
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ </>
+ )}
<Controller
control={control}
- name="authorizationEndpoint"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Authorization Endpoint"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input
- {...field}
- placeholder="https://accounts.google.com/o/oauth2/v2/auth"
- autoComplete="off"
- />
- </FormControl>
+ defaultValue={OIDCJWTSignatureAlgorithm.RS256}
+ name="jwtSignatureAlgorithm"
+ render={({ field: { onChange, value }, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel
+ htmlFor="oidc-jwt-algorithm"
+ className="inline-flex flex-wrap items-baseline gap-1.5"
+ >
+ JWT Signature Algorithm
+ </FieldLabel>
+ <Select value={value} onValueChange={onChange}>
+ <SelectTrigger
+ id="oidc-jwt-algorithm"
+ className="w-full"
+ isError={Boolean(error)}
+ >
+ <SelectValue placeholder="Select algorithm" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value={OIDCJWTSignatureAlgorithm.RS256}>RS256</SelectItem>
+ <SelectItem value={OIDCJWTSignatureAlgorithm.RS512}>RS512</SelectItem>
+ <SelectItem value={OIDCJWTSignatureAlgorithm.HS256}>HS256</SelectItem>
+ <SelectItem value={OIDCJWTSignatureAlgorithm.EDDSA}>EdDSA</SelectItem>
+ </SelectContent>
+ </Select>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
control={control}
- name="tokenEndpoint"
+ name="allowedEmailDomains"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Token Endpoint"
- errorText={error?.message}
- isError={Boolean(error)}
- >
+ <Field>
+ <FieldLabel
+ htmlFor="oidc-allowed-domains"
+ className="inline-flex flex-wrap items-baseline gap-1.5"
+ >
+ Allowed Email Domains (optional)
+ </FieldLabel>
<Input
- {...field}
- placeholder="https://oauth2.googleapis.com/token"
+ id="oidc-allowed-domains"
+ placeholder="infisical.com, *.google.com"
autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
/>
- </FormControl>
+ <FieldDescription>
+ Defaults to any. Supports wildcards (e.g. *.example.com).
+ </FieldDescription>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
control={control}
- name="userinfoEndpoint"
+ name="clientId"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="User info endpoint"
- errorText={error?.message}
- isError={Boolean(error)}
- >
+ <Field>
+ <FieldLabel htmlFor="oidc-client-id">Client ID</FieldLabel>
<Input
- {...field}
- placeholder="https://openidconnect.googleapis.com/v1/userinfo"
+ id="oidc-client-id"
+ placeholder="Client ID"
+ type={isClientIdFocused ? "text" : "password"}
autoComplete="off"
+ isError={Boolean(error)}
+ onFocus={() => setIsClientIdFocused.on()}
+ {...field}
+ onBlur={() => {
+ field.onBlur();
+ setIsClientIdFocused.off();
+ }}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
<Controller
control={control}
- name="jwksUri"
+ name="clientSecret"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="JWKS URI"
- errorText={error?.message}
- isError={Boolean(error)}
- >
+ <Field>
+ <FieldLabel htmlFor="oidc-client-secret">Client Secret</FieldLabel>
<Input
- {...field}
- placeholder="https://www.googleapis.com/oauth2/v3/certs"
+ id="oidc-client-secret"
+ placeholder="Client Secret"
+ type={isClientSecretFocused ? "text" : "password"}
autoComplete="off"
+ isError={Boolean(error)}
+ onFocus={() => setIsClientSecretFocused.on()}
+ {...field}
+ onBlur={() => {
+ field.onBlur();
+ setIsClientSecretFocused.off();
+ }}
/>
- </FormControl>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- </>
- )}
- <Controller
- control={control}
- defaultValue={OIDCJWTSignatureAlgorithm.RS256}
- name="jwtSignatureAlgorithm"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl
- className="w-full"
- label="JWT Signature Algorithm"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Select
- defaultValue={field.value}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- <SelectItem value={OIDCJWTSignatureAlgorithm.RS256}>RS256</SelectItem>
- <SelectItem value={OIDCJWTSignatureAlgorithm.RS512}>RS512</SelectItem>
- <SelectItem value={OIDCJWTSignatureAlgorithm.HS256}>HS256</SelectItem>
- <SelectItem value={OIDCJWTSignatureAlgorithm.EDDSA}>EdDSA</SelectItem>
- </Select>
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="allowedEmailDomains"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Allowed Email Domains (defaults to any, supports wildcards e.g. *.example.com)"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input {...field} placeholder="infisical.com, *.google.com" autoComplete="off" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="clientId"
- render={({ field, fieldState: { error } }) => (
- <FormControl label="Client ID" errorText={error?.message} isError={Boolean(error)}>
- <Input
- placeholder="Client ID"
- type={isClientIdFocused ? "text" : "password"}
- onFocus={() => setIsClientIdFocused.on()}
- {...field}
- onBlur={() => {
- field.onBlur();
- setIsClientIdFocused.off();
- }}
- autoComplete="off"
- className="bg-mineshaft-800"
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="clientSecret"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Client Secret"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input
- {...field}
- placeholder="Client Secret"
- type={isClientSecretFocused ? "text" : "password"}
- autoComplete="off"
- onFocus={() => setIsClientSecretFocused.on()}
- onBlur={() => {
- field.onBlur();
- setIsClientSecretFocused.off();
- }}
- className="bg-mineshaft-800"
- />
- </FormControl>
- )}
- />
- <div className="mt-8 flex justify-between">
- <div className="flex items-center">
- <Button
- className="mr-4"
- size="sm"
- type="submit"
- isLoading={createIsLoading || updateIsLoading}
- >
- {!data ? "Add" : "Update"}
+ </FieldGroup>
+ </div>
+ <SheetFooter className="justify-between border-t">
+ <div className="flex gap-2">
+ <Button type="submit" variant="org" isPending={isPending}>
+ {isExistingConfig ? "Update Configuration" : "Configure OIDC"}
</Button>
- <Button
- colorSchema="secondary"
- variant="plain"
- onClick={() => handlePopUpClose("addOIDC")}
- >
+ <Button type="button" variant="ghost" onClick={() => handlePopUpClose("addOIDC")}>
Cancel
</Button>
</div>
{!hideDelete && (
- <Button colorSchema="danger" onClick={() => setIsDeletePopupOpen.on()}>
+ <Button type="button" variant="danger" onClick={() => setIsDeletePopupOpen.on()}>
Delete
</Button>
)}
- </div>
+ </SheetFooter>
</form>
- </ModalContent>
- </Modal>
- <DeleteActionModal
- isOpen={isDeletePopupOpen}
- title="Are you sure you want to delete OIDC?"
- onChange={() => setIsDeletePopupOpen.toggle()}
- deleteKey="confirm"
- onDeleteApproved={handleOidcSoftDelete}
- />
+ </SheetContent>
+ </Sheet>
+
+ <AlertDialog open={isDeletePopupOpen} onOpenChange={() => setIsDeletePopupOpen.toggle()}>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <Trash2 />
+ </AlertDialogMedia>
+ <AlertDialogTitle>Delete OIDC Configuration?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This clears the OIDC connection. Members will no longer be able to sign in via OIDC
+ until it&apos;s reconfigured.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction variant="danger" onClick={handleOidcSoftDelete}>
+ Delete
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
</>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/AddEmailDomainModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/AddEmailDomainModal.tsx
index 77c2460309..99c921f9f0 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/AddEmailDomainModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/AddEmailDomainModal.tsx
@@ -3,8 +3,20 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
-import { useCreateEmailDomain } from "@app/hooks/api";
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Field,
+ FieldError,
+ FieldLabel,
+ Input
+} from "@app/components/v3";
+import { TEmailDomain, useCreateEmailDomain } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
const addDomainFormSchema = z.object({
@@ -24,9 +36,15 @@ type Props = {
popUp: UsePopUpState<["addDomain"]>;
handlePopUpClose: (popUpName: keyof UsePopUpState<["addDomain"]>) => void;
handlePopUpToggle: (popUpName: keyof UsePopUpState<["addDomain"]>, state?: boolean) => void;
+ onCreated?: (emailDomain: TEmailDomain) => void;
};
-export const AddEmailDomainModal = ({ popUp, handlePopUpClose, handlePopUpToggle }: Props) => {
+export const AddEmailDomainModal = ({
+ popUp,
+ handlePopUpClose,
+ handlePopUpToggle,
+ onCreated
+}: Props) => {
const { control, handleSubmit, reset } = useForm<TAddDomainForm>({
resolver: zodResolver(addDomainFormSchema)
});
@@ -35,13 +53,14 @@ export const AddEmailDomainModal = ({ popUp, handlePopUpClose, handlePopUpToggle
const onFormSubmit = async ({ domain }: TAddDomainForm) => {
try {
- await createEmailDomain({ domain });
+ const emailDomain = await createEmailDomain({ domain });
createNotification({
text: "Email domain added. Follow the DNS verification steps to complete setup.",
type: "success"
});
handlePopUpClose("addDomain");
reset();
+ onCreated?.(emailDomain);
} catch (error) {
createNotification({
text: (error as Error)?.message || "Failed to add email domain",
@@ -51,39 +70,41 @@ export const AddEmailDomainModal = ({ popUp, handlePopUpClose, handlePopUpToggle
};
return (
- <Modal
- isOpen={popUp?.addDomain?.isOpen}
+ <Dialog
+ open={popUp?.addDomain?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("addDomain", isOpen);
reset();
}}
>
- <ModalContent title="Add Email Domain" subTitle="Add a domain to verify ownership via DNS.">
- <form onSubmit={handleSubmit(onFormSubmit)}>
+ <DialogContent className="sm:max-w-md">
+ <DialogHeader>
+ <DialogTitle>Add email domain</DialogTitle>
+ <DialogDescription>Add a domain to verify ownership via DNS.</DialogDescription>
+ </DialogHeader>
+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-6">
<Controller
control={control}
defaultValue=""
name="domain"
render={({ field, fieldState: { error } }) => (
- <FormControl label="Domain" isError={Boolean(error)} errorText={error?.message}>
- <Input {...field} placeholder="company.com" />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="domain">Domain</FieldLabel>
+ <Input id="domain" placeholder="company.com" isError={Boolean(error)} {...field} />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- <div className="mt-8 flex items-center space-x-4">
- <Button size="sm" type="submit" isLoading={isPending} isDisabled={isPending}>
- Add Domain
- </Button>
- <Button
- colorSchema="secondary"
- variant="plain"
- onClick={() => handlePopUpClose("addDomain")}
- >
+ <DialogFooter>
+ <Button variant="ghost" type="button" onClick={() => handlePopUpClose("addDomain")}>
Cancel
</Button>
- </div>
+ <Button variant="org" type="submit" isPending={isPending} isDisabled={isPending}>
+ Add Domain
+ </Button>
+ </DialogFooter>
</form>
- </ModalContent>
- </Modal>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/EmailDomainVerificationModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/EmailDomainVerificationModal.tsx
index a2777dabb7..59aef50f24 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/EmailDomainVerificationModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/EmailDomainVerificationModal.tsx
@@ -1,8 +1,26 @@
-import { faCopy } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { Copy, Info } from "lucide-react";
import { createNotification } from "@app/components/notifications";
-import { Button, IconButton, Modal, ModalContent, Tooltip } from "@app/components/v2";
+import {
+ Alert,
+ AlertDescription,
+ AlertTitle,
+ Button,
+ Detail,
+ DetailGroup,
+ DetailLabel,
+ DetailValue,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ IconButton,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { TEmailDomain, useVerifyEmailDomain } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -48,75 +66,82 @@ export const EmailDomainVerificationModal = ({
const txtValue = `infisical-domain-verification=${domainData?.verificationCode ?? ""}`;
return (
- <Modal
- isOpen={popUp?.verifyDomain?.isOpen}
+ <Dialog
+ open={popUp?.verifyDomain?.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("verifyDomain", isOpen)}
>
- <ModalContent
- title="Verify Email Domain"
- subTitle={`Add the following DNS TXT record to verify ownership of ${domainData?.domain ?? ""}`}
- >
+ <DialogContent className="max-w-lg" onOpenAutoFocus={(e) => e.preventDefault()}>
+ <DialogHeader>
+ <DialogTitle>Verify Email Domain</DialogTitle>
+ <DialogDescription>
+ Add the following DNS TXT record to verify ownership of {domainData?.domain ?? ""}.
+ </DialogDescription>
+ </DialogHeader>
+
<div className="space-y-4">
- <div className="rounded-md border border-mineshaft-600 bg-mineshaft-800 p-4">
- <div className="mb-3">
- <p className="mb-1 text-sm font-medium text-gray-400">Record Type</p>
- <p className="text-sm text-gray-200">TXT</p>
- </div>
- <div className="mb-3">
- <div className="flex items-center justify-between">
- <p className="mb-1 text-sm font-medium text-gray-400">Record Name</p>
- <Tooltip content="Copy">
- <IconButton
- ariaLabel="copy record name"
- variant="plain"
- size="xs"
- onClick={() => handleCopy(domainData?.verificationRecordName ?? "")}
- >
- <FontAwesomeIcon icon={faCopy} className="text-gray-400" />
- </IconButton>
+ <DetailGroup className="rounded-md border border-border bg-card p-4">
+ <Detail>
+ <DetailLabel>Record Type</DetailLabel>
+ <DetailValue>TXT</DetailValue>
+ </Detail>
+ <Detail>
+ <DetailLabel className="flex items-center justify-between">
+ Record Name
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="copy record name"
+ variant="ghost-muted"
+ size="xs"
+ onClick={() => handleCopy(domainData?.verificationRecordName ?? "")}
+ >
+ <Copy />
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>Copy</TooltipContent>
</Tooltip>
- </div>
- <code className="block rounded bg-mineshaft-700 px-2 py-1 text-sm break-all text-gray-200">
- {domainData?.verificationRecordName}
- </code>
- </div>
- <div>
- <div className="flex items-center justify-between">
- <p className="mb-1 text-sm font-medium text-gray-400">Record Value</p>
- <Tooltip content="Copy">
- <IconButton
- ariaLabel="copy record value"
- variant="plain"
- size="xs"
- onClick={() => handleCopy(txtValue)}
- >
- <FontAwesomeIcon icon={faCopy} className="text-gray-400" />
- </IconButton>
+ </DetailLabel>
+ <DetailValue>{domainData?.verificationRecordName}</DetailValue>
+ </Detail>
+ <Detail>
+ <DetailLabel className="flex items-center justify-between">
+ Record Value
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="copy record value"
+ variant="ghost-muted"
+ size="xs"
+ onClick={() => handleCopy(txtValue)}
+ >
+ <Copy />
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>Copy</TooltipContent>
</Tooltip>
- </div>
- <code className="block rounded bg-mineshaft-700 px-2 py-1 text-sm break-all text-gray-200">
- {txtValue}
- </code>
- </div>
- </div>
- <p className="text-xs text-gray-500">
- DNS changes typically take a few minutes to propagate, but in some cases may take up to
- 48 hours. The verification code expires 7 days after creation.
- </p>
- <div className="flex items-center space-x-4">
- <Button size="sm" onClick={handleVerify} isLoading={isPending} isDisabled={isPending}>
- Verify Domain
- </Button>
- <Button
- colorSchema="secondary"
- variant="plain"
- onClick={() => handlePopUpClose("verifyDomain")}
- >
- Close
- </Button>
- </div>
+ </DetailLabel>
+ <DetailValue>{txtValue}</DetailValue>
+ </Detail>
+ </DetailGroup>
+ <Alert variant="warning">
+ <Info />
+ <AlertTitle>DNS changes can take up to 48 hours to propagate</AlertTitle>
+ <AlertDescription>
+ Most updates propagate within minutes. The verification code expires 7 days after
+ creation.
+ </AlertDescription>
+ </Alert>
</div>
- </ModalContent>
- </Modal>
+
+ <DialogFooter>
+ <Button variant="ghost" onClick={() => handlePopUpClose("verifyDomain")}>
+ Close
+ </Button>
+ <Button variant="org" isPending={isPending} onClick={handleVerify}>
+ Verify Domain
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/OrgEmailDomainsSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/OrgEmailDomainsSection.tsx
index 6492babc7a..721f03aa52 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/OrgEmailDomainsSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/OrgEmailDomainsSection.tsx
@@ -1,89 +1,115 @@
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { Globe, Plus } from "lucide-react";
import { OrgPermissionCan, PermissionDeniedBanner } from "@app/components/permissions";
-import { Button } from "@app/components/v2";
-import { DocumentationLinkBadge } from "@app/components/v3";
+import {
+ Button,
+ Card,
+ CardAction,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ DocumentationLinkBadge
+} from "@app/components/v3";
import {
OrgPermissionEmailDomainActions,
OrgPermissionSubjects,
useOrgPermission,
useSubscription
} from "@app/context";
-import { usePopUp } from "@app/hooks";
+import { TEmailDomain } from "@app/hooks/api";
+import { UsePopUpState } from "@app/hooks/usePopUp";
import { AddEmailDomainModal } from "./AddEmailDomainModal";
+import { EmailDomainVerificationModal } from "./EmailDomainVerificationModal";
import { OrgEmailDomainsTable } from "./OrgEmailDomainsTable";
-export const OrgEmailDomainsSection = () => {
- const { handlePopUpToggle, popUp, handlePopUpOpen, handlePopUpClose } = usePopUp([
- "addDomain"
- ] as const);
+type EmailDomainPopUps = ["addDomain", "verifyDomain"];
+
+type Props = {
+ popUp: UsePopUpState<EmailDomainPopUps>;
+ handlePopUpOpen: (popUpName: keyof UsePopUpState<EmailDomainPopUps>, data?: unknown) => void;
+ handlePopUpClose: (popUpName: keyof UsePopUpState<EmailDomainPopUps>) => void;
+ handlePopUpToggle: (popUpName: keyof UsePopUpState<EmailDomainPopUps>, state?: boolean) => void;
+};
+
+export const OrgEmailDomainsSection = ({
+ popUp,
+ handlePopUpOpen,
+ handlePopUpClose,
+ handlePopUpToggle
+}: Props) => {
const { permission } = useOrgPermission();
const { subscription } = useSubscription();
const hasEmailDomainVerification = Boolean(subscription?.emailDomainVerification);
+ const handleVerifyDomain = (emailDomain: TEmailDomain) =>
+ handlePopUpOpen("verifyDomain", emailDomain);
+
+ const renderBody = () => {
+ if (!hasEmailDomainVerification) {
+ return (
+ <div className="rounded-md border border-border bg-container p-6 text-center">
+ <p className="text-sm text-foreground">
+ Your current plan does not include email domain verification.
+ </p>
+ <p className="mt-1 text-xs text-accent">
+ Upgrade your plan to verify email domains for SSO and identity provider enforcement.
+ </p>
+ </div>
+ );
+ }
+
+ if (!permission.can(OrgPermissionEmailDomainActions.Read, OrgPermissionSubjects.EmailDomains)) {
+ return <PermissionDeniedBanner />;
+ }
+
+ return <OrgEmailDomainsTable onVerifyDomain={handleVerifyDomain} />;
+ };
+
return (
<>
- <div className="mb-4 space-y-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
- <div className="mb-4 flex items-center justify-between">
- <div>
- <div className="text-xl font-medium text-gray-200">
- Email Domains
- <DocumentationLinkBadge
- className="ml-2"
- href="https://infisical.com/docs/documentation/platform/email-domain"
- />
- </div>
- <p className="mt-1 mb-2 text-gray-400">
- Verify ownership of your email domains to use with SSO and identity providers.
- </p>
- </div>
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ <Globe className="size-4 text-accent" />
+ Email Domains
+ <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/email-domain" />
+ </CardTitle>
+ <CardDescription>Verified domains for your IDP.</CardDescription>
{hasEmailDomainVerification && (
- <OrgPermissionCan
- I={OrgPermissionEmailDomainActions.Create}
- a={OrgPermissionSubjects.EmailDomains}
- >
- {(isAllowed) => (
- <Button
- colorSchema="secondary"
- isDisabled={!isAllowed}
- leftIcon={<FontAwesomeIcon icon={faPlus} />}
- onClick={() => handlePopUpOpen("addDomain")}
- >
- Add domain
- </Button>
- )}
- </OrgPermissionCan>
+ <CardAction>
+ <OrgPermissionCan
+ I={OrgPermissionEmailDomainActions.Create}
+ a={OrgPermissionSubjects.EmailDomains}
+ >
+ {(isAllowed) => (
+ <Button
+ variant="outline"
+ isDisabled={!isAllowed}
+ onClick={() => handlePopUpOpen("addDomain")}
+ >
+ <Plus />
+ Add Domain
+ </Button>
+ )}
+ </OrgPermissionCan>
+ </CardAction>
)}
- </div>
- {!hasEmailDomainVerification ? (
- <div className="rounded-md border border-mineshaft-600 bg-mineshaft-800 p-6 text-center">
- <p className="text-gray-300">
- Your current plan does not include email domain verification.
- </p>
- <p className="mt-1 text-sm text-gray-500">
- Upgrade your plan to verify email domains for SSO and identity provider enforcement.
- </p>
- </div>
- ) : (
- <div>
- {permission.can(
- OrgPermissionEmailDomainActions.Read,
- OrgPermissionSubjects.EmailDomains
- ) ? (
- <OrgEmailDomainsTable />
- ) : (
- <PermissionDeniedBanner />
- )}
- </div>
- )}
- </div>
+ </CardHeader>
+ <CardContent>{renderBody()}</CardContent>
+ </Card>
<AddEmailDomainModal
popUp={popUp}
handlePopUpClose={handlePopUpClose}
handlePopUpToggle={handlePopUpToggle}
+ onCreated={handleVerifyDomain}
+ />
+ <EmailDomainVerificationModal
+ popUp={popUp}
+ handlePopUpClose={handlePopUpClose}
+ handlePopUpToggle={handlePopUpToggle}
/>
</>
);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/OrgEmailDomainsTable.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/OrgEmailDomainsTable.tsx
index 1ad646b6aa..885a5bb35d 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/OrgEmailDomainsTable.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgEmailDomainsSection/OrgEmailDomainsTable.tsx
@@ -1,69 +1,72 @@
import { useState } from "react";
-import {
- faCheckCircle,
- faClock,
- faEye,
- faGlobe,
- faMagnifyingGlass,
- faTimesCircle,
- faTrash
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format } from "date-fns";
-import { twMerge } from "tailwind-merge";
+import {
+ CircleCheck,
+ CircleX,
+ Clock,
+ MoreHorizontal,
+ Search,
+ ShieldCheck,
+ Trash2
+} from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
- DeleteActionModal,
- EmptyState,
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
+ Badge,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
IconButton,
- Input,
+ InputGroup,
+ InputGroupAddon,
+ InputGroupInput,
+ Skeleton,
Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
- Tooltip,
- Tr
-} from "@app/components/v2";
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow
+} from "@app/components/v3";
import {
OrgPermissionEmailDomainActions,
OrgPermissionSubjects,
useOrganization
} from "@app/context";
import { usePopUp } from "@app/hooks";
-import { useDeleteEmailDomain, useGetEmailDomains } from "@app/hooks/api";
+import { TEmailDomain, useDeleteEmailDomain, useGetEmailDomains } from "@app/hooks/api";
-import { EmailDomainVerificationModal } from "./EmailDomainVerificationModal";
+const STATUS_BADGE = {
+ pending: { label: "Pending", icon: Clock, variant: "info" as const },
+ verified: { label: "Verified", icon: CircleCheck, variant: "success" as const },
+ expired: { label: "Expired", icon: CircleX, variant: "danger" as const }
+};
-const STATUS_CONFIG = {
- pending: {
- label: "Pending",
- icon: faClock,
- className: "text-yellow-500"
- },
- verified: {
- label: "Verified",
- icon: faCheckCircle,
- className: "text-green-500"
- },
- expired: {
- label: "Expired",
- icon: faTimesCircle,
- className: "text-red-500"
- }
-} as const;
+type Props = {
+ onVerifyDomain: (emailDomain: TEmailDomain) => void;
+};
-export const OrgEmailDomainsTable = () => {
+export const OrgEmailDomainsTable = ({ onVerifyDomain }: Props) => {
const { currentOrg } = useOrganization();
const { data: emailDomains, isPending } = useGetEmailDomains(currentOrg?.id ?? "");
const [searchDomain, setSearchDomain] = useState("");
const { handlePopUpToggle, popUp, handlePopUpOpen, handlePopUpClose } = usePopUp([
- "removeDomain",
- "verifyDomain"
+ "removeDomain"
] as const);
const { mutateAsync: deleteEmailDomain } = useDeleteEmailDomain();
@@ -91,115 +94,176 @@ export const OrgEmailDomainsTable = () => {
: [];
return (
- <div>
- <Input
- value={searchDomain}
- onChange={(e) => setSearchDomain(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search domains..."
- />
- <TableContainer className="mt-4">
+ <div className="flex flex-col gap-4">
+ <InputGroup>
+ <InputGroupAddon>
+ <Search />
+ </InputGroupAddon>
+ <InputGroupInput
+ placeholder="Search domains"
+ value={searchDomain}
+ onChange={(e) => setSearchDomain(e.target.value)}
+ />
+ </InputGroup>
+ {!isPending && filteredDomains.length === 0 ? (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No email domains found</EmptyTitle>
+ <EmptyDescription>Add an email domain to setup your IDP.</EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ ) : (
<Table>
- <THead>
- <Tr>
- <Th>Domain</Th>
- <Th>Status</Th>
- <Th>Verified At</Th>
- <Th>Expires At</Th>
- <Th aria-label="actions" />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={5} innerKey="email-domains" />}
+ <TableHeader>
+ <TableRow>
+ <TableHead>Domain</TableHead>
+ <TableHead>Status</TableHead>
+ <TableHead>Verified at</TableHead>
+ <TableHead>Expires at</TableHead>
+ <TableHead className="w-px text-right" aria-label="Actions" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {isPending &&
+ Array.from({ length: 3 }).map((_, idx) => (
+ // eslint-disable-next-line react/no-array-index-key
+ <TableRow key={`email-domain-skeleton-${idx}`}>
+ <TableCell colSpan={5}>
+ <Skeleton className="h-5 w-full" />
+ </TableCell>
+ </TableRow>
+ ))}
{filteredDomains.map((emailDomain) => {
- const statusConfig = STATUS_CONFIG[emailDomain.status] || STATUS_CONFIG.pending;
+ const badge = STATUS_BADGE[emailDomain.status] ?? STATUS_BADGE.pending;
+ const StatusIcon = badge.icon;
return (
- <Tr key={emailDomain.id}>
- <Td className="max-w-xs">
- <span className="font-medium">{emailDomain.domain}</span>
- </Td>
- <Td>
- <span className={twMerge("flex items-center gap-1.5", statusConfig.className)}>
- <FontAwesomeIcon icon={statusConfig.icon} size="sm" />
- {statusConfig.label}
- </span>
- </Td>
- <Td>
- {emailDomain.verifiedAt
- ? format(new Date(emailDomain.verifiedAt), "MMM d, yyyy")
- : "-"}
- </Td>
- <Td>
- {emailDomain.status === "pending"
- ? format(new Date(emailDomain.codeExpiresAt), "MMM d, yyyy")
- : "-"}
- </Td>
- <Td>
+ <TableRow key={emailDomain.id}>
+ <TableCell className="font-medium text-foreground">
+ {emailDomain.domain}
+ </TableCell>
+ <TableCell>
+ <Badge variant={badge.variant}>
+ <StatusIcon />
+ {badge.label}
+ </Badge>
+ </TableCell>
+ <TableCell>
+ {emailDomain.verifiedAt ? (
+ format(new Date(emailDomain.verifiedAt), "MMM d, yyyy")
+ ) : (
+ <span className="text-muted">—</span>
+ )}
+ </TableCell>
+ <TableCell>
+ {emailDomain.status === "pending" ? (
+ format(new Date(emailDomain.codeExpiresAt), "MMM d, yyyy")
+ ) : (
+ <span className="text-muted">—</span>
+ )}
+ </TableCell>
+ <TableCell className="text-right">
<div className="flex items-center justify-end gap-2">
{emailDomain.status === "pending" && (
<OrgPermissionCan
I={OrgPermissionEmailDomainActions.VerifyDomain}
a={OrgPermissionSubjects.EmailDomains}
>
- {(isAllowed) => (
- <Tooltip content="View details & Verify">
- <IconButton
- ariaLabel="verify"
- variant="plain"
- onClick={() => handlePopUpOpen("verifyDomain", emailDomain)}
- isDisabled={!isAllowed}
- >
- <FontAwesomeIcon icon={faEye} />
- </IconButton>
- </Tooltip>
- )}
+ {(isAllowed) =>
+ isAllowed && (
+ <Badge asChild variant="warning">
+ <button type="button" onClick={() => onVerifyDomain(emailDomain)}>
+ <ShieldCheck />
+ Verify Domain
+ </button>
+ </Badge>
+ )
+ }
</OrgPermissionCan>
)}
- <OrgPermissionCan
- I={OrgPermissionEmailDomainActions.Delete}
- an={OrgPermissionSubjects.EmailDomains}
- >
- {(isAllowed) => (
- <Tooltip content="Delete">
- <IconButton
- ariaLabel="delete"
- colorSchema="danger"
- onClick={() =>
- handlePopUpOpen("removeDomain", {
- id: emailDomain.id,
- domain: emailDomain.domain
- })
- }
- isDisabled={!isAllowed}
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton
+ variant="ghost"
+ size="xs"
+ aria-label={`Actions for ${emailDomain.domain}`}
+ >
+ <MoreHorizontal />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-44">
+ {emailDomain.status === "pending" && (
+ <OrgPermissionCan
+ I={OrgPermissionEmailDomainActions.VerifyDomain}
+ a={OrgPermissionSubjects.EmailDomains}
>
- <FontAwesomeIcon icon={faTrash} />
- </IconButton>
- </Tooltip>
- )}
- </OrgPermissionCan>
+ {(isAllowed) => (
+ <DropdownMenuItem
+ isDisabled={!isAllowed}
+ onClick={() => onVerifyDomain(emailDomain)}
+ >
+ <ShieldCheck />
+ Verify
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
+ )}
+ <OrgPermissionCan
+ I={OrgPermissionEmailDomainActions.Delete}
+ an={OrgPermissionSubjects.EmailDomains}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ variant="danger"
+ isDisabled={!isAllowed}
+ onClick={() =>
+ handlePopUpOpen("removeDomain", {
+ id: emailDomain.id,
+ domain: emailDomain.domain
+ })
+ }
+ >
+ <Trash2 />
+ Delete
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
+ </DropdownMenuContent>
+ </DropdownMenu>
</div>
- </Td>
- </Tr>
+ </TableCell>
+ </TableRow>
);
})}
- </TBody>
+ </TableBody>
</Table>
- {filteredDomains.length === 0 && !isPending && (
- <EmptyState title="No email domains found" icon={faGlobe} />
- )}
- </TableContainer>
- <DeleteActionModal
- isOpen={popUp.removeDomain.isOpen}
- deleteKey="remove"
- title={`Do you want to remove the domain "${(popUp?.removeDomain?.data as { domain?: string })?.domain}"?`}
- onChange={(isOpen) => handlePopUpToggle("removeDomain", isOpen)}
- onDeleteApproved={onRemoveDomain}
- />
- <EmailDomainVerificationModal
- popUp={popUp}
- handlePopUpClose={handlePopUpClose}
- handlePopUpToggle={handlePopUpToggle}
- />
+ )}
+ <AlertDialog
+ open={popUp.removeDomain.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("removeDomain", isOpen)}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <Trash2 />
+ </AlertDialogMedia>
+ <AlertDialogTitle>
+ Remove domain &quot;
+ {(popUp?.removeDomain?.data as { domain?: string })?.domain}
+ &quot;?
+ </AlertDialogTitle>
+ <AlertDialogDescription>
+ This will remove the domain from your organization. Any SSO login associated with this
+ domain will no longer work.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction variant="danger" onClick={onRemoveDomain}>
+ Remove
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
</div>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
index 517e233c46..d82ec8105c 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
@@ -1,13 +1,37 @@
import { useState } from "react";
-import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { AlertTriangle, Info, ShieldCheck } from "lucide-react";
import { twMerge } from "tailwind-merge";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
-import { Button, Modal, ModalClose, ModalContent, Switch, Tooltip } from "@app/components/v2";
-import { NoticeBannerV2 } from "@app/components/v2/NoticeBannerV2/NoticeBannerV2";
+import {
+ Alert,
+ AlertDescription,
+ AlertTitle,
+ Badge,
+ Button,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldGroup,
+ FieldTitle,
+ HoverCard,
+ HoverCardContent,
+ HoverCardTrigger,
+ Switch
+} from "@app/components/v3";
import {
OrgPermissionActions,
OrgPermissionSubjects,
@@ -207,187 +231,160 @@ export const OrgGeneralAuthSection = ({
};
const isGoogleOAuthEnforced = currentOrg.googleSsoAuthEnforced;
-
- const getActiveSsoLabel = () => {
- if (isSamlActive) return "SAML";
- if (isOidcActive) return "OIDC";
- if (isLdapActive) return "LDAP";
- return "";
- };
+ const isAnySsoEnforced = Boolean(currentOrg?.authEnforced || isGoogleOAuthEnforced);
+ const enforcementLabel = enforcementTypeInModal === EnforceAuthType.SAML ? "SAML" : "Google";
return (
- <div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
- <div>
- <p className="text-xl font-medium text-gray-200">SSO Enforcement</p>
- <p className="mt-1 mb-2 text-gray-400">
- Manage strict enforcement of specific authentication methods for your organization.
- </p>
- </div>
- <div className="flex flex-col gap-2 py-4">
- <div className={twMerge("mt-4", (!isSamlConfigured || isGoogleOAuthEnforced) && "hidden")}>
- <div className="mb-2 flex justify-between">
- <div className="flex items-center gap-1">
- <span className="text-md text-mineshaft-100">Enforce SAML SSO</span>
- </div>
- <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
- {(isAllowed) => (
- <Switch
- id="enforce-saml-auth"
- onCheckedChange={(value) =>
- handleEnforceOrgAuthToggle(value, EnforceAuthType.SAML)
- }
- isChecked={currentOrg?.authEnforced ?? false}
- isDisabled={!isAllowed || currentOrg?.googleSsoAuthEnforced}
- />
- )}
- </OrgPermissionCan>
- </div>
- <p className="text-sm text-mineshaft-300">
- Enforce users to authenticate via SAML to access this organization.
- <br />
- When this is enabled your organization members will only be able to login with SAML.
- </p>
- </div>
-
- <div className={twMerge("mt-4", (!isOidcConfigured || isGoogleOAuthEnforced) && "hidden")}>
- <div className="mb-2 flex justify-between">
- <div className="flex items-center gap-1">
- <span className="text-md text-mineshaft-100">Enforce OIDC SSO</span>
- </div>
- <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
- {(isAllowed) => (
- <Switch
- id="enforce-oidc-auth"
- isChecked={currentOrg?.authEnforced ?? false}
- onCheckedChange={(value) =>
- handleEnforceOrgAuthToggle(value, EnforceAuthType.OIDC)
- }
- isDisabled={!isAllowed}
- />
- )}
- </OrgPermissionCan>
- </div>
- <p className="text-sm text-mineshaft-300">
- Enforce users to authenticate via OIDC to access this organization.
- <br />
- When this is enabled your organization members will only be able to login with OIDC.
- </p>
- </div>
-
- <div className={twMerge("mt-2", !isGoogleConfigured && "hidden")}>
- <div className="mb-2 flex justify-between">
- <div className="flex items-center gap-1">
- <span className="text-md text-mineshaft-100">Enforce Google OAuth</span>
- </div>
- <OrgPermissionCan
- I={OrgPermissionActions.Edit}
- a={OrgPermissionSubjects.Sso}
- tooltipProps={{
- className: "max-w-sm",
- side: "left"
- }}
- allowedLabel={
- isOidcActive || isSamlActive || isLdapActive
- ? `You cannot enforce Google OAuth while ${getActiveSsoLabel()} SSO is enabled. Disable ${getActiveSsoLabel()} SSO to enforce Google OAuth.`
- : undefined
- }
- renderTooltip={isOidcActive || isSamlActive || isLdapActive}
+ <>
+ <Card>
+ <CardHeader className="border-b">
+ <CardTitle>
+ <ShieldCheck className="size-4 text-accent" />
+ Enforcement
+ {isAnySsoEnforced && <Badge variant="success">Active</Badge>}
+ </CardTitle>
+ <CardDescription>Require all members to sign in via your IDP.</CardDescription>
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ <Field
+ orientation="horizontal"
+ className={twMerge((!isSamlConfigured || isGoogleOAuthEnforced) && "hidden")}
>
- {(isAllowed) => (
- <div>
+ <FieldContent>
+ <FieldTitle>Enforce SAML SSO</FieldTitle>
+ <FieldDescription>Only allow members to sign in via SAML.</FieldDescription>
+ </FieldContent>
+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
+ {(isAllowed) => (
<Switch
- id="enforce-google-sso"
+ id="enforce-saml-auth"
+ variant="org"
+ checked={currentOrg?.authEnforced ?? false}
onCheckedChange={(value) =>
- handleEnforceOrgAuthToggle(value, EnforceAuthType.GOOGLE)
+ handleEnforceOrgAuthToggle(value, EnforceAuthType.SAML)
}
- isChecked={currentOrg?.googleSsoAuthEnforced ?? false}
- isDisabled={
- !isAllowed ||
- currentOrg?.authEnforced ||
- isOidcActive ||
- isSamlActive ||
- isLdapActive
+ disabled={!isAllowed || currentOrg?.googleSsoAuthEnforced}
+ />
+ )}
+ </OrgPermissionCan>
+ </Field>
+
+ <Field
+ orientation="horizontal"
+ className={twMerge((!isOidcConfigured || isGoogleOAuthEnforced) && "hidden")}
+ >
+ <FieldContent>
+ <FieldTitle>Enforce OIDC SSO</FieldTitle>
+ <FieldDescription>Only allow members to sign in via OIDC.</FieldDescription>
+ </FieldContent>
+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
+ {(isAllowed) => (
+ <Switch
+ id="enforce-oidc-auth"
+ variant="org"
+ checked={currentOrg?.authEnforced ?? false}
+ onCheckedChange={(value) =>
+ handleEnforceOrgAuthToggle(value, EnforceAuthType.OIDC)
}
+ disabled={!isAllowed}
/>
- </div>
+ )}
+ </OrgPermissionCan>
+ </Field>
+
+ <Field
+ orientation="horizontal"
+ className={twMerge(
+ (!isGoogleConfigured || isSamlActive || isOidcActive || isLdapActive) && "hidden"
)}
- </OrgPermissionCan>
- </div>
- <p className="text-sm text-mineshaft-300">
- Enforce users to authenticate via Google OAuth to access this organization.
- <br />
- When this is enabled your organization members will only be able to login with Google
- OAuth (not Google SAML).
- </p>
- </div>
- </div>
- <div className="mt-4 py-4">
- <div className="mb-2 flex justify-between">
- <div className="flex items-center gap-1">
- <span className="text-md text-mineshaft-100">Enable Admin SSO Bypass</span>
- <Tooltip
- className="max-w-lg"
- content={
- <div>
- <span>
- When enabling admin SSO bypass, we highly recommend enabling MFA enforcement at
- the organization-level for security reasons.
- </span>
- <p className="mt-4">
- In case of a lockout, admins can use the{" "}
- <a
- target="_blank"
- className="underline underline-offset-2 hover:text-mineshaft-300"
- href="https://infisical.com/docs/documentation/platform/sso/overview#sso-break-glass"
- rel="noreferrer"
- >
- Admin Login Portal
- </a>{" "}
- at{" "}
- <a
- target="_blank"
- rel="noopener noreferrer"
- className="underline underline-offset-2 hover:text-mineshaft-300"
- href={`${window.location.origin}/login/admin`}
- >
- {window.location.origin}/login/admin
- </a>
- </p>
- </div>
- }
>
- <FontAwesomeIcon
- icon={faInfoCircle}
- size="sm"
- className="mt-0.5 inline-block text-mineshaft-400"
- />
- </Tooltip>
- </div>
- <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
- {(isAllowed) => (
- <Switch
- id="allow-admin-bypass"
- isChecked={currentOrg?.bypassOrgAuthEnabled ?? false}
- onCheckedChange={(value) => handleEnableBypassOrgAuthToggle(value)}
- isDisabled={!isAllowed}
- />
- )}
- </OrgPermissionCan>
- </div>
- <p className="text-sm text-mineshaft-300">
- <span>
- Allow organization admins to bypass SSO login enforcement when your SSO provider is
- unavailable, misconfigured, or inaccessible.
- </span>
- </p>
- </div>
+ <FieldContent>
+ <FieldTitle>Enforce Google OAuth</FieldTitle>
+ <FieldDescription>
+ Only allow members to sign in via Google OAuth (not SAML).
+ </FieldDescription>
+ </FieldContent>
+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
+ {(isAllowed) => (
+ <Switch
+ id="enforce-google-sso"
+ variant="org"
+ checked={currentOrg?.googleSsoAuthEnforced ?? false}
+ onCheckedChange={(value) =>
+ handleEnforceOrgAuthToggle(value, EnforceAuthType.GOOGLE)
+ }
+ disabled={!isAllowed || currentOrg?.authEnforced}
+ />
+ )}
+ </OrgPermissionCan>
+ </Field>
+
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>
+ Enable Admin SSO Bypass
+ <HoverCard openDelay={150} closeDelay={150}>
+ <HoverCardTrigger asChild>
+ <Info className="text-muted" />
+ </HoverCardTrigger>
+ <HoverCardContent className="w-80">
+ <p>
+ Enable org-level MFA before turning this on — without a second factor, an
+ admin password is the weakest way into the org.
+ </p>
+ <p className="mt-3 mb-0.5">
+ If locked out, admins can sign in via the{" "}
+ <a
+ target="_blank"
+ rel="noreferrer"
+ className="underline underline-offset-2 hover:text-foreground"
+ href="https://infisical.com/docs/documentation/platform/sso/overview#sso-break-glass"
+ >
+ Admin Login Portal
+ </a>{" "}
+ at{" "}
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline underline-offset-2 hover:text-foreground"
+ href={`${window.location.origin}/login/admin`}
+ >
+ /login/admin
+ </a>
+ .
+ </p>
+ </HoverCardContent>
+ </HoverCard>
+ </FieldTitle>
+ <FieldDescription>
+ Admins can sign in with a password if your IDP is inaccessible.
+ </FieldDescription>
+ </FieldContent>
+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
+ {(isAllowed) => (
+ <Switch
+ id="allow-admin-bypass"
+ variant="org"
+ checked={currentOrg?.bypassOrgAuthEnabled ?? false}
+ onCheckedChange={(value) => handleEnableBypassOrgAuthToggle(value)}
+ disabled={!isAllowed}
+ />
+ )}
+ </OrgPermissionCan>
+ </Field>
+ </FieldGroup>
+ </CardContent>
+ </Card>
+
<UpgradePlanModal
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
text="Your current plan does not include access to enforce SAML SSO. To unlock this feature, please upgrade to Infisical Pro plan."
/>
- <Modal
- isOpen={popUp.enforceSamlSsoConfirmation.isOpen}
+
+ <Dialog
+ open={popUp.enforceSamlSsoConfirmation.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("enforceSamlSsoConfirmation", isOpen);
setBypassEnabledInModal(currentOrg?.bypassOrgAuthEnabled ?? false);
@@ -396,56 +393,48 @@ export const OrgGeneralAuthSection = ({
}
}}
>
- <ModalContent
- className="max-w-2xl"
- title={`Enforce ${enforcementTypeInModal === EnforceAuthType.SAML ? "SAML" : "Google"} SSO`}
- >
- <NoticeBannerV2
- title={`Warning: This action will enforce ${enforcementTypeInModal === EnforceAuthType.SAML ? "SAML" : "Google"} SSO authentication`}
- >
- <p className="my-2 text-sm text-mineshaft-300">
- All users will be required to authenticate via{" "}
- {enforcementTypeInModal === EnforceAuthType.SAML ? "SAML" : "Google"} SSO to access
- this organization. Other authentication methods will be disabled.
- </p>
- <p className="text-sm font-medium text-mineshaft-200">
- Before proceeding, ensure your{" "}
- {enforcementTypeInModal === EnforceAuthType.SAML ? "SAML" : "Google"} provider is
- available and properly configured to avoid access issues.
- </p>
- </NoticeBannerV2>
+ <DialogContent className="max-w-2xl">
+ <DialogHeader>
+ <DialogTitle>Enforce {enforcementLabel} SSO</DialogTitle>
+ </DialogHeader>
+
+ <Alert variant="warning">
+ <AlertTriangle />
+ <AlertTitle>This action will enforce {enforcementLabel} SSO authentication</AlertTitle>
+ <AlertDescription>
+ <p>
+ All users will be required to authenticate via {enforcementLabel} SSO to access this
+ organization. Other authentication methods will be disabled.
+ </p>
+ <p className="font-medium">
+ Before proceeding, ensure your {enforcementLabel} provider is available and properly
+ configured to avoid access issues.
+ </p>
+ </AlertDescription>
+ </Alert>
{!currentOrg?.bypassOrgAuthEnabled && (
- <div className="mt-4 flex items-center justify-between rounded-md bg-mineshaft-800/50 py-3 pr-1 pl-2">
- <div className="flex-1 pr-3">
- <p className="text-sm font-medium text-gray-200">Enable Admin SSO Bypass</p>
- <p className="mt-1 text-sm text-gray-400">
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>Enable Admin SSO Bypass</FieldTitle>
+ <FieldDescription>
Allow organization admins to bypass SSO login enforcement if they experience any
- issues with their{" "}
- {enforcementTypeInModal === EnforceAuthType.SAML ? "SAML" : "Google"} provider
- </p>
- </div>
+ issues with their {enforcementLabel} provider.
+ </FieldDescription>
+ </FieldContent>
<Switch
id="bypass-enabled-modal"
- isChecked={bypassEnabledInModal}
+ variant="org"
+ checked={bypassEnabledInModal}
onCheckedChange={setBypassEnabledInModal}
/>
- </div>
+ </Field>
)}
- <div className="mt-6 flex gap-2">
- <Button
- onClick={handleEnforceSsoConfirm}
- className="mr-4"
- size="sm"
- colorSchema="primary"
- >
- Enable Enforcement
- </Button>
- <ModalClose asChild>
+ <DialogFooter>
+ <DialogClose asChild>
<Button
- colorSchema="secondary"
- variant="plain"
+ variant="ghost"
onClick={() => {
handlePopUpToggle("enforceSamlSsoConfirmation", false);
setBypassEnabledInModal(currentOrg?.bypassOrgAuthEnabled ?? false);
@@ -454,10 +443,13 @@ export const OrgGeneralAuthSection = ({
>
Cancel
</Button>
- </ModalClose>
- </div>
- </ModalContent>
- </Modal>
- </div>
+ </DialogClose>
+ <Button variant="org" onClick={handleEnforceSsoConfirm}>
+ Enable Enforcement
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgLDAPSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgLDAPSection.tsx
index 311a7ea4bf..8118a3ae3a 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgLDAPSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgLDAPSection.tsx
@@ -1,7 +1,28 @@
+import { ArrowLeftRight, MoreHorizontal, Pencil } from "lucide-react";
+
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 {
+ Button,
+ Card,
+ CardAction,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldGroup,
+ FieldTitle,
+ IconButton,
+ Switch
+} from "@app/components/v3";
import {
OrgPermissionActions,
OrgPermissionSubjects,
@@ -14,7 +35,11 @@ import { usePopUp } from "@app/hooks/usePopUp";
import { LDAPGroupMapModal } from "./LDAPGroupMapModal";
import { LDAPModal } from "./LDAPModal";
-export const OrgLDAPSection = (): JSX.Element => {
+type Props = {
+ onSwitchProvider?: () => void;
+};
+
+export const OrgLDAPSection = ({ onSwitchProvider }: Props): JSX.Element => {
const { currentOrg } = useOrganization();
const { subscription } = useSubscription();
@@ -54,8 +79,6 @@ export const OrgLDAPSection = (): JSX.Element => {
try {
if (subscription?.ldap && currentOrg) {
if (!data) {
- // case: LDAP is not configured
- // -> initialize empty LDAP configuration
await createMutateAsync({
organizationId: currentOrg.id,
isActive: false,
@@ -95,81 +118,93 @@ export const OrgLDAPSection = (): JSX.Element => {
const isGoogleOAuthEnabled = currentOrg.googleSsoAuthEnforced;
return (
- <div className="mb-4">
- <div className="py-4">
- <div className="mb-4 flex items-center justify-between">
- <div>
- <p className="text-xl font-medium text-gray-200">LDAP</p>
- <p className="mb-2 text-gray-400">Manage LDAP authentication configuration</p>
- </div>
- <OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Ldap}>
- {(isAllowed) => (
- <Button onClick={addLDAPBtnClick} colorSchema="secondary" isDisabled={!isAllowed}>
- Manage
- </Button>
- )}
- </OrgPermissionCan>
- </div>
- </div>
-
- {data && (
- <div className="pt-4">
- <div className="mb-2 flex items-center justify-between">
- <h2 className="text-md text-mineshaft-100">Enable LDAP</h2>
- <OrgPermissionCan
- I={OrgPermissionActions.Edit}
- a={OrgPermissionSubjects.Ldap}
- tooltipProps={{
- className: "max-w-sm",
- side: "left"
- }}
- allowedLabel={
- isGoogleOAuthEnabled
- ? "You cannot enable LDAP SSO while Google OAuth is enforced. Disable Google OAuth enforcement to enable LDAP SSO."
- : undefined
- }
- renderTooltip={isGoogleOAuthEnabled}
- >
- {(isAllowed) => (
- <div>
- <Switch
- id="enable-ldap-sso"
- onCheckedChange={(value) => handleLDAPToggle(value)}
- isChecked={data ? data.isActive : false}
- isDisabled={!isAllowed || isGoogleOAuthEnabled}
- >
- Enable
- </Switch>
- </div>
- )}
- </OrgPermissionCan>
- </div>
- <p className="text-sm text-mineshaft-300">
- Allow members to authenticate into Infisical with LDAP
- </p>
- </div>
- )}
-
- <div className="py-4">
- <div className="mb-2 flex items-center justify-between">
- <h2 className="text-md text-mineshaft-100">LDAP Group Mappings</h2>
- <OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Ldap}>
- {(isAllowed) => (
- <Button
- onClick={openLDAPGroupMapModal}
- colorSchema="secondary"
- isDisabled={!isAllowed}
- >
- Configure
- </Button>
+ <>
+ <Card>
+ <CardHeader>
+ <CardTitle>LDAP</CardTitle>
+ <CardDescription>Manage LDAP authentication configuration.</CardDescription>
+ <CardAction>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton variant="ghost" size="sm" aria-label="LDAP configuration options">
+ <MoreHorizontal />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-48">
+ <OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Ldap}>
+ {(isAllowed) => (
+ <DropdownMenuItem isDisabled={!isAllowed} onClick={addLDAPBtnClick}>
+ <Pencil />
+ Edit Configuration
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
+ {onSwitchProvider && (
+ <DropdownMenuItem onClick={onSwitchProvider}>
+ <ArrowLeftRight />
+ Switch Method
+ </DropdownMenuItem>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </CardAction>
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ {data && (
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>Enable LDAP</FieldTitle>
+ <FieldDescription>
+ Allow members to authenticate into Infisical with LDAP.
+ </FieldDescription>
+ </FieldContent>
+ <OrgPermissionCan
+ I={OrgPermissionActions.Edit}
+ a={OrgPermissionSubjects.Ldap}
+ tooltipProps={{
+ className: "max-w-sm",
+ side: "left"
+ }}
+ allowedLabel={
+ isGoogleOAuthEnabled
+ ? "You cannot enable LDAP SSO while Google OAuth is enforced. Disable Google OAuth enforcement to enable LDAP SSO."
+ : undefined
+ }
+ renderTooltip={isGoogleOAuthEnabled}
+ >
+ {(isAllowed) => (
+ <div>
+ <Switch
+ id="enable-ldap-sso"
+ variant="org"
+ checked={data.isActive}
+ onCheckedChange={(value) => handleLDAPToggle(value)}
+ disabled={!isAllowed || isGoogleOAuthEnabled}
+ />
+ </div>
+ )}
+ </OrgPermissionCan>
+ </Field>
)}
- </OrgPermissionCan>
- </div>
- <p className="text-sm text-mineshaft-300">
- Manage how LDAP groups are mapped to internal groups in Infisical
- </p>
- </div>
-
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>LDAP Group Mappings</FieldTitle>
+ <FieldDescription>
+ Manage how LDAP groups are mapped to internal groups in Infisical.
+ </FieldDescription>
+ </FieldContent>
+ <OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Ldap}>
+ {(isAllowed) => (
+ <Button variant="outline" isDisabled={!isAllowed} onClick={openLDAPGroupMapModal}>
+ Configure
+ </Button>
+ )}
+ </OrgPermissionCan>
+ </Field>
+ </FieldGroup>
+ </CardContent>
+ </Card>
<LDAPModal
popUp={popUp}
handlePopUpClose={handlePopUpClose}
@@ -186,6 +221,6 @@ export const OrgLDAPSection = (): JSX.Element => {
text="Your current plan does not include access to LDAP authentication. To unlock this feature, please upgrade to Infisical Enterprise plan."
isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
/>
- </div>
+ </>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx
index b722762e6a..91161e0543 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx
@@ -1,10 +1,33 @@
-import { faInfoCircle, faWarning } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { AlertTriangle, ArrowLeftRight, Info, MoreHorizontal, Pencil } from "lucide-react";
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 {
+ Alert,
+ AlertDescription,
+ AlertTitle,
+ Card,
+ CardAction,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldGroup,
+ FieldTitle,
+ HoverCard,
+ HoverCardContent,
+ HoverCardTrigger,
+ IconButton,
+ Switch
+} from "@app/components/v3";
import {
OrgPermissionActions,
OrgPermissionSubjects,
@@ -17,7 +40,11 @@ import { usePopUp } from "@app/hooks/usePopUp";
import { OIDCModal } from "./OIDCModal";
-export const OrgOIDCSection = (): JSX.Element => {
+type Props = {
+ onSwitchProvider?: () => void;
+};
+
+export const OrgOIDCSection = ({ onSwitchProvider }: Props): JSX.Element => {
const { currentOrg } = useOrganization();
const { subscription } = useSubscription();
@@ -78,119 +105,135 @@ export const OrgOIDCSection = (): JSX.Element => {
const isGoogleOAuthEnabled = currentOrg.googleSsoAuthEnforced;
return (
- <div className="mb-4 rounded-lg border-mineshaft-600 bg-mineshaft-900">
- <div className="mb-4 flex items-center justify-between">
- <div>
- <p className="text-xl font-medium text-gray-200">OIDC</p>
- <p className="mb-2 text-gray-400">Manage OIDC authentication configuration</p>
- </div>
-
- {!isPending && (
- <OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Sso}>
- {(isAllowed) => (
- <Button onClick={addOidcButtonClick} colorSchema="secondary" isDisabled={!isAllowed}>
- Manage
- </Button>
+ <>
+ <Card>
+ <CardHeader className="border-b">
+ <CardTitle>OIDC</CardTitle>
+ <CardDescription>Manage OIDC authentication configuration.</CardDescription>
+ {!isPending && (
+ <CardAction>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton variant="ghost" size="sm" aria-label="OIDC configuration options">
+ <MoreHorizontal />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-48">
+ <OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Sso}>
+ {(isAllowed) => (
+ <DropdownMenuItem isDisabled={!isAllowed} onClick={addOidcButtonClick}>
+ <Pencil />
+ Edit Configuration
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
+ {onSwitchProvider && (
+ <DropdownMenuItem onClick={onSwitchProvider}>
+ <ArrowLeftRight />
+ Switch Method
+ </DropdownMenuItem>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </CardAction>
+ )}
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ {data && (
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>Enable OIDC</FieldTitle>
+ <FieldDescription>
+ Allow members to authenticate into Infisical with OIDC.
+ </FieldDescription>
+ </FieldContent>
+ {!isPending && (
+ <OrgPermissionCan
+ I={OrgPermissionActions.Edit}
+ a={OrgPermissionSubjects.Sso}
+ tooltipProps={{
+ className: "max-w-sm",
+ side: "left"
+ }}
+ allowedLabel={
+ isGoogleOAuthEnabled
+ ? "You cannot enable OIDC SSO while Google OAuth is enforced. Disable Google OAuth enforcement to enable OIDC SSO."
+ : undefined
+ }
+ renderTooltip={isGoogleOAuthEnabled}
+ >
+ {(isAllowed) => (
+ <div>
+ <Switch
+ id="enable-oidc-sso"
+ variant="org"
+ checked={data.isActive}
+ onCheckedChange={(value) => handleOIDCToggle(value)}
+ disabled={!isAllowed || isGoogleOAuthEnabled}
+ />
+ </div>
+ )}
+ </OrgPermissionCan>
+ )}
+ </Field>
)}
- </OrgPermissionCan>
- )}
- </div>
- {data && (
- <div className="py-4">
- <div className="mb-2 flex items-center justify-between">
- <h2 className="text-md text-mineshaft-100">Enable OIDC</h2>
- {!isPending && (
- <OrgPermissionCan
- I={OrgPermissionActions.Edit}
- a={OrgPermissionSubjects.Sso}
- tooltipProps={{
- className: "max-w-sm",
- side: "left"
- }}
- allowedLabel={
- isGoogleOAuthEnabled
- ? "You cannot enable OIDC SSO while Google OAuth is enforced. Disable Google OAuth enforcement to enable OIDC SSO."
- : undefined
- }
- renderTooltip={isGoogleOAuthEnabled}
- >
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>
+ OIDC Group Membership Mapping
+ <HoverCard openDelay={150} closeDelay={150}>
+ <HoverCardTrigger asChild>
+ <Info className="text-muted" />
+ </HoverCardTrigger>
+ <HoverCardContent className="w-lg">
+ <p>
+ Sync group memberships from your OIDC provider on each sign-in. Users join
+ groups matching their OIDC group names and leave the ones that don&apos;t.
+ Manual group management is disabled while this is on.
+ </p>
+ <p className="mt-3">
+ Requires group claims in the OIDC token.{" "}
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline underline-offset-2 hover:text-foreground"
+ href="https://infisical.com/docs/documentation/platform/sso/overview"
+ >
+ See your OIDC provider docs for details.
+ </a>
+ </p>
+ <Alert variant="warning" className="mt-3">
+ <AlertTriangle />
+ <AlertTitle>
+ Changes only apply on the user&apos;s next OIDC sign-in.
+ </AlertTitle>
+ <AlertDescription>
+ Enforce OIDC SSO to keep this gap small.
+ </AlertDescription>
+ </Alert>
+ </HoverCardContent>
+ </HoverCard>
+ </FieldTitle>
+ <FieldDescription>
+ Infisical will manage user group memberships based on the OIDC provider.
+ </FieldDescription>
+ </FieldContent>
+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
{(isAllowed) => (
- <div>
- <Switch
- id="enable-oidc-sso"
- onCheckedChange={(value) => handleOIDCToggle(value)}
- isChecked={data ? data.isActive : false}
- isDisabled={!isAllowed || isGoogleOAuthEnabled}
- />
- </div>
+ <Switch
+ id="enforce-org-auth"
+ variant="org"
+ checked={data?.manageGroupMemberships ?? false}
+ onCheckedChange={(value) => handleOIDCGroupManagement(value)}
+ disabled={!isAllowed}
+ />
)}
</OrgPermissionCan>
- )}
- </div>
- <p className="text-sm text-mineshaft-300">
- Allow members to authenticate into Infisical with OIDC
- </p>
- </div>
- )}
- <div className="py-4">
- <div className="mb-2 flex justify-between">
- <div className="text-md flex items-center text-mineshaft-100">
- <span>OIDC Group Membership Mapping</span>
- <Tooltip
- className="max-w-lg"
- content={
- <>
- <p>
- 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.
- </p>
- <p className="mt-4">
- To use this feature you must include group claims in the OIDC token.
- </p>
- <a
- target="_blank"
- rel="noopener noreferrer"
- className="underline underline-offset-2 hover:text-mineshaft-300"
- href="https://infisical.com/docs/documentation/platform/sso/overview"
- >
- See your OIDC provider docs for details.
- </a>
- <p className="mt-4 text-yellow">
- <FontAwesomeIcon className="mr-1" icon={faWarning} />
- 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.
- </p>
- </>
- }
- >
- <FontAwesomeIcon
- icon={faInfoCircle}
- size="sm"
- className="mt-0.5 ml-1 inline-block text-mineshaft-400"
- />
- </Tooltip>
- </div>
- <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
- {(isAllowed) => (
- <Switch
- id="enforce-org-auth"
- isChecked={data?.manageGroupMemberships ?? false}
- onCheckedChange={(value) => handleOIDCGroupManagement(value)}
- isDisabled={!isAllowed}
- />
- )}
- </OrgPermissionCan>
- </div>
- <p className="text-sm text-mineshaft-300">
- Infisical will manage user group memberships based on the OIDC provider
- </p>
- </div>
+ </Field>
+ </FieldGroup>
+ </CardContent>
+ </Card>
<OIDCModal
popUp={popUp}
handlePopUpClose={handlePopUpClose}
@@ -201,6 +244,6 @@ export const OrgOIDCSection = (): JSX.Element => {
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
text="Your current plan does not include access to OIDC SSO. To unlock this feature, please upgrade to Infisical Pro plan."
/>
- </div>
+ </>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx
index ba2d23abdc..0ab2bb97ae 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx
@@ -1,10 +1,30 @@
-import { faInfoCircle, faWarning } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { AlertTriangle, ArrowLeftRight, Info, MoreHorizontal, Pencil } from "lucide-react";
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 {
+ Card,
+ CardAction,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldGroup,
+ FieldTitle,
+ IconButton,
+ Switch,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import {
OrgPermissionActions,
OrgPermissionSubjects,
@@ -16,10 +36,13 @@ import { usePopUp } from "@app/hooks/usePopUp";
import { SSOModal } from "./SSOModal";
-// Auth providers that support group sync
const GROUP_SYNC_SUPPORTED_PROVIDERS = ["google-saml"] as const;
-export const OrgSSOSection = (): JSX.Element => {
+type Props = {
+ onSwitchProvider?: () => void;
+};
+
+export const OrgSSOSection = ({ onSwitchProvider }: Props): JSX.Element => {
const { currentOrg } = useOrganization();
const { subscription } = useSubscription();
@@ -79,8 +102,6 @@ export const OrgSSOSection = (): JSX.Element => {
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",
@@ -105,117 +126,136 @@ export const OrgSSOSection = (): JSX.Element => {
const isGoogleOAuthEnabled = currentOrg.googleSsoAuthEnforced;
return (
- <div className="space-y-4">
- <div className="mb-4 flex items-center justify-between">
- <div>
- <p className="text-xl font-medium text-gray-200">SAML</p>
- <p className="mb-2 text-gray-400">Manage SAML authentication configuration</p>
- </div>
- {!isPending && (
- <OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Sso}>
- {(isAllowed) => (
- <Button onClick={addSSOBtnClick} colorSchema="secondary" isDisabled={!isAllowed}>
- Manage
- </Button>
- )}
- </OrgPermissionCan>
- )}
- </div>
- <div>
- <div className="mb-2 flex items-center justify-between pt-4">
- <h2 className="text-md text-mineshaft-100">Enable SAML</h2>
+ <>
+ <Card>
+ <CardHeader>
+ <CardTitle>SAML</CardTitle>
+ <CardDescription>Manage SAML authentication configuration.</CardDescription>
{!isPending && (
- <OrgPermissionCan
- I={OrgPermissionActions.Edit}
- a={OrgPermissionSubjects.Sso}
- tooltipProps={{
- className: "max-w-sm",
- side: "left"
- }}
- allowedLabel={
- isGoogleOAuthEnabled
- ? "You cannot enable SAML SSO while Google OAuth is enforced. Disable Google OAuth enforcement to enable SAML SSO."
- : undefined
- }
- renderTooltip={isGoogleOAuthEnabled}
- >
- {(isAllowed) => (
- <div>
- <Switch
- id="enable-saml-sso"
- onCheckedChange={(value) => handleSamlSSOToggle(value)}
- isChecked={data ? data.isActive : false}
- isDisabled={!isAllowed || isGoogleOAuthEnabled}
- />
- </div>
- )}
- </OrgPermissionCan>
+ <CardAction>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton variant="ghost" size="sm" aria-label="SAML configuration options">
+ <MoreHorizontal />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-48">
+ <OrgPermissionCan I={OrgPermissionActions.Create} a={OrgPermissionSubjects.Sso}>
+ {(isAllowed) => (
+ <DropdownMenuItem isDisabled={!isAllowed} onClick={addSSOBtnClick}>
+ <Pencil />
+ Edit Configuration
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
+ {onSwitchProvider && (
+ <DropdownMenuItem onClick={onSwitchProvider}>
+ <ArrowLeftRight />
+ Switch Method
+ </DropdownMenuItem>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </CardAction>
)}
- </div>
- <p className="text-sm text-mineshaft-300">
- Allow members to authenticate into Infisical with SAML
- </p>
- </div>
- {data && GROUP_SYNC_SUPPORTED_PROVIDERS.includes(data.authProvider) && (
- <div className="py-4">
- <div className="mb-2 flex justify-between">
- <div className="text-md flex items-center text-mineshaft-100">
- <span>SAML Group Membership Mapping</span>
- <Tooltip
- className="max-w-lg"
- content={
- <>
- <p>
- When this feature is enabled, Infisical will automatically sync group
- memberships between the SAML provider and Infisical. Users will be added to
- Infisical groups that match their SAML group names.
- </p>
- <p className="mt-4">
- To use this feature you must include group claims in the SAML response as a
- &quot;groups&quot; attribute.
- </p>
- <a
- target="_blank"
- rel="noopener noreferrer"
- className="underline underline-offset-2 hover:text-mineshaft-300"
- href="https://infisical.com/docs/documentation/platform/sso/overview"
- >
- See your SAML provider docs for details.
- </a>
- <p className="mt-4 text-yellow">
- <FontAwesomeIcon className="mr-1" icon={faWarning} />
- Group membership changes in the SAML provider only sync with Infisical when a
- user logs in via SAML. For example, if you remove a user from a group in the
- SAML provider, this change will not be reflected in Infisical until their next
- SAML login. To ensure this behavior, Infisical recommends enabling Enforce
- SAML SSO.
- </p>
- </>
- }
- >
- <FontAwesomeIcon
- icon={faInfoCircle}
- size="sm"
- className="mt-0.5 ml-1 inline-block text-mineshaft-400"
- />
- </Tooltip>
- </div>
- <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
- {(isAllowed) => (
- <Switch
- id="enable-saml-group-sync"
- isChecked={data?.enableGroupSync ?? false}
- onCheckedChange={(value) => handleSamlGroupManagement(value)}
- isDisabled={!isAllowed}
- />
+ </CardHeader>
+ <CardContent>
+ <FieldGroup>
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>Enable SAML</FieldTitle>
+ <FieldDescription>
+ Allow members to authenticate into Infisical with SAML.
+ </FieldDescription>
+ </FieldContent>
+ {!isPending && (
+ <OrgPermissionCan
+ I={OrgPermissionActions.Edit}
+ a={OrgPermissionSubjects.Sso}
+ tooltipProps={{
+ className: "max-w-sm",
+ side: "left"
+ }}
+ allowedLabel={
+ isGoogleOAuthEnabled
+ ? "You cannot enable SAML SSO while Google OAuth is enforced. Disable Google OAuth enforcement to enable SAML SSO."
+ : undefined
+ }
+ renderTooltip={isGoogleOAuthEnabled}
+ >
+ {(isAllowed) => (
+ <div>
+ <Switch
+ id="enable-saml-sso"
+ variant="org"
+ checked={data ? data.isActive : false}
+ onCheckedChange={(value) => handleSamlSSOToggle(value)}
+ disabled={!isAllowed || isGoogleOAuthEnabled}
+ />
+ </div>
+ )}
+ </OrgPermissionCan>
)}
- </OrgPermissionCan>
- </div>
- <p className="text-sm text-mineshaft-300">
- Infisical will manage user group memberships based on the SAML provider
- </p>
- </div>
- )}
+ </Field>
+ {data && GROUP_SYNC_SUPPORTED_PROVIDERS.includes(data.authProvider) && (
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>
+ SAML Group Membership Mapping
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="size-3.5 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-lg">
+ <p>
+ When this feature is enabled, Infisical will automatically sync group
+ memberships between the SAML provider and Infisical. Users will be added
+ to Infisical groups that match their SAML group names.
+ </p>
+ <p className="mt-3">
+ To use this feature you must include group claims in the SAML response as
+ a &quot;groups&quot; attribute.{" "}
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline underline-offset-2 hover:text-foreground"
+ href="https://infisical.com/docs/documentation/platform/sso/overview"
+ >
+ See your SAML provider docs for details.
+ </a>
+ </p>
+ <p className="mt-3 flex items-start gap-1.5 text-warning">
+ <AlertTriangle className="mt-0.5 size-3.5 shrink-0" />
+ <span>
+ Group membership changes in the SAML provider only sync with Infisical
+ when a user logs in via SAML — removing a user from a group in the SAML
+ provider will not be reflected in Infisical until their next SAML login.
+ Enable Enforce SAML SSO to ensure this behavior.
+ </span>
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </FieldTitle>
+ <FieldDescription>
+ Infisical will manage user group memberships based on the SAML provider.
+ </FieldDescription>
+ </FieldContent>
+ <OrgPermissionCan I={OrgPermissionActions.Edit} a={OrgPermissionSubjects.Sso}>
+ {(isAllowed) => (
+ <Switch
+ id="enable-saml-group-sync"
+ variant="org"
+ checked={data?.enableGroupSync ?? false}
+ onCheckedChange={(value) => handleSamlGroupManagement(value)}
+ disabled={!isAllowed}
+ />
+ )}
+ </OrgPermissionCan>
+ </Field>
+ )}
+ </FieldGroup>
+ </CardContent>
+ </Card>
<SSOModal
popUp={popUp}
handlePopUpClose={handlePopUpClose}
@@ -227,6 +267,6 @@ export const OrgSSOSection = (): JSX.Element => {
text={popUp.upgradePlan.data?.text}
isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
/>
- </div>
+ </>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSsoTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSsoTab.tsx
index 3b7a2ca9e6..7e90538089 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSsoTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSsoTab.tsx
@@ -1,9 +1,53 @@
-import { InfoIcon } from "lucide-react";
-import { twMerge } from "tailwind-merge";
+import { useState } from "react";
+import { IdCardIcon, Info, Plus, Trash2 } from "lucide-react";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
-import { Button, ContentLoader, EmptyState } from "@app/components/v2";
-import { Alert, AlertDescription, AlertTitle } from "@app/components/v3";
+import { createNotification } from "@app/components/notifications";
+import { OrgPermissionCan } from "@app/components/permissions";
+import {
+ Alert,
+ AlertDescription,
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
+ AlertTitle,
+ Button,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ DocumentationLinkBadge,
+ Empty,
+ EmptyContent,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldLabel,
+ FieldTitle,
+ PageLoader,
+ RadioGroup,
+ RadioGroupItem,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import {
OrgPermissionEmailDomainActions,
OrgPermissionSsoActions,
@@ -19,9 +63,12 @@ import {
useGetEmailDomains,
useGetLDAPConfig,
useGetOIDCConfig,
- useGetSSOConfig
+ useGetSSOConfig,
+ useUpdateLDAPConfig,
+ useUpdateSSOConfig
} from "@app/hooks/api";
import { LoginMethod } from "@app/hooks/api/admin/types";
+import { useUpdateOIDCConfig } from "@app/hooks/api/oidcConfig/mutations";
import { LDAPModal } from "./LDAPModal";
import { OIDCModal } from "./OIDCModal";
@@ -32,6 +79,17 @@ import { OrgOIDCSection } from "./OrgOIDCSection";
import { OrgSSOSection } from "./OrgSSOSection";
import { SSOModal } from "./SSOModal";
+const EmailDomainAlert = () => (
+ <Alert variant="info">
+ <Info />
+ <AlertTitle>Email domain verification required</AlertTitle>
+ <AlertDescription>
+ You must verify at least one email domain before configuring an identity provider. Add a
+ domain in the Email Domains section above.
+ </AlertDescription>
+ </Alert>
+);
+
export const OrgSsoTab = withPermission(
() => {
const {
@@ -42,9 +100,23 @@ export const OrgSsoTab = withPermission(
"addLDAP",
"addSSO",
"addOIDC",
- "upgradePlan"
+ "upgradePlan",
+ "addDomain",
+ "verifyDomain"
] as const);
+ const [isChooserOpen, setIsChooserOpen] = useState(false);
+ const [selectedProvider, setSelectedProvider] = useState<string>("");
+ const [chooserExclude, setChooserExclude] = useState<"saml" | "oidc" | "ldap" | null>(null);
+ const [pendingSwitch, setPendingSwitch] = useState<{
+ from: "saml" | "oidc" | "ldap";
+ to: "saml" | "oidc" | "ldap";
+ } | null>(null);
+
+ const { mutateAsync: updateSamlAsync } = useUpdateSSOConfig();
+ const { mutateAsync: updateOidcAsync } = useUpdateOIDCConfig();
+ const { mutateAsync: updateLdapAsync } = useUpdateLDAPConfig();
+
const { subscription } = useSubscription();
const { permission } = useOrgPermission();
@@ -81,171 +153,392 @@ export const OrgSsoTab = withPermission(
const shouldShowCreateIdentityProviderView =
!isOidcConfigured && !isSamlConfigured && !isLdapConfigured;
- const createIdentityProviderView =
+ const showEmailDomainAlert =
+ Boolean(subscription?.emailDomainVerification) && !isPending && !emailDomains?.length;
+
+ const hasUnverifiedEmailDomainsOnly =
+ Boolean(subscription?.emailDomainVerification) &&
+ !isPending &&
+ Boolean(emailDomains?.length) &&
+ !emailDomains?.some((d) => d.status === "verified");
+
+ const canSeeEmailDomainAlert =
+ showEmailDomainAlert &&
+ permission.can(OrgPermissionEmailDomainActions.Read, OrgPermissionSubjects.EmailDomains);
+
+ const anyProviderAvailable =
shouldDisplaySection(LoginMethod.SAML) ||
shouldDisplaySection(LoginMethod.OIDC) ||
- shouldDisplaySection(LoginMethod.LDAP) ? (
- <>
- <div className="mb-4 space-y-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
- <div>
- <p className="text-xl font-medium text-gray-200">Connect an Identity Provider</p>
- <p className="mt-1 mb-2 text-gray-400">
- Connect your identity provider to simplify user management with options like SAML,
- OIDC, and LDAP.
- </p>
- {subscription?.emailDomainVerification && !isPending && !emailDomains?.length && (
- <Alert variant="info" className="mt-3 bg-info/10">
- <InfoIcon />
- <AlertTitle>Email domain verification required</AlertTitle>
- <AlertDescription>
- You must verify at least one email domain before configuring an identity
- provider. Add a domain in the Email Domains section above.
- </AlertDescription>
- </Alert>
- )}
- </div>
- {shouldDisplaySection(LoginMethod.SAML) && (
- <div
- className={twMerge(
- "mt-4 flex items-center justify-between",
- (shouldDisplaySection(LoginMethod.OIDC) ||
- shouldDisplaySection(LoginMethod.LDAP)) &&
- "border-b border-mineshaft-500 pb-4"
- )}
- >
- <p className="text-lg text-gray-200">SAML</p>
- <Button
- colorSchema="secondary"
- onClick={() => {
- if (!subscription?.samlSSO) {
- handlePopUpOpen("upgradePlan", { featureName: "SAML SSO" });
- return;
- }
-
- handlePopUpOpen("addSSO");
- }}
- >
- Connect
- </Button>
- </div>
- )}
- {shouldDisplaySection(LoginMethod.OIDC) && (
- <div
- className={twMerge(
- "mt-4 flex items-center justify-between",
- shouldDisplaySection(LoginMethod.LDAP) && "border-b border-mineshaft-500 pb-4"
- )}
- >
- <p className="text-lg text-gray-200">OIDC</p>
- <Button
- colorSchema="secondary"
- onClick={() => {
- if (!subscription?.oidcSSO) {
- handlePopUpOpen("upgradePlan", { featureName: "OIDC SSO" });
- return;
- }
-
- handlePopUpOpen("addOIDC");
- }}
- >
- Connect
- </Button>
- </div>
- )}
- {shouldDisplaySection(LoginMethod.LDAP) && (
- <div className="mt-4 flex items-center justify-between">
- <p className="text-lg text-gray-200">LDAP</p>
- <Button
- colorSchema="secondary"
- onClick={() => {
- if (!subscription?.ldap) {
- handlePopUpOpen("upgradePlan", {
- featureName: "LDAP",
- isEnterpriseFeature: true
- });
- return;
- }
-
- handlePopUpOpen("addLDAP");
- }}
+ shouldDisplaySection(LoginMethod.LDAP);
+
+ const handleConnectSaml = () => {
+ if (!subscription?.samlSSO) {
+ handlePopUpOpen("upgradePlan", { featureName: "SAML SSO" });
+ return;
+ }
+ handlePopUpOpen("addSSO");
+ };
+
+ const handleConnectOidc = () => {
+ if (!subscription?.oidcSSO) {
+ handlePopUpOpen("upgradePlan", { featureName: "OIDC SSO" });
+ return;
+ }
+ handlePopUpOpen("addOIDC");
+ };
+
+ const handleConnectLdap = () => {
+ if (!subscription?.ldap) {
+ handlePopUpOpen("upgradePlan", {
+ featureName: "LDAP",
+ isEnterpriseFeature: true
+ });
+ return;
+ }
+ handlePopUpOpen("addLDAP");
+ };
+
+ const closeChooser = () => {
+ setIsChooserOpen(false);
+ setSelectedProvider("");
+ setChooserExclude(null);
+ };
+
+ const openProviderChooser = (exclude: "saml" | "oidc" | "ldap" | null = null) => {
+ setChooserExclude(exclude);
+ setSelectedProvider("");
+ setIsChooserOpen(true);
+ };
+
+ const openSelectedProvider = (provider: string) => {
+ if (provider === "saml") handleConnectSaml();
+ else if (provider === "oidc") handleConnectOidc();
+ else if (provider === "ldap") handleConnectLdap();
+ };
+
+ const handleConnectSelected = () => {
+ if (!selectedProvider) return;
+ const exclude = chooserExclude;
+ const target = selectedProvider;
+ closeChooser();
+
+ if (exclude && (target === "saml" || target === "oidc" || target === "ldap")) {
+ setPendingSwitch({ from: exclude, to: target });
+ return;
+ }
+
+ openSelectedProvider(target);
+ };
+
+ const providerLabel = (provider: "saml" | "oidc" | "ldap") => {
+ if (provider === "saml") return "SAML";
+ if (provider === "oidc") return "OIDC";
+ return "LDAP";
+ };
+
+ const handleConfirmSwitch = async () => {
+ if (!pendingSwitch || !currentOrg) return;
+ const { from, to } = pendingSwitch;
+
+ if (from === "saml") {
+ await updateSamlAsync({
+ organizationId: currentOrg.id,
+ isActive: false,
+ entryPoint: "",
+ issuer: "",
+ cert: ""
+ });
+ } else if (from === "oidc") {
+ await updateOidcAsync({
+ organizationId: currentOrg.id,
+ isActive: false,
+ issuer: "",
+ discoveryURL: "",
+ authorizationEndpoint: "",
+ allowedEmailDomains: "",
+ jwksUri: "",
+ tokenEndpoint: "",
+ userinfoEndpoint: "",
+ clientId: "",
+ clientSecret: ""
+ });
+ } else {
+ await updateLdapAsync({
+ organizationId: currentOrg.id,
+ isActive: false,
+ url: "",
+ bindDN: "",
+ bindPass: "",
+ searchBase: "",
+ searchFilter: "",
+ uniqueUserAttribute: "",
+ groupSearchBase: "",
+ groupSearchFilter: "",
+ caCert: ""
+ });
+ }
+
+ createNotification({
+ text: `Switched from ${providerLabel(from)} to ${providerLabel(to)}.`,
+ type: "success"
+ });
+
+ setPendingSwitch(null);
+ openSelectedProvider(to);
+ };
+
+ const createIdentityProviderView = anyProviderAvailable ? (
+ <Card>
+ <CardHeader className="border-b">
+ <CardTitle>
+ <IdCardIcon className="size-4 text-accent" />
+ Connect an Identity Provider
+ </CardTitle>
+ <CardDescription>
+ Connect your identity provider to simplify user management with options like SAML, OIDC,
+ and LDAP.
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No identity providers connected</EmptyTitle>
+ <EmptyDescription>
+ {showEmailDomainAlert
+ ? "Verify a domain first to add a connection."
+ : "Connect SAML, OIDC, or LDAP to authenticate members."}
+ </EmptyDescription>
+ </EmptyHeader>
+ <EmptyContent>
+ {showEmailDomainAlert && (
+ <OrgPermissionCan
+ I={OrgPermissionEmailDomainActions.Create}
+ a={OrgPermissionSubjects.EmailDomains}
>
- Connect
+ {(isAllowed) => (
+ <Button
+ variant="org"
+ isDisabled={!isAllowed}
+ onClick={() => handlePopUpOpen("addDomain")}
+ >
+ <Plus />
+ Add Domain
+ </Button>
+ )}
+ </OrgPermissionCan>
+ )}
+ {!showEmailDomainAlert && hasUnverifiedEmailDomainsOnly && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>
+ <Button variant="org" isDisabled>
+ <Plus />
+ Add Provider
+ </Button>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>Email domain verification required</TooltipContent>
+ </Tooltip>
+ )}
+ {!showEmailDomainAlert && !hasUnverifiedEmailDomainsOnly && (
+ <Button variant="org" onClick={() => openProviderChooser()}>
+ <Plus />
+ Add Provider
</Button>
- </div>
- )}
- </div>
- <SSOModal
- hideDelete
- popUp={popUp}
- handlePopUpClose={handlePopUpClose}
- handlePopUpToggle={handlePopUpToggle}
- />
- <OIDCModal
- hideDelete
- popUp={popUp}
- handlePopUpClose={handlePopUpClose}
- handlePopUpToggle={handlePopUpToggle}
- />
- <LDAPModal
- hideDelete
- popUp={popUp}
- handlePopUpClose={handlePopUpClose}
- handlePopUpToggle={handlePopUpToggle}
- />
- </>
- ) : (
- <EmptyState title="" iconSize="2x" className="pt-14 pb-10!">
- <p className="text-center text-lg">Single Sign-On (SSO) has been disabled</p>
- <p className="text-center">Contact your server administrator</p>
- </EmptyState>
- );
+ )}
+ </EmptyContent>
+ </Empty>
+ </CardContent>
+ </Card>
+ ) : (
+ <Empty>
+ <EmptyHeader>
+ <EmptyTitle>Single Sign-On (SSO) has been disabled</EmptyTitle>
+ <EmptyDescription>Contact your server administrator.</EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ );
if (areConfigsLoading) {
- return <ContentLoader />;
+ return <PageLoader />;
}
+ const showEnforcement = shouldDisplaySection([
+ LoginMethod.SAML,
+ LoginMethod.GOOGLE,
+ LoginMethod.OIDC
+ ]);
+
return (
<>
- <div className="space-y-4">
- {shouldDisplaySection([LoginMethod.SAML, LoginMethod.GOOGLE, LoginMethod.OIDC]) && (
- <OrgGeneralAuthSection
- isSamlConfigured={isSamlConfigured}
- isOidcConfigured={isOidcConfigured}
- isGoogleConfigured={isGoogleConfigured}
- isSamlActive={Boolean(samlConfig?.isActive)}
- isOidcActive={Boolean(oidcConfig?.isActive)}
- isLdapActive={Boolean(ldapConfig?.isActive)}
- />
- )}
- <OrgEmailDomainsSection />
- {shouldShowCreateIdentityProviderView ? (
- createIdentityProviderView
- ) : (
- <div className="mb-4 space-y-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-6">
- {subscription?.emailDomainVerification &&
- permission.can(
- OrgPermissionEmailDomainActions.Read,
- OrgPermissionSubjects.EmailDomains
- ) &&
- !isPending &&
- !emailDomains?.length && (
- <Alert variant="info" className="mt-3 bg-info/10">
- <InfoIcon />
- <AlertTitle>Email domain verification required</AlertTitle>
- <AlertDescription>
- You must verify at least one email domain before configuring an identity
- provider. Add a domain in the Email Domains section above.
- </AlertDescription>
- </Alert>
+ <div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
+ <div className="flex flex-col gap-4 lg:col-span-2">
+ {shouldShowCreateIdentityProviderView ? (
+ createIdentityProviderView
+ ) : (
+ <>
+ {canSeeEmailDomainAlert && <EmailDomainAlert />}
+ {isSamlConfigured && shouldDisplaySection(LoginMethod.SAML) && (
+ <OrgSSOSection onSwitchProvider={() => openProviderChooser("saml")} />
)}
- <div>
- {isSamlConfigured && shouldDisplaySection(LoginMethod.SAML) && <OrgSSOSection />}
- {isOidcConfigured && shouldDisplaySection(LoginMethod.OIDC) && <OrgOIDCSection />}
- {isLdapConfigured && shouldDisplaySection(LoginMethod.LDAP) && <OrgLDAPSection />}
- </div>
+ {isOidcConfigured && shouldDisplaySection(LoginMethod.OIDC) && (
+ <OrgOIDCSection onSwitchProvider={() => openProviderChooser("oidc")} />
+ )}
+ {isLdapConfigured && shouldDisplaySection(LoginMethod.LDAP) && (
+ <OrgLDAPSection onSwitchProvider={() => openProviderChooser("ldap")} />
+ )}
+ </>
+ )}
+ <OrgEmailDomainsSection
+ popUp={popUp}
+ handlePopUpOpen={handlePopUpOpen}
+ handlePopUpClose={handlePopUpClose}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ </div>
+ {showEnforcement && (
+ <div className="flex flex-col gap-4">
+ <OrgGeneralAuthSection
+ isSamlConfigured={isSamlConfigured}
+ isOidcConfigured={isOidcConfigured}
+ isGoogleConfigured={isGoogleConfigured}
+ isSamlActive={Boolean(samlConfig?.isActive)}
+ isOidcActive={Boolean(oidcConfig?.isActive)}
+ isLdapActive={Boolean(ldapConfig?.isActive)}
+ />
</div>
)}
</div>
+ {anyProviderAvailable && (
+ <>
+ <SSOModal
+ hideDelete
+ popUp={popUp}
+ handlePopUpClose={handlePopUpClose}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ <OIDCModal
+ hideDelete
+ popUp={popUp}
+ handlePopUpClose={handlePopUpClose}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ <LDAPModal
+ hideDelete
+ popUp={popUp}
+ handlePopUpClose={handlePopUpClose}
+ handlePopUpToggle={handlePopUpToggle}
+ />
+ <Dialog
+ open={isChooserOpen}
+ onOpenChange={(open) => {
+ if (open) {
+ setIsChooserOpen(true);
+ } else {
+ closeChooser();
+ }
+ }}
+ >
+ <DialogContent className="max-w-lg">
+ <DialogHeader>
+ <DialogTitle className="flex items-center gap-x-2">
+ {chooserExclude ? "Switch Identity Provider" : "Add Identity Provider"}
+ <DocumentationLinkBadge href="https://infisical.com/docs/integrations/user-authentication" />
+ </DialogTitle>
+ <DialogDescription>Pick a protocol to configure.</DialogDescription>
+ </DialogHeader>
+ <RadioGroup value={selectedProvider} onValueChange={setSelectedProvider}>
+ {shouldDisplaySection(LoginMethod.SAML) && chooserExclude !== "saml" && (
+ <FieldLabel htmlFor="provider-saml" variant="org">
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>SAML</FieldTitle>
+ <FieldDescription>
+ Standard enterprise SSO — Okta, Azure, Google Workspace.
+ </FieldDescription>
+ </FieldContent>
+ <RadioGroupItem value="saml" id="provider-saml" />
+ </Field>
+ </FieldLabel>
+ )}
+ {shouldDisplaySection(LoginMethod.OIDC) && chooserExclude !== "oidc" && (
+ <FieldLabel htmlFor="provider-oidc" variant="org">
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>OIDC</FieldTitle>
+ <FieldDescription>
+ OAuth-based identity layer — Auth0, Keycloak, custom IDPs.
+ </FieldDescription>
+ </FieldContent>
+ <RadioGroupItem value="oidc" id="provider-oidc" />
+ </Field>
+ </FieldLabel>
+ )}
+ {shouldDisplaySection(LoginMethod.LDAP) && chooserExclude !== "ldap" && (
+ <FieldLabel htmlFor="provider-ldap" variant="org">
+ <Field orientation="horizontal">
+ <FieldContent>
+ <FieldTitle>LDAP</FieldTitle>
+ <FieldDescription>
+ Directory protocol for on-prem identity stores.
+ </FieldDescription>
+ </FieldContent>
+ <RadioGroupItem value="ldap" id="provider-ldap" />
+ </Field>
+ </FieldLabel>
+ )}
+ </RadioGroup>
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button variant="ghost">Cancel</Button>
+ </DialogClose>
+ <Button
+ variant="org"
+ isDisabled={!selectedProvider}
+ onClick={handleConnectSelected}
+ >
+ Continue
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ <AlertDialog
+ open={pendingSwitch !== null}
+ onOpenChange={(open) => {
+ if (!open) setPendingSwitch(null);
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <Trash2 />
+ </AlertDialogMedia>
+ <AlertDialogTitle>
+ {pendingSwitch
+ ? `Switch to ${providerLabel(pendingSwitch.to)}?`
+ : "Switch identity provider?"}
+ </AlertDialogTitle>
+ <AlertDialogDescription>
+ {pendingSwitch ? (
+ <>
+ This will clear your current {providerLabel(pendingSwitch.from)}{" "}
+ configuration. Members will no longer be able to sign in via{" "}
+ {providerLabel(pendingSwitch.from)} or SSO until{" "}
+ {providerLabel(pendingSwitch.to)} is configured and activated.
+ </>
+ ) : null}
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction variant="danger" onClick={handleConfirmSwitch}>
+ Switch
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </>
+ )}
<UpgradePlanModal
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx
index 558f37dcbf..8e5dc71e6e 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModal.tsx
@@ -1,22 +1,45 @@
import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
+import { ClipboardCheckIcon, Copy, Trash2 } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogMedia,
+ AlertDialogTitle,
Button,
- DeleteActionModal,
- FormControl,
+ DocumentationLinkBadge,
+ Field,
+ FieldError,
+ FieldGroup,
+ FieldLabel,
+ IconButton,
Input,
- Modal,
- ModalContent,
Select,
+ SelectContent,
SelectItem,
- TextArea
-} from "@app/components/v2";
+ SelectTrigger,
+ SelectValue,
+ Sheet,
+ SheetContent,
+ SheetFooter,
+ SheetHeader,
+ SheetTitle,
+ TextArea,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useOrganization } from "@app/context";
-import { useToggle } from "@app/hooks";
+import { useTimedReset, useToggle } from "@app/hooks";
import { useCreateSSOConfig, useGetSSOConfig, useUpdateSSOConfig } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -153,6 +176,9 @@ export const SSOModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDelet
});
};
+ const [, isAcsCopied, setAcsCopied] = useTimedReset<string>({ initialState: "" });
+ const [, isAudienceCopied, setAudienceCopied] = useTimedReset<string>({ initialState: "" });
+
const renderLabels = (authProvider: string) => {
switch (authProvider) {
case AuthProvider.OKTA_SAML:
@@ -228,139 +254,214 @@ export const SSOModal = ({ popUp, handlePopUpClose, handlePopUpToggle, hideDelet
}
}, [authProvider]);
+ const isPending = createIsLoading || updateIsLoading;
+ const labels = renderLabels(authProvider);
+
return (
<>
- <Modal
- isOpen={popUp?.addSSO?.isOpen}
+ <Sheet
+ open={popUp?.addSSO?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("addSSO", isOpen);
reset();
}}
>
- <ModalContent title="Manage SAML configuration">
- <SSOModalHeader
- providerDetails={ssoAuthProviders.find((provider) => provider.value === authProvider)!}
- isConnected={Boolean(data)}
- />
- <form onSubmit={handleSubmit(onSSOModalSubmit)}>
- <Controller
- control={control}
- name="authProvider"
- defaultValue="okta-saml"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl label="Type" errorText={error?.message} isError={Boolean(error)}>
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- {ssoAuthProviders.map(({ label, value }) => (
- <SelectItem value={String(value || "")} key={label}>
- {label}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- {authProvider && data && (
- <>
- <div className="mb-4">
- <h3 className="text-sm text-mineshaft-400">
- {renderLabels(authProvider).acsUrl}
- </h3>
- <p className="text-md break-all text-gray-400">{`${window.origin}/api/v1/sso/saml2/${data.id}`}</p>
- </div>
- <div className="mb-4">
- <h3 className="text-sm text-mineshaft-400">
- {renderLabels(authProvider).entityId}
- </h3>
- <p className="text-md text-gray-400">{window.origin}</p>
- </div>
- <Controller
- control={control}
- name="entryPoint"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label={renderLabels(authProvider).entryPoint}
- errorText={error?.message}
- isError={Boolean(error)}
- isRequired
- >
- <Input
- {...field}
- placeholder={renderLabels(authProvider).entryPointPlaceholder}
- />
- </FormControl>
- )}
- />
+ <SheetContent className="sm:max-w-2xl">
+ <form onSubmit={handleSubmit(onSSOModalSubmit)} className="flex h-full min-h-0 flex-col">
+ <SheetHeader>
+ <SheetTitle className="flex items-center gap-x-2">
+ Manage SAML Configuration
+ <DocumentationLinkBadge href="https://infisical.com/docs/integrations/user-authentication" />
+ </SheetTitle>
+ </SheetHeader>
+ <div className="thin-scrollbar flex-1 overflow-y-auto px-4">
+ <SSOModalHeader
+ providerDetails={
+ ssoAuthProviders.find((provider) => provider.value === authProvider)!
+ }
+ isConnected={Boolean(data)}
+ />
+ <FieldGroup>
<Controller
control={control}
- name="issuer"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label={renderLabels(authProvider).issuer}
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <Input
- {...field}
- placeholder={renderLabels(authProvider).issuerPlaceholder}
- />
- </FormControl>
+ name="authProvider"
+ defaultValue="okta-saml"
+ render={({ field: { onChange, value }, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="sso-auth-provider">Type</FieldLabel>
+ <Select value={value} onValueChange={onChange}>
+ <SelectTrigger
+ id="sso-auth-provider"
+ className="w-full"
+ isError={Boolean(error)}
+ >
+ <SelectValue placeholder="Select SSO type" />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {ssoAuthProviders.map(({ label, value: providerValue }) => (
+ <SelectItem value={providerValue} key={label}>
+ {label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FieldError>{error?.message}</FieldError>
+ </Field>
)}
/>
- <Controller
- control={control}
- name="cert"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Certificate"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <TextArea {...field} placeholder="-----BEGIN CERTIFICATE----- ..." />
- </FormControl>
- )}
- />
- </>
- )}
-
- <div className="mt-8 flex justify-between">
- <div className="flex items-center">
- <Button
- className="mr-4"
- size="sm"
- type="submit"
- isLoading={createIsLoading || updateIsLoading}
- >
- {!data ? "Add" : "Update"}
+ {authProvider && data && (
+ <>
+ <Field>
+ <FieldLabel className="flex items-center justify-between">
+ {labels.acsUrl}
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="copy application callback url"
+ variant="ghost-muted"
+ size="xs"
+ onClick={() => {
+ navigator.clipboard.writeText(
+ `${window.origin}/api/v1/sso/saml2/${data.id}`
+ );
+ setAcsCopied("copied");
+ }}
+ >
+ {isAcsCopied ? <ClipboardCheckIcon /> : <Copy />}
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>{isAcsCopied ? "Copied" : "Copy"}</TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <p className="text-muted-foreground text-sm break-all">
+ {`${window.origin}/api/v1/sso/saml2/${data.id}`}
+ </p>
+ </Field>
+ <Field>
+ <FieldLabel className="flex items-center justify-between">
+ {labels.entityId}
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="copy audience"
+ variant="ghost-muted"
+ size="xs"
+ onClick={() => {
+ navigator.clipboard.writeText(window.origin);
+ setAudienceCopied("copied");
+ }}
+ >
+ {isAudienceCopied ? <ClipboardCheckIcon /> : <Copy />}
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>{isAudienceCopied ? "Copied" : "Copy"}</TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <p className="text-muted-foreground text-sm">{window.origin}</p>
+ </Field>
+ <Controller
+ control={control}
+ name="entryPoint"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="sso-entry-point">{labels.entryPoint}</FieldLabel>
+ <Input
+ id="sso-entry-point"
+ placeholder={labels.entryPointPlaceholder}
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="issuer"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel
+ htmlFor="sso-issuer"
+ className="inline-flex flex-wrap items-baseline gap-1.5"
+ >
+ {labels.issuer} (optional)
+ </FieldLabel>
+ <Input
+ id="sso-issuer"
+ placeholder={labels.issuerPlaceholder}
+ autoComplete="off"
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="cert"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel
+ htmlFor="sso-cert"
+ className="inline-flex flex-wrap items-baseline gap-1.5"
+ >
+ Certificate (optional)
+ </FieldLabel>
+ <TextArea
+ id="sso-cert"
+ placeholder="-----BEGIN CERTIFICATE----- ..."
+ isError={Boolean(error)}
+ {...field}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
+ />
+ </>
+ )}
+ </FieldGroup>
+ </div>
+ <SheetFooter className="justify-between border-t">
+ <div className="flex gap-2">
+ <Button type="submit" variant="org" isPending={isPending}>
+ {!data.isActive ? "Configure SAML" : "Update Configuration"}
</Button>
- <Button
- colorSchema="secondary"
- variant="plain"
- onClick={() => handlePopUpClose("addSSO")}
- >
+ <Button type="button" variant="ghost" onClick={() => handlePopUpClose("addSSO")}>
Cancel
</Button>
</div>
{!hideDelete && (
- <Button colorSchema="danger" onClick={() => setIsDeletePopupOpen.on()}>
+ <Button type="button" variant="danger" onClick={() => setIsDeletePopupOpen.on()}>
Delete
</Button>
)}
- </div>
+ </SheetFooter>
</form>
- </ModalContent>
- </Modal>
- <DeleteActionModal
- isOpen={isDeletePopupOpen}
- title="Are you sure you want to delete SAML SSO?"
- onChange={() => setIsDeletePopupOpen.toggle()}
- deleteKey="confirm"
- onDeleteApproved={handleSamlSoftDelete}
- />
+ </SheetContent>
+ </Sheet>
+
+ <AlertDialog open={isDeletePopupOpen} onOpenChange={() => setIsDeletePopupOpen.toggle()}>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogMedia>
+ <Trash2 />
+ </AlertDialogMedia>
+ <AlertDialogTitle>Delete SAML Configuration?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This clears the SAML connection. Members will no longer be able to sign in via SAML
+ until it&apos;s reconfigured.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction variant="danger" onClick={handleSamlSoftDelete}>
+ Delete
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
</>
);
};
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModalHeader.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModalHeader.tsx
index c244caa819..64e48ead96 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModalHeader.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/SSOModalHeader.tsx
@@ -20,7 +20,7 @@ export const SSOModalHeader = ({ providerDetails, isConnected }: Props) => {
<img
alt={`${providerDetails.label} logo`}
src={`/images/sso/${providerDetails.image}`}
- className="h-12 w-12 rounded-md bg-bunker-500 p-2"
+ className="h-10 w-10 rounded-md bg-foreground/5 p-1.5"
/>
<div>
<div className="flex items-center gap-x-2 text-mineshaft-300">
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx
index 6d0f489556..0fadbc47b2 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgTabGroup/OrgTabGroup.tsx
@@ -13,6 +13,7 @@ import { OrgGeneralTab } from "../OrgGeneralTab";
import { OrgProductSettingsTab } from "../OrgProductSettingsTab";
import { OrgProvisioningTab } from "../OrgProvisioningTab";
import { OrgSecurityTab } from "../OrgSecurityTab";
+import { OrgSsoDashboardTab } from "../OrgSsoDashboardTab";
import { OrgSsoTab } from "../OrgSsoTab";
import { OrgSubOrgsTab } from "../OrgSubOrgsTab";
import { OrgWorkflowIntegrationTab } from "../OrgWorkflowIntegrationTab";
@@ -35,6 +36,12 @@ export const OrgTabGroup = () => {
component: OrgSsoTab,
isHidden: isSubOrganization
},
+ {
+ name: "SSO Dashboard",
+ key: "sso-dashboard",
+ component: OrgSsoDashboardTab,
+ isHidden: isSubOrganization
+ },
{
name: "Provisioning",
key: "provisioning-settings",