Skip to content

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

2.4 KB
Raw Blame
import { Control, Controller } from "react-hook-form";
import { Info } from "lucide-react";

import {
  Field,
  FieldError,
  FieldLabel,
  Input,
  Tooltip,
  TooltipContent,
  TooltipTrigger
} from "@app/components/v3";
import { TAvailableAppConnection } from "@app/hooks/api/appConnections";

import { AppConnectionSelectField } from "./AppConnectionSelectField";
import { FormData } from "./schema";

type Props = {
  control: Control<FormData>;
  availableConnections: TAvailableAppConnection[];
  isPending: boolean;
};

export const AdcsFields = ({ control, availableConnections, isPending }: Props) => (
  <>
    <AppConnectionSelectField
      control={control}
      name="configuration.adcsConnection"
      label="ADCS Connection"
      required
      options={availableConnections}
      isLoading={isPending}
      tooltip="ADCS App Connection contains the Windows domain credentials and Gateway used to reach the AD CS server."
    />
    <Controller
      control={control}
      defaultValue=""
      name="configuration.caName"
      render={({ field, fieldState: { error } }) => (
        <Field className="mb-4">
          <FieldLabel>
            Certificate Authority <span className="text-muted">(optional)</span>
            <Tooltip>
              <TooltipTrigger asChild>
                <Info />
              </TooltipTrigger>
              <TooltipContent className="max-w-sm">
                <div className="flex flex-col gap-2">
                  <p>
                    The AD CS certificate authority name (the CA&apos;s common name), for example{" "}
                    <span className="font-mono">corp-ca01-CA</span>.
                  </p>
                  <p>
                    Leave blank only if the Gateway can reach the CA host over SMB (TCP 445) to
                    discover the name automatically. Otherwise enter it here.
                  </p>
                  <p>
                    To find the name, run this on the AD CS server:
                    <br />
                    <span className="font-mono">certutil -getreg CA\CommonName</span>
                  </p>
                </div>
              </TooltipContent>
            </Tooltip>
          </FieldLabel>
          <Input
            {...field}
            placeholder="Enter CA name (auto-discovered if left blank)"
            isError={Boolean(error)}
          />
          <FieldError errors={[error]} />
        </Field>
      )}
    />
  </>
);