Use new routing conventions for identity provider routes (#910)
This commit is contained in:
parent
7cfde23b9d
commit
b569341195
7 changed files with 124 additions and 36 deletions
16
src/identity-providers/routes.ts
Normal file
16
src/identity-providers/routes.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import type { RouteDef } from "../route-config";
|
||||||
|
import { IdentityProviderRoute } from "./routes/IdentityProvider";
|
||||||
|
import { IdentityProviderKeycloakOidcRoute } from "./routes/IdentityProviderKeycloakOidc";
|
||||||
|
import { IdentityProviderOidcRoute } from "./routes/IdentityProviderOidc";
|
||||||
|
import { IdentityProvidersRoute } from "./routes/IdentityProviders";
|
||||||
|
import { IdentityProviderTabRoute } from "./routes/IdentityProviderTab";
|
||||||
|
|
||||||
|
const routes: RouteDef[] = [
|
||||||
|
IdentityProvidersRoute,
|
||||||
|
IdentityProviderOidcRoute,
|
||||||
|
IdentityProviderKeycloakOidcRoute,
|
||||||
|
IdentityProviderRoute,
|
||||||
|
IdentityProviderTabRoute,
|
||||||
|
];
|
||||||
|
|
||||||
|
export default routes;
|
25
src/identity-providers/routes/IdentityProvider.ts
Normal file
25
src/identity-providers/routes/IdentityProvider.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import type { LocationDescriptorObject } from "history";
|
||||||
|
import { generatePath } from "react-router-dom";
|
||||||
|
import type { RouteDef } from "../../route-config";
|
||||||
|
import {
|
||||||
|
AddIdentityProvider,
|
||||||
|
IdentityProviderCrumb,
|
||||||
|
} from "../add/AddIdentityProvider";
|
||||||
|
|
||||||
|
export type IdentityProviderParams = {
|
||||||
|
realm: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const IdentityProviderRoute: RouteDef = {
|
||||||
|
path: "/:realm/identity-providers/:id",
|
||||||
|
component: AddIdentityProvider,
|
||||||
|
breadcrumb: () => IdentityProviderCrumb,
|
||||||
|
access: "manage-identity-providers",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toIdentityProvider = (
|
||||||
|
params: IdentityProviderParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(IdentityProviderRoute.path, params),
|
||||||
|
});
|
|
@ -0,0 +1,19 @@
|
||||||
|
import type { LocationDescriptorObject } from "history";
|
||||||
|
import { generatePath } from "react-router-dom";
|
||||||
|
import type { RouteDef } from "../../route-config";
|
||||||
|
import { AddOpenIdConnect } from "../add/AddOpenIdConnect";
|
||||||
|
|
||||||
|
export type IdentityProviderKeycloakOidcParams = { realm: string };
|
||||||
|
|
||||||
|
export const IdentityProviderKeycloakOidcRoute: RouteDef = {
|
||||||
|
path: "/:realm/identity-providers/keycloak-oidc",
|
||||||
|
component: AddOpenIdConnect,
|
||||||
|
breadcrumb: (t) => t("identity-providers:addKeycloakOpenIdProvider"),
|
||||||
|
access: "manage-identity-providers",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toIdentityProviderKeycloakOidc = (
|
||||||
|
params: IdentityProviderKeycloakOidcParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(IdentityProviderKeycloakOidcRoute.path, params),
|
||||||
|
});
|
19
src/identity-providers/routes/IdentityProviderOidc.ts
Normal file
19
src/identity-providers/routes/IdentityProviderOidc.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import type { LocationDescriptorObject } from "history";
|
||||||
|
import { generatePath } from "react-router-dom";
|
||||||
|
import type { RouteDef } from "../../route-config";
|
||||||
|
import { AddOpenIdConnect } from "../add/AddOpenIdConnect";
|
||||||
|
|
||||||
|
export type IdentityProviderOidcParams = { realm: string };
|
||||||
|
|
||||||
|
export const IdentityProviderOidcRoute: RouteDef = {
|
||||||
|
path: "/:realm/identity-providers/oidc",
|
||||||
|
component: AddOpenIdConnect,
|
||||||
|
breadcrumb: (t) => t("identity-providers:addOpenIdProvider"),
|
||||||
|
access: "manage-identity-providers",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toIdentityProviderOidc = (
|
||||||
|
params: IdentityProviderOidcParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(IdentityProviderOidcRoute.path, params),
|
||||||
|
});
|
24
src/identity-providers/routes/IdentityProviderTab.ts
Normal file
24
src/identity-providers/routes/IdentityProviderTab.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import type { LocationDescriptorObject } from "history";
|
||||||
|
import { generatePath } from "react-router-dom";
|
||||||
|
import type { RouteDef } from "../../route-config";
|
||||||
|
import { DetailSettings } from "../add/DetailSettings";
|
||||||
|
|
||||||
|
export type IdentityProviderTab = "settings";
|
||||||
|
|
||||||
|
export type IdentityProviderTabParams = {
|
||||||
|
realm: string;
|
||||||
|
id: string;
|
||||||
|
tab?: IdentityProviderTab;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const IdentityProviderTabRoute: RouteDef = {
|
||||||
|
path: "/:realm/identity-providers/:id/:tab?",
|
||||||
|
component: DetailSettings,
|
||||||
|
access: "manage-identity-providers",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toIdentityProviderTab = (
|
||||||
|
params: IdentityProviderTabParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(IdentityProviderTabRoute.path, params),
|
||||||
|
});
|
19
src/identity-providers/routes/IdentityProviders.ts
Normal file
19
src/identity-providers/routes/IdentityProviders.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import type { LocationDescriptorObject } from "history";
|
||||||
|
import { generatePath } from "react-router-dom";
|
||||||
|
import type { RouteDef } from "../../route-config";
|
||||||
|
import { IdentityProvidersSection } from "../IdentityProvidersSection";
|
||||||
|
|
||||||
|
export type IdentityProvidersParams = { realm: string };
|
||||||
|
|
||||||
|
export const IdentityProvidersRoute: RouteDef = {
|
||||||
|
path: "/:realm/identity-providers",
|
||||||
|
component: IdentityProvidersSection,
|
||||||
|
breadcrumb: (t) => t("identityProviders"),
|
||||||
|
access: "view-identity-providers",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toIdentityProviders = (
|
||||||
|
params: IdentityProvidersParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(IdentityProvidersRoute.path, params),
|
||||||
|
});
|
|
@ -9,13 +9,7 @@ import { DashboardSection } from "./dashboard/Dashboard";
|
||||||
import eventRoutes from "./events/routes";
|
import eventRoutes from "./events/routes";
|
||||||
import { GroupsSection } from "./groups/GroupsSection";
|
import { GroupsSection } from "./groups/GroupsSection";
|
||||||
import { SearchGroups } from "./groups/SearchGroups";
|
import { SearchGroups } from "./groups/SearchGroups";
|
||||||
import {
|
import identityProviders from "./identity-providers/routes";
|
||||||
AddIdentityProvider,
|
|
||||||
IdentityProviderCrumb,
|
|
||||||
} from "./identity-providers/add/AddIdentityProvider";
|
|
||||||
import { AddOpenIdConnect } from "./identity-providers/add/AddOpenIdConnect";
|
|
||||||
import { DetailSettings } from "./identity-providers/add/DetailSettings";
|
|
||||||
import { IdentityProvidersSection } from "./identity-providers/IdentityProvidersSection";
|
|
||||||
import { PageNotFoundSection } from "./PageNotFoundSection";
|
import { PageNotFoundSection } from "./PageNotFoundSection";
|
||||||
import realmRoleRoutes from "./realm-roles/routes";
|
import realmRoleRoutes from "./realm-roles/routes";
|
||||||
import realmSettingRoutes from "./realm-settings/routes";
|
import realmSettingRoutes from "./realm-settings/routes";
|
||||||
|
@ -40,40 +34,12 @@ export const routes: RouteDef[] = [
|
||||||
...clientRoutes,
|
...clientRoutes,
|
||||||
...clientScopesRoutes,
|
...clientScopesRoutes,
|
||||||
...eventRoutes,
|
...eventRoutes,
|
||||||
|
...identityProviders,
|
||||||
...realmRoleRoutes,
|
...realmRoleRoutes,
|
||||||
...realmRoutes,
|
...realmRoutes,
|
||||||
...realmSettingRoutes,
|
...realmSettingRoutes,
|
||||||
...sessionRoutes,
|
...sessionRoutes,
|
||||||
...userRoutes,
|
...userRoutes,
|
||||||
{
|
|
||||||
path: "/:realm/identity-providers",
|
|
||||||
component: IdentityProvidersSection,
|
|
||||||
breadcrumb: (t) => t("identityProviders"),
|
|
||||||
access: "view-identity-providers",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/identity-providers/oidc",
|
|
||||||
component: AddOpenIdConnect,
|
|
||||||
breadcrumb: (t) => t("identity-providers:addOpenIdProvider"),
|
|
||||||
access: "manage-identity-providers",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/identity-providers/keycloak-oidc",
|
|
||||||
component: AddOpenIdConnect,
|
|
||||||
breadcrumb: (t) => t("identity-providers:addKeycloakOpenIdProvider"),
|
|
||||||
access: "manage-identity-providers",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/identity-providers/:id",
|
|
||||||
component: AddIdentityProvider,
|
|
||||||
breadcrumb: () => IdentityProviderCrumb,
|
|
||||||
access: "manage-identity-providers",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/identity-providers/:id/:tab?",
|
|
||||||
component: DetailSettings,
|
|
||||||
access: "manage-identity-providers",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/:realm/user-federation",
|
path: "/:realm/user-federation",
|
||||||
component: UserFederationSection,
|
component: UserFederationSection,
|
||||||
|
|
Loading…
Reference in a new issue