import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Controller, useFormContext } from "react-hook-form"; import { FormGroup, Select, SelectOption, SelectVariant, } from "@patternfly/react-core"; import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import { FormAccess } from "../../components/form-access/FormAccess"; import { HelpItem } from "../../components/help-enabler/HelpItem"; import { Toggle } from "./SamlConfig"; const SIGNATURE_ALGORITHMS = [ "RSA_SHA1", "RSA_SHA256", "RSA_SHA256_MGF1", "RSA_SHA512", "RSA_SHA512_MGF1", "DSA_SHA1", ] as const; const KEYNAME_TRANSFORMER = ["NONE", "KEY_ID", "CERT_SUBJECT"] as const; const CANONICALIZATION = [ { name: "EXCLUSIVE", value: "http://www.w3.org/2001/10/xml-exc-c14n#" }, { name: "EXCLUSIVE_WITH_COMMENTS", value: "http://www.w3.org/2001/10/xml-exc-c14n#WithComments", }, { name: "INCLUSIVE", value: "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", }, { name: "INCLUSIVE_WITH_COMMENTS", value: "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", }, ] as const; export const SamlSignature = () => { const { t } = useTranslation("clients"); const [algOpen, setAlgOpen] = useState(false); const [keyOpen, setKeyOpen] = useState(false); const [canOpen, setCanOpen] = useState(false); const { control, watch } = useFormContext(); const signDocs = watch("attributes.saml$server$signature"); const signAssertion = watch("attributes.saml.assertion.signature"); return ( {(signDocs === "true" || signAssertion === "true") && ( <> } > ( )} /> } > ( )} /> } > ( )} /> )} ); };