Enable possiblity to support custom pages (without forking keycloakify)
This commit is contained in:
parent
e3b41c9bd1
commit
c9b2db625c
@ -6,7 +6,6 @@ import * as child_process from "child_process";
|
||||
import { generateDebugFiles, containerLaunchScriptBasename } from "./generateDebugFiles";
|
||||
import { URL } from "url";
|
||||
|
||||
|
||||
const reactProjectDirPath = process.cwd();
|
||||
|
||||
const doUseExternalAssets = process.argv[2]?.toLowerCase() === "--external-assets";
|
||||
@ -19,6 +18,8 @@ export function main() {
|
||||
|
||||
console.log("🔏 Building the keycloak theme...⌚");
|
||||
|
||||
const extraPagesId: string[] = (parsedPackageJson as any)["keycloakify"]?.["extraPages"] ?? [];
|
||||
|
||||
generateKeycloakThemeResources({
|
||||
keycloakThemeBuildingDirPath,
|
||||
"reactAppBuildDirPath": pathJoin(reactProjectDirPath, "build"),
|
||||
@ -53,7 +54,8 @@ export function main() {
|
||||
|
||||
};
|
||||
|
||||
})()
|
||||
})(),
|
||||
extraPagesId
|
||||
});
|
||||
|
||||
const { jarFilePath } = generateJavaStackFiles({
|
||||
|
@ -136,7 +136,7 @@ export function generateFtlFilesCodeFactory(
|
||||
|
||||
function generateFtlFilesCode(
|
||||
params: {
|
||||
pageId: PageId;
|
||||
pageId: string;
|
||||
}
|
||||
): { ftlCode: string; } {
|
||||
|
||||
|
@ -22,10 +22,14 @@ export function generateKeycloakThemeResources(
|
||||
urlPathname: string;
|
||||
//If urlOrigin is not undefined then it means --externals-assets
|
||||
urlOrigin: undefined | string;
|
||||
extraPagesId: string[];
|
||||
}
|
||||
) {
|
||||
|
||||
const { themeName, reactAppBuildDirPath, keycloakThemeBuildingDirPath, urlPathname, urlOrigin } = params;
|
||||
const {
|
||||
themeName, reactAppBuildDirPath, keycloakThemeBuildingDirPath,
|
||||
urlPathname, urlOrigin, extraPagesId
|
||||
} = params;
|
||||
|
||||
const themeDirPath = pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", themeName, "login");
|
||||
|
||||
@ -92,7 +96,7 @@ export function generateKeycloakThemeResources(
|
||||
urlOrigin
|
||||
});
|
||||
|
||||
pageIds.forEach(pageId => {
|
||||
[...pageIds, ...extraPagesId].forEach(pageId => {
|
||||
|
||||
const { ftlCode } = generateFtlFilesCode({ pageId });
|
||||
|
||||
|
@ -123,11 +123,6 @@ export declare namespace KcContextBase {
|
||||
passwordRequired: boolean;
|
||||
recaptchaRequired: boolean;
|
||||
recaptchaSiteKey?: string;
|
||||
/**
|
||||
* Defined when you use the keycloak-mail-whitelisting keycloak plugin
|
||||
* (https://github.com/micedre/keycloak-mail-whitelisting)
|
||||
*/
|
||||
authorizedMailDomains?: string[];
|
||||
social: {
|
||||
displayInfo: boolean;
|
||||
providers?: {
|
||||
|
@ -5,14 +5,14 @@ import { ftlValuesGlobalName } from "../../bin/build-keycloak-theme/ftlValuesGlo
|
||||
|
||||
export function getKcContext<KcContextExtended extends { pageId: string; } = never>(
|
||||
params?: {
|
||||
mockPageId: KcContextBase["pageId"] | KcContextExtended["pageId"] | false;
|
||||
mockPageId?: KcContextBase["pageId"] | KcContextExtended["pageId"];
|
||||
kcContextExtendedMock?: KcContextExtended[];
|
||||
}
|
||||
): { kcContext: KcContextBase | KcContextExtended & KcContextBase.Common; } {
|
||||
): { kcContext: (KcContextBase | KcContextExtended & KcContextBase.Common) | undefined; } {
|
||||
|
||||
const { mockPageId, kcContextExtendedMock } = params ?? { "mockPageId": false };
|
||||
|
||||
if (typeof mockPageId === "string") {
|
||||
if (mockPageId !== undefined) {
|
||||
|
||||
return {
|
||||
"pageId": mockPageId,
|
||||
|
@ -166,13 +166,6 @@ export const kcContextMocks: KcContextBase[] = [
|
||||
},
|
||||
"passwordRequired": true,
|
||||
"recaptchaRequired": false,
|
||||
"authorizedMailDomains": [
|
||||
"example.com",
|
||||
"another-example.com",
|
||||
"*.yet-another-example.com",
|
||||
"*.example.com",
|
||||
"hello-world.com"
|
||||
],
|
||||
"social": {
|
||||
"displayInfo": true
|
||||
},
|
||||
|
@ -13,6 +13,7 @@ generateKeycloakThemeResources({
|
||||
"reactAppBuildDirPath": pathJoin(sampleReactProjectDirPath, "build"),
|
||||
"keycloakThemeBuildingDirPath": pathJoin(sampleReactProjectDirPath, "build_keycloak_theme"),
|
||||
"urlPathname": "/keycloakify-demo-app/",
|
||||
"urlOrigin": undefined
|
||||
"urlOrigin": undefined,
|
||||
"extraPagesId": ["my-custom-page.ftl"]
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user