Use new routing conventions for realm settings (#904)
This commit is contained in:
parent
88ae607148
commit
620ac8b024
9 changed files with 192 additions and 52 deletions
20
src/realm-settings/routes.ts
Normal file
20
src/realm-settings/routes.ts
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import type { RouteDef } from "../route-config";
|
||||||
|
import { AesGeneratedSettingsRoute } from "./routes/AesGeneratedSettings";
|
||||||
|
import { EcdsaGeneratedSettingsRoute } from "./routes/EcdsaGeneratedSettings";
|
||||||
|
import { HmacGeneratedSettingsRoute } from "./routes/HmacGeneratedSettings";
|
||||||
|
import { JavaKeystoreSettingsRoute } from "./routes/JavaKeystoreSettings";
|
||||||
|
import { RealmSettingsRoute } from "./routes/RealmSettings";
|
||||||
|
import { RsaGeneratedSettingsRoute } from "./routes/RsaGeneratedSettings";
|
||||||
|
import { RsaSettingsRoute } from "./routes/RsaSettings";
|
||||||
|
|
||||||
|
const routes: RouteDef[] = [
|
||||||
|
RealmSettingsRoute,
|
||||||
|
AesGeneratedSettingsRoute,
|
||||||
|
EcdsaGeneratedSettingsRoute,
|
||||||
|
HmacGeneratedSettingsRoute,
|
||||||
|
JavaKeystoreSettingsRoute,
|
||||||
|
RsaGeneratedSettingsRoute,
|
||||||
|
RsaSettingsRoute,
|
||||||
|
];
|
||||||
|
|
||||||
|
export default routes;
|
23
src/realm-settings/routes/AesGeneratedSettings.ts
Normal file
23
src/realm-settings/routes/AesGeneratedSettings.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 { AESGeneratedSettings } from "../key-providers/aes-generated/AESGeneratedForm";
|
||||||
|
import { EditProviderCrumb } from "../RealmSettingsSection";
|
||||||
|
|
||||||
|
export type AesGeneratedSettingsParams = {
|
||||||
|
realm: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const AesGeneratedSettingsRoute: RouteDef = {
|
||||||
|
path: "/:realm/realm-settings/keys/:id/aes-generated/settings",
|
||||||
|
component: AESGeneratedSettings,
|
||||||
|
breadcrumb: () => EditProviderCrumb,
|
||||||
|
access: "view-realm",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toAesGeneratedSettings = (
|
||||||
|
params: AesGeneratedSettingsParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(AesGeneratedSettingsRoute.path, params),
|
||||||
|
});
|
23
src/realm-settings/routes/EcdsaGeneratedSettings.ts
Normal file
23
src/realm-settings/routes/EcdsaGeneratedSettings.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 { ECDSAGeneratedSettings } from "../key-providers/ecdsa-generated/ECDSAGeneratedForm";
|
||||||
|
import { EditProviderCrumb } from "../RealmSettingsSection";
|
||||||
|
|
||||||
|
export type EcdsaGeneratedSettingsParams = {
|
||||||
|
realm: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const EcdsaGeneratedSettingsRoute: RouteDef = {
|
||||||
|
path: "/:realm/realm-settings/keys/:id/ecdsa-generated/settings",
|
||||||
|
component: ECDSAGeneratedSettings,
|
||||||
|
breadcrumb: () => EditProviderCrumb,
|
||||||
|
access: "view-realm",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toEcdsaGeneratedSettings = (
|
||||||
|
params: EcdsaGeneratedSettingsParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(EcdsaGeneratedSettingsRoute.path, params),
|
||||||
|
});
|
23
src/realm-settings/routes/HmacGeneratedSettings.ts
Normal file
23
src/realm-settings/routes/HmacGeneratedSettings.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 { HMACGeneratedSettings } from "../key-providers/hmac-generated/HMACGeneratedForm";
|
||||||
|
import { EditProviderCrumb } from "../RealmSettingsSection";
|
||||||
|
|
||||||
|
export type HmacGeneratedSettingsParams = {
|
||||||
|
realm: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const HmacGeneratedSettingsRoute: RouteDef = {
|
||||||
|
path: "/:realm/realm-settings/keys/:id/hmac-generated/settings",
|
||||||
|
component: HMACGeneratedSettings,
|
||||||
|
breadcrumb: () => EditProviderCrumb,
|
||||||
|
access: "view-realm",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toHmacGeneratedSettings = (
|
||||||
|
params: HmacGeneratedSettingsParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(HmacGeneratedSettingsRoute.path, params),
|
||||||
|
});
|
23
src/realm-settings/routes/JavaKeystoreSettings.ts
Normal file
23
src/realm-settings/routes/JavaKeystoreSettings.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 { JavaKeystoreSettings } from "../key-providers/java-keystore/JavaKeystoreForm";
|
||||||
|
import { EditProviderCrumb } from "../RealmSettingsSection";
|
||||||
|
|
||||||
|
export type JavaKeystoreSettingsParams = {
|
||||||
|
realm: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const JavaKeystoreSettingsRoute: RouteDef = {
|
||||||
|
path: "/:realm/realm-settings/keys/:id/java-keystore/settings",
|
||||||
|
component: JavaKeystoreSettings,
|
||||||
|
breadcrumb: () => EditProviderCrumb,
|
||||||
|
access: "view-realm",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toJavaKeystoreSettings = (
|
||||||
|
params: JavaKeystoreSettingsParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(JavaKeystoreSettingsRoute.path, params),
|
||||||
|
});
|
32
src/realm-settings/routes/RealmSettings.ts
Normal file
32
src/realm-settings/routes/RealmSettings.ts
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import type { LocationDescriptorObject } from "history";
|
||||||
|
import { generatePath } from "react-router-dom";
|
||||||
|
import type { RouteDef } from "../../route-config";
|
||||||
|
import { RealmSettingsSection } from "../RealmSettingsSection";
|
||||||
|
|
||||||
|
export type RealmSettingsTab =
|
||||||
|
| "general"
|
||||||
|
| "login"
|
||||||
|
| "email"
|
||||||
|
| "themes"
|
||||||
|
| "keys"
|
||||||
|
| "events"
|
||||||
|
| "securityDefences"
|
||||||
|
| "sessions";
|
||||||
|
|
||||||
|
export type RealmSettingsParams = {
|
||||||
|
realm: string;
|
||||||
|
tab?: RealmSettingsTab;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const RealmSettingsRoute: RouteDef = {
|
||||||
|
path: "/:realm/realm-settings/:tab?",
|
||||||
|
component: RealmSettingsSection,
|
||||||
|
breadcrumb: (t) => t("realmSettings"),
|
||||||
|
access: "view-realm",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toRealmSettings = (
|
||||||
|
params: RealmSettingsParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(RealmSettingsRoute.path, params),
|
||||||
|
});
|
23
src/realm-settings/routes/RsaGeneratedSettings.ts
Normal file
23
src/realm-settings/routes/RsaGeneratedSettings.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 { RSAGeneratedSettings } from "../key-providers/rsa-generated/RSAGeneratedForm";
|
||||||
|
import { EditProviderCrumb } from "../RealmSettingsSection";
|
||||||
|
|
||||||
|
export type RsaGeneratedSettingsParams = {
|
||||||
|
realm: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const RsaGeneratedSettingsRoute: RouteDef = {
|
||||||
|
path: "/:realm/realm-settings/keys/:id/rsa-generated/settings",
|
||||||
|
component: RSAGeneratedSettings,
|
||||||
|
breadcrumb: () => EditProviderCrumb,
|
||||||
|
access: "view-realm",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toRsaGeneratedSettings = (
|
||||||
|
params: RsaGeneratedSettingsParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(RsaGeneratedSettingsRoute.path, params),
|
||||||
|
});
|
23
src/realm-settings/routes/RsaSettings.ts
Normal file
23
src/realm-settings/routes/RsaSettings.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 { RSASettings } from "../key-providers/rsa/RSAForm";
|
||||||
|
import { EditProviderCrumb } from "../RealmSettingsSection";
|
||||||
|
|
||||||
|
export type RsaSettingsParams = {
|
||||||
|
realm: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const RsaSettingsRoute: RouteDef = {
|
||||||
|
path: "/:realm/realm-settings/keys/:id/rsa/settings",
|
||||||
|
component: RSASettings,
|
||||||
|
breadcrumb: () => EditProviderCrumb,
|
||||||
|
access: "view-realm",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toRsaSettings = (
|
||||||
|
params: RsaSettingsParams
|
||||||
|
): LocationDescriptorObject => ({
|
||||||
|
pathname: generatePath(RsaSettingsRoute.path, params),
|
||||||
|
});
|
|
@ -18,16 +18,7 @@ import { DetailSettings } from "./identity-providers/add/DetailSettings";
|
||||||
import { IdentityProvidersSection } from "./identity-providers/IdentityProvidersSection";
|
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 { AESGeneratedSettings } from "./realm-settings/key-providers/aes-generated/AESGeneratedForm";
|
import realmSettingRoutes from "./realm-settings/routes";
|
||||||
import { ECDSAGeneratedSettings } from "./realm-settings/key-providers/ecdsa-generated/ECDSAGeneratedForm";
|
|
||||||
import { HMACGeneratedSettings } from "./realm-settings/key-providers/hmac-generated/HMACGeneratedForm";
|
|
||||||
import { JavaKeystoreSettings } from "./realm-settings/key-providers/java-keystore/JavaKeystoreForm";
|
|
||||||
import { RSAGeneratedSettings } from "./realm-settings/key-providers/rsa-generated/RSAGeneratedForm";
|
|
||||||
import { RSASettings } from "./realm-settings/key-providers/rsa/RSAForm";
|
|
||||||
import {
|
|
||||||
EditProviderCrumb,
|
|
||||||
RealmSettingsSection,
|
|
||||||
} from "./realm-settings/RealmSettingsSection";
|
|
||||||
import realmRoutes from "./realm/routes";
|
import realmRoutes from "./realm/routes";
|
||||||
import sessionRoutes from "./sessions/routes";
|
import sessionRoutes from "./sessions/routes";
|
||||||
import { LdapMapperDetails } from "./user-federation/ldap/mappers/LdapMapperDetails";
|
import { LdapMapperDetails } from "./user-federation/ldap/mappers/LdapMapperDetails";
|
||||||
|
@ -51,50 +42,9 @@ export const routes: RouteDef[] = [
|
||||||
...eventRoutes,
|
...eventRoutes,
|
||||||
...realmRoleRoutes,
|
...realmRoleRoutes,
|
||||||
...realmRoutes,
|
...realmRoutes,
|
||||||
|
...realmSettingRoutes,
|
||||||
...sessionRoutes,
|
...sessionRoutes,
|
||||||
...userRoutes,
|
...userRoutes,
|
||||||
{
|
|
||||||
path: "/:realm/realm-settings/:tab?",
|
|
||||||
component: RealmSettingsSection,
|
|
||||||
breadcrumb: (t) => t("realmSettings"),
|
|
||||||
access: "view-realm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/realm-settings/keys/:id?/aes-generated/settings",
|
|
||||||
component: AESGeneratedSettings,
|
|
||||||
breadcrumb: () => EditProviderCrumb,
|
|
||||||
access: "view-realm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/realm-settings/keys/:id?/ecdsa-generated/settings",
|
|
||||||
component: ECDSAGeneratedSettings,
|
|
||||||
breadcrumb: () => EditProviderCrumb,
|
|
||||||
access: "view-realm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/realm-settings/keys/:id?/hmac-generated/settings",
|
|
||||||
component: HMACGeneratedSettings,
|
|
||||||
breadcrumb: () => EditProviderCrumb,
|
|
||||||
access: "view-realm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/realm-settings/keys/:id?/java-keystore/settings",
|
|
||||||
component: JavaKeystoreSettings,
|
|
||||||
breadcrumb: () => EditProviderCrumb,
|
|
||||||
access: "view-realm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/realm-settings/keys/:id?/rsa-generated/settings",
|
|
||||||
component: RSAGeneratedSettings,
|
|
||||||
breadcrumb: () => EditProviderCrumb,
|
|
||||||
access: "view-realm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/:realm/realm-settings/keys/:id?/rsa/settings",
|
|
||||||
component: RSASettings,
|
|
||||||
breadcrumb: () => EditProviderCrumb,
|
|
||||||
access: "view-realm",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/:realm/identity-providers",
|
path: "/:realm/identity-providers",
|
||||||
component: IdentityProvidersSection,
|
component: IdentityProvidersSection,
|
||||||
|
|
Loading…
Reference in a new issue