Use new routing conventions for user federation routes (#911)
This commit is contained in:
parent
b569341195
commit
477fa6180c
10 changed files with 186 additions and 50 deletions
|
@ -15,10 +15,7 @@ import realmRoleRoutes from "./realm-roles/routes";
|
|||
import realmSettingRoutes from "./realm-settings/routes";
|
||||
import realmRoutes from "./realm/routes";
|
||||
import sessionRoutes from "./sessions/routes";
|
||||
import { LdapMapperDetails } from "./user-federation/ldap/mappers/LdapMapperDetails";
|
||||
import { UserFederationKerberosSettings } from "./user-federation/UserFederationKerberosSettings";
|
||||
import { UserFederationLdapSettings } from "./user-federation/UserFederationLdapSettings";
|
||||
import { UserFederationSection } from "./user-federation/UserFederationSection";
|
||||
import userFederationRoutes from "./user-federation/routes";
|
||||
import userRoutes from "./user/routes";
|
||||
|
||||
export type RouteDef = {
|
||||
|
@ -39,53 +36,8 @@ export const routes: RouteDef[] = [
|
|||
...realmRoutes,
|
||||
...realmSettingRoutes,
|
||||
...sessionRoutes,
|
||||
...userFederationRoutes,
|
||||
...userRoutes,
|
||||
{
|
||||
path: "/:realm/user-federation",
|
||||
component: UserFederationSection,
|
||||
breadcrumb: (t) => t("userFederation"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/kerberos",
|
||||
component: UserFederationSection,
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/kerberos/:id",
|
||||
component: UserFederationKerberosSettings,
|
||||
breadcrumb: (t) => t("common:settings"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/kerberos/new",
|
||||
component: UserFederationKerberosSettings,
|
||||
breadcrumb: (t) => t("common:settings"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/ldap",
|
||||
component: UserFederationSection,
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/ldap/new",
|
||||
component: UserFederationLdapSettings,
|
||||
breadcrumb: (t) => t("user-federation:addOneLdap"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/ldap/:id/:tab?",
|
||||
component: UserFederationLdapSettings,
|
||||
breadcrumb: (t) => t("common:settings"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/ldap/:id/:tab/:mapperId",
|
||||
component: LdapMapperDetails,
|
||||
breadcrumb: (t) => t("common:mappingDetails"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/",
|
||||
component: DashboardSection,
|
||||
|
|
22
src/user-federation/routes.ts
Normal file
22
src/user-federation/routes.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import type { RouteDef } from "../route-config";
|
||||
import { NewKerberosUserFederationRoute } from "./routes/NewKerberosUserFederation";
|
||||
import { NewLdapUserFederationRoute } from "./routes/NewLdapUserFederation";
|
||||
import { UserFederationRoute } from "./routes/UserFederation";
|
||||
import { UserFederationKerberosRoute } from "./routes/UserFederationKerberos";
|
||||
import { UserFederationLdapRoute } from "./routes/UserFederationLdap";
|
||||
import { UserFederationLdapMapperRoute } from "./routes/UserFederationLdapMapper";
|
||||
import { UserFederationsKerberosRoute } from "./routes/UserFederationsKerberos";
|
||||
import { UserFederationsLdapRoute } from "./routes/UserFederationsLdap";
|
||||
|
||||
const routes: RouteDef[] = [
|
||||
UserFederationRoute,
|
||||
UserFederationsKerberosRoute,
|
||||
UserFederationKerberosRoute,
|
||||
NewKerberosUserFederationRoute,
|
||||
UserFederationsLdapRoute,
|
||||
NewLdapUserFederationRoute,
|
||||
UserFederationLdapRoute,
|
||||
UserFederationLdapMapperRoute,
|
||||
];
|
||||
|
||||
export default routes;
|
19
src/user-federation/routes/NewKerberosUserFederation.ts
Normal file
19
src/user-federation/routes/NewKerberosUserFederation.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 { UserFederationKerberosSettings } from "../UserFederationKerberosSettings";
|
||||
|
||||
export type NewKerberosUserFederationParams = { realm: string };
|
||||
|
||||
export const NewKerberosUserFederationRoute: RouteDef = {
|
||||
path: "/:realm/user-federation/kerberos/new",
|
||||
component: UserFederationKerberosSettings,
|
||||
breadcrumb: (t) => t("common:settings"),
|
||||
access: "view-realm",
|
||||
};
|
||||
|
||||
export const toNewKerberosUserFederation = (
|
||||
params: NewKerberosUserFederationParams
|
||||
): LocationDescriptorObject => ({
|
||||
pathname: generatePath(NewKerberosUserFederationRoute.path, params),
|
||||
});
|
19
src/user-federation/routes/NewLdapUserFederation.ts
Normal file
19
src/user-federation/routes/NewLdapUserFederation.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 { UserFederationLdapSettings } from "../UserFederationLdapSettings";
|
||||
|
||||
export type NewLdapUserFederationParams = { realm: string };
|
||||
|
||||
export const NewLdapUserFederationRoute: RouteDef = {
|
||||
path: "/:realm/user-federation/ldap/new",
|
||||
component: UserFederationLdapSettings,
|
||||
breadcrumb: (t) => t("user-federation:addOneLdap"),
|
||||
access: "view-realm",
|
||||
};
|
||||
|
||||
export const toNewLdapUserFederation = (
|
||||
params: NewLdapUserFederationParams
|
||||
): LocationDescriptorObject => ({
|
||||
pathname: generatePath(NewLdapUserFederationRoute.path, params),
|
||||
});
|
19
src/user-federation/routes/UserFederation.ts
Normal file
19
src/user-federation/routes/UserFederation.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 { UserFederationSection } from "../UserFederationSection";
|
||||
|
||||
export type UserFederationParams = { realm: string };
|
||||
|
||||
export const UserFederationRoute: RouteDef = {
|
||||
path: "/:realm/user-federation",
|
||||
component: UserFederationSection,
|
||||
breadcrumb: (t) => t("userFederation"),
|
||||
access: "view-realm",
|
||||
};
|
||||
|
||||
export const toUserFederation = (
|
||||
params: UserFederationParams
|
||||
): LocationDescriptorObject => ({
|
||||
pathname: generatePath(UserFederationRoute.path, params),
|
||||
});
|
22
src/user-federation/routes/UserFederationKerberos.ts
Normal file
22
src/user-federation/routes/UserFederationKerberos.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import type { LocationDescriptorObject } from "history";
|
||||
import { generatePath } from "react-router-dom";
|
||||
import type { RouteDef } from "../../route-config";
|
||||
import { UserFederationKerberosSettings } from "../UserFederationKerberosSettings";
|
||||
|
||||
export type UserFederationKerberosParams = {
|
||||
realm: string;
|
||||
id: string;
|
||||
};
|
||||
|
||||
export const UserFederationKerberosRoute: RouteDef = {
|
||||
path: "/:realm/user-federation/kerberos/:id",
|
||||
component: UserFederationKerberosSettings,
|
||||
breadcrumb: (t) => t("common:settings"),
|
||||
access: "view-realm",
|
||||
};
|
||||
|
||||
export const toUserFederationKerberos = (
|
||||
params: UserFederationKerberosParams
|
||||
): LocationDescriptorObject => ({
|
||||
pathname: generatePath(UserFederationKerberosRoute.path, params),
|
||||
});
|
23
src/user-federation/routes/UserFederationLdap.ts
Normal file
23
src/user-federation/routes/UserFederationLdap.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import type { LocationDescriptorObject } from "history";
|
||||
import { generatePath } from "react-router-dom";
|
||||
import type { RouteDef } from "../../route-config";
|
||||
import { UserFederationLdapSettings } from "../UserFederationLdapSettings";
|
||||
|
||||
export type UserFederationLdapParams = {
|
||||
realm: string;
|
||||
id: string;
|
||||
tab?: string;
|
||||
};
|
||||
|
||||
export const UserFederationLdapRoute: RouteDef = {
|
||||
path: "/:realm/user-federation/ldap/:id/:tab?",
|
||||
component: UserFederationLdapSettings,
|
||||
breadcrumb: (t) => t("common:settings"),
|
||||
access: "view-realm",
|
||||
};
|
||||
|
||||
export const toUserFederationLdap = (
|
||||
params: UserFederationLdapParams
|
||||
): LocationDescriptorObject => ({
|
||||
pathname: generatePath(UserFederationLdapRoute.path, params),
|
||||
});
|
24
src/user-federation/routes/UserFederationLdapMapper.ts
Normal file
24
src/user-federation/routes/UserFederationLdapMapper.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 { LdapMapperDetails } from "../ldap/mappers/LdapMapperDetails";
|
||||
|
||||
export type UserFederationLdapMapperParams = {
|
||||
realm: string;
|
||||
id: string;
|
||||
tab: string;
|
||||
mapperId: string;
|
||||
};
|
||||
|
||||
export const UserFederationLdapMapperRoute: RouteDef = {
|
||||
path: "/:realm/user-federation/ldap/:id/:tab/:mapperId",
|
||||
component: LdapMapperDetails,
|
||||
breadcrumb: (t) => t("common:mappingDetails"),
|
||||
access: "view-realm",
|
||||
};
|
||||
|
||||
export const toUserFederationLdapMapper = (
|
||||
params: UserFederationLdapMapperParams
|
||||
): LocationDescriptorObject => ({
|
||||
pathname: generatePath(UserFederationLdapMapperRoute.path, params),
|
||||
});
|
18
src/user-federation/routes/UserFederationsKerberos.ts
Normal file
18
src/user-federation/routes/UserFederationsKerberos.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import type { LocationDescriptorObject } from "history";
|
||||
import { generatePath } from "react-router-dom";
|
||||
import type { RouteDef } from "../../route-config";
|
||||
import { UserFederationSection } from "../UserFederationSection";
|
||||
|
||||
export type UserFederationsKerberosParams = { realm: string };
|
||||
|
||||
export const UserFederationsKerberosRoute: RouteDef = {
|
||||
path: "/:realm/user-federation/kerberos",
|
||||
component: UserFederationSection,
|
||||
access: "view-realm",
|
||||
};
|
||||
|
||||
export const toUserFederationsKerberos = (
|
||||
params: UserFederationsKerberosParams
|
||||
): LocationDescriptorObject => ({
|
||||
pathname: generatePath(UserFederationsKerberosRoute.path, params),
|
||||
});
|
18
src/user-federation/routes/UserFederationsLdap.ts
Normal file
18
src/user-federation/routes/UserFederationsLdap.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import type { LocationDescriptorObject } from "history";
|
||||
import { generatePath } from "react-router-dom";
|
||||
import type { RouteDef } from "../../route-config";
|
||||
import { UserFederationSection } from "../UserFederationSection";
|
||||
|
||||
export type UserFederationsLdapParams = { realm: string };
|
||||
|
||||
export const UserFederationsLdapRoute: RouteDef = {
|
||||
path: "/:realm/user-federation/ldap",
|
||||
component: UserFederationSection,
|
||||
access: "view-realm",
|
||||
};
|
||||
|
||||
export const toUserFederationsLdap = (
|
||||
params: UserFederationsLdapParams
|
||||
): LocationDescriptorObject => ({
|
||||
pathname: generatePath(UserFederationsLdapRoute.path, params),
|
||||
});
|
Loading…
Reference in a new issue