@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
48 lines • 2.98 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { SelectControl } from "../../ui-shared";
import { FormAccess } from "../../components/form/FormAccess";
import { convertAttributeNameToForm } from "../../util";
import { Toggle } from "../../clients/add/SamlConfig";
const SIGNATURE_ALGORITHMS = [
"RSA_SHA1",
"RSA_SHA256",
"RSA_SHA256_MGF1",
"RSA_SHA512",
"RSA_SHA512_MGF1",
"DSA_SHA1",
];
const KEYNAME_TRANSFORMER = ["NONE", "KEY_ID", "CERT_SUBJECT"];
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",
},
];
export const SamlSignature = () => {
const { t } = useTranslation();
const { watch } = useFormContext();
const signDocs = watch(convertAttributeNameToForm("attributes.saml.server.signature"));
const signAssertion = watch(convertAttributeNameToForm("attributes.saml.assertion.signature"));
return (_jsxs(FormAccess, { isHorizontal: true, role: "manage-clients", className: "keycloak__capability-config__form", children: [_jsx(Toggle, { name: convertAttributeNameToForm("attributes.saml.server.signature"), label: "signDocuments" }), _jsx(Toggle, { name: convertAttributeNameToForm("attributes.saml.assertion.signature"), label: "signAssertions" }), (signDocs === "true" || signAssertion === "true") && (_jsxs(_Fragment, { children: [_jsx(SelectControl, { name: convertAttributeNameToForm("attributes.saml.signature.algorithm"), label: t("signatureAlgorithm"), labelIcon: t("signatureAlgorithmHelp"), controller: {
defaultValue: SIGNATURE_ALGORITHMS[0],
}, options: [...SIGNATURE_ALGORITHMS] }), _jsx(SelectControl, { name: convertAttributeNameToForm("attributes.saml.server.signature.keyinfo.xmlSigKeyInfoKeyNameTransformer"), label: t("signatureKeyName"), labelIcon: t("signatureKeyNameHelp"), controller: {
defaultValue: KEYNAME_TRANSFORMER[0],
}, options: [...KEYNAME_TRANSFORMER] }), _jsx(SelectControl, { name: "attributes.saml_signature_canonicalization_method", label: t("canonicalization"), labelIcon: t("canonicalizationHelp"), controller: {
defaultValue: CANONICALIZATION[0].value,
}, options: CANONICALIZATION.map(({ name, value }) => ({
key: value,
value: name,
})) })] }))] }));
};
//# sourceMappingURL=SamlSignature.js.map