keycloakify 6.0.3 → 6.3.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 +8 -1
- package/bin/create-keycloak-email-directory.js +9 -4
- package/bin/create-keycloak-email-directory.js.map +1 -1
- package/bin/download-builtin-keycloak-theme.d.ts +1 -0
- package/bin/download-builtin-keycloak-theme.js +13 -6
- package/bin/download-builtin-keycloak-theme.js.map +1 -1
- package/bin/generate-i18n-messages.js +8 -3
- package/bin/generate-i18n-messages.js.map +1 -1
- package/bin/keycloakify/BuildOptions.d.ts +2 -0
- package/bin/keycloakify/BuildOptions.js +3 -2
- package/bin/keycloakify/BuildOptions.js.map +1 -1
- package/bin/keycloakify/generateFtl/generateFtl.d.ts +1 -1
- package/bin/keycloakify/generateFtl/generateFtl.js +3 -1
- package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
- package/bin/keycloakify/generateKeycloakThemeResources.d.ts +1 -0
- package/bin/keycloakify/generateKeycloakThemeResources.js +5 -2
- package/bin/keycloakify/generateKeycloakThemeResources.js.map +1 -1
- package/bin/keycloakify/keycloakify.js +8 -4
- package/bin/keycloakify/keycloakify.js.map +1 -1
- package/bin/tools/cliOptions.d.ts +5 -0
- package/bin/tools/cliOptions.js +16 -0
- package/bin/tools/cliOptions.js.map +1 -0
- package/bin/tools/downloadAndUnzip.d.ts +1 -0
- package/bin/tools/downloadAndUnzip.js +1 -1
- package/bin/tools/downloadAndUnzip.js.map +1 -1
- package/bin/tools/logger.d.ts +12 -0
- package/bin/tools/logger.js +23 -0
- package/bin/tools/logger.js.map +1 -0
- package/bin/tsconfig.tsbuildinfo +1 -1
- package/lib/components/IdpReviewUserProfile.d.ts +9 -0
- package/lib/components/IdpReviewUserProfile.js +31 -0
- package/lib/components/IdpReviewUserProfile.js.map +1 -0
- package/lib/components/KcApp.js +6 -0
- package/lib/components/KcApp.js.map +1 -1
- package/lib/components/RegisterUserProfile.js +2 -61
- package/lib/components/RegisterUserProfile.js.map +1 -1
- package/lib/components/UpdateUserProfile.d.ts +9 -0
- package/lib/components/UpdateUserProfile.js +32 -0
- package/lib/components/UpdateUserProfile.js.map +1 -0
- package/lib/components/shared/UserProfileCommons.d.ts +16 -0
- package/lib/components/shared/UserProfileCommons.js +76 -0
- package/lib/components/shared/UserProfileCommons.js.map +1 -0
- package/lib/getKcContext/KcContextBase.d.ts +16 -1
- package/lib/getKcContext/KcContextBase.js.map +1 -1
- package/lib/getKcContext/getKcContext.js +6 -3
- package/lib/getKcContext/getKcContext.js.map +1 -1
- package/lib/getKcContext/kcContextMocks/kcContextMocks.js +107 -98
- package/lib/getKcContext/kcContextMocks/kcContextMocks.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/useFormValidationSlice.d.ts +5 -1
- package/lib/useFormValidationSlice.js +4 -0
- package/lib/useFormValidationSlice.js.map +1 -1
- package/package.json +24 -2
- package/src/bin/create-keycloak-email-directory.ts +8 -3
- package/src/bin/download-builtin-keycloak-theme.ts +11 -5
- package/src/bin/generate-i18n-messages.ts +9 -3
- package/src/bin/keycloakify/BuildOptions.ts +5 -2
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +3 -1
- package/src/bin/keycloakify/generateKeycloakThemeResources.ts +6 -2
- package/src/bin/keycloakify/keycloakify.ts +8 -3
- package/src/bin/tools/cliOptions.ts +15 -0
- package/src/bin/tools/downloadAndUnzip.ts +8 -2
- package/src/bin/tools/logger.ts +27 -0
- package/src/lib/components/IdpReviewUserProfile.tsx +46 -0
- package/src/lib/components/KcApp.tsx +6 -0
- package/src/lib/components/RegisterUserProfile.tsx +3 -156
- package/src/lib/components/UpdateUserProfile.tsx +71 -0
- package/src/lib/components/shared/UserProfileCommons.tsx +170 -0
- package/src/lib/getKcContext/KcContextBase.ts +20 -1
- package/src/lib/getKcContext/getKcContext.ts +10 -4
- package/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts +113 -98
- package/src/lib/useFormValidationSlice.tsx +5 -1
- package/src/test/bin/generateKeycloakThemeResources.ts +2 -1
- package/src/test/bin/setupSampleReactProject.ts +2 -1
@@ -7,6 +7,100 @@ import { pathJoin } from "../../../bin/tools/pathJoin";
|
|
7
7
|
|
8
8
|
const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/";
|
9
9
|
|
10
|
+
const attributes: Attribute[] = [
|
11
|
+
{
|
12
|
+
"validators": {
|
13
|
+
"username-prohibited-characters": {
|
14
|
+
"ignore.empty.value": true
|
15
|
+
},
|
16
|
+
"up-username-has-value": {},
|
17
|
+
"length": {
|
18
|
+
"ignore.empty.value": true,
|
19
|
+
"min": "3",
|
20
|
+
"max": "255"
|
21
|
+
},
|
22
|
+
"up-duplicate-username": {},
|
23
|
+
"up-username-mutation": {}
|
24
|
+
},
|
25
|
+
"displayName": "${username}",
|
26
|
+
"annotations": {},
|
27
|
+
"required": true,
|
28
|
+
"groupAnnotations": {},
|
29
|
+
"autocomplete": "username",
|
30
|
+
"readOnly": false,
|
31
|
+
"name": "username",
|
32
|
+
"value": "xxxx"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"validators": {
|
36
|
+
"up-email-exists-as-username": {},
|
37
|
+
"length": {
|
38
|
+
"max": "255",
|
39
|
+
"ignore.empty.value": true
|
40
|
+
},
|
41
|
+
"up-blank-attribute-value": {
|
42
|
+
"error-message": "missingEmailMessage",
|
43
|
+
"fail-on-null": false
|
44
|
+
},
|
45
|
+
"up-duplicate-email": {},
|
46
|
+
"email": {
|
47
|
+
"ignore.empty.value": true
|
48
|
+
},
|
49
|
+
"pattern": {
|
50
|
+
"ignore.empty.value": true,
|
51
|
+
"pattern": "gmail\\.com$"
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"displayName": "${email}",
|
55
|
+
"annotations": {},
|
56
|
+
"required": true,
|
57
|
+
"groupAnnotations": {},
|
58
|
+
"autocomplete": "email",
|
59
|
+
"readOnly": false,
|
60
|
+
"name": "email"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"validators": {
|
64
|
+
"length": {
|
65
|
+
"max": "255",
|
66
|
+
"ignore.empty.value": true
|
67
|
+
},
|
68
|
+
"person-name-prohibited-characters": {
|
69
|
+
"ignore.empty.value": true
|
70
|
+
},
|
71
|
+
"up-immutable-attribute": {},
|
72
|
+
"up-attribute-required-by-metadata-value": {}
|
73
|
+
},
|
74
|
+
"displayName": "${firstName}",
|
75
|
+
"annotations": {},
|
76
|
+
"required": true,
|
77
|
+
"groupAnnotations": {},
|
78
|
+
"readOnly": false,
|
79
|
+
"name": "firstName"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"validators": {
|
83
|
+
"length": {
|
84
|
+
"max": "255",
|
85
|
+
"ignore.empty.value": true
|
86
|
+
},
|
87
|
+
"person-name-prohibited-characters": {
|
88
|
+
"ignore.empty.value": true
|
89
|
+
},
|
90
|
+
"up-immutable-attribute": {},
|
91
|
+
"up-attribute-required-by-metadata-value": {}
|
92
|
+
},
|
93
|
+
"displayName": "${lastName}",
|
94
|
+
"annotations": {},
|
95
|
+
"required": true,
|
96
|
+
"groupAnnotations": {},
|
97
|
+
"readOnly": false,
|
98
|
+
"name": "lastName"
|
99
|
+
}
|
100
|
+
];
|
101
|
+
|
102
|
+
const attributesByName = Object.fromEntries(attributes.map(attribute => [attribute.name, attribute])) as any;
|
103
|
+
|
10
104
|
export const kcContextCommonMock: KcContextBase.Common = {
|
11
105
|
"url": {
|
12
106
|
"loginAction": "#",
|
@@ -200,104 +294,8 @@ export const kcContextMocks: KcContextBase[] = [
|
|
200
294
|
...registerCommon,
|
201
295
|
"profile": {
|
202
296
|
"context": "REGISTRATION_PROFILE" as const,
|
203
|
-
|
204
|
-
|
205
|
-
{
|
206
|
-
"validators": {
|
207
|
-
"username-prohibited-characters": {
|
208
|
-
"ignore.empty.value": true
|
209
|
-
},
|
210
|
-
"up-username-has-value": {},
|
211
|
-
"length": {
|
212
|
-
"ignore.empty.value": true,
|
213
|
-
"min": "3",
|
214
|
-
"max": "255"
|
215
|
-
},
|
216
|
-
"up-duplicate-username": {},
|
217
|
-
"up-username-mutation": {}
|
218
|
-
},
|
219
|
-
"displayName": "${username}",
|
220
|
-
"annotations": {},
|
221
|
-
"required": true,
|
222
|
-
"groupAnnotations": {},
|
223
|
-
"autocomplete": "username",
|
224
|
-
"readOnly": false,
|
225
|
-
"name": "username",
|
226
|
-
"value": "xxxx"
|
227
|
-
},
|
228
|
-
{
|
229
|
-
"validators": {
|
230
|
-
"up-email-exists-as-username": {},
|
231
|
-
"length": {
|
232
|
-
"max": "255",
|
233
|
-
"ignore.empty.value": true
|
234
|
-
},
|
235
|
-
"up-blank-attribute-value": {
|
236
|
-
"error-message": "missingEmailMessage",
|
237
|
-
"fail-on-null": false
|
238
|
-
},
|
239
|
-
"up-duplicate-email": {},
|
240
|
-
"email": {
|
241
|
-
"ignore.empty.value": true
|
242
|
-
},
|
243
|
-
"pattern": {
|
244
|
-
"ignore.empty.value": true,
|
245
|
-
"pattern": "gmail\\.com$"
|
246
|
-
}
|
247
|
-
},
|
248
|
-
"displayName": "${email}",
|
249
|
-
"annotations": {},
|
250
|
-
"required": true,
|
251
|
-
"groupAnnotations": {},
|
252
|
-
"autocomplete": "email",
|
253
|
-
"readOnly": false,
|
254
|
-
"name": "email"
|
255
|
-
},
|
256
|
-
{
|
257
|
-
"validators": {
|
258
|
-
"length": {
|
259
|
-
"max": "255",
|
260
|
-
"ignore.empty.value": true
|
261
|
-
},
|
262
|
-
"person-name-prohibited-characters": {
|
263
|
-
"ignore.empty.value": true
|
264
|
-
},
|
265
|
-
"up-immutable-attribute": {},
|
266
|
-
"up-attribute-required-by-metadata-value": {}
|
267
|
-
},
|
268
|
-
"displayName": "${firstName}",
|
269
|
-
"annotations": {},
|
270
|
-
"required": true,
|
271
|
-
"groupAnnotations": {},
|
272
|
-
"readOnly": false,
|
273
|
-
"name": "firstName"
|
274
|
-
},
|
275
|
-
{
|
276
|
-
"validators": {
|
277
|
-
"length": {
|
278
|
-
"max": "255",
|
279
|
-
"ignore.empty.value": true
|
280
|
-
},
|
281
|
-
"person-name-prohibited-characters": {
|
282
|
-
"ignore.empty.value": true
|
283
|
-
},
|
284
|
-
"up-immutable-attribute": {},
|
285
|
-
"up-attribute-required-by-metadata-value": {}
|
286
|
-
},
|
287
|
-
"displayName": "${lastName}",
|
288
|
-
"annotations": {},
|
289
|
-
"required": true,
|
290
|
-
"groupAnnotations": {},
|
291
|
-
"readOnly": false,
|
292
|
-
"name": "lastName"
|
293
|
-
}
|
294
|
-
];
|
295
|
-
|
296
|
-
return {
|
297
|
-
attributes,
|
298
|
-
"attributesByName": Object.fromEntries(attributes.map(attribute => [attribute.name, attribute])) as any
|
299
|
-
} as any;
|
300
|
-
})()
|
297
|
+
attributes,
|
298
|
+
attributesByName
|
301
299
|
}
|
302
300
|
})
|
303
301
|
];
|
@@ -423,5 +421,22 @@ export const kcContextMocks: KcContextBase[] = [
|
|
423
421
|
"baseUrl": "#"
|
424
422
|
},
|
425
423
|
"logoutConfirm": { "code": "123", skipLink: false }
|
424
|
+
}),
|
425
|
+
id<KcContextBase.UpdateUserProfile>({
|
426
|
+
...kcContextCommonMock,
|
427
|
+
"pageId": "update-user-profile.ftl",
|
428
|
+
"profile": {
|
429
|
+
"context": "REGISTRATION_PROFILE" as const,
|
430
|
+
attributes,
|
431
|
+
attributesByName
|
432
|
+
}
|
433
|
+
}),
|
434
|
+
id<KcContextBase.IdpReviewUserProfile>({
|
435
|
+
...kcContextCommonMock,
|
436
|
+
"pageId": "idp-review-user-profile.ftl",
|
437
|
+
"profile": {
|
438
|
+
attributes,
|
439
|
+
attributesByName
|
440
|
+
}
|
426
441
|
})
|
427
442
|
];
|
@@ -304,13 +304,17 @@ export function useGetErrors(params: {
|
|
304
304
|
return { getErrors };
|
305
305
|
}
|
306
306
|
|
307
|
+
/**
|
308
|
+
* NOTE: The attributesWithPassword returned is actually augmented with
|
309
|
+
* artificial password related attributes only if kcContext.passwordRequired === true
|
310
|
+
*/
|
307
311
|
export function useFormValidationSlice(params: {
|
308
312
|
kcContext: {
|
309
313
|
messagesPerField: Pick<KcContextBase.Common["messagesPerField"], "existsError" | "get">;
|
310
314
|
profile: {
|
311
315
|
attributes: Attribute[];
|
312
316
|
};
|
313
|
-
passwordRequired
|
317
|
+
passwordRequired?: boolean;
|
314
318
|
realm: { registrationEmailAsUsername: boolean };
|
315
319
|
};
|
316
320
|
/** NOTE: Try to avoid passing a new ref every render for better performances. */
|
@@ -8,6 +8,7 @@ export function setupSampleReactProject() {
|
|
8
8
|
downloadAndUnzip({
|
9
9
|
"url": "https://github.com/InseeFrLab/keycloakify/releases/download/v0.0.1/sample_build_dir_and_package_json.zip",
|
10
10
|
"destDirPath": sampleReactProjectDirPath,
|
11
|
-
"cacheDirPath": pathJoin(sampleReactProjectDirPath, "build_keycloak", ".cache")
|
11
|
+
"cacheDirPath": pathJoin(sampleReactProjectDirPath, "build_keycloak", ".cache"),
|
12
|
+
"isSilent": false
|
12
13
|
});
|
13
14
|
}
|