added dynamic components to client authenticator (#34259)
fixes: #33729 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
617d677341
commit
e520c71a1a
1 changed files with 18 additions and 1 deletions
|
@ -16,17 +16,20 @@ import {
|
||||||
CardBody,
|
CardBody,
|
||||||
ClipboardCopy,
|
ClipboardCopy,
|
||||||
Divider,
|
Divider,
|
||||||
|
Form,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
PageSection,
|
PageSection,
|
||||||
Split,
|
Split,
|
||||||
SplitItem,
|
SplitItem,
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { useFormContext, useWatch } from "react-hook-form";
|
import { useFormContext, useWatch } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useAdminClient } from "../../admin-client";
|
import { useAdminClient } from "../../admin-client";
|
||||||
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
|
||||||
|
import { DynamicComponents } from "../../components/dynamic/DynamicComponents";
|
||||||
import { FormAccess } from "../../components/form/FormAccess";
|
import { FormAccess } from "../../components/form/FormAccess";
|
||||||
|
import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
|
||||||
import { FormFields } from "../ClientDetails";
|
import { FormFields } from "../ClientDetails";
|
||||||
import { ClientSecret } from "./ClientSecret";
|
import { ClientSecret } from "./ClientSecret";
|
||||||
import { SignedJWT } from "./SignedJWT";
|
import { SignedJWT } from "./SignedJWT";
|
||||||
|
@ -72,6 +75,15 @@ export const Credentials = ({ client, save, refresh }: CredentialsProps) => {
|
||||||
(provider) => provider.id === clientAuthenticatorType,
|
(provider) => provider.id === clientAuthenticatorType,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { componentTypes } = useServerInfo();
|
||||||
|
const providerProperties = useMemo(
|
||||||
|
() =>
|
||||||
|
componentTypes?.["org.keycloak.authentication.ClientAuthenticator"]?.find(
|
||||||
|
(p) => p.id === clientAuthenticatorType,
|
||||||
|
)?.properties,
|
||||||
|
[clientAuthenticatorType, componentTypes],
|
||||||
|
);
|
||||||
|
|
||||||
useFetch(
|
useFetch(
|
||||||
() =>
|
() =>
|
||||||
Promise.all([
|
Promise.all([
|
||||||
|
@ -170,6 +182,11 @@ export const Credentials = ({ client, save, refresh }: CredentialsProps) => {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
{clientAuthenticatorType === "client-x509" && <X509 />}
|
{clientAuthenticatorType === "client-x509" && <X509 />}
|
||||||
|
{providerProperties && (
|
||||||
|
<Form>
|
||||||
|
<DynamicComponents properties={providerProperties} />
|
||||||
|
</Form>
|
||||||
|
)}
|
||||||
<ActionGroup>
|
<ActionGroup>
|
||||||
<Button variant="primary" type="submit" isDisabled={!isDirty}>
|
<Button variant="primary" type="submit" isDisabled={!isDirty}>
|
||||||
{t("save")}
|
{t("save")}
|
||||||
|
|
Loading…
Reference in a new issue