keycloakify 8.0.0-rc.3 → 9.0.0-rc.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.
Files changed (160) hide show
  1. package/README.md +14 -54
  2. package/account/kcContext/KcContext.js.map +1 -1
  3. package/account/kcContext/createGetKcContext.js +2 -6
  4. package/account/kcContext/createGetKcContext.js.map +1 -1
  5. package/account/kcContext/kcContextMocks.js +4 -3
  6. package/account/kcContext/kcContextMocks.js.map +1 -1
  7. package/bin/constants.d.ts +7 -0
  8. package/bin/constants.js +10 -0
  9. package/bin/constants.js.map +1 -0
  10. package/bin/copy-keycloak-resources-to-public.js +34 -22
  11. package/bin/copy-keycloak-resources-to-public.js.map +1 -1
  12. package/bin/download-builtin-keycloak-theme.d.ts +4 -1
  13. package/bin/download-builtin-keycloak-theme.js +8 -6
  14. package/bin/download-builtin-keycloak-theme.js.map +1 -1
  15. package/bin/eject-keycloak-page.js +5 -3
  16. package/bin/eject-keycloak-page.js.map +1 -1
  17. package/bin/getSrcDirPath.d.ts +1 -1
  18. package/bin/getSrcDirPath.js +4 -4
  19. package/bin/getSrcDirPath.js.map +1 -1
  20. package/bin/initialize-email-theme.js +9 -9
  21. package/bin/initialize-email-theme.js.map +1 -1
  22. package/bin/keycloakify/BuildOptions.d.ts +8 -6
  23. package/bin/keycloakify/BuildOptions.js +63 -71
  24. package/bin/keycloakify/BuildOptions.js.map +1 -1
  25. package/bin/keycloakify/generateFtl/generateFtl.d.ts +2 -3
  26. package/bin/keycloakify/generateFtl/generateFtl.js +3 -4
  27. package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
  28. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountPages.java +33 -0
  29. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProvider.java +76 -0
  30. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProviderFactory.java +25 -0
  31. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountSpi.java +50 -0
  32. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProvider.java +424 -0
  33. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProviderFactory.java +51 -0
  34. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/Templates.java +51 -0
  35. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountBean.java +91 -0
  36. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountFederatedIdentityBean.java +157 -0
  37. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ApplicationsBean.java +258 -0
  38. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AuthorizationBean.java +515 -0
  39. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/FeaturesBean.java +56 -0
  40. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/LogBean.java +95 -0
  41. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/PasswordBean.java +34 -0
  42. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/RealmBean.java +75 -0
  43. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ReferrerBean.java +38 -0
  44. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/SessionsBean.java +93 -0
  45. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/TotpBean.java +125 -0
  46. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/UrlBean.java +121 -0
  47. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/AccountUrls.java +115 -0
  48. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormService.java +1320 -0
  49. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormServiceFactory.java +64 -0
  50. package/bin/keycloakify/generateJavaStackFiles/bringInAccountV1.d.ts +7 -0
  51. package/bin/keycloakify/generateJavaStackFiles/bringInAccountV1.js +194 -0
  52. package/bin/keycloakify/generateJavaStackFiles/bringInAccountV1.js.map +1 -0
  53. package/bin/keycloakify/{generateJavaStackFiles.d.ts → generateJavaStackFiles/generateJavaStackFiles.d.ts} +6 -6
  54. package/bin/keycloakify/generateJavaStackFiles/generateJavaStackFiles.js +276 -0
  55. package/bin/keycloakify/generateJavaStackFiles/generateJavaStackFiles.js.map +1 -0
  56. package/bin/keycloakify/generateJavaStackFiles/index.d.ts +1 -0
  57. package/bin/keycloakify/generateJavaStackFiles/index.js +18 -0
  58. package/bin/keycloakify/generateJavaStackFiles/index.js.map +1 -0
  59. package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +1 -3
  60. package/bin/keycloakify/generateStartKeycloakTestingContainer.js +15 -6
  61. package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +1 -1
  62. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.d.ts +5 -2
  63. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js +11 -8
  64. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +1 -1
  65. package/bin/keycloakify/generateTheme/generateMessageProperties.d.ts +1 -1
  66. package/bin/keycloakify/generateTheme/generateTheme.d.ts +6 -5
  67. package/bin/keycloakify/generateTheme/generateTheme.js +59 -49
  68. package/bin/keycloakify/generateTheme/generateTheme.js.map +1 -1
  69. package/bin/keycloakify/generateTheme/readExtraPageNames.d.ts +1 -1
  70. package/bin/keycloakify/generateTheme/readExtraPageNames.js.map +1 -1
  71. package/bin/keycloakify/generateTheme/readFieldNameUsage.d.ts +1 -1
  72. package/bin/keycloakify/generateTheme/readStaticResourcesUsage.d.ts +1 -1
  73. package/bin/keycloakify/keycloakify.js +49 -90
  74. package/bin/keycloakify/keycloakify.js.map +1 -1
  75. package/bin/keycloakify/parsedPackageJson.d.ts +29 -31
  76. package/bin/keycloakify/parsedPackageJson.js +7 -8
  77. package/bin/keycloakify/parsedPackageJson.js.map +1 -1
  78. package/bin/promptKeycloakVersion.js +1 -1
  79. package/bin/promptKeycloakVersion.js.map +1 -1
  80. package/bin/tools/downloadAndUnzip.d.ts +1 -1
  81. package/bin/tools/downloadAndUnzip.js +24 -26
  82. package/bin/tools/downloadAndUnzip.js.map +1 -1
  83. package/bin/tools/getAbsoluteAndInOsFormatPath.d.ts +4 -0
  84. package/bin/tools/getAbsoluteAndInOsFormatPath.js +15 -0
  85. package/bin/tools/getAbsoluteAndInOsFormatPath.js.map +1 -0
  86. package/bin/tools/pathJoin.js +1 -1
  87. package/bin/tools/pathJoin.js.map +1 -1
  88. package/login/kcContext/KcContext.js.map +1 -1
  89. package/login/kcContext/createGetKcContext.js +2 -6
  90. package/login/kcContext/createGetKcContext.js.map +1 -1
  91. package/login/kcContext/kcContextMocks.js +5 -4
  92. package/login/kcContext/kcContextMocks.js.map +1 -1
  93. package/package.json +92 -21
  94. package/src/account/kcContext/KcContext.ts +2 -1
  95. package/src/account/kcContext/createGetKcContext.ts +2 -7
  96. package/src/account/kcContext/kcContextMocks.ts +5 -3
  97. package/src/bin/constants.ts +9 -0
  98. package/src/bin/copy-keycloak-resources-to-public.ts +20 -19
  99. package/src/bin/download-builtin-keycloak-theme.ts +14 -6
  100. package/src/bin/eject-keycloak-page.ts +5 -9
  101. package/src/bin/getSrcDirPath.ts +4 -4
  102. package/src/bin/initialize-email-theme.ts +7 -7
  103. package/src/bin/keycloakify/BuildOptions.ts +78 -59
  104. package/src/bin/keycloakify/generateFtl/generateFtl.ts +4 -7
  105. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountPages.java +33 -0
  106. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProvider.java +76 -0
  107. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProviderFactory.java +25 -0
  108. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountSpi.java +50 -0
  109. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProvider.java +424 -0
  110. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProviderFactory.java +51 -0
  111. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/Templates.java +51 -0
  112. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountBean.java +91 -0
  113. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountFederatedIdentityBean.java +157 -0
  114. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ApplicationsBean.java +258 -0
  115. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AuthorizationBean.java +515 -0
  116. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/FeaturesBean.java +56 -0
  117. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/LogBean.java +95 -0
  118. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/PasswordBean.java +34 -0
  119. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/RealmBean.java +75 -0
  120. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ReferrerBean.java +38 -0
  121. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/SessionsBean.java +93 -0
  122. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/TotpBean.java +125 -0
  123. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/UrlBean.java +121 -0
  124. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/AccountUrls.java +115 -0
  125. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormService.java +1320 -0
  126. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormServiceFactory.java +64 -0
  127. package/src/bin/keycloakify/generateJavaStackFiles/bringInAccountV1.ts +92 -0
  128. package/src/bin/keycloakify/generateJavaStackFiles/generateJavaStackFiles.ts +211 -0
  129. package/src/bin/keycloakify/generateJavaStackFiles/index.ts +1 -0
  130. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +21 -22
  131. package/src/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.ts +19 -15
  132. package/src/bin/keycloakify/generateTheme/generateMessageProperties.ts +1 -1
  133. package/src/bin/keycloakify/generateTheme/generateTheme.ts +78 -72
  134. package/src/bin/keycloakify/generateTheme/readExtraPageNames.ts +2 -1
  135. package/src/bin/keycloakify/generateTheme/readFieldNameUsage.ts +1 -1
  136. package/src/bin/keycloakify/generateTheme/readStaticResourcesUsage.ts +1 -1
  137. package/src/bin/keycloakify/keycloakify.ts +21 -44
  138. package/src/bin/keycloakify/parsedPackageJson.ts +11 -13
  139. package/src/bin/promptKeycloakVersion.ts +1 -1
  140. package/src/bin/tools/downloadAndUnzip.ts +6 -7
  141. package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +15 -0
  142. package/src/bin/tools/pathJoin.ts +1 -1
  143. package/src/login/kcContext/KcContext.ts +2 -1
  144. package/src/login/kcContext/createGetKcContext.ts +2 -7
  145. package/src/login/kcContext/kcContextMocks.ts +7 -5
  146. package/bin/keycloakify/generateJavaStackFiles.js +0 -103
  147. package/bin/keycloakify/generateJavaStackFiles.js.map +0 -1
  148. package/bin/mockTestingResourcesPath.d.ts +0 -3
  149. package/bin/mockTestingResourcesPath.js +0 -8
  150. package/bin/mockTestingResourcesPath.js.map +0 -1
  151. package/bin/tools/jar.d.ts +0 -33
  152. package/bin/tools/jar.js +0 -241
  153. package/bin/tools/jar.js.map +0 -1
  154. package/bin/tools/walk.d.ts +0 -8
  155. package/bin/tools/walk.js +0 -125
  156. package/bin/tools/walk.js.map +0 -1
  157. package/src/bin/keycloakify/generateJavaStackFiles.ts +0 -84
  158. package/src/bin/mockTestingResourcesPath.ts +0 -5
  159. package/src/bin/tools/jar.ts +0 -99
  160. package/src/bin/tools/walk.ts +0 -19
@@ -2,14 +2,7 @@
2
2
 
3
3
  import { getProjectRoot } from "./tools/getProjectRoot";
4
4
  import cliSelect from "cli-select";
5
- import {
6
- loginThemePageIds,
7
- accountThemePageIds,
8
- type LoginThemePageId,
9
- type AccountThemePageId,
10
- themeTypes,
11
- type ThemeType
12
- } from "./keycloakify/generateFtl";
5
+ import { loginThemePageIds, accountThemePageIds, type LoginThemePageId, type AccountThemePageId } from "./keycloakify/generateFtl";
13
6
  import { capitalize } from "tsafe/capitalize";
14
7
  import { readFile, writeFile } from "fs/promises";
15
8
  import { existsSync } from "fs";
@@ -17,10 +10,13 @@ import { join as pathJoin, relative as pathRelative } from "path";
17
10
  import { kebabCaseToCamelCase } from "./tools/kebabCaseToSnakeCase";
18
11
  import { assert, Equals } from "tsafe/assert";
19
12
  import { getThemeSrcDirPath } from "./getSrcDirPath";
13
+ import { themeTypes, type ThemeType } from "./constants";
20
14
 
21
15
  (async () => {
22
16
  console.log("Select a theme type");
23
17
 
18
+ const reactAppRootDirPath = process.cwd();
19
+
24
20
  const { value: themeType } = await cliSelect<ThemeType>({
25
21
  "values": [...themeTypes]
26
22
  }).catch(() => {
@@ -49,7 +45,7 @@ import { getThemeSrcDirPath } from "./getSrcDirPath";
49
45
 
50
46
  const pageBasename = capitalize(kebabCaseToCamelCase(pageId)).replace(/ftl$/, "tsx");
51
47
 
52
- const { themeSrcDirPath } = getThemeSrcDirPath({ "projectDirPath": process.cwd() });
48
+ const { themeSrcDirPath } = getThemeSrcDirPath({ reactAppRootDirPath });
53
49
 
54
50
  const targetFilePath = pathJoin(themeSrcDirPath, themeType, "pages", pageBasename);
55
51
 
@@ -2,15 +2,15 @@ import * as fs from "fs";
2
2
  import { exclude } from "tsafe";
3
3
  import { crawl } from "./tools/crawl";
4
4
  import { join as pathJoin } from "path";
5
- import { themeTypes } from "./keycloakify/generateFtl";
5
+ import { themeTypes } from "./constants";
6
6
 
7
7
  const themeSrcDirBasename = "keycloak-theme";
8
8
 
9
9
  /** Can't catch error, if the directory isn't found, this function will just exit the process with an error message. */
10
- export function getThemeSrcDirPath(params: { projectDirPath: string }) {
11
- const { projectDirPath } = params;
10
+ export function getThemeSrcDirPath(params: { reactAppRootDirPath: string }) {
11
+ const { reactAppRootDirPath } = params;
12
12
 
13
- const srcDirPath = pathJoin(projectDirPath, "src");
13
+ const srcDirPath = pathJoin(reactAppRootDirPath, "src");
14
14
 
15
15
  const themeSrcDirPath: string | undefined = crawl({ "dirPath": srcDirPath, "returnedPathsType": "relative to dirPath" })
16
16
  .map(fileRelativePath => {
@@ -10,17 +10,17 @@ import { getLogger } from "./tools/logger";
10
10
  import { getThemeSrcDirPath } from "./getSrcDirPath";
11
11
 
12
12
  export async function main() {
13
- const projectDirPath = process.cwd();
13
+ const reactAppRootDirPath = process.cwd();
14
14
 
15
- const { isSilent } = readBuildOptions({
16
- projectDirPath,
15
+ const buildOptions = readBuildOptions({
16
+ reactAppRootDirPath,
17
17
  "processArgv": process.argv.slice(2)
18
18
  });
19
19
 
20
- const logger = getLogger({ isSilent });
20
+ const logger = getLogger({ "isSilent": buildOptions.isSilent });
21
21
 
22
22
  const { themeSrcDirPath } = getThemeSrcDirPath({
23
- projectDirPath
23
+ reactAppRootDirPath
24
24
  });
25
25
 
26
26
  const emailThemeSrcDirPath = pathJoin(themeSrcDirPath, "email");
@@ -36,9 +36,9 @@ export async function main() {
36
36
  const builtinKeycloakThemeTmpDirPath = pathJoin(emailThemeSrcDirPath, "..", "tmp_xIdP3_builtin_keycloak_theme");
37
37
 
38
38
  await downloadBuiltinKeycloakTheme({
39
- projectDirPath,
40
39
  keycloakVersion,
41
- "destDirPath": builtinKeycloakThemeTmpDirPath
40
+ "destDirPath": builtinKeycloakThemeTmpDirPath,
41
+ buildOptions
42
42
  });
43
43
 
44
44
  transformCodebase({
@@ -1,34 +1,34 @@
1
- import { assert } from "tsafe/assert";
2
- import { id } from "tsafe/id";
3
1
  import { parse as urlParse } from "url";
4
- import { typeGuard } from "tsafe/typeGuard";
5
- import { symToStr } from "tsafe/symToStr";
6
- import { bundlers, getParsedPackageJson, type Bundler } from "./parsedPackageJson";
7
- import { join as pathJoin, sep as pathSep } from "path";
2
+ import { getParsedPackageJson } from "./parsedPackageJson";
3
+ import { join as pathJoin } from "path";
8
4
  import parseArgv from "minimist";
5
+ import { getAbsoluteAndInOsFormatPath } from "../tools/getAbsoluteAndInOsFormatPath";
9
6
 
10
7
  /** Consolidated build option gathered form CLI arguments and config in package.json */
11
8
  export type BuildOptions = {
12
9
  isSilent: boolean;
13
10
  themeVersion: string;
14
- themeName: string;
15
- extraThemeNames: string[];
11
+ themeNames: string[];
16
12
  extraThemeProperties: string[] | undefined;
17
13
  groupId: string;
18
14
  artifactId: string;
19
- bundler: Bundler;
20
- keycloakVersionDefaultAssets: string;
15
+ doCreateJar: boolean;
16
+ loginThemeResourcesFromKeycloakVersion: string;
17
+ reactAppRootDirPath: string;
21
18
  /** Directory of your built react project. Defaults to {cwd}/build */
22
19
  reactAppBuildDirPath: string;
23
20
  /** Directory that keycloakify outputs to. Defaults to {cwd}/build_keycloak */
24
21
  keycloakifyBuildDirPath: string;
22
+ publicDirPath: string;
23
+ cacheDirPath: string;
25
24
  /** If your app is hosted under a subpath, it's the case in CRA if you have "homepage": "https://example.com/my-app" in your package.json
26
25
  * In this case the urlPathname will be "/my-app/" */
27
26
  urlPathname: string | undefined;
27
+ doBuildRetrocompatAccountTheme: boolean;
28
28
  };
29
29
 
30
- export function readBuildOptions(params: { projectDirPath: string; processArgv: string[] }): BuildOptions {
31
- const { projectDirPath, processArgv } = params;
30
+ export function readBuildOptions(params: { reactAppRootDirPath: string; processArgv: string[] }): BuildOptions {
31
+ const { reactAppRootDirPath, processArgv } = params;
32
32
 
33
33
  const { isSilentCliParamProvided } = (() => {
34
34
  const argv = parseArgv(processArgv);
@@ -38,35 +38,36 @@ export function readBuildOptions(params: { projectDirPath: string; processArgv:
38
38
  };
39
39
  })();
40
40
 
41
- const parsedPackageJson = getParsedPackageJson({ projectDirPath });
41
+ const parsedPackageJson = getParsedPackageJson({ reactAppRootDirPath });
42
42
 
43
43
  const { name, keycloakify = {}, version, homepage } = parsedPackageJson;
44
44
 
45
- const { extraThemeProperties, groupId, artifactId, bundler, keycloakVersionDefaultAssets, extraThemeNames = [] } = keycloakify ?? {};
45
+ const { extraThemeProperties, groupId, artifactId, doCreateJar, loginThemeResourcesFromKeycloakVersion } = keycloakify ?? {};
46
46
 
47
- const themeName =
48
- keycloakify.themeName ??
49
- name
50
- .replace(/^@(.*)/, "$1")
51
- .split("/")
52
- .join("-");
47
+ const themeNames = (() => {
48
+ if (keycloakify.themeName === undefined) {
49
+ return [
50
+ name
51
+ .replace(/^@(.*)/, "$1")
52
+ .split("/")
53
+ .join("-")
54
+ ];
55
+ }
53
56
 
54
- return {
55
- themeName,
56
- extraThemeNames,
57
- "bundler": (() => {
58
- const { KEYCLOAKIFY_BUNDLER } = process.env;
59
-
60
- assert(
61
- typeGuard<Bundler | undefined>(KEYCLOAKIFY_BUNDLER, [undefined, ...id<readonly string[]>(bundlers)].includes(KEYCLOAKIFY_BUNDLER)),
62
- `${symToStr({ KEYCLOAKIFY_BUNDLER })} should be one of ${bundlers.join(", ")}`
63
- );
57
+ if (typeof keycloakify.themeName === "string") {
58
+ return [keycloakify.themeName];
59
+ }
64
60
 
65
- return KEYCLOAKIFY_BUNDLER ?? bundler ?? "keycloakify";
66
- })(),
67
- "artifactId": process.env.KEYCLOAKIFY_ARTIFACT_ID ?? artifactId ?? `${themeName}-keycloak-theme`,
61
+ return keycloakify.themeName;
62
+ })();
63
+
64
+ return {
65
+ reactAppRootDirPath,
66
+ themeNames,
67
+ "doCreateJar": doCreateJar ?? true,
68
+ "artifactId": process.env.KEYCLOAKIFY_ARTIFACT_ID ?? artifactId ?? `${themeNames[0]}-keycloak-theme`,
68
69
  "groupId": (() => {
69
- const fallbackGroupId = `${themeName}.keycloak`;
70
+ const fallbackGroupId = `${themeNames[0]}.keycloak`;
70
71
 
71
72
  return (
72
73
  process.env.KEYCLOAKIFY_GROUP_ID ??
@@ -83,41 +84,58 @@ export function readBuildOptions(params: { projectDirPath: string; processArgv:
83
84
  "themeVersion": process.env.KEYCLOAKIFY_THEME_VERSION ?? process.env.KEYCLOAKIFY_VERSION ?? version ?? "0.0.0",
84
85
  extraThemeProperties,
85
86
  "isSilent": isSilentCliParamProvided,
86
- "keycloakVersionDefaultAssets": keycloakVersionDefaultAssets ?? "11.0.3",
87
- "reactAppBuildDirPath": (() => {
88
- let { reactAppBuildDirPath = undefined } = parsedPackageJson.keycloakify ?? {};
89
-
90
- if (reactAppBuildDirPath === undefined) {
91
- return pathJoin(projectDirPath, "build");
87
+ "loginThemeResourcesFromKeycloakVersion": loginThemeResourcesFromKeycloakVersion ?? "11.0.3",
88
+ "publicDirPath": (() => {
89
+ let { PUBLIC_DIR_PATH } = process.env;
90
+
91
+ if (PUBLIC_DIR_PATH !== undefined) {
92
+ return getAbsoluteAndInOsFormatPath({
93
+ "pathIsh": PUBLIC_DIR_PATH,
94
+ "cwd": reactAppRootDirPath
95
+ });
92
96
  }
93
97
 
94
- if (pathSep === "\\") {
95
- reactAppBuildDirPath = reactAppBuildDirPath.replace(/\//g, pathSep);
96
- }
98
+ return pathJoin(reactAppRootDirPath, "public");
99
+ })(),
100
+ "reactAppBuildDirPath": (() => {
101
+ const { reactAppBuildDirPath } = parsedPackageJson.keycloakify ?? {};
97
102
 
98
- if (reactAppBuildDirPath.startsWith(`.${pathSep}`)) {
99
- return pathJoin(projectDirPath, reactAppBuildDirPath);
103
+ if (reactAppBuildDirPath !== undefined) {
104
+ return getAbsoluteAndInOsFormatPath({
105
+ "pathIsh": reactAppBuildDirPath,
106
+ "cwd": reactAppRootDirPath
107
+ });
100
108
  }
101
109
 
102
- return reactAppBuildDirPath;
110
+ return pathJoin(reactAppRootDirPath, "build");
103
111
  })(),
104
112
  "keycloakifyBuildDirPath": (() => {
105
- let { keycloakifyBuildDirPath = undefined } = parsedPackageJson.keycloakify ?? {};
106
-
107
- if (keycloakifyBuildDirPath === undefined) {
108
- return pathJoin(projectDirPath, "build_keycloak");
109
- }
110
-
111
- if (pathSep === "\\") {
112
- keycloakifyBuildDirPath = keycloakifyBuildDirPath.replace(/\//g, pathSep);
113
- }
113
+ const { keycloakifyBuildDirPath } = parsedPackageJson.keycloakify ?? {};
114
114
 
115
- if (keycloakifyBuildDirPath.startsWith(`.${pathSep}`)) {
116
- return pathJoin(projectDirPath, keycloakifyBuildDirPath);
115
+ if (keycloakifyBuildDirPath !== undefined) {
116
+ return getAbsoluteAndInOsFormatPath({
117
+ "pathIsh": keycloakifyBuildDirPath,
118
+ "cwd": reactAppRootDirPath
119
+ });
117
120
  }
118
121
 
119
- return keycloakifyBuildDirPath;
122
+ return pathJoin(reactAppRootDirPath, "build_keycloak");
120
123
  })(),
124
+ "cacheDirPath": pathJoin(
125
+ (() => {
126
+ let { XDG_CACHE_HOME } = process.env;
127
+
128
+ if (XDG_CACHE_HOME !== undefined) {
129
+ return getAbsoluteAndInOsFormatPath({
130
+ "pathIsh": XDG_CACHE_HOME,
131
+ "cwd": reactAppRootDirPath
132
+ });
133
+ }
134
+
135
+ return pathJoin(reactAppRootDirPath, "node_modules", ".cache");
136
+ })(),
137
+ "keycloakify"
138
+ ),
121
139
  "urlPathname": (() => {
122
140
  const { homepage } = parsedPackageJson;
123
141
 
@@ -133,6 +151,7 @@ export function readBuildOptions(params: { projectDirPath: string; processArgv:
133
151
 
134
152
  const out = url.pathname.replace(/([^/])$/, "$1/");
135
153
  return out === "/" ? undefined : out;
136
- })()
154
+ })(),
155
+ "doBuildRetrocompatAccountTheme": parsedPackageJson.keycloakify?.doBuildRetrocompatAccountTheme ?? true
137
156
  };
138
157
  }
@@ -8,13 +8,9 @@ import { objectKeys } from "tsafe/objectKeys";
8
8
  import { ftlValuesGlobalName } from "../ftlValuesGlobalName";
9
9
  import type { BuildOptions } from "../BuildOptions";
10
10
  import { assert } from "tsafe/assert";
11
-
12
- export const themeTypes = ["login", "account"] as const;
13
-
14
- export type ThemeType = (typeof themeTypes)[number];
11
+ import type { ThemeType } from "../../constants";
15
12
 
16
13
  export type BuildOptionsLike = {
17
- themeName: string;
18
14
  themeVersion: string;
19
15
  urlPathname: string | undefined;
20
16
  };
@@ -22,6 +18,7 @@ export type BuildOptionsLike = {
22
18
  assert<BuildOptions extends BuildOptionsLike ? true : false>();
23
19
 
24
20
  export function generateFtlFilesCodeFactory(params: {
21
+ themeName: string;
25
22
  indexHtmlCode: string;
26
23
  //NOTE: Expected to be an empty object if external assets mode is enabled.
27
24
  cssGlobalsToDefine: Record<string, string>;
@@ -30,7 +27,7 @@ export function generateFtlFilesCodeFactory(params: {
30
27
  themeType: ThemeType;
31
28
  fieldNames: string[];
32
29
  }) {
33
- const { cssGlobalsToDefine, indexHtmlCode, buildOptions, keycloakifyVersion, themeType, fieldNames } = params;
30
+ const { themeName, cssGlobalsToDefine, indexHtmlCode, buildOptions, keycloakifyVersion, themeType, fieldNames } = params;
34
31
 
35
32
  const $ = cheerio.load(indexHtmlCode);
36
33
 
@@ -104,7 +101,7 @@ export function generateFtlFilesCodeFactory(params: {
104
101
  .replace("KEYCLOAKIFY_VERSION_xEdKd3xEdr", keycloakifyVersion)
105
102
  .replace("KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx", buildOptions.themeVersion)
106
103
  .replace("KEYCLOAKIFY_THEME_TYPE_dExKd3xEdr", themeType)
107
- .replace("KEYCLOAKIFY_THEME_NAME_cXxKd3xEer", buildOptions.themeName),
104
+ .replace("KEYCLOAKIFY_THEME_NAME_cXxKd3xEer", themeName),
108
105
  "<!-- xIdLqMeOedErIdLsPdNdI9dSlxI -->": [
109
106
  "<#if scripts??>",
110
107
  " <#list scripts as script>",
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
3
+ * and other contributors as indicated by the @author tags.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ package org.keycloak.forms.account;
19
+
20
+ /**
21
+ * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
22
+ */
23
+ public enum AccountPages {
24
+ ACCOUNT,
25
+ PASSWORD,
26
+ TOTP,
27
+ FEDERATED_IDENTITY,
28
+ LOG,
29
+ SESSIONS,
30
+ APPLICATIONS,
31
+ RESOURCES,
32
+ RESOURCE_DETAIL;
33
+ }
@@ -0,0 +1,76 @@
1
+ /*
2
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
3
+ * and other contributors as indicated by the @author tags.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ package org.keycloak.forms.account;
19
+
20
+ import jakarta.ws.rs.core.HttpHeaders;
21
+ import jakarta.ws.rs.core.MultivaluedMap;
22
+ import jakarta.ws.rs.core.Response;
23
+ import jakarta.ws.rs.core.UriInfo;
24
+ import java.util.List;
25
+ import org.keycloak.events.Event;
26
+ import org.keycloak.models.RealmModel;
27
+ import org.keycloak.models.UserModel;
28
+ import org.keycloak.models.UserSessionModel;
29
+ import org.keycloak.models.utils.FormMessage;
30
+ import org.keycloak.provider.Provider;
31
+
32
+ /**
33
+ * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
34
+ */
35
+ public interface AccountProvider extends Provider {
36
+
37
+ AccountProvider setUriInfo(UriInfo uriInfo);
38
+
39
+ AccountProvider setHttpHeaders(HttpHeaders httpHeaders);
40
+
41
+ Response createResponse(AccountPages page);
42
+
43
+ AccountProvider setError(Response.Status status, String message, Object... parameters);
44
+
45
+ AccountProvider setErrors(Response.Status status, List<FormMessage> messages);
46
+
47
+ AccountProvider setSuccess(String message, Object... parameters);
48
+
49
+ AccountProvider setWarning(String message, Object... parameters);
50
+
51
+ AccountProvider setUser(UserModel user);
52
+
53
+ AccountProvider setProfileFormData(MultivaluedMap<String, String> formData);
54
+
55
+ AccountProvider setRealm(RealmModel realm);
56
+
57
+ AccountProvider setReferrer(String[] referrer);
58
+
59
+ AccountProvider setEvents(List<Event> events);
60
+
61
+ AccountProvider setSessions(List<UserSessionModel> sessions);
62
+
63
+ AccountProvider setPasswordSet(boolean passwordSet);
64
+
65
+ AccountProvider setStateChecker(String stateChecker);
66
+
67
+ AccountProvider setIdTokenHint(String idTokenHint);
68
+
69
+ AccountProvider setFeatures(
70
+ boolean social,
71
+ boolean events,
72
+ boolean passwordUpdateSupported,
73
+ boolean authorizationSupported);
74
+
75
+ AccountProvider setAttribute(String key, String value);
76
+ }
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
3
+ * and other contributors as indicated by the @author tags.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ package org.keycloak.forms.account;
19
+
20
+ import org.keycloak.provider.ProviderFactory;
21
+
22
+ /**
23
+ * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
24
+ */
25
+ public interface AccountProviderFactory extends ProviderFactory<AccountProvider> {}
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
3
+ * and other contributors as indicated by the @author tags.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ package org.keycloak.forms.account;
19
+
20
+ import com.google.auto.service.AutoService;
21
+ import org.keycloak.provider.Provider;
22
+ import org.keycloak.provider.ProviderFactory;
23
+ import org.keycloak.provider.Spi;
24
+
25
+ /**
26
+ * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
27
+ */
28
+ @AutoService(Spi.class)
29
+ public class AccountSpi implements Spi {
30
+
31
+ @Override
32
+ public boolean isInternal() {
33
+ return true;
34
+ }
35
+
36
+ @Override
37
+ public String getName() {
38
+ return "account";
39
+ }
40
+
41
+ @Override
42
+ public Class<? extends Provider> getProviderClass() {
43
+ return AccountProvider.class;
44
+ }
45
+
46
+ @Override
47
+ public Class<? extends ProviderFactory> getProviderFactoryClass() {
48
+ return AccountProviderFactory.class;
49
+ }
50
+ }