Skip to content

Commit

Permalink
added dynamic components to client authenticator (keycloak#34259)
Browse files Browse the repository at this point in the history
fixes: keycloak#33729

Signed-off-by: Erik Jan de Wit <[email protected]>
  • Loading branch information
edewit authored Oct 23, 2024
1 parent 617d677 commit e520c71
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion js/apps/admin-ui/src/clients/credentials/Credentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ import {
CardBody,
ClipboardCopy,
Divider,
Form,
FormGroup,
PageSection,
Split,
SplitItem,
} from "@patternfly/react-core";
import { useState } from "react";
import { useMemo, useState } from "react";
import { useFormContext, useWatch } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { useAdminClient } from "../../admin-client";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
import { DynamicComponents } from "../../components/dynamic/DynamicComponents";
import { FormAccess } from "../../components/form/FormAccess";
import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
import { FormFields } from "../ClientDetails";
import { ClientSecret } from "./ClientSecret";
import { SignedJWT } from "./SignedJWT";
Expand Down Expand Up @@ -72,6 +75,15 @@ export const Credentials = ({ client, save, refresh }: CredentialsProps) => {
(provider) => provider.id === clientAuthenticatorType,
);

const { componentTypes } = useServerInfo();
const providerProperties = useMemo(
() =>
componentTypes?.["org.keycloak.authentication.ClientAuthenticator"]?.find(
(p) => p.id === clientAuthenticatorType,
)?.properties,
[clientAuthenticatorType, componentTypes],
);

useFetch(
() =>
Promise.all([
Expand Down Expand Up @@ -170,6 +182,11 @@ export const Credentials = ({ client, save, refresh }: CredentialsProps) => {
</FormGroup>
)}
{clientAuthenticatorType === "client-x509" && <X509 />}
{providerProperties && (
<Form>
<DynamicComponents properties={providerProperties} />
</Form>
)}
<ActionGroup>
<Button variant="primary" type="submit" isDisabled={!isDirty}>
{t("save")}
Expand Down

0 comments on commit e520c71

Please sign in to comment.