2020-11-02 20:15:09 +00:00
|
|
|
import {
|
|
|
|
AlertVariant,
|
|
|
|
ButtonVariant,
|
2021-03-19 07:49:33 +00:00
|
|
|
Divider,
|
2020-11-02 20:15:09 +00:00
|
|
|
DropdownItem,
|
2021-09-28 12:09:27 +00:00
|
|
|
Label,
|
2020-11-02 20:15:09 +00:00
|
|
|
PageSection,
|
|
|
|
Tab,
|
|
|
|
TabTitleText,
|
2021-09-28 12:09:27 +00:00
|
|
|
Tooltip,
|
2020-11-02 20:15:09 +00:00
|
|
|
} from "@patternfly/react-core";
|
2021-09-28 12:09:27 +00:00
|
|
|
import { InfoCircleIcon } from "@patternfly/react-icons";
|
2021-08-26 08:39:35 +00:00
|
|
|
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
|
2022-02-02 10:33:57 +00:00
|
|
|
import { cloneDeep, sortBy } from "lodash-es";
|
2022-08-03 12:12:07 +00:00
|
|
|
import { useMemo, useState } from "react";
|
2021-07-21 15:08:40 +00:00
|
|
|
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { useHistory, useParams } from "react-router-dom";
|
2022-08-16 13:09:14 +00:00
|
|
|
import { useNavigate } from "react-router-dom-v5-compat";
|
2020-11-02 20:15:09 +00:00
|
|
|
import { useAlerts } from "../components/alert/Alerts";
|
2021-03-17 07:10:30 +00:00
|
|
|
import {
|
|
|
|
ConfirmDialogModal,
|
|
|
|
useConfirmDialog,
|
|
|
|
} from "../components/confirm-dialog/ConfirmDialog";
|
2021-02-28 20:02:31 +00:00
|
|
|
import { DownloadDialog } from "../components/download-dialog/DownloadDialog";
|
2021-09-28 12:09:27 +00:00
|
|
|
import {
|
|
|
|
ViewHeader,
|
|
|
|
ViewHeaderBadge,
|
|
|
|
} from "../components/view-header/ViewHeader";
|
2021-11-16 11:10:10 +00:00
|
|
|
import { KeycloakSpinner } from "../components/keycloak-spinner/KeycloakSpinner";
|
2021-04-29 06:28:59 +00:00
|
|
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
2021-07-21 15:08:40 +00:00
|
|
|
import { useRealm } from "../context/realm-context/RealmContext";
|
|
|
|
import { RolesList } from "../realm-roles/RolesList";
|
2020-11-02 20:15:09 +00:00
|
|
|
import {
|
2022-08-09 08:32:16 +00:00
|
|
|
convertAttributeNameToForm,
|
2020-11-02 20:15:09 +00:00
|
|
|
convertFormValuesToObject,
|
|
|
|
convertToFormValues,
|
|
|
|
exportClient,
|
|
|
|
} from "../util";
|
2021-11-30 13:07:44 +00:00
|
|
|
import useToggle from "../utils/useToggle";
|
2021-07-21 15:08:40 +00:00
|
|
|
import { AdvancedTab } from "./AdvancedTab";
|
|
|
|
import { ClientSettings } from "./ClientSettings";
|
2022-05-18 09:16:20 +00:00
|
|
|
import { ClientSessions } from "./ClientSessions";
|
2021-07-21 15:08:40 +00:00
|
|
|
import { Credentials } from "./credentials/Credentials";
|
|
|
|
import { Keys } from "./keys/Keys";
|
2022-01-31 07:20:35 +00:00
|
|
|
import { ClientParams, ClientTab, toClient } from "./routes/Client";
|
2021-07-21 15:08:40 +00:00
|
|
|
import { toClients } from "./routes/Clients";
|
2020-11-24 20:11:13 +00:00
|
|
|
import { ClientScopes } from "./scopes/ClientScopes";
|
|
|
|
import { EvaluateScopes } from "./scopes/EvaluateScopes";
|
2020-12-07 18:37:36 +00:00
|
|
|
import { ServiceAccount } from "./service-account/ServiceAccount";
|
2021-10-01 14:36:36 +00:00
|
|
|
import { isRealmClient, getProtocolName } from "./utils";
|
2021-10-12 09:28:55 +00:00
|
|
|
import { SamlKeys } from "./keys/SamlKeys";
|
2021-11-17 08:27:56 +00:00
|
|
|
import { AuthorizationSettings } from "./authorization/Settings";
|
|
|
|
import { AuthorizationResources } from "./authorization/Resources";
|
2022-01-04 09:17:43 +00:00
|
|
|
import { AuthorizationScopes } from "./authorization/Scopes";
|
2022-01-21 14:10:36 +00:00
|
|
|
import { AuthorizationPolicies } from "./authorization/Policies";
|
2022-01-12 16:01:54 +00:00
|
|
|
import { AuthorizationPermissions } from "./authorization/Permissions";
|
2022-01-23 20:21:19 +00:00
|
|
|
import { AuthorizationEvaluate } from "./authorization/AuthorizationEvaluate";
|
2022-01-31 07:20:35 +00:00
|
|
|
import {
|
|
|
|
routableTab,
|
|
|
|
RoutableTabs,
|
|
|
|
} from "../components/routable-tabs/RoutableTabs";
|
|
|
|
import {
|
|
|
|
AuthorizationTab,
|
|
|
|
toAuthorizationTab,
|
|
|
|
} from "./routes/AuthenticationTab";
|
|
|
|
import { toClientScopesTab } from "./routes/ClientScopeTab";
|
2022-02-09 22:37:31 +00:00
|
|
|
import { AuthorizationExport } from "./authorization/AuthorizationExport";
|
2022-04-20 09:42:24 +00:00
|
|
|
import { useServerInfo } from "../context/server-info/ServerInfoProvider";
|
2022-04-26 10:11:17 +00:00
|
|
|
import { PermissionsTab } from "../components/permission-tab/PermissionTab";
|
2022-05-27 09:26:49 +00:00
|
|
|
import type { KeyValueType } from "../components/key-value-form/key-value-convert";
|
2022-05-17 07:52:19 +00:00
|
|
|
import { useAccess } from "../context/access/Access";
|
2021-09-28 15:14:49 +00:00
|
|
|
|
2020-11-30 19:33:31 +00:00
|
|
|
type ClientDetailHeaderProps = {
|
2021-02-08 20:50:03 +00:00
|
|
|
onChange: (value: boolean) => void;
|
|
|
|
value: boolean;
|
2020-11-30 19:33:31 +00:00
|
|
|
save: () => void;
|
|
|
|
client: ClientRepresentation;
|
|
|
|
toggleDownloadDialog: () => void;
|
|
|
|
toggleDeleteDialog: () => void;
|
|
|
|
};
|
|
|
|
|
|
|
|
const ClientDetailHeader = ({
|
|
|
|
onChange,
|
|
|
|
value,
|
|
|
|
save,
|
|
|
|
client,
|
|
|
|
toggleDownloadDialog,
|
|
|
|
toggleDeleteDialog,
|
|
|
|
}: ClientDetailHeaderProps) => {
|
|
|
|
const { t } = useTranslation("clients");
|
|
|
|
const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({
|
|
|
|
titleKey: "clients:disableConfirmTitle",
|
|
|
|
messageKey: "clients:disableConfirm",
|
|
|
|
continueButtonLabel: "common:disable",
|
|
|
|
onConfirm: () => {
|
|
|
|
onChange(!value);
|
|
|
|
save();
|
|
|
|
},
|
|
|
|
});
|
2021-09-28 12:09:27 +00:00
|
|
|
|
|
|
|
const badges = useMemo<ViewHeaderBadge[]>(() => {
|
2021-10-01 14:36:36 +00:00
|
|
|
const protocolName = getProtocolName(
|
|
|
|
t,
|
|
|
|
client.protocol ?? "openid-connect"
|
|
|
|
);
|
2021-09-28 12:09:27 +00:00
|
|
|
|
|
|
|
const text = client.bearerOnly ? (
|
2021-09-30 10:04:50 +00:00
|
|
|
<Tooltip
|
|
|
|
data-testid="bearer-only-explainer-tooltip"
|
|
|
|
content={t("explainBearerOnly")}
|
|
|
|
>
|
|
|
|
<Label
|
|
|
|
data-testid="bearer-only-explainer-label"
|
|
|
|
icon={<InfoCircleIcon />}
|
|
|
|
>
|
2021-10-01 14:36:36 +00:00
|
|
|
{protocolName}
|
2021-09-30 10:04:50 +00:00
|
|
|
</Label>
|
2021-09-28 12:09:27 +00:00
|
|
|
</Tooltip>
|
|
|
|
) : (
|
2021-10-01 14:36:36 +00:00
|
|
|
<Label>{protocolName}</Label>
|
2021-09-28 12:09:27 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return [{ text }];
|
2021-10-01 14:36:36 +00:00
|
|
|
}, [client, t]);
|
2021-09-28 12:09:27 +00:00
|
|
|
|
2022-05-17 07:52:19 +00:00
|
|
|
const { hasAccess } = useAccess();
|
2022-05-30 09:23:24 +00:00
|
|
|
const isManager = hasAccess("manage-clients") || client.access?.configure;
|
2022-05-17 07:52:19 +00:00
|
|
|
|
2021-09-28 15:14:49 +00:00
|
|
|
const dropdownItems = [
|
2021-11-30 13:07:44 +00:00
|
|
|
<DropdownItem key="download" onClick={toggleDownloadDialog}>
|
2021-09-28 15:14:49 +00:00
|
|
|
{t("downloadAdapterConfig")}
|
|
|
|
</DropdownItem>,
|
|
|
|
<DropdownItem key="export" onClick={() => exportClient(client)}>
|
|
|
|
{t("common:export")}
|
|
|
|
</DropdownItem>,
|
2022-05-17 07:52:19 +00:00
|
|
|
...(!isRealmClient(client) && isManager
|
2021-09-28 15:14:49 +00:00
|
|
|
? [
|
|
|
|
<Divider key="divider" />,
|
|
|
|
<DropdownItem
|
|
|
|
data-testid="delete-client"
|
|
|
|
key="delete"
|
2021-11-30 13:07:44 +00:00
|
|
|
onClick={toggleDeleteDialog}
|
2021-09-28 15:14:49 +00:00
|
|
|
>
|
|
|
|
{t("common:delete")}
|
|
|
|
</DropdownItem>,
|
|
|
|
]
|
|
|
|
: []),
|
|
|
|
];
|
|
|
|
|
2020-11-30 19:33:31 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<DisableConfirm />
|
|
|
|
<ViewHeader
|
2022-01-12 16:01:54 +00:00
|
|
|
titleKey={client.clientId!}
|
2020-11-30 19:33:31 +00:00
|
|
|
subKey="clients:clientsExplain"
|
2021-09-28 12:09:27 +00:00
|
|
|
badges={badges}
|
2021-03-19 07:49:33 +00:00
|
|
|
divider={false}
|
2022-05-17 07:52:19 +00:00
|
|
|
isReadOnly={!isManager}
|
2021-06-22 08:32:04 +00:00
|
|
|
helpTextKey="clients-help:enableDisable"
|
2021-09-28 15:14:49 +00:00
|
|
|
dropdownItems={dropdownItems}
|
2020-11-30 19:33:31 +00:00
|
|
|
isEnabled={value}
|
|
|
|
onToggle={(value) => {
|
|
|
|
if (!value) {
|
|
|
|
toggleDisableDialog();
|
|
|
|
} else {
|
|
|
|
onChange(value);
|
|
|
|
save();
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-03-17 13:40:19 +00:00
|
|
|
export type SaveOptions = {
|
|
|
|
confirmed?: boolean;
|
|
|
|
messageKey?: string;
|
|
|
|
};
|
|
|
|
|
2021-10-29 16:11:06 +00:00
|
|
|
export default function ClientDetails() {
|
2020-11-02 20:15:09 +00:00
|
|
|
const { t } = useTranslation("clients");
|
2022-07-14 13:02:28 +00:00
|
|
|
const { adminClient } = useAdminClient();
|
2021-07-28 12:01:42 +00:00
|
|
|
const { addAlert, addError } = useAlerts();
|
2021-04-12 15:42:36 +00:00
|
|
|
const { realm } = useRealm();
|
2022-04-20 09:42:24 +00:00
|
|
|
const { profileInfo } = useServerInfo();
|
2021-04-12 15:42:36 +00:00
|
|
|
|
2022-05-17 07:52:19 +00:00
|
|
|
const { hasAccess } = useAccess();
|
2022-05-30 09:23:24 +00:00
|
|
|
const permissionsEnabled =
|
|
|
|
!profileInfo?.disabledFeatures?.includes("ADMIN_FINE_GRAINED_AUTHZ") &&
|
|
|
|
hasAccess("manage-authorization");
|
|
|
|
const hasManageClients = hasAccess("manage-clients");
|
|
|
|
const hasViewUsers = hasAccess("view-users");
|
2022-05-17 07:52:19 +00:00
|
|
|
|
2021-04-12 15:42:36 +00:00
|
|
|
const history = useHistory();
|
2022-08-16 13:09:14 +00:00
|
|
|
const navigate = useNavigate();
|
2021-02-17 21:12:25 +00:00
|
|
|
|
2021-11-30 13:07:44 +00:00
|
|
|
const [downloadDialogOpen, toggleDownloadDialogOpen] = useToggle();
|
|
|
|
const [changeAuthenticatorOpen, toggleChangeAuthenticatorOpen] = useToggle();
|
2020-11-02 20:15:09 +00:00
|
|
|
|
2022-03-09 16:42:23 +00:00
|
|
|
const form = useForm<ClientRepresentation>({ shouldUnregister: false });
|
2021-07-21 15:08:40 +00:00
|
|
|
const { clientId } = useParams<ClientParams>();
|
2022-05-18 09:22:30 +00:00
|
|
|
const [key, setKey] = useState(0);
|
2020-11-02 20:15:09 +00:00
|
|
|
|
2021-04-29 06:28:59 +00:00
|
|
|
const clientAuthenticatorType = useWatch({
|
|
|
|
control: form.control,
|
|
|
|
name: "clientAuthenticatorType",
|
|
|
|
defaultValue: "client-secret",
|
|
|
|
});
|
|
|
|
|
2020-11-24 20:11:13 +00:00
|
|
|
const [client, setClient] = useState<ClientRepresentation>();
|
2020-11-02 20:15:09 +00:00
|
|
|
|
2021-01-29 13:59:03 +00:00
|
|
|
const loader = async () => {
|
2021-03-01 09:20:36 +00:00
|
|
|
const roles = await adminClient.clients.listRoles({ id: clientId });
|
2022-02-02 10:33:57 +00:00
|
|
|
return sortBy(roles, (role) => role.name?.toUpperCase());
|
2021-01-29 13:59:03 +00:00
|
|
|
};
|
|
|
|
|
2020-11-02 20:15:09 +00:00
|
|
|
const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({
|
|
|
|
titleKey: "clients:clientDeleteConfirmTitle",
|
|
|
|
messageKey: "clients:clientDeleteConfirm",
|
|
|
|
continueButtonLabel: "common:delete",
|
|
|
|
continueButtonVariant: ButtonVariant.danger,
|
2020-11-12 12:55:52 +00:00
|
|
|
onConfirm: async () => {
|
2020-11-02 20:15:09 +00:00
|
|
|
try {
|
2021-03-01 09:20:36 +00:00
|
|
|
await adminClient.clients.del({ id: clientId });
|
2020-11-02 20:15:09 +00:00
|
|
|
addAlert(t("clientDeletedSuccess"), AlertVariant.success);
|
2022-08-16 13:09:14 +00:00
|
|
|
navigate(toClients({ realm }));
|
2020-11-02 20:15:09 +00:00
|
|
|
} catch (error) {
|
2021-07-28 12:01:42 +00:00
|
|
|
addError("clients:clientDeleteError", error);
|
2020-11-02 20:15:09 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const setupForm = (client: ClientRepresentation) => {
|
2022-03-28 20:54:15 +00:00
|
|
|
form.reset({ ...client });
|
2022-03-09 16:42:23 +00:00
|
|
|
convertToFormValues(client, form.setValue);
|
2022-03-29 07:55:05 +00:00
|
|
|
if (client.attributes?.["acr.loa.map"]) {
|
|
|
|
form.setValue(
|
2022-08-09 08:32:16 +00:00
|
|
|
convertAttributeNameToForm("attributes.acr.loa.map"),
|
2022-03-29 07:55:05 +00:00
|
|
|
Object.entries(JSON.parse(client.attributes["acr.loa.map"])).flatMap(
|
|
|
|
([key, value]) => ({ key, value })
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2020-11-02 20:15:09 +00:00
|
|
|
};
|
|
|
|
|
2021-04-29 06:28:59 +00:00
|
|
|
useFetch(
|
|
|
|
() => adminClient.clients.findOne({ id: clientId }),
|
|
|
|
(fetchedClient) => {
|
2021-09-30 08:58:48 +00:00
|
|
|
if (!fetchedClient) {
|
|
|
|
throw new Error(t("common:notFound"));
|
|
|
|
}
|
2021-12-08 15:08:42 +00:00
|
|
|
setClient(cloneDeep(fetchedClient));
|
2021-04-29 06:28:59 +00:00
|
|
|
setupForm(fetchedClient);
|
|
|
|
},
|
2022-05-18 09:22:30 +00:00
|
|
|
[clientId, key]
|
2021-04-29 06:28:59 +00:00
|
|
|
);
|
2020-11-02 20:15:09 +00:00
|
|
|
|
2021-03-17 13:40:19 +00:00
|
|
|
const save = async (
|
|
|
|
{ confirmed = false, messageKey = "clientSaveSuccess" }: SaveOptions = {
|
|
|
|
confirmed: false,
|
|
|
|
messageKey: "clientSaveSuccess",
|
|
|
|
}
|
|
|
|
) => {
|
2020-11-02 20:15:09 +00:00
|
|
|
if (await form.trigger()) {
|
2021-03-17 07:10:30 +00:00
|
|
|
if (
|
2021-04-06 18:14:56 +00:00
|
|
|
!client?.publicClient &&
|
2021-04-29 06:28:59 +00:00
|
|
|
client?.clientAuthenticatorType !== clientAuthenticatorType &&
|
2021-03-17 07:10:30 +00:00
|
|
|
!confirmed
|
|
|
|
) {
|
2021-11-30 13:07:44 +00:00
|
|
|
toggleChangeAuthenticatorOpen();
|
2021-03-17 07:10:30 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-02-21 15:43:23 +00:00
|
|
|
|
2022-08-09 08:32:16 +00:00
|
|
|
const values = convertFormValuesToObject(form.getValues());
|
2022-02-21 15:43:23 +00:00
|
|
|
|
2022-03-09 16:42:23 +00:00
|
|
|
const submittedClient =
|
|
|
|
convertFormValuesToObject<ClientRepresentation>(values);
|
2020-11-02 20:15:09 +00:00
|
|
|
|
2022-03-29 07:55:05 +00:00
|
|
|
if (submittedClient.attributes?.["acr.loa.map"]) {
|
|
|
|
submittedClient.attributes["acr.loa.map"] = JSON.stringify(
|
2022-05-27 09:26:49 +00:00
|
|
|
Object.fromEntries(
|
|
|
|
(submittedClient.attributes["acr.loa.map"] as KeyValueType[])
|
|
|
|
.filter(({ key }) => key !== "")
|
|
|
|
.map(({ key, value }) => [key, value])
|
|
|
|
)
|
2022-03-29 07:55:05 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-11-02 20:15:09 +00:00
|
|
|
try {
|
2021-02-28 20:02:31 +00:00
|
|
|
const newClient: ClientRepresentation = {
|
|
|
|
...client,
|
2021-12-08 15:08:42 +00:00
|
|
|
...submittedClient,
|
2020-11-02 20:15:09 +00:00
|
|
|
};
|
2021-12-06 16:32:52 +00:00
|
|
|
|
|
|
|
newClient.clientId = newClient.clientId?.trim();
|
|
|
|
|
2021-03-01 09:20:36 +00:00
|
|
|
await adminClient.clients.update({ id: clientId }, newClient);
|
2021-02-28 20:02:31 +00:00
|
|
|
setupForm(newClient);
|
|
|
|
setClient(newClient);
|
2021-03-17 13:40:19 +00:00
|
|
|
addAlert(t(messageKey), AlertVariant.success);
|
2020-11-02 20:15:09 +00:00
|
|
|
} catch (error) {
|
2021-12-08 15:08:42 +00:00
|
|
|
addError("clients:clientSaveError", error);
|
2020-11-02 20:15:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-11-30 19:33:31 +00:00
|
|
|
if (!client) {
|
2021-11-16 11:10:10 +00:00
|
|
|
return <KeycloakSpinner />;
|
2020-11-30 19:33:31 +00:00
|
|
|
}
|
2021-09-28 15:14:49 +00:00
|
|
|
|
2022-01-31 07:20:35 +00:00
|
|
|
const route = (tab: ClientTab) =>
|
|
|
|
routableTab({
|
|
|
|
to: toClient({
|
|
|
|
realm,
|
|
|
|
clientId,
|
|
|
|
tab,
|
|
|
|
}),
|
|
|
|
history,
|
|
|
|
});
|
|
|
|
|
|
|
|
const authenticationRoute = (tab: AuthorizationTab) =>
|
|
|
|
routableTab({
|
|
|
|
to: toAuthorizationTab({
|
|
|
|
realm,
|
|
|
|
clientId,
|
|
|
|
tab,
|
|
|
|
}),
|
|
|
|
history,
|
|
|
|
});
|
|
|
|
|
2020-11-02 20:15:09 +00:00
|
|
|
return (
|
|
|
|
<>
|
2021-03-17 07:10:30 +00:00
|
|
|
<ConfirmDialogModal
|
|
|
|
continueButtonLabel="common:yes"
|
2022-08-31 10:48:46 +00:00
|
|
|
cancelButtonLabel="common:no"
|
2021-03-17 07:10:30 +00:00
|
|
|
titleKey={t("changeAuthenticatorConfirmTitle", {
|
2021-04-29 06:28:59 +00:00
|
|
|
clientAuthenticatorType: clientAuthenticatorType,
|
2021-03-17 07:10:30 +00:00
|
|
|
})}
|
|
|
|
open={changeAuthenticatorOpen}
|
2021-11-30 13:07:44 +00:00
|
|
|
toggleDialog={toggleChangeAuthenticatorOpen}
|
2021-03-17 13:40:19 +00:00
|
|
|
onConfirm={() => save({ confirmed: true })}
|
2021-03-17 07:10:30 +00:00
|
|
|
>
|
|
|
|
<>
|
|
|
|
{t("changeAuthenticatorConfirm", {
|
2021-04-29 06:28:59 +00:00
|
|
|
clientAuthenticatorType: clientAuthenticatorType,
|
2021-03-17 07:10:30 +00:00
|
|
|
})}
|
|
|
|
</>
|
|
|
|
</ConfirmDialogModal>
|
2020-11-02 20:15:09 +00:00
|
|
|
<DeleteConfirm />
|
2022-09-12 13:30:27 +00:00
|
|
|
{downloadDialogOpen && (
|
|
|
|
<DownloadDialog
|
|
|
|
id={client.id!}
|
|
|
|
protocol={client.protocol}
|
|
|
|
open
|
|
|
|
toggleDialog={toggleDownloadDialogOpen}
|
|
|
|
/>
|
|
|
|
)}
|
2020-11-02 20:15:09 +00:00
|
|
|
<Controller
|
|
|
|
name="enabled"
|
|
|
|
control={form.control}
|
|
|
|
defaultValue={true}
|
2020-11-30 19:33:31 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<ClientDetailHeader
|
|
|
|
value={value}
|
|
|
|
onChange={onChange}
|
|
|
|
client={client}
|
|
|
|
save={save}
|
|
|
|
toggleDeleteDialog={toggleDeleteDialog}
|
2021-11-30 13:07:44 +00:00
|
|
|
toggleDownloadDialog={toggleDownloadDialogOpen}
|
2020-11-30 19:33:31 +00:00
|
|
|
/>
|
|
|
|
)}
|
2020-11-02 20:15:09 +00:00
|
|
|
/>
|
2021-03-19 07:49:33 +00:00
|
|
|
<PageSection variant="light" className="pf-u-p-0">
|
2021-02-28 20:02:31 +00:00
|
|
|
<FormProvider {...form}>
|
2022-01-31 07:20:35 +00:00
|
|
|
<RoutableTabs data-testid="client-tabs" isBox mountOnEnter>
|
2020-11-02 20:15:09 +00:00
|
|
|
<Tab
|
2021-02-28 20:02:31 +00:00
|
|
|
id="settings"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="clientSettingsTab"
|
2021-02-28 20:02:31 +00:00
|
|
|
title={<TabTitleText>{t("common:settings")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...route("settings")}
|
2020-11-02 20:15:09 +00:00
|
|
|
>
|
2021-03-19 07:49:33 +00:00
|
|
|
<ClientSettings
|
2021-10-06 11:05:27 +00:00
|
|
|
client={client}
|
2021-03-19 07:49:33 +00:00
|
|
|
save={() => save()}
|
|
|
|
reset={() => setupForm(client)}
|
|
|
|
/>
|
2020-11-02 20:15:09 +00:00
|
|
|
</Tab>
|
2021-10-05 10:32:20 +00:00
|
|
|
{((!client.publicClient && !isRealmClient(client)) ||
|
|
|
|
client.protocol === "saml") && (
|
2021-05-04 08:11:58 +00:00
|
|
|
<Tab
|
|
|
|
id="keys"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="keysTab"
|
2021-05-04 08:11:58 +00:00
|
|
|
title={<TabTitleText>{t("keys")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...route("keys")}
|
2021-05-04 08:11:58 +00:00
|
|
|
>
|
2021-10-12 09:28:55 +00:00
|
|
|
{client.protocol === "openid-connect" && (
|
2022-05-30 09:23:24 +00:00
|
|
|
<Keys
|
|
|
|
clientId={clientId}
|
|
|
|
save={save}
|
|
|
|
hasConfigureAccess={client.access?.configure}
|
|
|
|
/>
|
2021-10-12 09:28:55 +00:00
|
|
|
)}
|
|
|
|
{client.protocol === "saml" && (
|
|
|
|
<SamlKeys clientId={clientId} save={save} />
|
|
|
|
)}
|
2021-05-04 08:11:58 +00:00
|
|
|
</Tab>
|
|
|
|
)}
|
2022-05-30 09:23:24 +00:00
|
|
|
{!client.publicClient &&
|
|
|
|
!isRealmClient(client) &&
|
|
|
|
(hasManageClients || client.access?.configure) && (
|
|
|
|
<Tab
|
|
|
|
id="credentials"
|
|
|
|
title={<TabTitleText>{t("credentials")}</TabTitleText>}
|
|
|
|
{...route("credentials")}
|
|
|
|
>
|
|
|
|
<Credentials
|
|
|
|
key={key}
|
|
|
|
client={client}
|
|
|
|
save={save}
|
|
|
|
refresh={() => setKey(key + 1)}
|
|
|
|
/>
|
|
|
|
</Tab>
|
|
|
|
)}
|
2021-02-28 20:02:31 +00:00
|
|
|
<Tab
|
|
|
|
id="roles"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="rolesTab"
|
2021-02-28 20:02:31 +00:00
|
|
|
title={<TabTitleText>{t("roles")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...route("roles")}
|
2021-02-28 20:02:31 +00:00
|
|
|
>
|
2021-03-15 13:42:19 +00:00
|
|
|
<RolesList
|
|
|
|
loader={loader}
|
|
|
|
paginated={false}
|
|
|
|
messageBundle="clients"
|
2022-05-30 09:23:24 +00:00
|
|
|
isReadOnly={!(hasManageClients || client.access?.configure)}
|
2021-03-15 13:42:19 +00:00
|
|
|
/>
|
2021-02-28 20:02:31 +00:00
|
|
|
</Tab>
|
2022-02-21 15:20:24 +00:00
|
|
|
{!isRealmClient(client) && !client.bearerOnly && (
|
2021-09-28 15:14:49 +00:00
|
|
|
<Tab
|
|
|
|
id="clientScopes"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="clientScopesTab"
|
2021-09-28 15:14:49 +00:00
|
|
|
title={<TabTitleText>{t("clientScopes")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...route("clientScopes")}
|
2021-03-01 09:20:36 +00:00
|
|
|
>
|
2022-01-31 07:20:35 +00:00
|
|
|
<RoutableTabs
|
|
|
|
defaultLocation={toClientScopesTab({
|
|
|
|
realm,
|
|
|
|
clientId,
|
|
|
|
tab: "setup",
|
|
|
|
})}
|
2021-02-28 20:02:31 +00:00
|
|
|
>
|
2021-09-28 15:14:49 +00:00
|
|
|
<Tab
|
|
|
|
id="setup"
|
|
|
|
title={<TabTitleText>{t("setup")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...routableTab({
|
|
|
|
to: toClientScopesTab({
|
|
|
|
realm,
|
|
|
|
clientId,
|
|
|
|
tab: "setup",
|
|
|
|
}),
|
|
|
|
history,
|
|
|
|
})}
|
2021-09-28 15:14:49 +00:00
|
|
|
>
|
|
|
|
<ClientScopes
|
2021-11-23 14:59:04 +00:00
|
|
|
clientName={client.clientId!}
|
2021-09-28 15:14:49 +00:00
|
|
|
clientId={clientId}
|
|
|
|
protocol={client!.protocol!}
|
2022-05-30 09:23:24 +00:00
|
|
|
fineGrainedAccess={client!.access?.manage}
|
2021-09-28 15:14:49 +00:00
|
|
|
/>
|
|
|
|
</Tab>
|
|
|
|
<Tab
|
|
|
|
id="evaluate"
|
|
|
|
title={<TabTitleText>{t("evaluate")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...routableTab({
|
|
|
|
to: toClientScopesTab({
|
|
|
|
realm,
|
|
|
|
clientId,
|
|
|
|
tab: "evaluate",
|
|
|
|
}),
|
|
|
|
history,
|
|
|
|
})}
|
2021-09-28 15:14:49 +00:00
|
|
|
>
|
|
|
|
<EvaluateScopes
|
|
|
|
clientId={clientId}
|
|
|
|
protocol={client!.protocol!}
|
|
|
|
/>
|
|
|
|
</Tab>
|
2022-01-31 07:20:35 +00:00
|
|
|
</RoutableTabs>
|
2021-09-28 15:14:49 +00:00
|
|
|
</Tab>
|
|
|
|
)}
|
2022-03-07 13:49:58 +00:00
|
|
|
{client!.authorizationServicesEnabled && (
|
2021-11-17 08:27:56 +00:00
|
|
|
<Tab
|
|
|
|
id="authorization"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="authorizationTab"
|
2021-11-17 08:27:56 +00:00
|
|
|
title={<TabTitleText>{t("authorization")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...route("authorization")}
|
2021-11-17 08:27:56 +00:00
|
|
|
>
|
2022-01-31 07:20:35 +00:00
|
|
|
<RoutableTabs
|
2021-12-16 16:31:17 +00:00
|
|
|
mountOnEnter
|
|
|
|
unmountOnExit
|
2022-01-31 07:20:35 +00:00
|
|
|
defaultLocation={toAuthorizationTab({
|
|
|
|
realm,
|
|
|
|
clientId,
|
|
|
|
tab: "settings",
|
|
|
|
})}
|
2021-11-17 08:27:56 +00:00
|
|
|
>
|
|
|
|
<Tab
|
|
|
|
id="settings"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="authorizationSettings"
|
2021-11-17 08:27:56 +00:00
|
|
|
title={<TabTitleText>{t("settings")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...authenticationRoute("settings")}
|
2021-11-17 08:27:56 +00:00
|
|
|
>
|
|
|
|
<AuthorizationSettings clientId={clientId} />
|
|
|
|
</Tab>
|
|
|
|
<Tab
|
|
|
|
id="resources"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="authorizationResources"
|
2021-11-17 08:27:56 +00:00
|
|
|
title={<TabTitleText>{t("resources")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...authenticationRoute("resources")}
|
2021-11-17 08:27:56 +00:00
|
|
|
>
|
|
|
|
<AuthorizationResources clientId={clientId} />
|
|
|
|
</Tab>
|
2022-01-04 09:17:43 +00:00
|
|
|
<Tab
|
|
|
|
id="scopes"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="authorizationScopes"
|
2022-01-04 09:17:43 +00:00
|
|
|
title={<TabTitleText>{t("scopes")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...authenticationRoute("scopes")}
|
2022-01-04 09:17:43 +00:00
|
|
|
>
|
|
|
|
<AuthorizationScopes clientId={clientId} />
|
|
|
|
</Tab>
|
2022-01-12 16:01:54 +00:00
|
|
|
<Tab
|
2022-01-21 14:10:36 +00:00
|
|
|
id="policies"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="authorizationPolicies"
|
2022-01-21 14:10:36 +00:00
|
|
|
title={<TabTitleText>{t("policies")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...authenticationRoute("policies")}
|
2022-01-21 14:10:36 +00:00
|
|
|
>
|
|
|
|
<AuthorizationPolicies clientId={clientId} />
|
|
|
|
</Tab>
|
|
|
|
<Tab
|
|
|
|
id="permissions"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="authorizationPermissions"
|
2022-04-26 10:11:17 +00:00
|
|
|
title={
|
|
|
|
<TabTitleText>{t("common:permissions")}</TabTitleText>
|
|
|
|
}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...authenticationRoute("permissions")}
|
2022-01-12 16:01:54 +00:00
|
|
|
>
|
|
|
|
<AuthorizationPermissions clientId={clientId} />
|
|
|
|
</Tab>
|
2022-01-23 20:21:19 +00:00
|
|
|
<Tab
|
2022-02-09 22:37:31 +00:00
|
|
|
id="evaluate"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="authorizationEvaluate"
|
2022-01-23 20:21:19 +00:00
|
|
|
title={<TabTitleText>{t("evaluate")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...authenticationRoute("evaluate")}
|
2022-01-23 20:21:19 +00:00
|
|
|
>
|
2022-03-07 14:28:42 +00:00
|
|
|
<AuthorizationEvaluate client={client} save={save} />
|
2022-01-23 20:21:19 +00:00
|
|
|
</Tab>
|
2022-02-09 22:37:31 +00:00
|
|
|
<Tab
|
|
|
|
id="export"
|
|
|
|
data-testid="authorizationExport"
|
|
|
|
title={<TabTitleText>{t("common:export")}</TabTitleText>}
|
|
|
|
{...authenticationRoute("export")}
|
|
|
|
>
|
|
|
|
<AuthorizationExport />
|
|
|
|
</Tab>
|
2022-01-31 07:20:35 +00:00
|
|
|
</RoutableTabs>
|
2021-11-17 08:27:56 +00:00
|
|
|
</Tab>
|
|
|
|
)}
|
2022-05-30 09:23:24 +00:00
|
|
|
{client!.serviceAccountsEnabled && hasViewUsers && (
|
2020-11-24 20:11:13 +00:00
|
|
|
<Tab
|
2021-02-28 20:02:31 +00:00
|
|
|
id="serviceAccount"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="serviceAccountTab"
|
2021-02-28 20:02:31 +00:00
|
|
|
title={<TabTitleText>{t("serviceAccount")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...route("serviceAccount")}
|
2020-11-24 20:11:13 +00:00
|
|
|
>
|
2021-06-15 06:14:38 +00:00
|
|
|
<ServiceAccount client={client} />
|
2020-11-24 20:11:13 +00:00
|
|
|
</Tab>
|
2021-02-28 20:02:31 +00:00
|
|
|
)}
|
2022-06-01 09:13:28 +00:00
|
|
|
<Tab
|
|
|
|
id="sessions"
|
|
|
|
data-testid="sessionsTab"
|
|
|
|
title={<TabTitleText>{t("sessions")}</TabTitleText>}
|
|
|
|
{...route("sessions")}
|
|
|
|
>
|
|
|
|
<ClientSessions client={client} />
|
|
|
|
</Tab>
|
2022-12-01 14:15:27 +00:00
|
|
|
{permissionsEnabled &&
|
|
|
|
(hasManageClients || client.access?.manage) && (
|
|
|
|
<Tab
|
|
|
|
id="permissions"
|
|
|
|
data-testid="permissionsTab"
|
|
|
|
title={<TabTitleText>{t("common:permissions")}</TabTitleText>}
|
|
|
|
{...route("permissions")}
|
|
|
|
>
|
|
|
|
<PermissionsTab id={client.id!} type="clients" />
|
|
|
|
</Tab>
|
|
|
|
)}
|
2020-12-07 18:37:36 +00:00
|
|
|
<Tab
|
2021-02-28 20:02:31 +00:00
|
|
|
id="advanced"
|
2022-01-31 07:20:35 +00:00
|
|
|
data-testid="advancedTab"
|
2021-02-28 20:02:31 +00:00
|
|
|
title={<TabTitleText>{t("advanced")}</TabTitleText>}
|
2022-01-31 07:20:35 +00:00
|
|
|
{...route("advanced")}
|
2020-12-07 18:37:36 +00:00
|
|
|
>
|
2021-02-28 20:02:31 +00:00
|
|
|
<AdvancedTab save={save} client={client} />
|
2020-12-07 18:37:36 +00:00
|
|
|
</Tab>
|
2022-01-31 07:20:35 +00:00
|
|
|
</RoutableTabs>
|
2021-02-28 20:02:31 +00:00
|
|
|
</FormProvider>
|
2020-11-02 20:15:09 +00:00
|
|
|
</PageSection>
|
|
|
|
</>
|
|
|
|
);
|
2021-10-29 16:11:06 +00:00
|
|
|
}
|