Keycloak
1import { lazy } from "react";
2import type { Path } from "react-router-dom";
3import { generateEncodedPath } from "../../utils/generateEncodedPath";
4import type { AppRouteObject } from "../../routes";
5
6export type ScopeDetailsParams = {
7realm: string;
8id: string;
9scopeId?: string;
10};
11
12const ScopeDetails = lazy(() => import("../authorization/ScopeDetails"));
13
14export const ScopeDetailsRoute: AppRouteObject = {
15path: "/:realm/clients/:id/authorization/scope",
16element: <ScopeDetails />,
17breadcrumb: (t) => t("authorizationScopeDetails"),
18handle: {
19access: (accessChecker) =>
20accessChecker.hasAny("manage-clients", "view-authorization"),
21},
22};
23
24export const ScopeDetailsWithScopeIdRoute: AppRouteObject = {
25...ScopeDetailsRoute,
26path: "/:realm/clients/:id/authorization/scope/:scopeId",
27};
28
29export const toScopeDetails = (params: ScopeDetailsParams): Partial<Path> => {
30const path = params.scopeId
31? ScopeDetailsWithScopeIdRoute.path
32: ScopeDetailsRoute.path;
33
34return {
35pathname: generateEncodedPath(path, params),
36};
37};
38