keycloakify 7.7.2 → 7.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/account/kcContext/createGetKcContext.js +3 -6
- package/account/kcContext/createGetKcContext.js.map +1 -1
- package/account/kcContext/kcContextMocks.js +3 -3
- package/account/kcContext/kcContextMocks.js.map +1 -1
- package/account/pages/Account.d.ts +1 -1
- package/account/pages/Account.js +1 -1
- package/account/pages/Account.js.map +1 -1
- package/account/pages/Password.d.ts +1 -1
- package/account/pages/Password.js +1 -1
- package/account/pages/Password.js.map +1 -1
- package/bin/copy-keycloak-resources-to-public.d.ts +2 -0
- package/bin/copy-keycloak-resources-to-public.js +140 -0
- package/bin/copy-keycloak-resources-to-public.js.map +1 -0
- package/bin/download-builtin-keycloak-theme.js +8 -10
- package/bin/download-builtin-keycloak-theme.js.map +1 -1
- package/bin/initialize-email-theme.js +5 -2
- package/bin/initialize-email-theme.js.map +1 -1
- package/bin/keycloakify/BuildOptions.d.ts +1 -3
- package/bin/keycloakify/BuildOptions.js +15 -5
- package/bin/keycloakify/BuildOptions.js.map +1 -1
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js +4 -3
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +1 -1
- package/bin/keycloakify/generateTheme/generateTheme.js +26 -23
- package/bin/keycloakify/generateTheme/generateTheme.js.map +1 -1
- package/bin/keycloakify/keycloakify.js +11 -14
- package/bin/keycloakify/keycloakify.js.map +1 -1
- package/bin/keycloakify/parsedPackageJson.d.ts +5 -5
- package/bin/mockTestingResourcesPath.d.ts +3 -3
- package/bin/mockTestingResourcesPath.js +4 -4
- package/bin/mockTestingResourcesPath.js.map +1 -1
- package/login/kcContext/KcContext.d.ts +1 -1
- package/login/kcContext/createGetKcContext.js +3 -6
- package/login/kcContext/createGetKcContext.js.map +1 -1
- package/login/kcContext/kcContextMocks.js +4 -4
- package/login/kcContext/kcContextMocks.js.map +1 -1
- package/login/pages/LoginConfigTotp.js +1 -1
- package/login/pages/LoginConfigTotp.js.map +1 -1
- package/package.json +9 -8
- package/src/account/kcContext/createGetKcContext.ts +3 -9
- package/src/account/kcContext/kcContextMocks.ts +3 -3
- package/src/account/pages/Account.tsx +1 -1
- package/src/account/pages/Password.tsx +1 -1
- package/src/bin/copy-keycloak-resources-to-public.ts +48 -0
- package/src/bin/download-builtin-keycloak-theme.ts +8 -15
- package/src/bin/initialize-email-theme.ts +6 -2
- package/src/bin/keycloakify/BuildOptions.ts +13 -5
- package/src/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.ts +13 -4
- package/src/bin/keycloakify/generateTheme/generateTheme.ts +24 -12
- package/src/bin/keycloakify/keycloakify.ts +4 -7
- package/src/bin/mockTestingResourcesPath.ts +3 -3
- package/src/login/kcContext/KcContext.ts +1 -1
- package/src/login/kcContext/createGetKcContext.ts +3 -9
- package/src/login/kcContext/kcContextMocks.ts +4 -4
- package/src/login/pages/LoginConfigTotp.tsx +5 -4
- package/bin/tools/cliOptions.d.ts +0 -5
- package/bin/tools/cliOptions.js +0 -16
- package/bin/tools/cliOptions.js.map +0 -1
- package/src/bin/tools/cliOptions.ts +0 -15
@@ -4,7 +4,7 @@ import { useGetClassName } from "keycloakify/account/lib/useGetClassName";
|
|
4
4
|
import type { KcContext } from "../kcContext";
|
5
5
|
import type { I18n } from "../i18n";
|
6
6
|
|
7
|
-
export default function
|
7
|
+
export default function Password(props: PageProps<Extract<KcContext, { pageId: "password.ftl" }>, I18n>) {
|
8
8
|
const { kcContext, i18n, doUseDefaultCss, Template, classes } = props;
|
9
9
|
|
10
10
|
const { getClassName } = useGetClassName({
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
import { downloadKeycloakStaticResources } from "./keycloakify/generateTheme/downloadKeycloakStaticResources";
|
4
|
+
import { join as pathJoin, relative as pathRelative } from "path";
|
5
|
+
import { basenameOfKeycloakDirInPublicDir } from "./mockTestingResourcesPath";
|
6
|
+
import { readBuildOptions } from "./keycloakify/BuildOptions";
|
7
|
+
import { themeTypes } from "./keycloakify/generateFtl";
|
8
|
+
import * as fs from "fs";
|
9
|
+
|
10
|
+
(async () => {
|
11
|
+
const projectDirPath = process.cwd();
|
12
|
+
|
13
|
+
const buildOptions = readBuildOptions({
|
14
|
+
"processArgv": process.argv.slice(2),
|
15
|
+
"projectDirPath": process.cwd()
|
16
|
+
});
|
17
|
+
|
18
|
+
const keycloakDirInPublicDir = pathJoin(process.env["PUBLIC_DIR_PATH"] || pathJoin(projectDirPath, "public"), basenameOfKeycloakDirInPublicDir);
|
19
|
+
|
20
|
+
if (fs.existsSync(keycloakDirInPublicDir)) {
|
21
|
+
console.log(`${pathRelative(projectDirPath, keycloakDirInPublicDir)} already exists.`);
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
for (const themeType of themeTypes) {
|
26
|
+
await downloadKeycloakStaticResources({
|
27
|
+
"isSilent": false,
|
28
|
+
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
29
|
+
"themeType": themeType,
|
30
|
+
"themeDirPath": keycloakDirInPublicDir
|
31
|
+
});
|
32
|
+
}
|
33
|
+
|
34
|
+
fs.writeFileSync(
|
35
|
+
pathJoin(keycloakDirInPublicDir, "README.txt"),
|
36
|
+
Buffer.from(
|
37
|
+
// prettier-ignore
|
38
|
+
[
|
39
|
+
"This is just a test folder that helps develop",
|
40
|
+
"the login and register page without having to run a Keycloak container"
|
41
|
+
].join(" ")
|
42
|
+
)
|
43
|
+
);
|
44
|
+
|
45
|
+
fs.writeFileSync(pathJoin(keycloakDirInPublicDir, ".gitignore"), Buffer.from("*", "utf8"));
|
46
|
+
|
47
|
+
console.log(`${pathRelative(projectDirPath, keycloakDirInPublicDir)} directory created.`);
|
48
|
+
})();
|
@@ -2,7 +2,6 @@
|
|
2
2
|
import { join as pathJoin } from "path";
|
3
3
|
import { downloadAndUnzip } from "./tools/downloadAndUnzip";
|
4
4
|
import { promptKeycloakVersion } from "./promptKeycloakVersion";
|
5
|
-
import { getCliOptions } from "./tools/cliOptions";
|
6
5
|
import { getLogger } from "./tools/logger";
|
7
6
|
import { readBuildOptions } from "./keycloakify/BuildOptions";
|
8
7
|
|
@@ -21,28 +20,22 @@ export async function downloadBuiltinKeycloakTheme(params: { keycloakVersion: st
|
|
21
20
|
}
|
22
21
|
|
23
22
|
async function main() {
|
24
|
-
const
|
25
|
-
|
23
|
+
const buildOptions = readBuildOptions({
|
24
|
+
"projectDirPath": process.cwd(),
|
25
|
+
"processArgv": process.argv.slice(2)
|
26
|
+
});
|
27
|
+
|
28
|
+
const logger = getLogger({ "isSilent": buildOptions.isSilent });
|
26
29
|
const { keycloakVersion } = await promptKeycloakVersion();
|
27
30
|
|
28
|
-
const destDirPath = pathJoin(
|
29
|
-
readBuildOptions({
|
30
|
-
"isSilent": true,
|
31
|
-
"isExternalAssetsCliParamProvided": false,
|
32
|
-
"projectDirPath": process.cwd()
|
33
|
-
}).keycloakifyBuildDirPath,
|
34
|
-
"src",
|
35
|
-
"main",
|
36
|
-
"resources",
|
37
|
-
"theme"
|
38
|
-
);
|
31
|
+
const destDirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, "src", "main", "resources", "theme");
|
39
32
|
|
40
33
|
logger.log(`Downloading builtins theme of Keycloak ${keycloakVersion} here ${destDirPath}`);
|
41
34
|
|
42
35
|
await downloadBuiltinKeycloakTheme({
|
43
36
|
keycloakVersion,
|
44
37
|
destDirPath,
|
45
|
-
isSilent
|
38
|
+
"isSilent": buildOptions.isSilent
|
46
39
|
});
|
47
40
|
}
|
48
41
|
|
@@ -4,13 +4,17 @@ import { downloadBuiltinKeycloakTheme } from "./download-builtin-keycloak-theme"
|
|
4
4
|
import { join as pathJoin, relative as pathRelative } from "path";
|
5
5
|
import { transformCodebase } from "./tools/transformCodebase";
|
6
6
|
import { promptKeycloakVersion } from "./promptKeycloakVersion";
|
7
|
+
import { readBuildOptions } from "./keycloakify/BuildOptions";
|
7
8
|
import * as fs from "fs";
|
8
|
-
import { getCliOptions } from "./tools/cliOptions";
|
9
9
|
import { getLogger } from "./tools/logger";
|
10
10
|
import { getEmailThemeSrcDirPath } from "./getSrcDirPath";
|
11
11
|
|
12
12
|
export async function main() {
|
13
|
-
const { isSilent } =
|
13
|
+
const { isSilent } = readBuildOptions({
|
14
|
+
"projectDirPath": process.cwd(),
|
15
|
+
"processArgv": process.argv.slice(2)
|
16
|
+
});
|
17
|
+
|
14
18
|
const logger = getLogger({ isSilent });
|
15
19
|
|
16
20
|
const { emailThemeSrcDirPath } = getEmailThemeSrcDirPath({
|
@@ -6,6 +6,7 @@ import { symToStr } from "tsafe/symToStr";
|
|
6
6
|
import { bundlers, getParsedPackageJson, type Bundler } from "./parsedPackageJson";
|
7
7
|
import * as fs from "fs";
|
8
8
|
import { join as pathJoin, sep as pathSep } from "path";
|
9
|
+
import parseArgv from "minimist";
|
9
10
|
|
10
11
|
/** Consolidated build option gathered form CLI arguments and config in package.json */
|
11
12
|
export type BuildOptions = BuildOptions.Standalone | BuildOptions.ExternalAssets;
|
@@ -53,10 +54,17 @@ export namespace BuildOptions {
|
|
53
54
|
}
|
54
55
|
}
|
55
56
|
|
56
|
-
export
|
57
|
+
export function readBuildOptions(params: { projectDirPath: string; processArgv: string[] }): BuildOptions {
|
58
|
+
const { projectDirPath, processArgv } = params;
|
57
59
|
|
58
|
-
|
59
|
-
|
60
|
+
const { isExternalAssetsCliParamProvided, isSilentCliParamProvided } = (() => {
|
61
|
+
const argv = parseArgv(processArgv);
|
62
|
+
|
63
|
+
return {
|
64
|
+
"isSilentCliParamProvided": typeof argv["silent"] === "boolean" ? argv["silent"] : false,
|
65
|
+
"isExternalAssetsCliParamProvided": typeof argv["external-assets"] === "boolean" ? argv["external-assets"] : false
|
66
|
+
};
|
67
|
+
})();
|
60
68
|
|
61
69
|
const parsedPackageJson = getParsedPackageJson({ projectDirPath });
|
62
70
|
|
@@ -145,8 +153,8 @@ export function readBuildOptions(params: { projectDirPath: string; isExternalAss
|
|
145
153
|
"extraLoginPages": [...(extraPages ?? []), ...(extraLoginPages ?? [])],
|
146
154
|
extraAccountPages,
|
147
155
|
extraThemeProperties,
|
148
|
-
isSilent,
|
149
|
-
"keycloakVersionDefaultAssets": keycloakVersionDefaultAssets ??
|
156
|
+
"isSilent": isSilentCliParamProvided,
|
157
|
+
"keycloakVersionDefaultAssets": keycloakVersionDefaultAssets ?? "11.0.3",
|
150
158
|
"reactAppBuildDirPath": (() => {
|
151
159
|
let { reactAppBuildDirPath = undefined } = parsedPackageJson.keycloakify ?? {};
|
152
160
|
|
@@ -3,7 +3,12 @@ import * as fs from "fs";
|
|
3
3
|
import { join as pathJoin, relative as pathRelative } from "path";
|
4
4
|
import type { ThemeType } from "../generateFtl";
|
5
5
|
import { downloadBuiltinKeycloakTheme } from "../../download-builtin-keycloak-theme";
|
6
|
-
import {
|
6
|
+
import {
|
7
|
+
resourcesCommonDirPathRelativeToPublicDir,
|
8
|
+
resourcesDirPathRelativeToPublicDir,
|
9
|
+
basenameOfKeycloakDirInPublicDir
|
10
|
+
} from "../../mockTestingResourcesPath";
|
11
|
+
import * as crypto from "crypto";
|
7
12
|
|
8
13
|
export async function downloadKeycloakStaticResources(
|
9
14
|
// prettier-ignore
|
@@ -16,7 +21,11 @@ export async function downloadKeycloakStaticResources(
|
|
16
21
|
) {
|
17
22
|
const { themeType, isSilent, themeDirPath, keycloakVersion } = params;
|
18
23
|
|
19
|
-
const tmpDirPath = pathJoin(
|
24
|
+
const tmpDirPath = pathJoin(
|
25
|
+
themeDirPath,
|
26
|
+
"..",
|
27
|
+
`tmp_suLeKsxId_${crypto.createHash("sha256").update(`${themeType}-${keycloakVersion}`).digest("hex").slice(0, 8)}`
|
28
|
+
);
|
20
29
|
|
21
30
|
await downloadBuiltinKeycloakTheme({
|
22
31
|
keycloakVersion,
|
@@ -26,12 +35,12 @@ export async function downloadKeycloakStaticResources(
|
|
26
35
|
|
27
36
|
transformCodebase({
|
28
37
|
"srcDirPath": pathJoin(tmpDirPath, "keycloak", themeType, "resources"),
|
29
|
-
"destDirPath": pathJoin(themeDirPath, pathRelative(
|
38
|
+
"destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesDirPathRelativeToPublicDir))
|
30
39
|
});
|
31
40
|
|
32
41
|
transformCodebase({
|
33
42
|
"srcDirPath": pathJoin(tmpDirPath, "keycloak", "common", "resources"),
|
34
|
-
"destDirPath": pathJoin(themeDirPath, pathRelative(
|
43
|
+
"destDirPath": pathJoin(themeDirPath, pathRelative(basenameOfKeycloakDirInPublicDir, resourcesCommonDirPathRelativeToPublicDir))
|
35
44
|
});
|
36
45
|
|
37
46
|
fs.rmSync(tmpDirPath, { "recursive": true, "force": true });
|
@@ -4,7 +4,7 @@ import { join as pathJoin } from "path";
|
|
4
4
|
import { replaceImportsFromStaticInJsCode } from "../replacers/replaceImportsFromStaticInJsCode";
|
5
5
|
import { replaceImportsInCssCode } from "../replacers/replaceImportsInCssCode";
|
6
6
|
import { generateFtlFilesCodeFactory, loginThemePageIds, accountThemePageIds, themeTypes, type ThemeType } from "../generateFtl";
|
7
|
-
import {
|
7
|
+
import { basenameOfKeycloakDirInPublicDir } from "../../mockTestingResourcesPath";
|
8
8
|
import { isInside } from "../../tools/isInside";
|
9
9
|
import type { BuildOptions } from "../BuildOptions";
|
10
10
|
import { assert } from "tsafe/assert";
|
@@ -84,7 +84,7 @@ export async function generateTheme(params: {
|
|
84
84
|
if (
|
85
85
|
buildOptions.isStandalone &&
|
86
86
|
isInside({
|
87
|
-
"dirPath": pathJoin(reactAppBuildDirPath,
|
87
|
+
"dirPath": pathJoin(reactAppBuildDirPath, basenameOfKeycloakDirInPublicDir),
|
88
88
|
filePath
|
89
89
|
})
|
90
90
|
) {
|
@@ -172,23 +172,28 @@ export async function generateTheme(params: {
|
|
172
172
|
fs.writeFileSync(pathJoin(themeDirPath, pageId), Buffer.from(ftlCode, "utf8"));
|
173
173
|
});
|
174
174
|
|
175
|
-
|
175
|
+
//TODO: Remove this block we left it for now only for backward compatibility
|
176
|
+
// we now have a separate script for this
|
177
|
+
copy_keycloak_resources_to_public: {
|
178
|
+
const keycloakDirInPublicDir = pathJoin(reactAppBuildDirPath, "..", "public", basenameOfKeycloakDirInPublicDir);
|
179
|
+
|
180
|
+
if (fs.existsSync(keycloakDirInPublicDir)) {
|
181
|
+
break copy_keycloak_resources_to_public;
|
182
|
+
}
|
183
|
+
|
176
184
|
await downloadKeycloakStaticResources({
|
177
185
|
"isSilent": buildOptions.isSilent,
|
178
186
|
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
179
|
-
themeDirPath,
|
187
|
+
"themeDirPath": keycloakDirInPublicDir,
|
180
188
|
themeType
|
181
189
|
});
|
182
190
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
const keycloakResourcesWithinPublicDirPath = pathJoin(reactAppBuildDirPath, "..", "public", mockTestingSubDirOfPublicDirBasename);
|
187
|
-
|
188
|
-
await downloadKeycloakStaticResources_configured(keycloakResourcesWithinPublicDirPath);
|
191
|
+
if (themeType !== themeTypes[0]) {
|
192
|
+
break copy_keycloak_resources_to_public;
|
193
|
+
}
|
189
194
|
|
190
195
|
fs.writeFileSync(
|
191
|
-
pathJoin(
|
196
|
+
pathJoin(keycloakDirInPublicDir, "README.txt"),
|
192
197
|
Buffer.from(
|
193
198
|
// prettier-ignore
|
194
199
|
[
|
@@ -198,9 +203,16 @@ export async function generateTheme(params: {
|
|
198
203
|
)
|
199
204
|
);
|
200
205
|
|
201
|
-
fs.writeFileSync(pathJoin(
|
206
|
+
fs.writeFileSync(pathJoin(keycloakDirInPublicDir, ".gitignore"), Buffer.from("*", "utf8"));
|
202
207
|
}
|
203
208
|
|
209
|
+
await downloadKeycloakStaticResources({
|
210
|
+
"isSilent": buildOptions.isSilent,
|
211
|
+
"keycloakVersion": buildOptions.keycloakVersionDefaultAssets,
|
212
|
+
themeDirPath,
|
213
|
+
themeType
|
214
|
+
});
|
215
|
+
|
204
216
|
fs.writeFileSync(
|
205
217
|
pathJoin(themeDirPath, "theme.properties"),
|
206
218
|
Buffer.from(["parent=keycloak", ...(buildOptions.extraThemeProperties ?? [])].join("\n\n"), "utf8")
|
@@ -6,7 +6,6 @@ import { generateStartKeycloakTestingContainer } from "./generateStartKeycloakTe
|
|
6
6
|
import * as fs from "fs";
|
7
7
|
import { readBuildOptions } from "./BuildOptions";
|
8
8
|
import { getLogger } from "../tools/logger";
|
9
|
-
import { getCliOptions } from "../tools/cliOptions";
|
10
9
|
import jar from "../tools/jar";
|
11
10
|
import { assert } from "tsafe/assert";
|
12
11
|
import { Equals } from "tsafe";
|
@@ -14,18 +13,16 @@ import { getEmailThemeSrcDirPath } from "../getSrcDirPath";
|
|
14
13
|
import { getProjectRoot } from "../tools/getProjectRoot";
|
15
14
|
|
16
15
|
export async function main() {
|
17
|
-
const { isSilent, hasExternalAssets } = getCliOptions(process.argv.slice(2));
|
18
|
-
const logger = getLogger({ isSilent });
|
19
|
-
logger.log("🔏 Building the keycloak theme...⌚");
|
20
|
-
|
21
16
|
const projectDirPath = process.cwd();
|
22
17
|
|
23
18
|
const buildOptions = readBuildOptions({
|
24
19
|
projectDirPath,
|
25
|
-
"
|
26
|
-
"isSilent": isSilent
|
20
|
+
"processArgv": process.argv.slice(2)
|
27
21
|
});
|
28
22
|
|
23
|
+
const logger = getLogger({ "isSilent": buildOptions.isSilent });
|
24
|
+
logger.log("🔏 Building the keycloak theme...⌚");
|
25
|
+
|
29
26
|
const { doBundlesEmailTemplate } = await generateTheme({
|
30
27
|
keycloakThemeBuildingDirPath: buildOptions.keycloakifyBuildDirPath,
|
31
28
|
"emailThemeSrcDirPath": (() => {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { pathJoin } from "./tools/pathJoin";
|
2
2
|
|
3
|
-
export const
|
4
|
-
export const
|
5
|
-
export const
|
3
|
+
export const basenameOfKeycloakDirInPublicDir = "keycloak-resources";
|
4
|
+
export const resourcesDirPathRelativeToPublicDir = pathJoin(basenameOfKeycloakDirInPublicDir, "resources");
|
5
|
+
export const resourcesCommonDirPathRelativeToPublicDir = pathJoin(basenameOfKeycloakDirInPublicDir, "resources_common");
|
@@ -333,7 +333,6 @@ export declare namespace KcContext {
|
|
333
333
|
totpSecretEncoded: string;
|
334
334
|
qrUrl: string;
|
335
335
|
policy: {
|
336
|
-
supportedApplications: string[];
|
337
336
|
algorithm: "HmacSHA1" | "HmacSHA256" | "HmacSHA512";
|
338
337
|
digits: number;
|
339
338
|
lookAheadWindow: number;
|
@@ -347,6 +346,7 @@ export declare namespace KcContext {
|
|
347
346
|
initialCounter: number;
|
348
347
|
}
|
349
348
|
);
|
349
|
+
supportedApplications: string[];
|
350
350
|
totpSecretQrCode: string;
|
351
351
|
manualUrl: string;
|
352
352
|
totpSecret: string;
|
@@ -9,7 +9,7 @@ import type { ExtendKcContext } from "./getKcContextFromWindow";
|
|
9
9
|
import { getKcContextFromWindow } from "./getKcContextFromWindow";
|
10
10
|
import { pathJoin } from "keycloakify/bin/tools/pathJoin";
|
11
11
|
import { pathBasename } from "keycloakify/tools/pathBasename";
|
12
|
-
import {
|
12
|
+
import { resourcesCommonDirPathRelativeToPublicDir } from "keycloakify/bin/mockTestingResourcesPath";
|
13
13
|
import { symToStr } from "tsafe/symToStr";
|
14
14
|
import { loginThemePageIds } from "keycloakify/bin/keycloakify/generateFtl/pageId";
|
15
15
|
|
@@ -33,13 +33,7 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
|
33
33
|
if (mockPageId !== undefined && realKcContext === undefined) {
|
34
34
|
//TODO maybe trow if no mock fo custom page
|
35
35
|
|
36
|
-
console.log(
|
37
|
-
[
|
38
|
-
`%cKeycloakify: ${symToStr({ mockPageId })} set to ${mockPageId}.`,
|
39
|
-
`If assets are missing make sure you have built your Keycloak theme at least once.`
|
40
|
-
].join(" "),
|
41
|
-
"background: red; color: yellow; font-size: medium"
|
42
|
-
);
|
36
|
+
console.log(`%cKeycloakify: ${symToStr({ mockPageId })} set to ${mockPageId}.`, "background: red; color: yellow; font-size: medium");
|
43
37
|
|
44
38
|
const kcContextDefaultMock = kcContextMocks.find(({ pageId }) => pageId === mockPageId);
|
45
39
|
|
@@ -158,7 +152,7 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
|
158
152
|
{
|
159
153
|
const { url } = realKcContext;
|
160
154
|
|
161
|
-
url.resourcesCommonPath = pathJoin(url.resourcesPath, pathBasename(
|
155
|
+
url.resourcesCommonPath = pathJoin(url.resourcesPath, pathBasename(resourcesCommonDirPathRelativeToPublicDir));
|
162
156
|
}
|
163
157
|
|
164
158
|
return { "kcContext": realKcContext as any };
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import "minimal-polyfills/Object.fromEntries";
|
2
2
|
import type { KcContext, Attribute } from "./KcContext";
|
3
|
-
import {
|
3
|
+
import { resourcesCommonDirPathRelativeToPublicDir, resourcesDirPathRelativeToPublicDir } from "keycloakify/bin/mockTestingResourcesPath";
|
4
4
|
import { pathJoin } from "keycloakify/bin/tools/pathJoin";
|
5
5
|
import { id } from "tsafe/id";
|
6
6
|
|
@@ -104,8 +104,8 @@ export const kcContextCommonMock: KcContext.Common = {
|
|
104
104
|
"keycloakifyVersion": "0.0.0",
|
105
105
|
"url": {
|
106
106
|
"loginAction": "#",
|
107
|
-
"resourcesPath": pathJoin(PUBLIC_URL,
|
108
|
-
"resourcesCommonPath": pathJoin(PUBLIC_URL,
|
107
|
+
"resourcesPath": pathJoin(PUBLIC_URL, resourcesDirPathRelativeToPublicDir),
|
108
|
+
"resourcesCommonPath": pathJoin(PUBLIC_URL, resourcesCommonDirPathRelativeToPublicDir),
|
109
109
|
"loginRestartFlowUrl": "/auth/realms/myrealm/login-actions/restart?client_id=account&tab_id=HoAx28ja4xg",
|
110
110
|
"loginUrl": "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg"
|
111
111
|
},
|
@@ -453,8 +453,8 @@ export const kcContextMocks: KcContext[] = [
|
|
453
453
|
manualUrl: "#",
|
454
454
|
totpSecret: "G4nsI8lQagRMUchH8jEG",
|
455
455
|
otpCredentials: [],
|
456
|
+
supportedApplications: ["FreeOTP", "Google Authenticator"],
|
456
457
|
policy: {
|
457
|
-
supportedApplications: ["FreeOTP", "Google Authenticator"],
|
458
458
|
algorithm: "HmacSHA1",
|
459
459
|
digits: 6,
|
460
460
|
lookAheadWindow: 1,
|
@@ -3,6 +3,7 @@ import type { PageProps } from "keycloakify/login/pages/PageProps";
|
|
3
3
|
import { useGetClassName } from "keycloakify/login/lib/useGetClassName";
|
4
4
|
import type { KcContext } from "../kcContext";
|
5
5
|
import type { I18n } from "../i18n";
|
6
|
+
import { MessageKey } from "keycloakify/login/i18n/i18n";
|
6
7
|
|
7
8
|
export default function LoginConfigTotp(props: PageProps<Extract<KcContext, { pageId: "login-config-totp.ftl" }>, I18n>) {
|
8
9
|
const { kcContext, i18n, doUseDefaultCss, Template, classes } = props;
|
@@ -16,7 +17,7 @@ export default function LoginConfigTotp(props: PageProps<Extract<KcContext, { pa
|
|
16
17
|
|
17
18
|
const { msg, msgStr } = i18n;
|
18
19
|
|
19
|
-
const algToKeyUriAlg: Record<
|
20
|
+
const algToKeyUriAlg: Record<(typeof kcContext)["totp"]["policy"]["algorithm"], string> = {
|
20
21
|
"HmacSHA1": "SHA1",
|
21
22
|
"HmacSHA256": "SHA256",
|
22
23
|
"HmacSHA512": "SHA512"
|
@@ -30,8 +31,8 @@ export default function LoginConfigTotp(props: PageProps<Extract<KcContext, { pa
|
|
30
31
|
<p>{msg("loginTotpStep1")}</p>
|
31
32
|
|
32
33
|
<ul id="kc-totp-supported-apps">
|
33
|
-
{totp.
|
34
|
-
<li>{app}</li>
|
34
|
+
{totp.supportedApplications.map(app => (
|
35
|
+
<li>{msgStr(app as MessageKey, app)}</li>
|
35
36
|
))}
|
36
37
|
</ul>
|
37
38
|
</li>
|
@@ -169,7 +170,7 @@ export default function LoginConfigTotp(props: PageProps<Extract<KcContext, { pa
|
|
169
170
|
name="cancel-aia"
|
170
171
|
value="true"
|
171
172
|
>
|
172
|
-
|
173
|
+
{msg("doCancel")}
|
173
174
|
</button>
|
174
175
|
</>
|
175
176
|
) : (
|
package/bin/tools/cliOptions.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getCliOptions = void 0;
|
7
|
-
var minimist_1 = __importDefault(require("minimist"));
|
8
|
-
var getCliOptions = function (processArgv) {
|
9
|
-
var argv = (0, minimist_1.default)(processArgv);
|
10
|
-
return {
|
11
|
-
isSilent: typeof argv["silent"] === "boolean" ? argv["silent"] : false,
|
12
|
-
hasExternalAssets: typeof argv["external-assets"] === "boolean" ? argv["external-assets"] : false
|
13
|
-
};
|
14
|
-
};
|
15
|
-
exports.getCliOptions = getCliOptions;
|
16
|
-
//# sourceMappingURL=cliOptions.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"cliOptions.js","sourceRoot":"","sources":["../../src/bin/tools/cliOptions.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAiC;AAO1B,IAAM,aAAa,GAAG,UAAC,WAAqB;IAC/C,IAAM,IAAI,GAAG,IAAA,kBAAS,EAAC,WAAW,CAAC,CAAC;IAEpC,OAAO;QACH,QAAQ,EAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK;QACtE,iBAAiB,EAAE,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK;KACpG,CAAC;AACN,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB"}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import parseArgv from "minimist";
|
2
|
-
|
3
|
-
export type CliOptions = {
|
4
|
-
isSilent: boolean;
|
5
|
-
hasExternalAssets: boolean;
|
6
|
-
};
|
7
|
-
|
8
|
-
export const getCliOptions = (processArgv: string[]): CliOptions => {
|
9
|
-
const argv = parseArgv(processArgv);
|
10
|
-
|
11
|
-
return {
|
12
|
-
isSilent: typeof argv["silent"] === "boolean" ? argv["silent"] : false,
|
13
|
-
hasExternalAssets: typeof argv["external-assets"] === "boolean" ? argv["external-assets"] : false
|
14
|
-
};
|
15
|
-
};
|