import { useTranslation } from "react-i18next"; import { Controller, useFormContext } from "react-hook-form"; import { FormGroup, Switch, Checkbox, Grid, GridItem, InputGroup, } 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 { convertAttributeNameToForm } from "../../util"; import "./capability-config.css"; type CapabilityConfigProps = { unWrap?: boolean; protocol?: string; }; export const CapabilityConfig = ({ unWrap, protocol: type, }: CapabilityConfigProps) => { const { t } = useTranslation("clients"); const { control, watch, setValue } = useFormContext(); const protocol = type || watch("protocol"); const clientAuthentication = watch("publicClient"); const authorization = watch("authorizationServicesEnabled"); return ( {protocol === "openid-connect" && ( <> } > ( { onChange(!value); if (!value) { setValue("authorizationServicesEnabled", false); setValue("serviceAccountsEnabled", false); setValue( convertAttributeNameToForm( "attributes.oidc.ciba.grant.enabled" ), false ); } }} /> )} /> } > ( { onChange(value); if (value) { setValue("serviceAccountsEnabled", true); } }} isDisabled={clientAuthentication} /> )} /> ( )} /> ( )} /> ( )} /> ( )} /> ( )} /> ( )} /> )} {protocol === "saml" && ( <> } label={t("encryptAssertions")} fieldId="kc-encrypt" hasNoPaddingTop > ( )} /> } label={t("clientSignature")} fieldId="kc-client-signature" hasNoPaddingTop > ( )} /> )} ); };