import { useTranslation } from "react-i18next"; import { useFormContext } from "react-hook-form"; import { FormGroup } from "@patternfly/react-core"; import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import type { ClientSettingsProps } from "../ClientSettings"; import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput"; import { FormAccess } from "../../components/form-access/FormAccess"; import { HelpItem } from "../../components/help-enabler/HelpItem"; import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput"; import { SaveReset } from "../advanced/SaveReset"; import environment from "../../environment"; import { useRealm } from "../../context/realm-context/RealmContext"; import { useAccess } from "../../context/access/Access"; import { convertAttributeNameToForm } from "../../util"; export const AccessSettings = ({ client, save, reset, }: ClientSettingsProps) => { const { t } = useTranslation("clients"); const { register, watch } = useFormContext(); const { realm } = useRealm(); const { hasAccess } = useAccess(); const isManager = hasAccess("manage-clients") || client.access?.configure; const protocol = watch("protocol"); const idpInitiatedSsoUrlName: string = watch( "attributes.saml_idp_initiated_sso_url_name" ); return ( {!client.bearerOnly && ( <> } > } > } > } > {protocol === "saml" && ( <> } helperText={ idpInitiatedSsoUrlName !== "" && t("idpInitiatedSsoUrlNameHelp", { url: `${environment.authServerUrl}/realms/${realm}/protocol/saml/clients/${idpInitiatedSsoUrlName}`, }) } > } > } > )} {protocol !== "saml" && ( } > )} )} {protocol !== "saml" && ( } > )} {client.bearerOnly && ( )} ); };