keycloakify 4.5.2-beta.0 → 4.5.4

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 (36) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +5 -6
  3. package/bin/KeycloakVersion.d.ts +1 -1
  4. package/bin/KeycloakVersion.js +1 -1
  5. package/bin/KeycloakVersion.js.map +1 -1
  6. package/bin/build-keycloak-theme/build-keycloak-theme.js +3 -2
  7. package/bin/build-keycloak-theme/build-keycloak-theme.js.map +1 -1
  8. package/bin/build-keycloak-theme/generateDebugFiles/generateDebugFiles.d.ts +2 -1
  9. package/bin/build-keycloak-theme/generateDebugFiles/generateDebugFiles.js.map +1 -1
  10. package/bin/build-keycloak-theme/generateDebugFiles/standalone-ha_16.1.0.xml +652 -0
  11. package/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +8 -9
  12. package/bin/build-keycloak-theme/generateKeycloakThemeResources.d.ts +2 -1
  13. package/bin/build-keycloak-theme/generateKeycloakThemeResources.js +5 -5
  14. package/bin/build-keycloak-theme/generateKeycloakThemeResources.js.map +1 -1
  15. package/bin/download-builtin-keycloak-theme.js +1 -1
  16. package/bin/tools/getProjectRoot.js +1 -1
  17. package/bin/tools/getProjectRoot.js.map +1 -1
  18. package/lib/getKcContext/getKcContext.js +9 -1
  19. package/lib/getKcContext/getKcContext.js.map +1 -1
  20. package/lib/getKcContext/kcContextMocks/urlResourcesPath.js +1 -1
  21. package/lib/getKcContext/kcContextMocks/urlResourcesPath.js.map +1 -1
  22. package/lib/tools/pathBasename.d.ts +1 -0
  23. package/lib/tools/pathBasename.js +8 -0
  24. package/lib/tools/pathBasename.js.map +1 -0
  25. package/package.json +10 -5
  26. package/src/bin/KeycloakVersion.ts +1 -1
  27. package/src/bin/build-keycloak-theme/build-keycloak-theme.ts +3 -2
  28. package/src/bin/build-keycloak-theme/generateDebugFiles/generateDebugFiles.ts +2 -1
  29. package/src/bin/build-keycloak-theme/generateDebugFiles/standalone-ha_16.1.0.xml +652 -0
  30. package/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +8 -9
  31. package/src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts +10 -7
  32. package/src/bin/download-builtin-keycloak-theme.ts +1 -1
  33. package/src/bin/tools/getProjectRoot.ts +1 -1
  34. package/src/lib/getKcContext/getKcContext.ts +12 -1
  35. package/src/lib/getKcContext/kcContextMocks/urlResourcesPath.ts +1 -1
  36. package/src/lib/tools/pathBasename.ts +3 -0
@@ -126,6 +126,14 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
126
126
  key == "loginAction" &&
127
127
  are_same_path(path, ["url"]) &&
128
128
  pageId == "saml-post-form.ftl"
129
+ ) || (
130
+ ["contextData", "idpConfig", "idp", "authenticationSession"]?seq_contains(key) &&
131
+ are_same_path(path, ["brokerContext"]) &&
132
+ ["login-idp-link-confirm.ftl", "login-idp-link-email.ftl" ]?seq_contains(pageId)
133
+ ) || (
134
+ key == "identityProviderBrokerCtx" &&
135
+ are_same_path(path, []) &&
136
+ ["login-idp-link-confirm.ftl", "login-idp-link-email.ftl" ]?seq_contains(pageId)
129
137
  )
130
138
  >
131
139
  <#local out_seq += ["/*If you need '" + key + "' on " + pageId + ", please submit an issue to the Keycloakify repo*/"]>
@@ -144,15 +152,6 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
144
152
 
145
153
  </#if>
146
154
 
147
- <#if
148
- ["contextData", "idpConfig", "idp", "authenticationSession"]?seq_contains(key) &&
149
- are_same_path(path, ["brokerContext"])
150
- >
151
- <#continue>
152
- </#if>
153
-
154
- <#if key == "identityProviderBrokerCtx" && are_same_path(path, []) ><#continue></#if>
155
-
156
155
  <#attempt>
157
156
  <#if !object[key]??>
158
157
  <#continue>
@@ -1,12 +1,13 @@
1
1
  import { transformCodebase } from "../tools/transformCodebase";
2
2
  import * as fs from "fs";
3
- import { join as pathJoin } from "path";
3
+ import { join as pathJoin, basename as pathBasename } from "path";
4
4
  import { replaceImportsInCssCode, replaceImportsFromStaticInJsCode } from "./replaceImportFromStatic";
5
5
  import { generateFtlFilesCodeFactory, pageIds } from "./generateFtl";
6
6
  import { downloadBuiltinKeycloakTheme } from "../download-builtin-keycloak-theme";
7
7
  import * as child_process from "child_process";
8
8
  import { resourcesCommonPath, resourcesPath, subDirOfPublicDirBasename } from "../../lib/getKcContext/kcContextMocks/urlResourcesPath";
9
9
  import { isInside } from "../tools/isInside";
10
+ import type { KeycloakVersion } from "../KeycloakVersion";
10
11
 
11
12
  export function generateKeycloakThemeResources(params: {
12
13
  themeName: string;
@@ -17,7 +18,7 @@ export function generateKeycloakThemeResources(params: {
17
18
  urlOrigin: undefined | string;
18
19
  extraPagesId: string[];
19
20
  extraThemeProperties: string[];
20
- keycloakVersion: "11.0.3" | "15.0.2";
21
+ keycloakVersion: KeycloakVersion;
21
22
  }) {
22
23
  const {
23
24
  themeName,
@@ -112,20 +113,22 @@ export function generateKeycloakThemeResources(params: {
112
113
  const reactAppPublicDirPath = pathJoin(reactAppBuildDirPath, "..", "public");
113
114
 
114
115
  transformCodebase({
115
- "srcDirPath": themeResourcesDirPath,
116
- "destDirPath": pathJoin(reactAppPublicDirPath, resourcesPath),
116
+ "srcDirPath": pathJoin(tmpDirPath, "keycloak", "common", "resources"),
117
+ "destDirPath": pathJoin(themeResourcesDirPath, pathBasename(resourcesCommonPath)),
117
118
  });
118
119
 
119
120
  transformCodebase({
120
- "srcDirPath": pathJoin(tmpDirPath, "keycloak", "common", "resources"),
121
- "destDirPath": pathJoin(reactAppPublicDirPath, resourcesCommonPath),
121
+ "srcDirPath": themeResourcesDirPath,
122
+ "destDirPath": pathJoin(reactAppPublicDirPath, resourcesPath),
122
123
  });
123
124
 
124
125
  const keycloakResourcesWithinPublicDirPath = pathJoin(reactAppPublicDirPath, subDirOfPublicDirBasename);
125
126
 
126
127
  fs.writeFileSync(
127
128
  pathJoin(keycloakResourcesWithinPublicDirPath, "README.txt"),
128
- Buffer.from(["This is just a test folder that helps develop", "the login and register page without having to yarn build"].join(" ")),
129
+ Buffer.from(
130
+ ["This is just a test folder that helps develop", "the login and register page without having to run a Keycloak container"].join(" "),
131
+ ),
129
132
  );
130
133
 
131
134
  fs.writeFileSync(pathJoin(keycloakResourcesWithinPublicDirPath, ".gitignore"), Buffer.from("*", "utf8"));
@@ -22,7 +22,7 @@ if (require.main === module) {
22
22
  const keycloakVersion = process.argv[2] as KeycloakVersion | undefined;
23
23
 
24
24
  if (keycloakVersion === undefined) {
25
- return "15.0.2";
25
+ return "11.0.3";
26
26
  }
27
27
 
28
28
  return keycloakVersion;
@@ -2,7 +2,7 @@ import * as fs from "fs";
2
2
  import * as path from "path";
3
3
 
4
4
  function getProjectRootRec(dirPath: string): string {
5
- if (fs.existsSync(path.join(dirPath, "package.json"))) {
5
+ if (fs.existsSync(path.join(dirPath, "tsconfig.json"))) {
6
6
  return dirPath;
7
7
  }
8
8
  return getProjectRootRec(path.join(dirPath, ".."));
@@ -7,6 +7,9 @@ import { exclude } from "tsafe/exclude";
7
7
  import { assert } from "tsafe/assert";
8
8
  import type { ExtendsKcContextBase } from "./getKcContextFromWindow";
9
9
  import { getKcContextFromWindow } from "./getKcContextFromWindow";
10
+ import { pathJoin } from "../tools/pathJoin";
11
+ import { pathBasename } from "../tools/pathBasename";
12
+ import { resourcesCommonPath } from "./kcContextMocks/urlResourcesPath";
10
13
 
11
14
  export function getKcContext<KcContextExtended extends { pageId: string } = never>(params?: {
12
15
  mockPageId?: ExtendsKcContextBase<KcContextExtended>["pageId"];
@@ -93,5 +96,13 @@ export function getKcContext<KcContextExtended extends { pageId: string } = neve
93
96
  return { kcContext };
94
97
  }
95
98
 
96
- return { "kcContext": getKcContextFromWindow<KcContextExtended>() };
99
+ const kcContext = getKcContextFromWindow<KcContextExtended>();
100
+
101
+ if (kcContext !== undefined) {
102
+ const { url } = kcContext;
103
+
104
+ url.resourcesCommonPath = pathJoin(url.resourcesPath, pathBasename(resourcesCommonPath));
105
+ }
106
+
107
+ return { kcContext };
97
108
  }
@@ -2,4 +2,4 @@ import { pathJoin } from "../../tools/pathJoin";
2
2
 
3
3
  export const subDirOfPublicDirBasename = "keycloak_static";
4
4
  export const resourcesPath = pathJoin(subDirOfPublicDirBasename, "resources");
5
- export const resourcesCommonPath = pathJoin(subDirOfPublicDirBasename, "resources_common");
5
+ export const resourcesCommonPath = pathJoin(resourcesPath, "resources_common");
@@ -0,0 +1,3 @@
1
+ export function pathBasename(path: string) {
2
+ return path.split("/").reverse()[0];
3
+ }