keycloakify 4.8.4 β 4.8.7
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/CHANGELOG.md +15 -0
- package/README.md +6 -464
- package/bin/build-keycloak-theme/build-keycloak-theme.js +1 -1
- package/bin/build-keycloak-theme/build-keycloak-theme.js.map +1 -1
- package/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +3 -2
- package/bin/promptKeycloakVersion.js +34 -6
- package/bin/promptKeycloakVersion.js.map +1 -1
- package/package.json +1 -1
- package/src/bin/build-keycloak-theme/build-keycloak-theme.ts +1 -1
- package/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +3 -2
- package/src/bin/promptKeycloakVersion.ts +9 -6
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
### **4.8.7** (2022-04-25)
|
2
|
+
|
3
|
+
- Update instructions to test on Keycloak 18 https://github.com/keycloak/keycloak-web/issues/306 #93
|
4
|
+
- Move the documentation form the readme to docs.keycloakify.dev
|
5
|
+
- Update README.md
|
6
|
+
- Update demo video
|
7
|
+
|
8
|
+
### **4.8.6** (2022-04-22)
|
9
|
+
|
10
|
+
- always offer to download v11.0.3
|
11
|
+
|
12
|
+
### **4.8.5** (2022-04-22)
|
13
|
+
|
14
|
+
- #91
|
15
|
+
|
1
16
|
### **4.8.4** (2022-04-22)
|
2
17
|
|
3
18
|
- #90
|
package/README.md
CHANGED
@@ -23,477 +23,19 @@
|
|
23
23
|
<a href="https://github.com/thomasdarimont/awesome-keycloak">
|
24
24
|
<img src="https://awesome.re/mentioned-badge.svg"/>
|
25
25
|
</a>
|
26
|
+
<p align="center">
|
27
|
+
<a href="https://www.keycloakify.dev">Home</a>
|
28
|
+
-
|
29
|
+
<a href="https://docs.keycloakify.dev">Documentation</a>
|
26
30
|
</p>
|
27
31
|
|
28
|
-
> New with v4.8.0: [Email template customization.](#email-template-customization)
|
29
|
-
|
30
|
-
<p align="center">
|
31
|
-
<i>Ultimately this build tool generates a Keycloak theme</i>
|
32
|
-
<img src="https://user-images.githubusercontent.com/6702424/110260457-a1c3d380-7fac-11eb-853a-80459b65626b.png">
|
33
|
-
</p>
|
34
|
-
|
35
|
-
# Motivations
|
36
|
-
|
37
|
-
Keycloak provides [theme support](https://www.keycloak.org/docs/latest/server_development/#_themes) for web pages. This allows customizing the look and feel of end-user facing pages so they can be integrated with your applications.
|
38
|
-
It involves, however, a lot of raw JS/CSS/[FTL]() hacking, and bundling the theme is not exactly straightforward.
|
39
|
-
|
40
|
-
Beyond that, if you use Keycloak for a specific app you want your login page to be tightly integrated with it.
|
41
|
-
Ideally, you don't want the user to notice when he is being redirected away.
|
42
|
-
|
43
|
-
Trying to reproduce the look and feel of a specific app in another stack is not an easy task not to mention
|
44
|
-
the cheer amount of maintenance that it involves.
|
45
|
-
|
46
|
-
<p align="center">
|
47
|
-
<i>Without keycloakify, users suffers from a harsh context switch, no fronted form pre-validation</i><br>
|
48
|
-
<img src="https://user-images.githubusercontent.com/6702424/134997335-a28b4a57-0884-47ec-9341-a0e49f835c4d.gif">
|
49
|
-
</p>
|
50
|
-
|
51
|
-
Wouldn't it be great if we could just design the login and register pages as if they were part of our app?
|
52
|
-
Here is `keycloakify` for you πΈ
|
53
|
-
|
54
|
-
<p align="center">
|
55
|
-
<i> <a href="https://datalab.sspcloud.fr">With keycloakify:</a> </i>
|
56
|
-
<br>
|
57
|
-
<img src="https://user-images.githubusercontent.com/6702424/114332075-c5e37900-9b45-11eb-910b-48a05b3d90d9.gif">
|
58
|
-
</p>
|
59
|
-
|
60
|
-
**TL;DR**: [Here](https://github.com/garronej/keycloakify-demo-app) is a Hello World React project with Keycloakify set up.
|
61
|
-
|
62
|
-
If you already have a Keycloak custom theme, it can be easily ported to Keycloakify.
|
63
|
-
|
64
|
-
---
|
65
|
-
|
66
|
-
- [Motivations](#motivations)
|
67
|
-
- [Requirements](#requirements)
|
68
|
-
- [My framework doesnβt seem to be supported, what can I do?](#my-framework-doesnt-seem-to-be-supported-what-can-i-do)
|
69
|
-
- [How to use](#how-to-use)
|
70
|
-
- [Setting up the build tool](#setting-up-the-build-tool)
|
71
|
-
- [Changing just the look of the default Keycloak theme](#changing-just-the-look-of-the-default-keycloak-theme)
|
72
|
-
- [Advanced pages configuration](#advanced-pages-configuration)
|
73
|
-
- [Hot reload](#hot-reload)
|
74
|
-
- [Enable loading in a blink of an eye of login pages β‘ (--external-assets)](#enable-loading-in-a-blink-of-an-eye-of-login-pages----external-assets)
|
75
|
-
- [Email template customization.](#email-template-customization)
|
76
|
-
- [User profile and frontend form validation](#user-profile-and-frontend-form-validation)
|
77
|
-
- [Support for Terms and conditions](#support-for-terms-and-conditions)
|
78
|
-
- [Some pages still have the default theme. Why?](#some-pages-still-have-the-default-theme-why)
|
79
|
-
- [GitHub Actions](#github-actions)
|
80
|
-
- [Limitations](#limitations)
|
81
|
-
- [`process.env.PUBLIC_URL` not supported.](#processenvpublic_url-not-supported)
|
82
|
-
- [`@font-face` importing fonts from the `src/` dir](#font-face-importing-fonts-from-the-src-dir)
|
83
|
-
- [Example of setup that **won't** work](#example-of-setup-that-wont-work)
|
84
|
-
- [Possible workarounds](#possible-workarounds)
|
85
|
-
- [Implement context persistence (optional)](#implement-context-persistence-optional)
|
86
|
-
- [Kickstart video](#kickstart-video)
|
87
|
-
- [FTL errors related to `ftl_object_to_js_code_declaring_an_object` in Keycloak logs.](#ftl-errors-related-to-ftl_object_to_js_code_declaring_an_object-in-keycloak-logs)
|
88
|
-
- [Adding custom message (to `i18n/useKcMessage.tsx`)](#adding-custom-message-to-i18nusekcmessagetsx)
|
89
|
-
- [Downloading builtin theme resource files](#downloading-builtin-theme-resource-files)
|
90
|
-
- [Email domain whitelist](#email-domain-whitelist)
|
91
|
-
- [Changelog highlights](#changelog-highlights)
|
92
|
-
- [v4.8.0](#v480)
|
93
|
-
- [v4.7.4](#v474)
|
94
|
-
- [v4.7.2](#v472)
|
95
|
-
- [v4.7.0](#v470)
|
96
|
-
- [v4.6.0](#v460)
|
97
|
-
- [v4.5.3](#v453)
|
98
|
-
- [v4.3.0](#v430)
|
99
|
-
- [v4](#v4)
|
100
|
-
- [v3](#v3)
|
101
|
-
- [v2.5](#v25)
|
102
|
-
- [v2](#v2)
|
103
|
-
|
104
|
-
# Requirements
|
105
|
-
|
106
|
-
On Windows OS you'll have to use [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10). More info [here](https://github.com/InseeFrLab/keycloakify/issues/54#issuecomment-984834217)
|
107
|
-
|
108
|
-
Tested with the following Keycloak versions:
|
109
|
-
|
110
|
-
- [11.0.3](https://hub.docker.com/layers/jboss/keycloak/11.0.3/images/sha256-4438f1e51c1369371cb807dffa526e1208086b3ebb9cab009830a178de949782?context=explore)
|
111
|
-
- [12.0.4](https://hub.docker.com/layers/jboss/keycloak/12.0.4/images/sha256-67e0c88e69bd0c7aef972c40bdeb558a974013a28b3668ca790ed63a04d70584?context=explore)
|
112
|
-
- [15.0.2](https://hub.docker.com/layers/jboss/keycloak/15.0.2/images/sha256-d8ed1ee5df42a178c341f924377da75db49eab08ea9f058ff39a8ed7ee05ec93?context=explore)
|
113
|
-
- [16.1.0](https://hub.docker.com/layers/jboss/keycloak/16.1.0/images/sha256-6ecb9492224c6cfbb55d43f64a5ab634145d8cc1eba14eae8c37e3afde89546e?context=explore)
|
114
|
-
- 17.0.1
|
115
|
-
|
116
|
-
This tool will be maintained to stay compatible with Keycloak v11 and up, however, the default pages you will get
|
117
|
-
(before you customize it) will always be the ones of Keycloak v11.
|
118
|
-
|
119
|
-
This tool assumes you are bundling your app with Webpack (tested with the versions that ships with CRA v4.44.2 and v5.0.0) .
|
120
|
-
It assumes there is a `build/` directory at the root of your react project directory containing a `index.html` file
|
121
|
-
and a `build/static/` directory generated by webpack.
|
122
|
-
For more information see [this issue](https://github.com/InseeFrLab/keycloakify/issues/5#issuecomment-832296432)
|
123
|
-
|
124
|
-
**All this is defaults with [`create-react-app`](https://create-react-app.dev)** (tested with 5.0.0, 4.0.3)
|
125
|
-
|
126
|
-
- `mvn` ([Maven](https://maven.apache.org/)), `rm`, `mkdir`, `curl`, `unzip` are assumed to be available.
|
127
|
-
- `docker` must be up and running when running `start_keycloak_testing_container.sh` (Instructions provided after running `yarn keycloak`).
|
128
|
-
|
129
|
-
## My framework doesnβt seem to be supported, what can I do?
|
130
|
-
|
131
|
-
Currently Keycloakify is only compatible with SPA React apps.
|
132
|
-
It doesnβt mean that you can't use Keycloakify if you are using Next.js, Express or any other
|
133
|
-
framework that involves a server but your Keycloak theme will need to be a standalone project.
|
134
|
-
Find specific instructions about how to get started [**here**](https://github.com/garronej/keycloakify-demo-app#keycloak-theme-only).
|
135
|
-
|
136
|
-
To share your styles between your main app and your login pages you will need to externalize your design system by making it a
|
137
|
-
separate module. Checkout [ts_ci](https://github.com/garronej/ts_ci), it can help with that (example with [our design system](https://github.com/InseeFrLab/onyxia-ui)).
|
138
|
-
|
139
|
-
# How to use
|
140
|
-
|
141
|
-
## Setting up the build tool
|
142
|
-
|
143
|
-
```bash
|
144
|
-
yarn add keycloakify @emotion/react
|
145
|
-
```
|
146
|
-
|
147
|
-
[`package.json`](https://github.com/garronej/keycloakify-demo-app/blob/main/package.json)
|
148
|
-
|
149
|
-
```json
|
150
|
-
"scripts": {
|
151
|
-
"keycloak": "yarn build && build-keycloak-theme",
|
152
|
-
}
|
153
|
-
```
|
154
|
-
|
155
|
-
```bash
|
156
|
-
yarn keycloak # generates keycloak-theme.jar
|
157
|
-
```
|
158
|
-
|
159
|
-
On the console will be printed all the instructions about how to load the generated theme in Keycloak
|
160
|
-
|
161
|
-
### Changing just the look of the default Keycloak theme
|
162
|
-
|
163
|
-
The first approach is to only customize the style of the default Keycloak login by providing
|
164
|
-
your own class names.
|
165
|
-
|
166
|
-
If you have created a new React project specifically to create a Keycloak theme and nothing else then
|
167
|
-
your index should look something like:
|
168
|
-
|
169
|
-
`src/index.tsx`
|
170
|
-
|
171
|
-
```tsx
|
172
|
-
import { App } from "./<wherever>/App";
|
173
|
-
import { KcApp, defaultKcProps, getKcContext } from "keycloakify";
|
174
|
-
import { css } from "tss-react/@emotion/css";
|
175
|
-
|
176
|
-
const { kcContext } = getKcContext();
|
177
|
-
|
178
|
-
const myClassName = css({ "color": "red" });
|
179
|
-
|
180
|
-
reactDom.render(
|
181
|
-
<KcApp
|
182
|
-
kcContext={kcContext}
|
183
|
-
{...{
|
184
|
-
...defaultKcProps,
|
185
|
-
"kcHeaderWrapperClass": myClassName,
|
186
|
-
}}
|
187
|
-
/>,
|
188
|
-
document.getElementById("root"),
|
189
|
-
);
|
190
|
-
```
|
191
|
-
|
192
|
-
If you share a unique project for your app and the Keycloak theme, your index should look
|
193
|
-
more like this:
|
194
|
-
|
195
|
-
`src/index.tsx`
|
196
|
-
|
197
|
-
```tsx
|
198
|
-
import { App } from "./<wherever>/App";
|
199
|
-
import { KcApp, defaultKcProps, getKcContext } from "keycloakify";
|
200
|
-
import { css } from "tss-react/@emotion/css";
|
201
|
-
|
202
|
-
const { kcContext } = getKcContext();
|
203
|
-
|
204
|
-
const myClassName = css({ "color": "red" });
|
205
|
-
|
206
|
-
reactDom.render(
|
207
|
-
// Unless the app is currently being served by Keycloak
|
208
|
-
// kcContext is undefined.
|
209
|
-
kcContext !== undefined ? (
|
210
|
-
<KcApp
|
211
|
-
kcContext={kcContext}
|
212
|
-
{...{
|
213
|
-
...defaultKcProps,
|
214
|
-
"kcHeaderWrapperClass": myClassName,
|
215
|
-
}}
|
216
|
-
/>
|
217
|
-
) : (
|
218
|
-
<App />
|
219
|
-
), // Your actual app
|
220
|
-
document.getElementById("root"),
|
221
|
-
);
|
222
|
-
```
|
223
|
-
|
224
|
-
<p align="center">
|
225
|
-
<i>result:</i></br>
|
226
|
-
<img src="https://user-images.githubusercontent.com/6702424/114326299-6892fc00-9b34-11eb-8d75-85696e55458f.png">
|
227
|
-
</p>
|
228
|
-
|
229
|
-
Example of a customization using only CSS: [here](https://github.com/InseeFrLab/onyxia-web/blob/012639d62327a9a56be80c46e32c32c9497b82db/src/app/components/KcApp.tsx)
|
230
|
-
(the [index.tsx](https://github.com/InseeFrLab/onyxia-web/blob/012639d62327a9a56be80c46e32c32c9497b82db/src/app/index.tsx#L89-L94) )
|
231
|
-
and the result you can expect:
|
232
|
-
|
233
|
-
<p align="center">
|
234
|
-
<img src="https://github.com/InseeFrLab/keycloakify/releases/download/v0.3.8/keycloakify_after.gif">
|
235
32
|
</p>
|
236
33
|
|
237
|
-
### Advanced pages configuration
|
238
|
-
|
239
|
-
If you want to go beyond only customizing the CSS you can re-implement some of the
|
240
|
-
pages or even add new ones.
|
241
|
-
|
242
|
-
If you want to go this way checkout the demo setup provided [here](https://github.com/garronej/keycloakify-demo-app/tree/look_and_feel).
|
243
|
-
If you prefer a real life example you can checkout [onyxia-web's source](https://github.com/InseeFrLab/onyxia-web/tree/main/src/ui/components/KcApp).
|
244
|
-
The web app is in production [here](https://datalab.sspcloud.fr).
|
245
|
-
|
246
|
-
Main takeaways are:
|
247
|
-
|
248
|
-
- You must declare your custom pages in the package.json. [example](https://github.com/garronej/keycloakify-demo-app/blob/4eb2a9f63e9823e653b2d439495bda55e5ecc134/package.json#L17-L22)
|
249
|
-
- (TS only) You must declare theses page in the type argument of the getter
|
250
|
-
function for the `kcContext` in order to have the correct typings. [example](https://github.com/garronej/keycloakify-demo-app/blob/4eb2a9f63e9823e653b2d439495bda55e5ecc134/src/KcApp/kcContext.ts#L16-L21)
|
251
|
-
- (TS only) If you use Keycloak plugins that defines non standard `.ftl` values
|
252
|
-
(Like for example [this plugin](https://github.com/micedre/keycloak-mail-whitelisting)
|
253
|
-
that define `authorizedMailDomains` in `register.ftl`) you should
|
254
|
-
declare theses value to get the type. [example](https://github.com/garronej/keycloakify-demo-app/blob/4eb2a9f63e9823e653b2d439495bda55e5ecc134/src/KcApp/kcContext.ts#L6-L13)
|
255
|
-
- You should provide sample data for all the non standard value if you want to be able
|
256
|
-
to debug the page outside of keycloak. [example](https://github.com/garronej/keycloakify-demo-app/blob/4eb2a9f63e9823e653b2d439495bda55e5ecc134/src/KcApp/kcContext.ts#L28-L43)
|
257
|
-
|
258
|
-
### Hot reload
|
259
|
-
|
260
|
-
Rebuild the theme each time you make a change to see the result is not practical.
|
261
|
-
If you want to test your login screens outside of Keycloak you can mock a given `kcContext`:
|
262
|
-
|
263
|
-
```tsx
|
264
|
-
import {
|
265
|
-
KcApp,
|
266
|
-
defaultKcProps,
|
267
|
-
getKcContext
|
268
|
-
} from "keycloakify";
|
269
|
-
|
270
|
-
const { kcContext } = getKcContext({
|
271
|
-
"mockPageId": "login.ftl"
|
272
|
-
});
|
273
|
-
|
274
|
-
reactDom.render(
|
275
|
-
<KcApp
|
276
|
-
kcContext={kcContextMocks.kcLoginContext}
|
277
|
-
{...defaultKcProps}
|
278
|
-
/>
|
279
|
-
document.getElementById("root")
|
280
|
-
);
|
281
|
-
```
|
282
|
-
|
283
|
-
Then `yarn start`, you will see your login page.
|
284
|
-
|
285
|
-
Checkout [this concrete example](https://github.com/garronej/keycloakify-demo-app/blob/main/src/index.tsx)
|
286
|
-
|
287
|
-
## Enable loading in a blink of an eye of login pages β‘ (--external-assets)
|
288
|
-
|
289
|
-
By default the theme generated is standalone. Meaning that when your users
|
290
|
-
reach the login pages all scripts, images and stylesheet are downloaded from the Keycloak server.
|
291
|
-
If you are specifically building a theme to integrate with an app or a website that allows users
|
292
|
-
to first browse unauthenticated before logging in, you will get a significant
|
293
|
-
performance boost if you jump through those hoops:
|
294
|
-
|
295
|
-
- Provide the url of your app in the `homepage` field of package.json. [ex](https://github.com/garronej/keycloakify-demo-app/blob/7847cc70ef374ab26a6cc7953461cf25603e9a6d/package.json#L2) or in a `public/CNAME` file. [ex](https://github.com/garronej/keycloakify-demo-app/blob/main/public/CNAME).
|
296
|
-
- Build the theme using `npx build-keycloak-theme --external-assets` [ex](https://github.com/garronej/keycloakify-demo-app/blob/7847cc70ef374ab26a6cc7953461cf25603e9a6d/.github/workflows/ci.yaml#L21)
|
297
|
-
- Enable [long-term assets caching](https://create-react-app.dev/docs/production-build/#static-file-caching) on the server hosting your app.
|
298
|
-
- Make sure not to build your app and the keycloak theme separately
|
299
|
-
and remember to update the Keycloak theme every time you update your app.
|
300
|
-
- Be mindful that if your app is down your login pages are down as well.
|
301
|
-
|
302
|
-
Checkout a complete setup [here](https://github.com/garronej/keycloakify-demo-app#about-keycloakify)
|
303
|
-
|
304
|
-
# Email template customization.
|
305
|
-
|
306
|
-
_Introduced in [v4.8.0](https://github.com/InseeFrLab/keycloakify/releases/tag/v4.8.0)_
|
307
|
-
|
308
|
-
It is now possible to customize the emails sent to your users to confirm their email address ect.
|
309
|
-
Just run `npx create-keycloak-theme-email-directory`, it will create a `keycloak_theme_email` directory
|
310
|
-
at the root of your project.
|
311
|
-
This directory should be tracked by Git (`yarn add -A`)
|
312
|
-
You can start hacking the default template.
|
313
|
-
When `npx build-keycloak-theme` (`yarn keycloak`) is run. If the directory `keycloak_theme_email` exists
|
314
|
-
at the root of your project, it will be bundled into your `.jar` file and you will be able to select
|
315
|
-
it [in the Keycloak administration pages](https://user-images.githubusercontent.com/6702424/164299589-75f8008b-b24e-4836-ad6b-72149bb55621.png).
|
316
|
-
|
317
|
-
# User profile and frontend form validation
|
318
|
-
|
319
34
|
<p align="center">
|
320
|
-
<a href="https://
|
321
|
-
|
322
|
-
</a>
|
35
|
+
<i>Ultimately this build tool generates a Keycloak theme <a href="https://www.keycloakify.dev">Learn more</a></i>
|
36
|
+
<img src="https://user-images.githubusercontent.com/6702424/110260457-a1c3d380-7fac-11eb-853a-80459b65626b.png">
|
323
37
|
</p>
|
324
38
|
|
325
|
-
NOTE: In reality the regexp used in this gif doesn't work server side, the regexp pattern should be `^[^@]@gmail\.com$` π¬.
|
326
|
-
|
327
|
-
User Profile is a Keycloak feature that enables to
|
328
|
-
[define, from the admin console](https://user-images.githubusercontent.com/6702424/136872461-1f5b64ef-d2ef-4c6b-bb8d-07d4729552b3.png),
|
329
|
-
what information you want to collect on your users in the register page and to validate inputs
|
330
|
-
[**on the frontend**, in realtime](https://github.com/InseeFrLab/keycloakify/blob/6dca6a93d8cfe634ee4d8574ad0c091641220092/src/lib/getKcContext/KcContextBase.ts#L225-L261)!
|
331
|
-
|
332
|
-
NOTE: User profile is only available in Keycloak 15 and it's a beta feature that
|
333
|
-
[needs to be enabled when launching keycloak](https://github.com/InseeFrLab/keycloakify/blob/59f106bf9e210b63b190826da2bf5f75fc8b7644/src/bin/build-keycloak-theme/build-keycloak-theme.ts#L116-L117)
|
334
|
-
and [enabled in the console](https://user-images.githubusercontent.com/6702424/136874428-b071d614-c7f7-440d-9b2e-670faadc0871.png).
|
335
|
-
|
336
|
-
Keycloakify, in [`register-user-profile.ftl`](https://github.com/InseeFrLab/keycloakify/blob/main/src/lib/components/RegisterUserProfile.tsx),
|
337
|
-
provides frontend validation out of the box.
|
338
|
-
|
339
|
-
For implementing your own `register-user-profile.ftl` page, you can use [`import { useFormValidationSlice } from "keycloakify";`](https://github.com/InseeFrLab/keycloakify/blob/main/src/lib/useFormValidationSlice.tsx).
|
340
|
-
Find usage example [`here`](https://github.com/InseeFrLab/keycloakify/blob/d3a07edfcb3739e30032dc96fc2a55944dfc3387/src/lib/components/RegisterUserProfile.tsx#L79-L112).
|
341
|
-
|
342
|
-
As for right now [it's not possible to define a pattern for the password](https://keycloak.discourse.group/t/make-password-policies-available-to-freemarker/11632)
|
343
|
-
from the admin console. You can however pass validators for it to the `useFormValidationSlice` function.
|
344
|
-
|
345
|
-
# Support for Terms and conditions
|
346
|
-
|
347
|
-
[Many organizations have a requirement that when a new user logs in for the first time, they need to agree to the terms and conditions of the website.](https://www.keycloak.org/docs/4.8/server_admin/#terms-and-conditions).
|
348
|
-
|
349
|
-
First you need to enable the required action on the Keycloak server admin console:
|
350
|
-

|
351
|
-
|
352
|
-
Then to load your own therms of services using [like this](https://github.com/garronej/keycloakify-demo-app/blob/8168c928a66605f2464f9bd28a4dc85fb0a231f9/src/index.tsx#L42-L66).
|
353
|
-
|
354
|
-
# Some pages still have the default theme. Why?
|
355
|
-
|
356
|
-
This project only support out of the box the most common user facing pages of Keycloak login.
|
357
|
-
[Here](https://user-images.githubusercontent.com/6702424/116787906-227fe700-aaa7-11eb-92ee-22e7673717c2.png) is the complete list of pages (you get them after running `yarn test`)
|
358
|
-
and [here](https://github.com/InseeFrLab/keycloakify/tree/main/src/lib/components) are the pages currently implemented by this module.
|
359
|
-
If you need to customize pages that are not supported yet or if you need to implement some non standard `.ftl` pages please refer to [Advanced pages configuration](#advanced-pages-configuration).
|
360
|
-
|
361
|
-
# GitHub Actions
|
362
|
-
|
363
|
-

|
364
|
-
|
365
|
-
[Here is a demo repo](https://github.com/garronej/keycloakify-demo-app) to show how to automate
|
366
|
-
the building and publishing of the theme (the .jar file).
|
367
|
-
|
368
|
-
# Limitations
|
369
|
-
|
370
|
-
## `process.env.PUBLIC_URL` not supported.
|
371
|
-
|
372
|
-
You won't be able to [import things from your public directory **in your JavaScript code** (it's supported in `public/index.html`)](https://create-react-app.dev/docs/using-the-public-folder/#adding-assets-outside-of-the-module-system).
|
373
|
-
(This isn't recommended anyway).
|
374
|
-
|
375
|
-
## `@font-face` importing fonts from the `src/` dir
|
376
|
-
|
377
|
-
If you are building the theme with [--external-assets](#enable-loading-in-a-blink-of-a-eye-of-login-pages-)
|
378
|
-
this limitation doesn't apply, you can import fonts however you see fit.
|
379
|
-
|
380
|
-
### Example of setup that **won't** work
|
381
|
-
|
382
|
-
- We have a `fonts/` directory in `src/`
|
383
|
-
- We import the font like this [`src: url("/fonts/my-font.woff2") format("woff2");`](https://github.com/garronej/keycloakify-demo-app/blob/07d54a3012ef354ee12b1374c6f7ad1cb125d56b/src/fonts.scss#L4) in a `.scss` a file.
|
384
|
-
|
385
|
-
### Possible workarounds
|
386
|
-
|
387
|
-
- Use [`--external-assets`](#enable-loading-in-a-blink-of-a-eye-of-login-pages-).
|
388
|
-
- If it is possible, use Google Fonts or any other font provider.
|
389
|
-
- If you want to host your font recommended approach is to move your fonts into the `public`
|
390
|
-
directory and to place your `@font-face` statements in the `public/index.html`.
|
391
|
-
Example [here](https://github.com/garronej/keycloakify-demo-app/blob/9aa2dbaec28a7786d6b2983c9a59d393dec1b2d6/public/index.html#L27-L73)
|
392
|
-
(and the font are [here](https://github.com/garronej/keycloakify-demo-app/tree/main/public/fonts/WorkSans)).
|
393
|
-
- You can also [use non relative url](https://github.com/garronej/keycloakify-demo-app/blob/2de8a9eb6f5de9c94f9cd3991faad0377e63268c/src/fonts.scss#L16) but don't forget [`Access-Control-Allow-Origin`](https://github.com/garronej/keycloakify-demo-app/blob/2de8a9eb6f5de9c94f9cd3991faad0377e63268c/nginx.conf#L17-L19).
|
394
|
-
|
395
|
-
# Implement context persistence (optional)
|
396
|
-
|
397
|
-
If, before logging in, a user has selected a specific language
|
398
|
-
you don't want it to be reset to default when the user gets redirected to
|
399
|
-
the login or register pages.
|
400
|
-
|
401
|
-
Same goes for the dark mode, you don't want, if the user had it enabled
|
402
|
-
to show the login page with light themes.
|
403
|
-
|
404
|
-
The problem is that you are probably using `localStorage` to persist theses values across
|
405
|
-
reload but, as the Keycloak pages are not served on the same domain that the rest of your
|
406
|
-
app you won't be able to carry over states using `localStorage`.
|
407
|
-
|
408
|
-
The only reliable solution is to inject parameters into the URL before
|
409
|
-
redirecting to Keycloak. We integrate with
|
410
|
-
[`keycloak-js`](https://github.com/keycloak/keycloak-documentation/blob/master/securing_apps/topics/oidc/javascript-adapter.adoc),
|
411
|
-
by providing you a way to tell `keycloak-js` that you would like to inject
|
412
|
-
some search parameters before redirecting.
|
413
|
-
|
414
|
-
The method also works with [`@react-keycloak/web`](https://www.npmjs.com/package/@react-keycloak/web) (use the `initOptions`).
|
415
|
-
|
416
|
-
You can implement your own mechanism to pass the states in the URL and
|
417
|
-
restore it on the other side but we recommend using `powerhooks/useGlobalState`
|
418
|
-
from the library [`powerhooks`](https://www.powerhooks.dev) that provide an elegant
|
419
|
-
way to handle states such as `isDarkModeEnabled` or `selectedLanguage`.
|
420
|
-
|
421
|
-
Let's modify [the example](https://github.com/keycloak/keycloak-documentation/blob/master/securing_apps/topics/oidc/javascript-adapter.adoc) from the official `keycloak-js` documentation to
|
422
|
-
enables the states of `useGlobalStates` to be injected in the URL before redirecting.
|
423
|
-
Note that the states are automatically restored on the other side by `powerhooks`
|
424
|
-
|
425
|
-
```typescript
|
426
|
-
import keycloak_js from "keycloak-js";
|
427
|
-
import { injectGlobalStatesInSearchParams } from "powerhooks/useGlobalState";
|
428
|
-
import { createKeycloakAdapter } from "keycloakify";
|
429
|
-
|
430
|
-
//...
|
431
|
-
|
432
|
-
const keycloakInstance = keycloak_js({
|
433
|
-
"url": "http://keycloak-server/auth",
|
434
|
-
"realm": "myrealm",
|
435
|
-
"clientId": "myapp",
|
436
|
-
});
|
437
|
-
|
438
|
-
keycloakInstance.init({
|
439
|
-
"onLoad": "check-sso",
|
440
|
-
"silentCheckSsoRedirectUri": window.location.origin + "/silent-check-sso.html",
|
441
|
-
"adapter": createKeycloakAdapter({
|
442
|
-
"transformUrlBeforeRedirect": injectGlobalStatesInSearchParams,
|
443
|
-
keycloakInstance,
|
444
|
-
}),
|
445
|
-
});
|
446
|
-
|
447
|
-
//...
|
448
|
-
```
|
449
|
-
|
450
|
-
If you really want to go the extra miles and avoid having the white
|
451
|
-
flash of the blank html before the js bundle have been evaluated
|
452
|
-
[here is a snippet](https://github.com/InseeFrLab/onyxia-web/blob/e1c1f309aaa3d5f860df39ba0b75cce89c88a9de/public/index.html#L117-L166) that you can place in your `public/index.html` if you are using `powerhooks/useGlobalState`.
|
453
|
-
|
454
|
-
# Kickstart video
|
455
|
-
|
456
|
-
_NOTE: keycloak-react-theming was renamed keycloakify since this video was recorded_
|
457
|
-
[](https://youtu.be/xTz0Rj7i2v8)
|
458
|
-
|
459
|
-
# FTL errors related to `ftl_object_to_js_code_declaring_an_object` in Keycloak logs.
|
460
|
-
|
461
|
-
If you ever encounter one of these errors:
|
462
|
-
|
463
|
-
```log
|
464
|
-
FTL stack trace ("~" means nesting-related):
|
465
|
-
- Failed at: #local value = object[key] [in template "login.ftl" in macro "ftl_object_to_js_code_declaring_an_object" at line 70, column 21]
|
466
|
-
- Reached through: @compress [in template "login.ftl" in macro "ftl_object_to_js_code_declaring_an_object" at line 36, column 5]
|
467
|
-
- Reached through: @ftl_object_to_js_code_declaring_an_object object=value depth=(dep... [in template "login.ftl" in macro "ftl_object_to_js_code_declaring_an_object" at line 81, column 27]
|
468
|
-
- Reached through: @compress [in template "login.ftl" in macro "ftl_object_to_js_code_declaring_an_object" at line 36, column 5]
|
469
|
-
- Reached through: @ftl_object_to_js_code_declaring_an_object object=(.data_model) de... [in template "login.ftl" at line 163, column 43]
|
470
|
-
```
|
471
|
-
|
472
|
-
It's just noise, they can be safely ignored.
|
473
|
-
You can, however, and are encouraged to, report any that you would spot.
|
474
|
-
Just open an issue about it and I will release a patched version of Keycloakify in the better delays.
|
475
|
-
|
476
|
-
# Adding custom message (to `i18n/useKcMessage.tsx`)
|
477
|
-
|
478
|
-
You can reproduce [this approach](https://github.com/garronej/keycloakify-demo-app/blob/main/src/kcMessagesExtension.ts)
|
479
|
-
( don't forget to [evaluate the code](https://github.com/garronej/keycloakify-demo-app/blob/0a6d349dba89a5702f98ba48bca6c76ac7265e1f/src/index.tsx#L15) ).
|
480
|
-
This approach is a bit hacky as it doesn't provide type safety but it works.
|
481
|
-
|
482
|
-
# Downloading builtin theme resource files
|
483
|
-
|
484
|
-
Running `npx download-builtin-keycloak-theme` will let you download the themes that comes by default with
|
485
|
-
a Keycloak version of your choosing.
|
486
|
-
|
487
|
-
[Video demo](https://user-images.githubusercontent.com/6702424/164304458-934b0e1d-9de7-4bb4-8a1c-e06a70b1636a.mov)
|
488
|
-
|
489
|
-
# Email domain whitelist
|
490
|
-
|
491
|
-
NOTE: This have been kind of deprecated by [user attribute](#user-profile-and-frontend-form-validation) you could
|
492
|
-
use a pattern [like this one](https://github.com/InseeFrLab/onyxia-web/blob/f1206e0329b3b8d401ca7bffa95ca9c213cb190a/src/app/components/KcApp/kcContext.ts#L106) to whitelist email domains.
|
493
|
-
|
494
|
-
If you want to restrict the emails domain that can register, you can use [this plugin](https://github.com/micedre/keycloak-mail-whitelisting)
|
495
|
-
and `kcRegisterContext["authorizedMailDomains"]` to validate on.
|
496
|
-
|
497
39
|
# Changelog highlights
|
498
40
|
|
499
41
|
## v4.8.0
|
@@ -144,7 +144,7 @@ function main() {
|
|
144
144
|
"Once your container is up and running: ",
|
145
145
|
"- Log into the admin console π http://localhost:8080/admin username: admin, password: admin π",
|
146
146
|
'- Create a realm named "myrealm"',
|
147
|
-
'- Create a client with
|
147
|
+
'- Create a client with ID: "myclient", "Root URL": "https://www.keycloak.org/app/" and "Valid redirect URIs": "https://www.keycloak.org/app/*"',
|
148
148
|
"- Select Login Theme: " + themeName + " (don't forget to save at the bottom of the page)",
|
149
149
|
"- Go to \uD83D\uDC49 https://www.keycloak.org/app/ \uD83D\uDC48 Click \"Save\" then \"Sign in\". You should see your login page",
|
150
150
|
"",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build-keycloak-theme.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/build-keycloak-theme.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mFAAkF;AAClF,mEAAkE;AAClE,6BAA4F;AAC5F,2DAA+C;AAC/C,iGAAgG;AAChG,2BAA0B;AAC1B,qCAAyB;AAQzB,IAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE1C,IAAM,mBAAmB,GAAG,CAAA,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,0CAAE,WAAW,EAAE,MAAK,mBAAmB,CAAC;AAEnF,IAAM,iBAAiB,GAAsB,OAAO,CAAC,IAAA,WAAQ,EAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC,CAAC;AAEvF,QA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wBAAwB;KAC9C,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CACP;QACI,EAAE;QACF,sEAA+D,IAAA,eAAY,EAAC,mBAAmB,EAAE,WAAW,CAAC,kBAAK;QAClH,8HAA4H;QAC5H,EAAE;QACF,2EAA2E;QAC3E,EAAE;QACF,cAAc;QACd,4BAA4B;QAC5B,oCAAoC;QACpC,kCAAkC;QAClC,yCAAyC;QACzC,oBAAoB;QACpB,kBAAkB;QAClB,iBAAiB;QACjB,kBAAkB;QAClB,gDAA8C,IAAA,eAAY,EAAC,WAAW,CAAC,4BAAuB,IAAA,eAAY,EAAC,WAAW,CAAG;QACzH,yBAAyB;QACzB,gCAAgC;QAChC,sCAAsC;QACtC,UAAU;QACV,8BAA8B;QAC9B,gCAAgC;QAChC,qEAAqE;QACrE,iBAAiB;QACjB,2BAA2B;QAC3B,oBAAoB;QACpB,+BAA+B;QAC/B,wBAAwB;QACxB,uBAAuB;QACvB,yCAAyC;QACzC,EAAE;QACF,EAAE;QACF,2DAAyD,wBAAwB,2DAAwD;QACzI,EAAE;QACF,sBAAU,IAAA,eAAY,EAAC,mBAAmB,EAAE,IAAA,WAAQ,EAAC,oCAA4B,EAAE,6EAAqC,CAAC,QAAQ,CAAC,CAAC,kBAAK;QACxI,EAAE;QACF,mJAAmJ;QACnJ,EAAE;QACF,yCAAyC;QACzC,iGAAiG;QACjG,kCAAkC;QAClC,
|
1
|
+
{"version":3,"file":"build-keycloak-theme.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/build-keycloak-theme.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mFAAkF;AAClF,mEAAkE;AAClE,6BAA4F;AAC5F,2DAA+C;AAC/C,iGAAgG;AAChG,2BAA0B;AAC1B,qCAAyB;AAQzB,IAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE1C,IAAM,mBAAmB,GAAG,CAAA,MAAA,OAAO,CAAC,IAAI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_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|
122
122
|
key == "updateProfileCtx" &&
|
123
123
|
are_same_path(path, [])
|
124
124
|
) || (
|
125
|
-
<#-- https://github.com/InseeFrLab/keycloakify/pull/65#issuecomment-991896344 -->
|
125
|
+
<#-- https://github.com/InseeFrLab/keycloakify/pull/65#issuecomment-991896344 (reports with saml-post-form.ftl) -->
|
126
|
+
<#-- https://github.com/InseeFrLab/keycloakify/issues/91#issue-1212319466 (reports with error.ftl and Kc18) -->
|
126
127
|
key == "loginAction" &&
|
127
128
|
are_same_path(path, ["url"]) &&
|
128
|
-
|
129
|
+
["saml-post-form.ftl", "error.ftl"]?seq_contains(pageId)
|
129
130
|
) || (
|
130
131
|
["contextData", "idpConfig", "idp", "authenticationSession"]?seq_contains(key) &&
|
131
132
|
are_same_path(path, ["brokerContext"]) &&
|
@@ -35,6 +35,31 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
36
|
}
|
37
37
|
};
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
40
|
+
if (!m) return o;
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
42
|
+
try {
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
44
|
+
}
|
45
|
+
catch (error) { e = { error: error }; }
|
46
|
+
finally {
|
47
|
+
try {
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
49
|
+
}
|
50
|
+
finally { if (e) throw e.error; }
|
51
|
+
}
|
52
|
+
return ar;
|
53
|
+
};
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
55
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
56
|
+
if (ar || !(i in from)) {
|
57
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
58
|
+
ar[i] = from[i];
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
62
|
+
};
|
38
63
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
39
64
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
40
65
|
};
|
@@ -45,9 +70,9 @@ var rest_1 = require("@octokit/rest");
|
|
45
70
|
var cli_select_1 = __importDefault(require("cli-select"));
|
46
71
|
function promptKeycloakVersion() {
|
47
72
|
return __awaiter(this, void 0, void 0, function () {
|
48
|
-
var getLatestsSemVersionedTag, tags, keycloakVersion;
|
49
|
-
return __generator(this, function (
|
50
|
-
switch (
|
73
|
+
var getLatestsSemVersionedTag, tags, _a, keycloakVersion;
|
74
|
+
return __generator(this, function (_b) {
|
75
|
+
switch (_b.label) {
|
51
76
|
case 0:
|
52
77
|
getLatestsSemVersionedTag = (function () {
|
53
78
|
var octokit = (function () {
|
@@ -59,8 +84,9 @@ function promptKeycloakVersion() {
|
|
59
84
|
return { getLatestsSemVersionedTag: getLatestsSemVersionedTag };
|
60
85
|
})().getLatestsSemVersionedTag;
|
61
86
|
console.log("Initialize the directory with email template from which keycloak version?");
|
87
|
+
_a = [[]];
|
62
88
|
return [4 /*yield*/, getLatestsSemVersionedTag({
|
63
|
-
"count":
|
89
|
+
"count": 10,
|
64
90
|
"doIgnoreBeta": true,
|
65
91
|
"owner": "keycloak",
|
66
92
|
"repo": "keycloak",
|
@@ -69,7 +95,9 @@ function promptKeycloakVersion() {
|
|
69
95
|
return tag;
|
70
96
|
}); })];
|
71
97
|
case 1:
|
72
|
-
tags = _a.sent()
|
98
|
+
tags = __spreadArray.apply(void 0, [__spreadArray.apply(void 0, _a.concat([__read.apply(void 0, [(_b.sent())]), false])), [
|
99
|
+
"11.0.3",
|
100
|
+
], false]);
|
73
101
|
if (process.env["GITHUB_ACTIONS"] === "true") {
|
74
102
|
return [2 /*return*/, { "keycloakVersion": tags[0] }];
|
75
103
|
}
|
@@ -80,7 +108,7 @@ function promptKeycloakVersion() {
|
|
80
108
|
process.exit(-1);
|
81
109
|
})];
|
82
110
|
case 2:
|
83
|
-
keycloakVersion = (
|
111
|
+
keycloakVersion = (_b.sent()).value;
|
84
112
|
console.log(keycloakVersion);
|
85
113
|
return [2 /*return*/, { keycloakVersion: keycloakVersion }];
|
86
114
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"promptKeycloakVersion.js","sourceRoot":"","sources":["../src/bin/promptKeycloakVersion.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"promptKeycloakVersion.js","sourceRoot":"","sources":["../src/bin/promptKeycloakVersion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAAoG;AACpG,sCAAwC;AACxC,0DAAmC;AAEnC,SAAsB,qBAAqB;;;;;;oBAC/B,yBAAyB,GAAK,CAAC;wBAC3B,IAAA,OAAO,GAAK,CAAC;4BACjB,IAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;4BAE7C,IAAM,OAAO,GAAG,IAAI,cAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;4BAE7F,OAAO,EAAE,OAAO,SAAA,EAAE,CAAC;wBACvB,CAAC,CAAC,EAAE,QANW,CAMV;wBAEG,IAAA,yBAAyB,GAAK,IAAA,4DAAgC,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,0BAAlD,CAAmD;wBAEpF,OAAO,EAAE,yBAAyB,2BAAA,EAAE,CAAC;oBACzC,CAAC,CAAC,EAAE,0BAZ6B,CAY5B;oBAEL,OAAO,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC;;oBAGjF,qBAAM,yBAAyB,CAAC;4BAChC,OAAO,EAAE,EAAE;4BACX,cAAc,EAAE,IAAI;4BACpB,OAAO,EAAE,UAAU;4BACnB,MAAM,EAAE,UAAU;yBACrB,CAAC,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,GAAG,CAAC,UAAC,EAAO;gCAAL,GAAG,SAAA;4BAAO,OAAA,GAAG;wBAAH,CAAG,CAAC,EAAzB,CAAyB,CAAC,EAAA;;oBANvC,IAAI,6FACH,CAAC,SAKqC,CAAC;4BAC1C,QAAQ;kCACX;oBAED,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,MAAM,EAAE;wBAC1C,sBAAO,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAC;qBACzC;oBAEkC,qBAAM,IAAA,oBAAS,EAAS;4BACvD,QAAQ,EAAE,IAAI;yBACjB,CAAC,CAAC,KAAK,CAAC;4BACL,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;4BAExB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBACrB,CAAC,CAAC,EAAA;;oBANa,eAAe,GAAK,CAAA,SAMjC,CAAA,MAN4B;oBAQ9B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;oBAE7B,sBAAO,EAAE,eAAe,iBAAA,EAAE,EAAC;;;;CAC9B;AA1CD,sDA0CC"}
|
package/package.json
CHANGED
@@ -143,7 +143,7 @@ export function main() {
|
|
143
143
|
"Once your container is up and running: ",
|
144
144
|
"- Log into the admin console π http://localhost:8080/admin username: admin, password: admin π",
|
145
145
|
'- Create a realm named "myrealm"',
|
146
|
-
'- Create a client with
|
146
|
+
'- Create a client with ID: "myclient", "Root URL": "https://www.keycloak.org/app/" and "Valid redirect URIs": "https://www.keycloak.org/app/*"',
|
147
147
|
`- Select Login Theme: ${themeName} (don't forget to save at the bottom of the page)`,
|
148
148
|
`- Go to π https://www.keycloak.org/app/ π Click "Save" then "Sign in". You should see your login page`,
|
149
149
|
"",
|
package/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl
CHANGED
@@ -122,10 +122,11 @@ ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
|
122
122
|
key == "updateProfileCtx" &&
|
123
123
|
are_same_path(path, [])
|
124
124
|
) || (
|
125
|
-
<#-- https://github.com/InseeFrLab/keycloakify/pull/65#issuecomment-991896344 -->
|
125
|
+
<#-- https://github.com/InseeFrLab/keycloakify/pull/65#issuecomment-991896344 (reports with saml-post-form.ftl) -->
|
126
|
+
<#-- https://github.com/InseeFrLab/keycloakify/issues/91#issue-1212319466 (reports with error.ftl and Kc18) -->
|
126
127
|
key == "loginAction" &&
|
127
128
|
are_same_path(path, ["url"]) &&
|
128
|
-
|
129
|
+
["saml-post-form.ftl", "error.ftl"]?seq_contains(pageId)
|
129
130
|
) || (
|
130
131
|
["contextData", "idpConfig", "idp", "authenticationSession"]?seq_contains(key) &&
|
131
132
|
are_same_path(path, ["brokerContext"]) &&
|
@@ -19,12 +19,15 @@ export async function promptKeycloakVersion() {
|
|
19
19
|
|
20
20
|
console.log("Initialize the directory with email template from which keycloak version?");
|
21
21
|
|
22
|
-
const tags =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
const tags = [
|
23
|
+
...(await getLatestsSemVersionedTag({
|
24
|
+
"count": 10,
|
25
|
+
"doIgnoreBeta": true,
|
26
|
+
"owner": "keycloak",
|
27
|
+
"repo": "keycloak",
|
28
|
+
}).then(arr => arr.map(({ tag }) => tag))),
|
29
|
+
"11.0.3",
|
30
|
+
];
|
28
31
|
|
29
32
|
if (process.env["GITHUB_ACTIONS"] === "true") {
|
30
33
|
return { "keycloakVersion": tags[0] };
|