diff --git a/src/clients/add/CapabilityConfig.tsx b/src/clients/add/CapabilityConfig.tsx index 7f1f5521d7..3ba9036af5 100644 --- a/src/clients/add/CapabilityConfig.tsx +++ b/src/clients/add/CapabilityConfig.tsx @@ -1,5 +1,6 @@ import React from "react"; import { useTranslation } from "react-i18next"; +import { Controller, useFormContext } from "react-hook-form"; import { FormGroup, Switch, @@ -8,11 +9,13 @@ import { GridItem, InputGroup, } from "@patternfly/react-core"; -import { Controller, useFormContext } from "react-hook-form"; + import { FormAccess } from "../../components/form-access/FormAccess"; import { ClientForm } from "../ClientDetails"; import { HelpItem } from "../../components/help-enabler/HelpItem"; +import "./capability-config.css"; + type CapabilityConfigProps = { unWrap?: boolean; protocol?: string; @@ -26,10 +29,15 @@ export const CapabilityConfig = ({ const { control, watch, setValue } = useFormContext(); const protocol = type || watch("protocol"); const clientAuthentication = watch("publicClient"); - const clientAuthorization = watch("authorizationServicesEnabled"); + const authorization = watch("authorizationServicesEnabled"); return ( - + <> {protocol === "openid-connect" && ( <> @@ -47,7 +55,7 @@ export const CapabilityConfig = ({ > ( onChange(!value)} + onChange={(value) => { + onChange(!value); + if (!value) { + setValue("authorizationServicesEnabled", false); + setValue("serviceAccountsEnabled", false); + } + }} /> )} /> @@ -85,7 +99,7 @@ export const CapabilityConfig = ({ name="authorizationServicesEnabled" label={t("common:on")} labelOff={t("common:off")} - isChecked={value} + isChecked={value && !clientAuthentication} onChange={(value) => { onChange(value); if (value) { @@ -103,7 +117,7 @@ export const CapabilityConfig = ({ fieldId="kc-flow" > - + - + - + - +