@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
116 lines • 7.84 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { AlertVariant, PageSection, Text } from "@patternfly/react-core";
import { useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { ScrollForm } from "../ui-shared";
import { convertAttributeNameToForm, toUpperCase } from "../util";
import { AdvancedSettings } from "../clients/advanced/AdvancedSettings";
import { AuthenticationOverrides } from "../clients/advanced/AuthenticationOverrides";
import { ClusteringPanel } from "../clients/advanced/ClusteringPanel";
import { FineGrainOpenIdConnect } from "../clients/advanced/FineGrainOpenIdConnect";
import { FineGrainSamlEndpointConfig } from "../clients/advanced/FineGrainSamlEndpointConfig";
import { OpenIdConnectCompatibilityModes } from "../clients/advanced/OpenIdConnectCompatibilityModes";
export const parseResult = (result, prefixKey, addAlert, t) => {
var _a, _b;
const successCount = ((_a = result.successRequests) === null || _a === void 0 ? void 0 : _a.length) || 0;
const failedCount = ((_b = result.failedRequests) === null || _b === void 0 ? void 0 : _b.length) || 0;
if (successCount === 0 && failedCount === 0) {
addAlert(t("noAdminUrlSet"), AlertVariant.warning);
}
else if (failedCount > 0) {
addAlert(t(prefixKey + "Success", { successNodes: result.successRequests }), AlertVariant.success);
addAlert(t(prefixKey + "Fail", { failedNodes: result.failedRequests }), AlertVariant.danger);
}
else {
addAlert(t(prefixKey + "Success", { successNodes: result.successRequests }), AlertVariant.success);
}
};
export const AdvancedTab = ({ save, client }) => {
const { t } = useTranslation();
const openIdConnect = "openid-connect";
const { setValue } = useFormContext();
const { publicClient, attributes, protocol, authenticationFlowBindingOverrides, } = client;
const resetFields = (names) => {
for (const name of names) {
setValue(convertAttributeNameToForm(`attributes.${name}`), (attributes === null || attributes === void 0 ? void 0 : attributes[name]) || "");
}
};
return (_jsx(PageSection, { variant: "light", className: "pf-v5-u-py-0", children: _jsx(ScrollForm, { label: t("jumpToSection"), sections: [
{
title: t("clustering"),
isHidden: !publicClient,
panel: _jsx(ClusteringPanel, { client: client, save: save }),
},
{
title: t("fineGrainOpenIdConnectConfiguration"),
isHidden: protocol !== openIdConnect,
panel: (_jsxs(_Fragment, { children: [_jsx(Text, { className: "pf-v5-u-pb-lg", children: t("fineGrainOpenIdConnectConfigurationHelp") }), _jsx(FineGrainOpenIdConnect, { save: save, reset: () => {
resetFields([
"logoUri",
"policyUri",
"tosUri",
"access.token.signed.response.alg",
"id.token.signed.response.alg",
"id.token.encrypted.response.alg",
"id.token.encrypted.response.enc",
"user.info.response.signature.alg",
"user.info.encrypted.response.alg",
"user.info.encrypted.response.enc",
"request.object.signature.alg",
"request.object.encryption.alg",
"request.object.encryption.enc",
"request.object.required",
"request.uris",
"authorization.signed.response.alg",
"authorization.encrypted.response.alg",
"authorization.encrypted.response.enc",
]);
} })] })),
},
{
title: t("openIdConnectCompatibilityModes"),
isHidden: protocol !== openIdConnect,
panel: (_jsxs(_Fragment, { children: [_jsx(Text, { className: "pf-v5-u-pb-lg", children: t("openIdConnectCompatibilityModesHelp") }), _jsx(OpenIdConnectCompatibilityModes, { save: () => save(), reset: () => resetFields([
"exclude.session.state.from.auth.response",
"use.refresh.tokens",
"client_credentials.use_refresh_token",
"token.response.type.bearer.lower-case",
]) })] })),
},
{
title: t("fineGrainSamlEndpointConfig"),
isHidden: protocol === openIdConnect,
panel: (_jsxs(_Fragment, { children: [_jsx(Text, { className: "pf-v5-u-pb-lg", children: t("fineGrainSamlEndpointConfigHelp") }), _jsx(FineGrainSamlEndpointConfig, { save: () => save(), reset: () => resetFields([
"logoUri",
"policyUri",
"tosUri",
"saml_assertion_consumer_url_post",
"saml_assertion_consumer_url_redirect",
"saml_single_logout_service_url_post",
"saml_single_logout_service_url_redirect",
"saml_single_logout_service_url_artifact",
"saml_artifact_binding_url",
"saml_artifact_resolution_service_url",
]) })] })),
},
{
title: t("advancedSettings"),
panel: (_jsxs(_Fragment, { children: [_jsx(Text, { className: "pf-v5-u-pb-lg", children: t("advancedSettings" + toUpperCase(protocol || "")) }), _jsx(AdvancedSettings, { protocol: protocol, save: () => save(), reset: () => {
resetFields([
"saml.assertion.lifespan",
"access.token.lifespan",
"tls.client.certificate.bound.access.tokens",
"pkce.code.challenge.method",
]);
} })] })),
},
{
title: t("authenticationOverrides"),
panel: (_jsxs(_Fragment, { children: [_jsx(Text, { className: "pf-v5-u-pb-lg", children: t("authenticationOverridesHelp") }), _jsx(AuthenticationOverrides, { protocol: protocol, save: () => save(), reset: () => {
setValue("authenticationFlowBindingOverrides.browser", authenticationFlowBindingOverrides === null || authenticationFlowBindingOverrides === void 0 ? void 0 : authenticationFlowBindingOverrides.browser);
setValue("authenticationFlowBindingOverrides.direct_grant", authenticationFlowBindingOverrides === null || authenticationFlowBindingOverrides === void 0 ? void 0 : authenticationFlowBindingOverrides.direct_grant);
} })] })),
},
], borders: true }) }));
};
//# sourceMappingURL=AdvancedTab.js.map