2020-09-17 13:51:40 +00:00
|
|
|
import React from "react";
|
2020-09-22 12:43:51 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
2020-08-31 18:26:25 +00:00
|
|
|
import {
|
|
|
|
FormGroup,
|
|
|
|
Switch,
|
|
|
|
Checkbox,
|
|
|
|
Grid,
|
|
|
|
GridItem,
|
|
|
|
} from "@patternfly/react-core";
|
2021-02-28 20:02:31 +00:00
|
|
|
import { Controller, useFormContext } from "react-hook-form";
|
2020-08-31 18:26:25 +00:00
|
|
|
|
2020-10-28 18:17:15 +00:00
|
|
|
import { FormAccess } from "../../components/form-access/FormAccess";
|
2021-02-28 20:02:31 +00:00
|
|
|
import { ClientForm } from "../ClientDetails";
|
2020-10-28 18:17:15 +00:00
|
|
|
|
2021-02-28 20:02:31 +00:00
|
|
|
export const CapabilityConfig = () => {
|
2020-09-17 13:51:40 +00:00
|
|
|
const { t } = useTranslation("clients");
|
2021-02-28 20:02:31 +00:00
|
|
|
const { control } = useFormContext<ClientForm>();
|
2020-09-17 13:51:40 +00:00
|
|
|
return (
|
2020-10-28 18:17:15 +00:00
|
|
|
<FormAccess isHorizontal role="manage-clients">
|
2020-09-29 06:34:27 +00:00
|
|
|
<FormGroup
|
|
|
|
hasNoPaddingTop
|
|
|
|
label={t("clientAuthentication")}
|
|
|
|
fieldId="kc-authentication"
|
|
|
|
>
|
2020-09-17 13:51:40 +00:00
|
|
|
<Controller
|
|
|
|
name="publicClient"
|
2020-09-25 17:42:32 +00:00
|
|
|
defaultValue={false}
|
2021-02-28 20:02:31 +00:00
|
|
|
control={control}
|
2020-09-17 13:51:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Switch
|
|
|
|
id="kc-authentication"
|
|
|
|
name="publicClient"
|
|
|
|
label={t("common:on")}
|
|
|
|
labelOff={t("common:off")}
|
|
|
|
isChecked={value}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2020-09-29 06:34:27 +00:00
|
|
|
<FormGroup
|
|
|
|
hasNoPaddingTop
|
|
|
|
label={t("clientAuthorization")}
|
|
|
|
fieldId="kc-authorization"
|
|
|
|
>
|
2020-09-17 13:51:40 +00:00
|
|
|
<Controller
|
|
|
|
name="authorizationServicesEnabled"
|
2020-09-25 17:42:32 +00:00
|
|
|
defaultValue={false}
|
2021-02-28 20:02:31 +00:00
|
|
|
control={control}
|
2020-09-17 13:51:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Switch
|
2020-09-22 12:43:51 +00:00
|
|
|
id="kc-authorization"
|
2020-09-17 13:51:40 +00:00
|
|
|
name="authorizationServicesEnabled"
|
|
|
|
label={t("common:on")}
|
|
|
|
labelOff={t("common:off")}
|
|
|
|
isChecked={value}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2020-09-29 06:34:27 +00:00
|
|
|
<FormGroup
|
|
|
|
hasNoPaddingTop
|
|
|
|
label={t("authenticationFlow")}
|
|
|
|
fieldId="kc-flow"
|
|
|
|
>
|
2020-09-17 13:51:40 +00:00
|
|
|
<Grid>
|
2020-09-23 19:19:02 +00:00
|
|
|
<GridItem lg={4} sm={6}>
|
2020-09-17 13:51:40 +00:00
|
|
|
<Controller
|
|
|
|
name="standardFlowEnabled"
|
2020-09-25 17:42:32 +00:00
|
|
|
defaultValue={false}
|
2021-02-28 20:02:31 +00:00
|
|
|
control={control}
|
2020-09-17 13:51:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Checkbox
|
|
|
|
label={t("standardFlow")}
|
|
|
|
id="kc-flow-standard"
|
|
|
|
name="standardFlowEnabled"
|
|
|
|
isChecked={value}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</GridItem>
|
2020-09-23 19:19:02 +00:00
|
|
|
<GridItem lg={8} sm={6}>
|
2020-09-17 13:51:40 +00:00
|
|
|
<Controller
|
|
|
|
name="directAccessGrantsEnabled"
|
2020-09-25 17:42:32 +00:00
|
|
|
defaultValue={false}
|
2021-02-28 20:02:31 +00:00
|
|
|
control={control}
|
2020-09-17 13:51:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Checkbox
|
|
|
|
label={t("directAccess")}
|
|
|
|
id="kc-flow-direct"
|
|
|
|
name="directAccessGrantsEnabled"
|
|
|
|
isChecked={value}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</GridItem>
|
2020-09-23 19:19:02 +00:00
|
|
|
<GridItem lg={4} sm={6}>
|
2020-09-17 13:51:40 +00:00
|
|
|
<Controller
|
|
|
|
name="implicitFlowEnabled"
|
2020-09-25 17:42:32 +00:00
|
|
|
defaultValue={false}
|
2021-02-28 20:02:31 +00:00
|
|
|
control={control}
|
2020-09-17 13:51:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Checkbox
|
2020-09-22 12:43:51 +00:00
|
|
|
label={t("implicitFlow")}
|
|
|
|
id="kc-flow-implicit"
|
2020-09-17 13:51:40 +00:00
|
|
|
name="implicitFlowEnabled"
|
|
|
|
isChecked={value}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</GridItem>
|
2020-09-23 19:19:02 +00:00
|
|
|
<GridItem lg={8} sm={6}>
|
2020-09-17 13:51:40 +00:00
|
|
|
<Controller
|
|
|
|
name="serviceAccountsEnabled"
|
2020-09-25 17:42:32 +00:00
|
|
|
defaultValue={false}
|
2021-02-28 20:02:31 +00:00
|
|
|
control={control}
|
2020-09-17 13:51:40 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Checkbox
|
|
|
|
label={t("serviceAccount")}
|
|
|
|
id="kc-flow-service-account"
|
|
|
|
name="serviceAccountsEnabled"
|
|
|
|
isChecked={value}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</GridItem>
|
|
|
|
</Grid>
|
|
|
|
</FormGroup>
|
2020-10-28 18:17:15 +00:00
|
|
|
</FormAccess>
|
2020-09-17 13:51:40 +00:00
|
|
|
);
|
|
|
|
};
|