UNPKG

@keycloakify/keycloak-admin-ui

Version:
18 lines 2.67 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { FormProvider, useForm } from "react-hook-form"; import { ActionGroup, Button } from "@patternfly/react-core"; import { FormAccess } from "../../components/form/FormAccess"; import { HelpLinkTextInput } from "../../realm-settings/security-defences/HelpLinkTextInput"; import { convertToFormValues } from "../../util"; import "./security-defences.css"; export const HeadersForm = ({ realm, save }) => { const { t } = useTranslation(); const form = useForm(); const { setValue, formState: { isDirty }, handleSubmit, } = form; const setupForm = () => convertToFormValues(realm, setValue); useEffect(setupForm, []); return (_jsx(FormProvider, { ...form, children: _jsxs(FormAccess, { isHorizontal: true, role: "manage-realm", className: "keycloak__security-defences__form", onSubmit: handleSubmit(save), children: [_jsx(HelpLinkTextInput, { fieldName: "browserSecurityHeaders.xFrameOptions", url: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options" }), _jsx(HelpLinkTextInput, { fieldName: "browserSecurityHeaders.contentSecurityPolicy", url: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy" }), _jsx(HelpLinkTextInput, { fieldName: "browserSecurityHeaders.contentSecurityPolicyReportOnly", url: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only" }), _jsx(HelpLinkTextInput, { fieldName: "browserSecurityHeaders.xContentTypeOptions", url: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options" }), _jsx(HelpLinkTextInput, { fieldName: "browserSecurityHeaders.xRobotsTag", url: "https://developers.google.com/search/docs/advanced/robots/robots_meta_tag" }), _jsx(HelpLinkTextInput, { fieldName: "browserSecurityHeaders.xXSSProtection", url: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection" }), _jsx(HelpLinkTextInput, { fieldName: "browserSecurityHeaders.strictTransportSecurity", url: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security" }), _jsx(HelpLinkTextInput, { fieldName: "browserSecurityHeaders.referrerPolicy", url: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy" }), _jsxs(ActionGroup, { children: [_jsx(Button, { variant: "primary", type: "submit", "data-testid": "headers-form-tab-save", isDisabled: !isDirty, children: t("save") }), _jsx(Button, { variant: "link", onClick: setupForm, children: t("revert") })] })] }) })); }; //# sourceMappingURL=HeadersForm.js.map