Compare commits

...

25 Commits

Author SHA1 Message Date
8f8857bc22 Update changelog v5.4.2 2022-06-01 22:21:23 +00:00
226247b3b6 Bump version (changelog ignore) 2022-06-02 00:15:25 +02:00
b2ea5014f3 Update evt (changelog ignore) 2022-06-02 00:15:10 +02:00
48bc416aa7 Update powerhooks (changelog ignore) 2022-06-02 00:14:36 +02:00
386e7203b2 Merge branch 'main' of https://github.com/InseeFrLab/keycloakify 2022-06-01 05:51:41 +02:00
9bdb224631 Prevent rate limite in CI by authenticating 2022-06-01 05:51:33 +02:00
dd36aacbee Update changelog v5.4.1 2022-06-01 03:45:04 +00:00
6b57b1c720 Bump version (changelog ignore) 2022-06-01 05:42:23 +02:00
9e9e6d41ff Update dependencies (changelog ignore) 2022-06-01 05:38:12 +02:00
5140389502 Update changelog v5.4.0 2022-05-23 14:59:15 +00:00
fc6328131f Bump version (changelog ignore) 2022-05-23 16:51:58 +02:00
9de0083ca6 #109 2022-05-23 16:51:18 +02:00
f5231b840d Update changelog v5.3.2 2022-05-04 10:16:04 +00:00
afb6596c4b Bump version (changelog ignore) 2022-05-04 12:13:10 +02:00
dde9afef92 Merge pull request #101 from Romcol/bugfix/99
Issue #99 - Make replace less greedy in remplaceImportFromStatic
2022-05-04 12:12:06 +02:00
6595e9c3cb [IMP] Issue #99 - Make replace less greedy in remplaceImportFromStatic 2022-05-04 11:22:58 +02:00
c0e3b5fe06 Update changelog v5.3.1 2022-04-29 16:41:12 +00:00
6b8f3bbc51 Bump version (changelog ignore) 2022-04-29 18:35:39 +02:00
9a5a021e64 Comment out missleading informations 2022-04-29 18:35:07 +02:00
14c05fec8c Update changelog v5.3.0 2022-04-28 07:52:08 +00:00
eaf7a455cd Fix name of npx script for generating email dir (changelog ignore) 2022-04-28 09:46:49 +02:00
55bb21f3ee Merge branch 'main' of https://github.com/InseeFrLab/keycloakify 2022-04-28 09:36:41 +02:00
f123bc0912 Bump version (changelog ignore) 2022-04-28 09:35:53 +02:00
572eb7b1c0 Rename keycloak_theme_email to keycloak_email (it's shorter) 2022-04-28 09:34:01 +02:00
2befaff8a8 Update changelog sumup in readme (changelog ignore) 2022-04-27 23:32:47 +02:00
14 changed files with 105 additions and 49 deletions

View File

@ -25,6 +25,8 @@ jobs:
test: test:
runs-on: macos-10.15 runs-on: macos-10.15
needs: test_formatting needs: test_formatting
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy: strategy:
matrix: matrix:
node: [ '15', '14' ] node: [ '15', '14' ]

2
.gitignore vendored
View File

@ -47,5 +47,5 @@ jspm_packages
.idea .idea
/keycloak_theme_email /keycloak_email
/build_keycloak /build_keycloak

View File

@ -1,3 +1,30 @@
### **5.4.2** (2022-06-01)
- Prevent rate limite in CI by authenticating
### **5.4.1** (2022-06-01)
## **5.4.0** (2022-05-23)
- #109
### **5.3.2** (2022-05-04)
- Merge pull request #101 from Romcol/bugfix/99
Issue #99 - Make replace less greedy in remplaceImportFromStatic
- [IMP] Issue #99 - Make replace less greedy in remplaceImportFromStatic
### **5.3.1** (2022-04-29)
- Comment out missleading informations
## **5.3.0** (2022-04-28)
- Rename keycloak_theme_email to keycloak_email (it's shorter)
## **5.2.0** (2022-04-27) ## **5.2.0** (2022-04-27)
- Export KcApp - Export KcApp

View File

@ -38,6 +38,15 @@
# Changelog highlights # Changelog highlights
## v5.3.0
Rename `keycloak_theme_email` to `keycloak_email`.
If you already had a `keycloak_theme_email` you should rename it `keycloak_email`.
## v5.0.0
New i18n system. Import of terms and services have changed. [See example](https://github.com/garronej/keycloakify-demo-app/blob/a5b6a50f24bc25e082931f5ad9ebf47492acd12a/src/index.tsx#L46-L63).
## v4.10.0 ## v4.10.0
Add `login-idp-link-email.ftl` page [See PR](https://github.com/InseeFrLab/keycloakify/pull/92). Add `login-idp-link-email.ftl` page [See PR](https://github.com/InseeFrLab/keycloakify/pull/92).

View File

@ -1,6 +1,6 @@
{ {
"name": "keycloakify", "name": "keycloakify",
"version": "5.2.0", "version": "5.4.2",
"description": "Keycloak theme generator for Reacts app", "description": "Keycloak theme generator for Reacts app",
"repository": { "repository": {
"type": "git", "type": "git",
@ -22,7 +22,7 @@
}, },
"bin": { "bin": {
"build-keycloak-theme": "dist/bin/build-keycloak-theme/index.js", "build-keycloak-theme": "dist/bin/build-keycloak-theme/index.js",
"create-keycloak-theme-email-directory": "dist/bin/create-keycloak-theme-email-directory.js", "create-keycloak-email-directory": "dist/bin/create-keycloak-email-directory.js",
"download-builtin-keycloak-theme": "dist/bin/download-builtin-keycloak-theme.js" "download-builtin-keycloak-theme": "dist/bin/download-builtin-keycloak-theme.js"
}, },
"lint-staged": { "lint-staged": {
@ -57,7 +57,7 @@
"homepage": "https://github.com/garronej/keycloakify", "homepage": "https://github.com/garronej/keycloakify",
"peerDependencies": { "peerDependencies": {
"@emotion/react": "^11.4.1", "@emotion/react": "^11.4.1",
"react": "^16.8.0 || ^17.0.0" "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}, },
"devDependencies": { "devDependencies": {
"@emotion/react": "^11.4.1", "@emotion/react": "^11.4.1",
@ -77,14 +77,14 @@
"@octokit/rest": "^18.12.0", "@octokit/rest": "^18.12.0",
"cheerio": "^1.0.0-rc.5", "cheerio": "^1.0.0-rc.5",
"cli-select": "^1.1.2", "cli-select": "^1.1.2",
"evt": "2.0.0-beta.39", "evt": "2.0.0-beta.43",
"memoizee": "^0.4.15", "memoizee": "^0.4.15",
"minimal-polyfills": "^2.2.1", "minimal-polyfills": "^2.2.1",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"powerhooks": "^0.14.0", "powerhooks": "^0.17.1",
"react-markdown": "^5.0.3", "react-markdown": "^5.0.3",
"scripting-tools": "^0.19.13", "scripting-tools": "^0.19.13",
"tsafe": "^0.9.0", "tsafe": "^0.10.0",
"tss-react": "^3.5.2" "tss-react": "^3.7.0"
} }
} }

View File

@ -19,7 +19,7 @@ const doUseExternalAssets = process.argv[2]?.toLowerCase() === "--external-asset
const parsedPackageJson: ParsedPackageJson = require(pathJoin(reactProjectDirPath, "package.json")); const parsedPackageJson: ParsedPackageJson = require(pathJoin(reactProjectDirPath, "package.json"));
export const keycloakThemeBuildingDirPath = pathJoin(reactProjectDirPath, "build_keycloak"); export const keycloakThemeBuildingDirPath = pathJoin(reactProjectDirPath, "build_keycloak");
export const keycloakThemeEmailDirPath = pathJoin(keycloakThemeBuildingDirPath, "..", "keycloak_theme_email"); export const keycloakThemeEmailDirPath = pathJoin(keycloakThemeBuildingDirPath, "..", "keycloak_email");
function sanitizeThemeName(name: string) { function sanitizeThemeName(name: string) {
return name return name
@ -106,7 +106,8 @@ export function main() {
`✅ Your keycloak theme has been generated and bundled into ./${pathRelative(reactProjectDirPath, jarFilePath)} 🚀`, `✅ Your keycloak theme has been generated and bundled into ./${pathRelative(reactProjectDirPath, jarFilePath)} 🚀`,
`It is to be placed in "/opt/keycloak/providers" in the container running a quay.io/keycloak/keycloak Docker image.`, `It is to be placed in "/opt/keycloak/providers" in the container running a quay.io/keycloak/keycloak Docker image.`,
"", "",
"Using Helm (https://github.com/codecentric/helm-charts), edit to reflect:", //TODO: Restore when we find a good Helm chart for Keycloak.
//"Using Helm (https://github.com/codecentric/helm-charts), edit to reflect:",
"", "",
"value.yaml: ", "value.yaml: ",
" extraInitContainers: |", " extraInitContainers: |",

View File

@ -124,9 +124,11 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
) || ( ) || (
<#-- https://github.com/InseeFrLab/keycloakify/pull/65#issuecomment-991896344 (reports with saml-post-form.ftl) --> <#-- https://github.com/InseeFrLab/keycloakify/pull/65#issuecomment-991896344 (reports with saml-post-form.ftl) -->
<#-- https://github.com/InseeFrLab/keycloakify/issues/91#issue-1212319466 (reports with error.ftl and Kc18) --> <#-- https://github.com/InseeFrLab/keycloakify/issues/91#issue-1212319466 (reports with error.ftl and Kc18) -->
<#-- https://github.com/InseeFrLab/keycloakify/issues/109#issuecomment-1134610163 -->
key == "loginAction" && key == "loginAction" &&
are_same_path(path, ["url"]) && are_same_path(path, ["url"]) &&
["saml-post-form.ftl", "error.ftl"]?seq_contains(pageId) ["saml-post-form.ftl", "error.ftl", "info.ftl"]?seq_contains(pageId) &&
!(auth?has_content && auth.showTryAnotherWayLink())
) || ( ) || (
["contextData", "idpConfig", "idp", "authenticationSession"]?seq_contains(key) && ["contextData", "idpConfig", "idp", "authenticationSession"]?seq_contains(key) &&
are_same_path(path, ["brokerContext"]) && are_same_path(path, ["brokerContext"]) &&
@ -153,6 +155,33 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
</#if> </#if>
<#if key == "showUsername" && are_same_path(path, ["auth"])>
<#attempt>
<#return auth.showUsername()?c>
<#recover>
<#local out_seq += ["/*Couldn't evaluate auth.showUsername()*/"]>
<#continue>
</#attempt>
</#if>
<#if key == "showResetCredentials" && are_same_path(path, ["auth"])>
<#attempt>
<#return auth.showResetCredentials()?c>
<#recover>
<#local out_seq += ["/*Couldn't evaluate auth.showResetCredentials()*/"]>
<#continue>
</#attempt>
</#if>
<#if key == "showTryAnotherWayLink" && are_same_path(path, ["auth"])>
<#attempt>
<#return auth.showTryAnotherWayLink()?c>
<#recover>
<#local out_seq += ["/*Couldn't evaluate auth.showTryAnotherWayLink()*/"]>
<#continue>
</#attempt>
</#if>
<#attempt> <#attempt>
<#if !object[key]??> <#if !object[key]??>
<#continue> <#continue>

View File

@ -88,7 +88,7 @@ export function generateKeycloakThemeResources(params: {
console.log( console.log(
[ [
`Not bundling email template because ${pathBasename(keycloakThemeEmailDirPath)} does not exist`, `Not bundling email template because ${pathBasename(keycloakThemeEmailDirPath)} does not exist`,
`To start customizing the email template, run: 👉 npx create-keycloak-theme-email-directory 👈`, `To start customizing the email template, run: 👉 npx create-keycloak-email-directory 👈`,
].join("\n"), ].join("\n"),
); );
doBundleEmailTemplate = false; doBundleEmailTemplate = false;

View File

@ -17,12 +17,12 @@ export function replaceImportsFromStaticInJsCode(params: { jsCode: string; urlOr
const { jsCode, urlOrigin } = params; const { jsCode, urlOrigin } = params;
const fixedJsCode = jsCode const fixedJsCode = jsCode
.replace(/(\w+\.\w+)\+"static\//g, (...[, group]) => .replace(/([a-zA-Z]+\.[a-zA-Z]+)\+"static\//g, (...[, group]) =>
urlOrigin === undefined urlOrigin === undefined
? `window.${ftlValuesGlobalName}.url.resourcesPath + "/build/static/` ? `window.${ftlValuesGlobalName}.url.resourcesPath + "/build/static/`
: `("${ftlValuesGlobalName}" in window ? "${urlOrigin}" : "") + ${group} + "static/`, : `("${ftlValuesGlobalName}" in window ? "${urlOrigin}" : "") + ${group} + "static/`,
) )
.replace(/".chunk.css",(\w)+=(\w+\.\w+)\+(\w+),/, (...[, group1, group2, group3]) => .replace(/".chunk.css",([a-zA-Z])+=([a-zA-Z]+\.[a-zA-Z]+)\+([a-zA-Z]+),/, (...[, group1, group2, group3]) =>
urlOrigin === undefined urlOrigin === undefined
? `".chunk.css",${group1} = window.${ftlValuesGlobalName}.url.resourcesPath + "/build/" + ${group3},` ? `".chunk.css",${group1} = window.${ftlValuesGlobalName}.url.resourcesPath + "/build/" + ${group3},`
: `".chunk.css",${group1} = ("${ftlValuesGlobalName}" in window ? "${urlOrigin}" : "") + ${group2} + ${group3},`, : `".chunk.css",${group1} = ("${ftlValuesGlobalName}" in window ? "${urlOrigin}" : "") + ${group2} + ${group3},`,

View File

@ -1,7 +0,0 @@
import { Octokit } from "@octokit/rest";
export function createOctokit(params: { github_token: string }) {
const { github_token } = params;
return new Octokit({ ...(github_token !== "" ? { "auth": github_token } : {}) });
}

View File

@ -52,9 +52,9 @@ export declare namespace KcContextBase {
currentLanguageTag: KcLanguageTag; currentLanguageTag: KcLanguageTag;
}; };
auth?: { auth?: {
showUsername: boolean; showUsername?: boolean;
showResetCredentials: boolean; showResetCredentials?: boolean;
showTryAnotherWayLink: boolean; showTryAnotherWayLink?: boolean;
attemptedUsername?: string; attemptedUsername?: string;
}; };
scripts: string[]; scripts: string[];

View File

@ -8,7 +8,7 @@ generateKeycloakThemeResources({
"themeName": "keycloakify-demo-app", "themeName": "keycloakify-demo-app",
"reactAppBuildDirPath": pathJoin(sampleReactProjectDirPath, "build"), "reactAppBuildDirPath": pathJoin(sampleReactProjectDirPath, "build"),
"keycloakThemeBuildingDirPath": pathJoin(sampleReactProjectDirPath, "build_keycloak_theme"), "keycloakThemeBuildingDirPath": pathJoin(sampleReactProjectDirPath, "build_keycloak_theme"),
"keycloakThemeEmailDirPath": pathJoin(sampleReactProjectDirPath, "keycloak_theme_email"), "keycloakThemeEmailDirPath": pathJoin(sampleReactProjectDirPath, "keycloak_email"),
"urlPathname": "/keycloakify-demo-app/", "urlPathname": "/keycloakify-demo-app/",
"urlOrigin": undefined, "urlOrigin": undefined,
"extraPagesId": ["my-custom-page.ftl"], "extraPagesId": ["my-custom-page.ftl"],

View File

@ -680,10 +680,10 @@ event-emitter@^0.3.5:
d "1" d "1"
es5-ext "~0.10.14" es5-ext "~0.10.14"
evt@2.0.0-beta.39: evt@2.0.0-beta.43:
version "2.0.0-beta.39" version "2.0.0-beta.43"
resolved "https://registry.yarnpkg.com/evt/-/evt-2.0.0-beta.39.tgz#3c859a83b35940f7eecfb5f148f03b7cbf3fee51" resolved "https://registry.yarnpkg.com/evt/-/evt-2.0.0-beta.43.tgz#971d3452ed2d0d4516ad98404f15f0c69c745340"
integrity sha512-XxJkaHrFWBrzjTbnr5LJYXkGkADsAXReZfq2lFu3Kf1iCEw5/5ibrdXu3bQdWW6xkZ8qwAHT3STU9zYcCl09BA== integrity sha512-CXfX3FrC9+/EjK21ZNyJFIeBt7cj6ecjrlsTTeUYhT8a+ORe0qyQiRJRweZvmrPGci1tEGYdFvEimC0BD4YBOw==
dependencies: dependencies:
minimal-polyfills "^2.2.1" minimal-polyfills "^2.2.1"
run-exclusive "^2.2.14" run-exclusive "^2.2.14"
@ -1295,15 +1295,15 @@ please-upgrade-node@^3.2.0:
dependencies: dependencies:
semver-compare "^1.0.0" semver-compare "^1.0.0"
powerhooks@^0.14.0: powerhooks@^0.17.1:
version "0.14.0" version "0.17.1"
resolved "https://registry.yarnpkg.com/powerhooks/-/powerhooks-0.14.0.tgz#44dd201f470761362a139ae2cb51eaa658ed5e3e" resolved "https://registry.yarnpkg.com/powerhooks/-/powerhooks-0.17.1.tgz#701477631c0d937d3cef27f6ce54cd70b5e9e7e7"
integrity sha512-jWrRHyqev7Lh3MId7h1mNxs+fgegr8liHN17AaHxMgrXI6KxJ14B3Pe1It4FIRWJ4Z1dxsA734FerFGZ3Vgdkg== integrity sha512-KI7vcvMEylCVUI1uL36fDkJ85P1yUXTrhh1vn7aNo1Wa+U6qkelBLtE+414VtHJZw21X8nMJaoRMRtrzTXneog==
dependencies: dependencies:
evt "2.0.0-beta.39" evt "2.0.0-beta.43"
memoizee "^0.4.15" memoizee "^0.4.15"
resize-observer-polyfill "^1.5.1" resize-observer-polyfill "^1.5.1"
tsafe "^0.8.1" tsafe "^0.10.0"
prettier@^2.3.0: prettier@^2.3.0:
version "2.4.1" version "2.4.1"
@ -1625,21 +1625,16 @@ trough@^1.0.0:
resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406" resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406"
integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA== integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==
tsafe@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-0.10.0.tgz#c4fba365a49467ea6167e8c9482ddb94ee51b795"
integrity sha512-CFfa1uJKfU0DDRbuB8bf2mfXjkOqiTsrltexzMMLxq5gjd1LttFECNGsO8dYUALJDbShb6+f3CwAppW/wf9BrA==
tsafe@^0.4.1: tsafe@^0.4.1:
version "0.4.1" version "0.4.1"
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-0.4.1.tgz#00af1be2db82abb4be531209b90232d7954e1a03" resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-0.4.1.tgz#00af1be2db82abb4be531209b90232d7954e1a03"
integrity sha512-+OZ0gdgmwcru+MOSheCx+ymAvQz+1/ui+KFJRuaq0t2m8RNrlf7eSzEieptoPQXPY67Mdkqgkdjknn8azoD5sw== integrity sha512-+OZ0gdgmwcru+MOSheCx+ymAvQz+1/ui+KFJRuaq0t2m8RNrlf7eSzEieptoPQXPY67Mdkqgkdjknn8azoD5sw==
tsafe@^0.8.1:
version "0.8.1"
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-0.8.1.tgz#9af7e1540bc04313a82d60c98056a5017c8b086b"
integrity sha512-EfPjxQHzndQAV/uh0SMGP26Wg3dCuaw8dRv2VPEuGHen5qzg2oqsMvZw2wkQFkiMisZq2fm95m5lheimW2Fpvg==
tsafe@^0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/tsafe/-/tsafe-0.9.0.tgz#8394e5fdf81e690c97e2b8be4180a079a4a19bfb"
integrity sha512-wmbu8pI/xmW69b13HoS8WbTcSlRTDjIut9ACblBjVZVTk0vsMRXdoh1k1jMu5EzKNohBavKHhqNOOsccSR7XCA==
tslib@^1.9.0: tslib@^1.9.0:
version "1.14.1" version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
@ -1650,10 +1645,10 @@ tslib@^2.2.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
tss-react@^3.5.2: tss-react@^3.7.0:
version "3.5.2" version "3.7.0"
resolved "https://registry.yarnpkg.com/tss-react/-/tss-react-3.5.2.tgz#1b5db1f4a71fe62c939eed5368ea7809ca2ad0a9" resolved "https://registry.yarnpkg.com/tss-react/-/tss-react-3.7.0.tgz#664b4259c36800eb5285a583f6d8c1d5d1d1a30f"
integrity sha512-IgGizaOhbntrWdh2EISJYnhYEEWXXWf3sn5aa8LYf7e59NCM5mg0PxJuEoLx9pLG5WlJF80zTRN/Y1Jnjw9LYA== integrity sha512-thvJWR+sr3ZGMcV/Ryo1F5RzjXd1gMTzYV/ckfUEBhu701uTYE3KyL9DNxv827uRFPFSLYG7bKefuc7kmYMB9Q==
dependencies: dependencies:
"@emotion/cache" "*" "@emotion/cache" "*"
"@emotion/serialize" "*" "@emotion/serialize" "*"