@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
23 lines • 4.06 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { FormGroup, Switch } from "@patternfly/react-core";
import { Controller, FormProvider, useWatch, } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { HelpItem, TextControl } from "../../ui-shared";
import { FormAccess } from "../../components/form/FormAccess";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
export const LdapSettingsKerberosIntegration = ({ form, showSectionHeading = false, showSectionDescription = false, }) => {
const { t } = useTranslation();
const allowKerberosAuth = useWatch({
control: form.control,
name: "config.allowKerberosAuthentication",
defaultValue: ["false"],
});
return (_jsxs(FormProvider, { ...form, children: [showSectionHeading && (_jsx(WizardSectionHeader, { title: t("kerberosIntegration"), description: t("ldapKerberosSettingsDescription"), showDescription: showSectionDescription })), _jsxs(FormAccess, { role: "manage-realm", isHorizontal: true, children: [_jsx(FormGroup, { label: t("allowKerberosAuthentication"), labelIcon: _jsx(HelpItem, { helpText: t("allowKerberosAuthenticationHelp"), fieldLabelId: "allowKerberosAuthentication" }), fieldId: "kc-allow-kerberos-authentication", hasNoPaddingTop: true, children: _jsx(Controller, { name: "config.allowKerberosAuthentication", defaultValue: ["false"], control: form.control, render: ({ field }) => (_jsx(Switch, { id: "kc-allow-kerberos-authentication", "data-testid": "allow-kerberos-auth", isDisabled: false, onChange: (_event, value) => field.onChange([`${value}`]), isChecked: field.value[0] === "true", label: t("on"), labelOff: t("off"), "aria-label": t("allowKerberosAuthentication") })) }) }), allowKerberosAuth[0] === "true" && (_jsxs(_Fragment, { children: [_jsx(TextControl, { name: "config.kerberosRealm.0", label: t("kerberosRealm"), labelIcon: t("kerberosRealmHelp"), rules: {
required: t("validateRealm"),
} }), _jsx(TextControl, { name: "config.serverPrincipal.0", label: t("serverPrincipal"), labelIcon: t("serverPrincipalHelp"), rules: {
required: t("validateServerPrincipal"),
} }), _jsx(TextControl, { name: "config.keyTab.0", label: t("keyTab"), labelIcon: t("keyTabHelp"), rules: {
required: t("validateKeyTab"),
} }), _jsx(TextControl, { name: "config.krbPrincipalAttribute.0", label: t("krbPrincipalAttribute"), labelIcon: t("krbPrincipalAttributeHelp") }), _jsx(FormGroup, { label: t("debug"), labelIcon: _jsx(HelpItem, { helpText: t("debugHelp"), fieldLabelId: "debug" }), fieldId: "kc-debug", hasNoPaddingTop: true, children: _jsx(Controller, { name: "config.debug", defaultValue: ["false"], control: form.control, render: ({ field }) => (_jsx(Switch, { id: "kc-debug", "data-testid": "debug", isDisabled: false, onChange: (_event, value) => field.onChange([`${value}`]), isChecked: field.value[0] === "true", label: t("on"), labelOff: t("off"), "aria-label": t("debug") })) }) })] })), _jsx(FormGroup, { label: t("useKerberosForPasswordAuthentication"), labelIcon: _jsx(HelpItem, { helpText: t("useKerberosForPasswordAuthenticationHelp"), fieldLabelId: "useKerberosForPasswordAuthentication" }), fieldId: "kc-use-kerberos-password-authentication", hasNoPaddingTop: true, children: _jsx(Controller, { name: "config.useKerberosForPasswordAuthentication", defaultValue: ["false"], control: form.control, render: ({ field }) => (_jsx(Switch, { id: "kc-use-kerberos-password-authentication", "data-testid": "use-kerberos-pw-auth", isDisabled: false, onChange: (_event, value) => field.onChange([`${value}`]), isChecked: field.value[0] === "true", label: t("on"), labelOff: t("off"), "aria-label": t("useKerberosForPasswordAuthentication") })) }) })] })] }));
};
//# sourceMappingURL=LdapSettingsKerberosIntegration.js.map