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.
- package/README.md +14 -54
- package/account/kcContext/KcContext.js.map +1 -1
- package/account/kcContext/createGetKcContext.js +2 -6
- package/account/kcContext/createGetKcContext.js.map +1 -1
- package/account/kcContext/kcContextMocks.js +4 -3
- package/account/kcContext/kcContextMocks.js.map +1 -1
- package/bin/constants.d.ts +7 -0
- package/bin/constants.js +10 -0
- package/bin/constants.js.map +1 -0
- package/bin/copy-keycloak-resources-to-public.js +34 -22
- package/bin/copy-keycloak-resources-to-public.js.map +1 -1
- package/bin/download-builtin-keycloak-theme.d.ts +4 -1
- package/bin/download-builtin-keycloak-theme.js +8 -6
- package/bin/download-builtin-keycloak-theme.js.map +1 -1
- package/bin/eject-keycloak-page.js +5 -3
- package/bin/eject-keycloak-page.js.map +1 -1
- package/bin/getSrcDirPath.d.ts +1 -1
- package/bin/getSrcDirPath.js +4 -4
- package/bin/getSrcDirPath.js.map +1 -1
- package/bin/initialize-email-theme.js +9 -9
- package/bin/initialize-email-theme.js.map +1 -1
- package/bin/keycloakify/BuildOptions.d.ts +8 -6
- package/bin/keycloakify/BuildOptions.js +63 -71
- package/bin/keycloakify/BuildOptions.js.map +1 -1
- package/bin/keycloakify/generateFtl/generateFtl.d.ts +2 -3
- package/bin/keycloakify/generateFtl/generateFtl.js +3 -4
- package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountPages.java +33 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProvider.java +76 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProviderFactory.java +25 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountSpi.java +50 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProvider.java +424 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProviderFactory.java +51 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/Templates.java +51 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountBean.java +91 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountFederatedIdentityBean.java +157 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ApplicationsBean.java +258 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AuthorizationBean.java +515 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/FeaturesBean.java +56 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/LogBean.java +95 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/PasswordBean.java +34 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/RealmBean.java +75 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ReferrerBean.java +38 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/SessionsBean.java +93 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/TotpBean.java +125 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/UrlBean.java +121 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/AccountUrls.java +115 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormService.java +1320 -0
- package/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormServiceFactory.java +64 -0
- package/bin/keycloakify/generateJavaStackFiles/bringInAccountV1.d.ts +7 -0
- package/bin/keycloakify/generateJavaStackFiles/bringInAccountV1.js +194 -0
- package/bin/keycloakify/generateJavaStackFiles/bringInAccountV1.js.map +1 -0
- package/bin/keycloakify/{generateJavaStackFiles.d.ts → generateJavaStackFiles/generateJavaStackFiles.d.ts} +6 -6
- package/bin/keycloakify/generateJavaStackFiles/generateJavaStackFiles.js +276 -0
- package/bin/keycloakify/generateJavaStackFiles/generateJavaStackFiles.js.map +1 -0
- package/bin/keycloakify/generateJavaStackFiles/index.d.ts +1 -0
- package/bin/keycloakify/generateJavaStackFiles/index.js +18 -0
- package/bin/keycloakify/generateJavaStackFiles/index.js.map +1 -0
- package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +1 -3
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js +15 -6
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +1 -1
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.d.ts +5 -2
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js +11 -8
- package/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.js.map +1 -1
- package/bin/keycloakify/generateTheme/generateMessageProperties.d.ts +1 -1
- package/bin/keycloakify/generateTheme/generateTheme.d.ts +6 -5
- package/bin/keycloakify/generateTheme/generateTheme.js +59 -49
- package/bin/keycloakify/generateTheme/generateTheme.js.map +1 -1
- package/bin/keycloakify/generateTheme/readExtraPageNames.d.ts +1 -1
- package/bin/keycloakify/generateTheme/readExtraPageNames.js.map +1 -1
- package/bin/keycloakify/generateTheme/readFieldNameUsage.d.ts +1 -1
- package/bin/keycloakify/generateTheme/readStaticResourcesUsage.d.ts +1 -1
- package/bin/keycloakify/keycloakify.js +49 -90
- package/bin/keycloakify/keycloakify.js.map +1 -1
- package/bin/keycloakify/parsedPackageJson.d.ts +29 -31
- package/bin/keycloakify/parsedPackageJson.js +7 -8
- package/bin/keycloakify/parsedPackageJson.js.map +1 -1
- package/bin/promptKeycloakVersion.js +1 -1
- package/bin/promptKeycloakVersion.js.map +1 -1
- package/bin/tools/downloadAndUnzip.d.ts +1 -1
- package/bin/tools/downloadAndUnzip.js +24 -26
- package/bin/tools/downloadAndUnzip.js.map +1 -1
- package/bin/tools/getAbsoluteAndInOsFormatPath.d.ts +4 -0
- package/bin/tools/getAbsoluteAndInOsFormatPath.js +15 -0
- package/bin/tools/getAbsoluteAndInOsFormatPath.js.map +1 -0
- package/bin/tools/pathJoin.js +1 -1
- package/bin/tools/pathJoin.js.map +1 -1
- package/login/kcContext/KcContext.js.map +1 -1
- package/login/kcContext/createGetKcContext.js +2 -6
- package/login/kcContext/createGetKcContext.js.map +1 -1
- package/login/kcContext/kcContextMocks.js +5 -4
- package/login/kcContext/kcContextMocks.js.map +1 -1
- package/package.json +92 -21
- package/src/account/kcContext/KcContext.ts +2 -1
- package/src/account/kcContext/createGetKcContext.ts +2 -7
- package/src/account/kcContext/kcContextMocks.ts +5 -3
- package/src/bin/constants.ts +9 -0
- package/src/bin/copy-keycloak-resources-to-public.ts +20 -19
- package/src/bin/download-builtin-keycloak-theme.ts +14 -6
- package/src/bin/eject-keycloak-page.ts +5 -9
- package/src/bin/getSrcDirPath.ts +4 -4
- package/src/bin/initialize-email-theme.ts +7 -7
- package/src/bin/keycloakify/BuildOptions.ts +78 -59
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +4 -7
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountPages.java +33 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProvider.java +76 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountProviderFactory.java +25 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountSpi.java +50 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProvider.java +424 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/FreeMarkerAccountProviderFactory.java +51 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/Templates.java +51 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountBean.java +91 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AccountFederatedIdentityBean.java +157 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ApplicationsBean.java +258 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/AuthorizationBean.java +515 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/FeaturesBean.java +56 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/LogBean.java +95 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/PasswordBean.java +34 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/RealmBean.java +75 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/ReferrerBean.java +38 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/SessionsBean.java +93 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/TotpBean.java +125 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/freemarker/model/UrlBean.java +121 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/AccountUrls.java +115 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormService.java +1320 -0
- package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/services/resources/account/AccountFormServiceFactory.java +64 -0
- package/src/bin/keycloakify/generateJavaStackFiles/bringInAccountV1.ts +92 -0
- package/src/bin/keycloakify/generateJavaStackFiles/generateJavaStackFiles.ts +211 -0
- package/src/bin/keycloakify/generateJavaStackFiles/index.ts +1 -0
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +21 -22
- package/src/bin/keycloakify/generateTheme/downloadKeycloakStaticResources.ts +19 -15
- package/src/bin/keycloakify/generateTheme/generateMessageProperties.ts +1 -1
- package/src/bin/keycloakify/generateTheme/generateTheme.ts +78 -72
- package/src/bin/keycloakify/generateTheme/readExtraPageNames.ts +2 -1
- package/src/bin/keycloakify/generateTheme/readFieldNameUsage.ts +1 -1
- package/src/bin/keycloakify/generateTheme/readStaticResourcesUsage.ts +1 -1
- package/src/bin/keycloakify/keycloakify.ts +21 -44
- package/src/bin/keycloakify/parsedPackageJson.ts +11 -13
- package/src/bin/promptKeycloakVersion.ts +1 -1
- package/src/bin/tools/downloadAndUnzip.ts +6 -7
- package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +15 -0
- package/src/bin/tools/pathJoin.ts +1 -1
- package/src/login/kcContext/KcContext.ts +2 -1
- package/src/login/kcContext/createGetKcContext.ts +2 -7
- package/src/login/kcContext/kcContextMocks.ts +7 -5
- package/bin/keycloakify/generateJavaStackFiles.js +0 -103
- package/bin/keycloakify/generateJavaStackFiles.js.map +0 -1
- package/bin/mockTestingResourcesPath.d.ts +0 -3
- package/bin/mockTestingResourcesPath.js +0 -8
- package/bin/mockTestingResourcesPath.js.map +0 -1
- package/bin/tools/jar.d.ts +0 -33
- package/bin/tools/jar.js +0 -241
- package/bin/tools/jar.js.map +0 -1
- package/bin/tools/walk.d.ts +0 -8
- package/bin/tools/walk.js +0 -125
- package/bin/tools/walk.js.map +0 -1
- package/src/bin/keycloakify/generateJavaStackFiles.ts +0 -84
- package/src/bin/mockTestingResourcesPath.ts +0 -5
- package/src/bin/tools/jar.ts +0 -99
- 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({
|
48
|
+
const { themeSrcDirPath } = getThemeSrcDirPath({ reactAppRootDirPath });
|
53
49
|
|
54
50
|
const targetFilePath = pathJoin(themeSrcDirPath, themeType, "pages", pageBasename);
|
55
51
|
|
package/src/bin/getSrcDirPath.ts
CHANGED
@@ -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 "./
|
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: {
|
11
|
-
const {
|
10
|
+
export function getThemeSrcDirPath(params: { reactAppRootDirPath: string }) {
|
11
|
+
const { reactAppRootDirPath } = params;
|
12
12
|
|
13
|
-
const srcDirPath = pathJoin(
|
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
|
13
|
+
const reactAppRootDirPath = process.cwd();
|
14
14
|
|
15
|
-
const
|
16
|
-
|
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
|
-
|
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 {
|
5
|
-
import {
|
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
|
-
|
15
|
-
extraThemeNames: string[];
|
11
|
+
themeNames: string[];
|
16
12
|
extraThemeProperties: string[] | undefined;
|
17
13
|
groupId: string;
|
18
14
|
artifactId: string;
|
19
|
-
|
20
|
-
|
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: {
|
31
|
-
const {
|
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({
|
41
|
+
const parsedPackageJson = getParsedPackageJson({ reactAppRootDirPath });
|
42
42
|
|
43
43
|
const { name, keycloakify = {}, version, homepage } = parsedPackageJson;
|
44
44
|
|
45
|
-
const { extraThemeProperties, groupId, artifactId,
|
45
|
+
const { extraThemeProperties, groupId, artifactId, doCreateJar, loginThemeResourcesFromKeycloakVersion } = keycloakify ?? {};
|
46
46
|
|
47
|
-
const
|
48
|
-
keycloakify.themeName
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
const themeNames = (() => {
|
48
|
+
if (keycloakify.themeName === undefined) {
|
49
|
+
return [
|
50
|
+
name
|
51
|
+
.replace(/^@(.*)/, "$1")
|
52
|
+
.split("/")
|
53
|
+
.join("-")
|
54
|
+
];
|
55
|
+
}
|
53
56
|
|
54
|
-
|
55
|
-
|
56
|
-
|
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
|
-
|
66
|
-
|
67
|
-
|
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 = `${
|
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
|
-
"
|
87
|
-
"
|
88
|
-
let {
|
89
|
-
|
90
|
-
if (
|
91
|
-
return
|
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
|
-
|
95
|
-
|
96
|
-
|
98
|
+
return pathJoin(reactAppRootDirPath, "public");
|
99
|
+
})(),
|
100
|
+
"reactAppBuildDirPath": (() => {
|
101
|
+
const { reactAppBuildDirPath } = parsedPackageJson.keycloakify ?? {};
|
97
102
|
|
98
|
-
if (reactAppBuildDirPath
|
99
|
-
return
|
103
|
+
if (reactAppBuildDirPath !== undefined) {
|
104
|
+
return getAbsoluteAndInOsFormatPath({
|
105
|
+
"pathIsh": reactAppBuildDirPath,
|
106
|
+
"cwd": reactAppRootDirPath
|
107
|
+
});
|
100
108
|
}
|
101
109
|
|
102
|
-
return
|
110
|
+
return pathJoin(reactAppRootDirPath, "build");
|
103
111
|
})(),
|
104
112
|
"keycloakifyBuildDirPath": (() => {
|
105
|
-
|
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
|
116
|
-
return
|
115
|
+
if (keycloakifyBuildDirPath !== undefined) {
|
116
|
+
return getAbsoluteAndInOsFormatPath({
|
117
|
+
"pathIsh": keycloakifyBuildDirPath,
|
118
|
+
"cwd": reactAppRootDirPath
|
119
|
+
});
|
117
120
|
}
|
118
121
|
|
119
|
-
return
|
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",
|
104
|
+
.replace("KEYCLOAKIFY_THEME_NAME_cXxKd3xEer", themeName),
|
108
105
|
"<!-- xIdLqMeOedErIdLsPdNdI9dSlxI -->": [
|
109
106
|
"<#if scripts??>",
|
110
107
|
" <#list scripts as script>",
|
package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountPages.java
ADDED
@@ -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> {}
|
package/src/bin/keycloakify/generateJavaStackFiles/account-v1-java/forms/account/AccountSpi.java
ADDED
@@ -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
|
+
}
|