keycloakify 7.16.0-rc.1 → 8.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 (143) hide show
  1. package/README.md +3 -3
  2. package/account/Template.js +5 -3
  3. package/account/Template.js.map +1 -1
  4. package/account/kcContext/kcContextMocks.js +0 -4
  5. package/account/kcContext/kcContextMocks.js.map +1 -1
  6. package/bin/copy-keycloak-resources-to-public.js +3 -2
  7. package/bin/copy-keycloak-resources-to-public.js.map +1 -1
  8. package/bin/download-builtin-keycloak-theme.d.ts +1 -1
  9. package/bin/download-builtin-keycloak-theme.js +84 -11
  10. package/bin/download-builtin-keycloak-theme.js.map +1 -1
  11. package/bin/initialize-email-theme.js +6 -5
  12. package/bin/initialize-email-theme.js.map +1 -1
  13. package/bin/keycloakify/BuildOptions.d.ts +18 -36
  14. package/bin/keycloakify/BuildOptions.js +71 -145
  15. package/bin/keycloakify/BuildOptions.js.map +1 -1
  16. package/bin/keycloakify/generateFtl/generateFtl.d.ts +5 -25
  17. package/bin/keycloakify/generateFtl/generateFtl.js +7 -11
  18. package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
  19. package/bin/keycloakify/{generateJavaStackFiles/generateJavaStackFiles.d.ts → generateJavaStackFiles.d.ts} +3 -4
  20. package/bin/keycloakify/generateJavaStackFiles.js +103 -0
  21. package/bin/keycloakify/generateJavaStackFiles.js.map +1 -0
  22. package/bin/keycloakify/generateStartKeycloakTestingContainer.js +1 -5
  23. package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +1 -1
  24. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.d.ts +5 -1
  25. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js +24 -6
  26. package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +1 -1
  27. package/bin/keycloakify/generateTheme/generateTheme.d.ts +8 -28
  28. package/bin/keycloakify/generateTheme/generateTheme.js +22 -33
  29. package/bin/keycloakify/generateTheme/generateTheme.js.map +1 -1
  30. package/bin/keycloakify/generateTheme/readFieldNameUsage.js +1 -2
  31. package/bin/keycloakify/generateTheme/readFieldNameUsage.js.map +1 -1
  32. package/bin/keycloakify/generateTheme/readStaticResourcesUsage.d.ts +17 -0
  33. package/bin/keycloakify/generateTheme/readStaticResourcesUsage.js +172 -0
  34. package/bin/keycloakify/generateTheme/readStaticResourcesUsage.js.map +1 -0
  35. package/bin/keycloakify/keycloakify.js +17 -17
  36. package/bin/keycloakify/keycloakify.js.map +1 -1
  37. package/bin/keycloakify/replacers/replaceImportsFromStaticInJsCode.d.ts +0 -11
  38. package/bin/keycloakify/replacers/replaceImportsFromStaticInJsCode.js +6 -27
  39. package/bin/keycloakify/replacers/replaceImportsFromStaticInJsCode.js.map +1 -1
  40. package/bin/keycloakify/replacers/replaceImportsInCssCode.js +1 -7
  41. package/bin/keycloakify/replacers/replaceImportsInCssCode.js.map +1 -1
  42. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.d.ts +3 -13
  43. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js +5 -12
  44. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js.map +1 -1
  45. package/bin/tools/downloadAndUnzip.d.ts +13 -2
  46. package/bin/tools/downloadAndUnzip.js +81 -15
  47. package/bin/tools/downloadAndUnzip.js.map +1 -1
  48. package/bin/tools/transformCodebase.d.ts +1 -0
  49. package/bin/tools/transformCodebase.js +6 -5
  50. package/bin/tools/transformCodebase.js.map +1 -1
  51. package/bin/tools/unzip.d.ts +2 -1
  52. package/bin/tools/unzip.js +129 -11
  53. package/bin/tools/unzip.js.map +1 -1
  54. package/lib/usePrepareTemplate.d.ts +0 -5
  55. package/lib/usePrepareTemplate.js +4 -10
  56. package/lib/usePrepareTemplate.js.map +1 -1
  57. package/login/Template.js +5 -6
  58. package/login/Template.js.map +1 -1
  59. package/login/kcContext/KcContext.d.ts +1 -1
  60. package/login/kcContext/kcContextMocks.js +1 -5
  61. package/login/kcContext/kcContextMocks.js.map +1 -1
  62. package/login/pages/Login.js +16 -20
  63. package/login/pages/Login.js.map +1 -1
  64. package/login/pages/LoginOtp.js +1 -2
  65. package/login/pages/LoginOtp.js.map +1 -1
  66. package/package.json +11 -77
  67. package/src/account/Template.tsx +5 -3
  68. package/src/account/kcContext/kcContextMocks.ts +0 -4
  69. package/src/bin/copy-keycloak-resources-to-public.ts +3 -2
  70. package/src/bin/download-builtin-keycloak-theme.ts +71 -14
  71. package/src/bin/initialize-email-theme.ts +6 -4
  72. package/src/bin/keycloakify/BuildOptions.ts +99 -192
  73. package/src/bin/keycloakify/generateFtl/generateFtl.ts +16 -45
  74. package/src/bin/keycloakify/generateJavaStackFiles.ts +84 -0
  75. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +1 -6
  76. package/src/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.ts +30 -6
  77. package/src/bin/keycloakify/generateTheme/generateTheme.ts +34 -69
  78. package/src/bin/keycloakify/generateTheme/readFieldNameUsage.ts +1 -4
  79. package/src/bin/keycloakify/generateTheme/readStaticResourcesUsage.ts +83 -0
  80. package/src/bin/keycloakify/keycloakify.ts +2 -1
  81. package/src/bin/keycloakify/replacers/replaceImportsFromStaticInJsCode.ts +9 -51
  82. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +1 -9
  83. package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +5 -29
  84. package/src/bin/tools/downloadAndUnzip.ts +99 -15
  85. package/src/bin/tools/transformCodebase.ts +7 -6
  86. package/src/bin/tools/unzip.ts +57 -8
  87. package/src/lib/usePrepareTemplate.ts +13 -24
  88. package/src/login/Template.tsx +5 -6
  89. package/src/login/kcContext/KcContext.ts +1 -1
  90. package/src/login/kcContext/kcContextMocks.ts +1 -5
  91. package/src/login/pages/Login.tsx +31 -34
  92. package/src/login/pages/LoginOtp.tsx +1 -2
  93. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountPages.java +0 -33
  94. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProvider.java +0 -76
  95. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProviderFactory.java +0 -25
  96. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountSpi.java +0 -50
  97. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProvider.java +0 -424
  98. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProviderFactory.java +0 -51
  99. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/Templates.java +0 -51
  100. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountBean.java +0 -91
  101. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountFederatedIdentityBean.java +0 -157
  102. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ApplicationsBean.java +0 -258
  103. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AuthorizationBean.java +0 -515
  104. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/FeaturesBean.java +0 -56
  105. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/LogBean.java +0 -95
  106. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/PasswordBean.java +0 -34
  107. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/RealmBean.java +0 -75
  108. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ReferrerBean.java +0 -38
  109. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/SessionsBean.java +0 -93
  110. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/TotpBean.java +0 -125
  111. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/UrlBean.java +0 -121
  112. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/AccountUrls.java +0 -115
  113. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormService.java +0 -1320
  114. package/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormServiceFactory.java +0 -64
  115. package/bin/keycloakify/generateJavaStackFiles/generateJavaStackFiles.js +0 -298
  116. package/bin/keycloakify/generateJavaStackFiles/generateJavaStackFiles.js.map +0 -1
  117. package/bin/keycloakify/generateJavaStackFiles/index.d.ts +0 -1
  118. package/bin/keycloakify/generateJavaStackFiles/index.js +0 -18
  119. package/bin/keycloakify/generateJavaStackFiles/index.js.map +0 -1
  120. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountPages.java +0 -33
  121. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProvider.java +0 -76
  122. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProviderFactory.java +0 -25
  123. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountSpi.java +0 -50
  124. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProvider.java +0 -424
  125. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProviderFactory.java +0 -51
  126. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/Templates.java +0 -51
  127. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountBean.java +0 -91
  128. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountFederatedIdentityBean.java +0 -157
  129. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ApplicationsBean.java +0 -258
  130. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AuthorizationBean.java +0 -515
  131. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/FeaturesBean.java +0 -56
  132. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/LogBean.java +0 -95
  133. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/PasswordBean.java +0 -34
  134. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/RealmBean.java +0 -75
  135. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ReferrerBean.java +0 -38
  136. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/SessionsBean.java +0 -93
  137. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/TotpBean.java +0 -125
  138. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/UrlBean.java +0 -121
  139. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/AccountUrls.java +0 -115
  140. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormService.java +0 -1320
  141. package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormServiceFactory.java +0 -64
  142. package/src/bin/keycloakify/generateJavaStackFiles/generateJavaStackFiles.ts +0 -249
  143. package/src/bin/keycloakify/generateJavaStackFiles/index.ts +0 -1
@@ -2,6 +2,7 @@ import fsp from "node:fs/promises";
2
2
  import fs from "fs";
3
3
  import path from "node:path";
4
4
  import yauzl from "yauzl";
5
+ import yazl from "yazl";
5
6
  import stream from "node:stream";
6
7
  import { promisify } from "node:util";
7
8
 
@@ -19,11 +20,16 @@ async function pathExists(path: string) {
19
20
  }
20
21
  }
21
22
 
22
- export async function unzip(file: string, targetFolder: string, unzipSubPath?: string) {
23
- // add trailing slash to unzipSubPath and targetFolder
24
- if (unzipSubPath && (!unzipSubPath.endsWith("/") || !unzipSubPath.endsWith("\\"))) {
25
- unzipSubPath += "/";
26
- }
23
+ // Handlings of non posix path is not implemented correctly
24
+ // it work by coincidence. Don't have the time to fix but it should be fixed.
25
+ export async function unzip(file: string, targetFolder: string, specificDirsToExtract?: string[]) {
26
+ specificDirsToExtract = specificDirsToExtract?.map(dirPath => {
27
+ if (!dirPath.endsWith("/") || !dirPath.endsWith("\\")) {
28
+ dirPath += "/";
29
+ }
30
+
31
+ return dirPath;
32
+ });
27
33
 
28
34
  if (!targetFolder.endsWith("/") || !targetFolder.endsWith("\\")) {
29
35
  targetFolder += "/";
@@ -42,15 +48,17 @@ export async function unzip(file: string, targetFolder: string, unzipSubPath?: s
42
48
  zipfile.readEntry();
43
49
 
44
50
  zipfile.on("entry", async entry => {
45
- if (unzipSubPath) {
51
+ if (specificDirsToExtract !== undefined) {
52
+ const dirPath = specificDirsToExtract.find(dirPath => entry.fileName.startsWith(dirPath));
53
+
46
54
  // Skip files outside of the unzipSubPath
47
- if (!entry.fileName.startsWith(unzipSubPath)) {
55
+ if (dirPath === undefined) {
48
56
  zipfile.readEntry();
49
57
  return;
50
58
  }
51
59
 
52
60
  // Remove the unzipSubPath from the file name
53
- entry.fileName = entry.fileName.substring(unzipSubPath.length);
61
+ entry.fileName = entry.fileName.substring(dirPath.length);
54
62
  }
55
63
 
56
64
  const target = path.join(targetFolder, entry.fileName);
@@ -77,6 +85,8 @@ export async function unzip(file: string, targetFolder: string, unzipSubPath?: s
77
85
  return;
78
86
  }
79
87
 
88
+ await fsp.mkdir(path.dirname(target), { "recursive": true });
89
+
80
90
  await pipeline(readStream, fs.createWriteStream(target));
81
91
 
82
92
  zipfile.readEntry();
@@ -90,3 +100,42 @@ export async function unzip(file: string, targetFolder: string, unzipSubPath?: s
90
100
  });
91
101
  });
92
102
  }
103
+
104
+ // NOTE: This code was directly copied from ChatGPT and appears to function as expected.
105
+ // However, confidence in its complete accuracy and robustness is limited.
106
+ export async function zip(sourceFolder: string, targetZip: string) {
107
+ return new Promise<void>(async (resolve, reject) => {
108
+ const zipfile = new yazl.ZipFile();
109
+ const files: string[] = [];
110
+
111
+ // Recursive function to explore directories and their subdirectories
112
+ async function exploreDir(dir: string) {
113
+ const dirContent = await fsp.readdir(dir);
114
+ for (const file of dirContent) {
115
+ const filePath = path.join(dir, file);
116
+ const stat = await fsp.stat(filePath);
117
+ if (stat.isDirectory()) {
118
+ await exploreDir(filePath);
119
+ } else if (stat.isFile()) {
120
+ files.push(filePath);
121
+ }
122
+ }
123
+ }
124
+
125
+ // Collecting all files to be zipped
126
+ await exploreDir(sourceFolder);
127
+
128
+ // Adding files to zip
129
+ for (const file of files) {
130
+ const relativePath = path.relative(sourceFolder, file);
131
+ zipfile.addFile(file, relativePath);
132
+ }
133
+
134
+ zipfile.outputStream
135
+ .pipe(fs.createWriteStream(targetZip))
136
+ .on("close", () => resolve())
137
+ .on("error", err => reject(err)); // Listen to error events
138
+
139
+ zipfile.end();
140
+ });
141
+ }
@@ -1,21 +1,15 @@
1
1
  import { useReducer, useEffect } from "react";
2
2
  import { headInsert } from "keycloakify/tools/headInsert";
3
- import { pathJoin } from "keycloakify/bin/tools/pathJoin";
4
3
  import { clsx } from "keycloakify/tools/clsx";
5
4
 
6
5
  export function usePrepareTemplate(params: {
7
6
  doFetchDefaultThemeResources: boolean;
8
- stylesCommon?: string[];
9
7
  styles?: string[];
10
8
  scripts?: string[];
11
- url: {
12
- resourcesCommonPath: string;
13
- resourcesPath: string;
14
- };
15
9
  htmlClassName: string | undefined;
16
10
  bodyClassName: string | undefined;
17
11
  }) {
18
- const { doFetchDefaultThemeResources, stylesCommon = [], styles = [], url, scripts = [], htmlClassName, bodyClassName } = params;
12
+ const { doFetchDefaultThemeResources, styles = [], scripts = [], htmlClassName, bodyClassName } = params;
19
13
 
20
14
  const [isReady, setReady] = useReducer(() => true, !doFetchDefaultThemeResources);
21
15
 
@@ -31,23 +25,18 @@ export function usePrepareTemplate(params: {
31
25
  (async () => {
32
26
  const prLoadedArray: Promise<void>[] = [];
33
27
 
34
- [
35
- ...stylesCommon.map(relativePath => pathJoin(url.resourcesCommonPath, relativePath)),
36
- ...styles.map(relativePath => pathJoin(url.resourcesPath, relativePath))
37
- ]
38
- .reverse()
39
- .forEach(href => {
40
- const { prLoaded, remove } = headInsert({
41
- "type": "css",
42
- "position": "prepend",
43
- href
44
- });
45
-
46
- removeArray.push(remove);
47
-
48
- prLoadedArray.push(prLoaded);
28
+ styles.reverse().forEach(href => {
29
+ const { prLoaded, remove } = headInsert({
30
+ "type": "css",
31
+ "position": "prepend",
32
+ href
49
33
  });
50
34
 
35
+ removeArray.push(remove);
36
+
37
+ prLoadedArray.push(prLoaded);
38
+ });
39
+
51
40
  await Promise.all(prLoadedArray);
52
41
 
53
42
  if (isUnmounted) {
@@ -57,10 +46,10 @@ export function usePrepareTemplate(params: {
57
46
  setReady();
58
47
  })();
59
48
 
60
- scripts.forEach(relativePath => {
49
+ scripts.forEach(src => {
61
50
  const { remove } = headInsert({
62
51
  "type": "javascript",
63
- "src": pathJoin(url.resourcesPath, relativePath)
52
+ src
64
53
  });
65
54
 
66
55
  removeArray.push(remove);
@@ -31,13 +31,12 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
31
31
 
32
32
  const { isReady } = usePrepareTemplate({
33
33
  "doFetchDefaultThemeResources": doUseDefaultCss,
34
- url,
35
- "stylesCommon": [
36
- "node_modules/patternfly/dist/css/patternfly.min.css",
37
- "node_modules/patternfly/dist/css/patternfly-additions.min.css",
38
- "lib/zocial/zocial.css"
34
+ "styles": [
35
+ `${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly.min.css`,
36
+ `${url.resourcesCommonPath}/node_modules/patternfly/dist/css/patternfly-additions.min.css`,
37
+ `${url.resourcesCommonPath}/lib/zocial/zocial.css`,
38
+ `${url.resourcesPath}/css/login.css`
39
39
  ],
40
- "styles": ["css/login.css"],
41
40
  "htmlClassName": getClassName("kcHtmlClass"),
42
41
  "bodyClassName": undefined
43
42
  });
@@ -145,7 +145,7 @@ export declare namespace KcContext {
145
145
  rememberMe?: string;
146
146
  password?: string;
147
147
  };
148
- usernameEditDisabled: boolean;
148
+ usernameHidden?: boolean;
149
149
  social: {
150
150
  displayInfo: boolean;
151
151
  providers?: {
@@ -234,10 +234,6 @@ export const kcContextCommonMock: KcContext.Common = {
234
234
  "clientId": "myApp"
235
235
  },
236
236
  "scripts": [],
237
- "message": {
238
- "type": "success",
239
- "summary": "This is a test message"
240
- },
241
237
  "isAppInitiatedAction": false
242
238
  };
243
239
 
@@ -264,7 +260,7 @@ export const kcContextMocks = [
264
260
  "social": {
265
261
  "displayInfo": true
266
262
  },
267
- "usernameEditDisabled": false,
263
+ "usernameHidden": false,
268
264
  "login": {},
269
265
  "registrationDisabled": false
270
266
  }),
@@ -14,7 +14,7 @@ export default function Login(props: PageProps<Extract<KcContext, { pageId: "log
14
14
  classes
15
15
  });
16
16
 
17
- const { social, realm, url, usernameEditDisabled, login, auth, registrationDisabled } = kcContext;
17
+ const { social, realm, url, usernameHidden, login, auth, registrationDisabled } = kcContext;
18
18
 
19
19
  const { msg, msgStr } = i18n;
20
20
 
@@ -66,40 +66,37 @@ export default function Login(props: PageProps<Extract<KcContext, { pageId: "log
66
66
  {realm.password && (
67
67
  <form id="kc-form-login" onSubmit={onSubmit} action={url.loginAction} method="post">
68
68
  <div className={getClassName("kcFormGroupClass")}>
69
- {(() => {
70
- const label = !realm.loginWithEmailAllowed
71
- ? "username"
72
- : realm.registrationEmailAsUsername
73
- ? "email"
74
- : "usernameOrEmail";
69
+ {!usernameHidden &&
70
+ (() => {
71
+ const label = !realm.loginWithEmailAllowed
72
+ ? "username"
73
+ : realm.registrationEmailAsUsername
74
+ ? "email"
75
+ : "usernameOrEmail";
75
76
 
76
- const autoCompleteHelper: typeof label = label === "usernameOrEmail" ? "username" : label;
77
+ const autoCompleteHelper: typeof label = label === "usernameOrEmail" ? "username" : label;
77
78
 
78
- return (
79
- <>
80
- <label htmlFor={autoCompleteHelper} className={getClassName("kcLabelClass")}>
81
- {msg(label)}
82
- </label>
83
- <input
84
- tabIndex={1}
85
- id={autoCompleteHelper}
86
- className={getClassName("kcInputClass")}
87
- //NOTE: This is used by Google Chrome auto fill so we use it to tell
88
- //the browser how to pre fill the form but before submit we put it back
89
- //to username because it is what keycloak expects.
90
- name={autoCompleteHelper}
91
- defaultValue={login.username ?? ""}
92
- type="text"
93
- {...(usernameEditDisabled
94
- ? { "disabled": true }
95
- : {
96
- "autoFocus": true,
97
- "autoComplete": "off"
98
- })}
99
- />
100
- </>
101
- );
102
- })()}
79
+ return (
80
+ <>
81
+ <label htmlFor={autoCompleteHelper} className={getClassName("kcLabelClass")}>
82
+ {msg(label)}
83
+ </label>
84
+ <input
85
+ tabIndex={1}
86
+ id={autoCompleteHelper}
87
+ className={getClassName("kcInputClass")}
88
+ //NOTE: This is used by Google Chrome auto fill so we use it to tell
89
+ //the browser how to pre fill the form but before submit we put it back
90
+ //to username because it is what keycloak expects.
91
+ name={autoCompleteHelper}
92
+ defaultValue={login.username ?? ""}
93
+ type="text"
94
+ autoFocus={true}
95
+ autoComplete="off"
96
+ />
97
+ </>
98
+ );
99
+ })()}
103
100
  </div>
104
101
  <div className={getClassName("kcFormGroupClass")}>
105
102
  <label htmlFor="password" className={getClassName("kcLabelClass")}>
@@ -116,7 +113,7 @@ export default function Login(props: PageProps<Extract<KcContext, { pageId: "log
116
113
  </div>
117
114
  <div className={clsx(getClassName("kcFormGroupClass"), getClassName("kcFormSettingClass"))}>
118
115
  <div id="kc-form-options">
119
- {realm.rememberMe && !usernameEditDisabled && (
116
+ {realm.rememberMe && !usernameHidden && (
120
117
  <div className="checkbox">
121
118
  <label>
122
119
  <input
@@ -1,6 +1,5 @@
1
1
  import { useEffect } from "react";
2
2
  import { headInsert } from "keycloakify/tools/headInsert";
3
- import { pathJoin } from "keycloakify/bin/tools/pathJoin";
4
3
  import { clsx } from "keycloakify/tools/clsx";
5
4
  import type { PageProps } from "keycloakify/login/pages/PageProps";
6
5
  import { useGetClassName } from "keycloakify/login/lib/useGetClassName";
@@ -24,7 +23,7 @@ export default function LoginOtp(props: PageProps<Extract<KcContext, { pageId: "
24
23
 
25
24
  const { prLoaded, remove } = headInsert({
26
25
  "type": "javascript",
27
- "src": pathJoin(kcContext.url.resourcesCommonPath, "node_modules/jquery/dist/jquery.min.js")
26
+ "src": `${kcContext.url.resourcesCommonPath}/node_modules/jquery/dist/jquery.min.js`
28
27
  });
29
28
 
30
29
  (async () => {
@@ -1,33 +0,0 @@
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
- }
@@ -1,76 +0,0 @@
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
- }
@@ -1,25 +0,0 @@
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> {}
@@ -1,50 +0,0 @@
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
- }