UNPKG

@keycloakify/keycloak-admin-ui

Version:
32 lines 2.19 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { SelectControl, useFetch } from "../../ui-shared"; import { ActionGroup, Button } from "@patternfly/react-core"; import { sortBy } from "lodash-es"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useAdminClient } from "../../admin-client"; import { FormAccess } from "../../components/form/FormAccess"; export const AuthenticationOverrides = ({ protocol, save, reset, hasConfigureAccess, }) => { const { adminClient } = useAdminClient(); const { t } = useTranslation(); const [flows, setFlows] = useState([]); useFetch(() => adminClient.authenticationManagement.getFlows(), (flows) => { let filteredFlows = [ ...flows.filter((flow) => flow.providerId !== "client-flow"), ]; filteredFlows = sortBy(filteredFlows, [(f) => f.alias]); setFlows(filteredFlows); }, []); return (_jsxs(FormAccess, { role: "manage-clients", fineGrainedAccess: hasConfigureAccess, isHorizontal: true, children: [_jsx(SelectControl, { name: "authenticationFlowBindingOverrides.browser", label: t("browserFlow"), labelIcon: t("browserFlowHelp"), controller: { defaultValue: "", }, options: [ { key: "", value: t("choose") }, ...flows.map(({ id, alias }) => ({ key: id, value: alias })), ] }), protocol === "openid-connect" && (_jsx(SelectControl, { name: "authenticationFlowBindingOverrides.direct_grant", label: t("directGrant"), labelIcon: t("directGrantHelp"), controller: { defaultValue: "", }, options: [ { key: "", value: t("choose") }, ...flows.map(({ id, alias }) => ({ key: id, value: alias })), ] })), _jsxs(ActionGroup, { children: [_jsx(Button, { variant: "secondary", onClick: save, "data-testid": "OIDCAuthFlowOverrideSave", children: t("save") }), _jsx(Button, { variant: "link", onClick: reset, "data-testid": "OIDCAuthFlowOverrideRevert", children: t("revert") })] })] })); }; //# sourceMappingURL=AuthenticationOverrides.js.map