keycloakify 10.0.0-rc.2 → 10.0.0-rc.3
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/account/Template.js +2 -2
- package/account/Template.js.map +1 -1
- package/account/i18n/i18n.d.ts +3 -4
- package/account/i18n/i18n.js +2 -3
- package/account/i18n/i18n.js.map +1 -1
- package/account/kcContext/KcContext.d.ts +0 -15
- package/account/kcContext/KcContext.js.map +1 -1
- package/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +160 -243
- package/bin/keycloakify/generateFtl/generateFtl.js +1 -1
- package/bin/keycloakify/generateFtl/generateFtl.js.map +1 -1
- package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +2 -0
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js +9 -12
- package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +1 -1
- package/bin/keycloakify/keycloakify.js +1 -0
- package/bin/keycloakify/keycloakify.js.map +1 -1
- package/login/Template.js +2 -2
- package/login/Template.js.map +1 -1
- package/login/i18n/i18n.d.ts +3 -4
- package/login/i18n/i18n.js +2 -3
- package/login/i18n/i18n.js.map +1 -1
- package/login/pages/Code.js +1 -1
- package/login/pages/Code.js.map +1 -1
- package/login/pages/IdpReviewUserProfile.js.map +1 -1
- package/login/pages/Login.js +1 -1
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginUpdateProfile.js +1 -1
- package/login/pages/LoginUpdateProfile.js.map +1 -1
- package/login/pages/LoginUsername.js +1 -1
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/Register.js +1 -1
- package/login/pages/Register.js.map +1 -1
- package/login/pages/UpdateEmail.js.map +1 -1
- package/login/pages/WebauthnRegister.js +1 -1
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/package.json +1 -7
- package/src/account/Template.tsx +2 -5
- package/src/account/i18n/i18n.tsx +5 -8
- package/src/account/kcContext/KcContext.ts +0 -15
- package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +160 -243
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +1 -1
- package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +13 -14
- package/src/bin/keycloakify/keycloakify.ts +1 -0
- package/src/login/Template.tsx +6 -22
- package/src/login/i18n/i18n.tsx +5 -8
- package/src/login/pages/Code.tsx +1 -1
- package/src/login/pages/IdpReviewUserProfile.tsx +1 -1
- package/src/login/pages/Login.tsx +1 -1
- package/src/login/pages/LoginUpdateProfile.tsx +1 -1
- package/src/login/pages/LoginUsername.tsx +1 -1
- package/src/login/pages/Register.tsx +1 -1
- package/src/login/pages/UpdateEmail.tsx +1 -1
- package/src/login/pages/WebauthnRegister.tsx +1 -1
- package/bin/tools/grant-exec-perms.d.ts +0 -1
- package/bin/tools/grant-exec-perms.js +0 -100
- package/bin/tools/grant-exec-perms.js.map +0 -1
- package/src/bin/tools/grant-exec-perms.ts +0 -19
@@ -28,11 +28,10 @@ export type GenericI18n<MessageKey extends string> = {
|
|
28
28
|
*/
|
29
29
|
currentLanguageTag: string;
|
30
30
|
/**
|
31
|
-
*
|
32
|
-
*
|
33
|
-
* on next load currentLanguageTag === newLanguageTag
|
31
|
+
* Redirect to this url to change the language.
|
32
|
+
* After reload currentLanguageTag === newLanguageTag
|
34
33
|
*/
|
35
|
-
|
34
|
+
getChangeLocalUrl: (newLanguageTag: string) => string;
|
36
35
|
/**
|
37
36
|
* e.g. "en" => "English", "fr" => "Français", ...
|
38
37
|
*
|
@@ -104,7 +103,7 @@ export function createUseI18n<ExtraMessageKey extends string = never>(extraMessa
|
|
104
103
|
} as any
|
105
104
|
}),
|
106
105
|
currentLanguageTag,
|
107
|
-
"
|
106
|
+
"getChangeLocalUrl": newLanguageTag => {
|
108
107
|
const { locale } = kcContext;
|
109
108
|
|
110
109
|
assert(locale !== undefined, "Internationalization not enabled");
|
@@ -113,9 +112,7 @@ export function createUseI18n<ExtraMessageKey extends string = never>(extraMessa
|
|
113
112
|
|
114
113
|
assert(targetSupportedLocale !== undefined, `${newLanguageTag} need to be enabled in Keycloak admin`);
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
assert(false, "never");
|
115
|
+
return targetSupportedLocale.url;
|
119
116
|
},
|
120
117
|
"labelBySupportedLanguageTag": Object.fromEntries(
|
121
118
|
(kcContext.locale?.supported ?? []).map(({ languageTag, label }) => [languageTag, label])
|
@@ -164,21 +164,6 @@ export declare namespace KcContext {
|
|
164
164
|
};
|
165
165
|
mode?: "qr" | "manual" | undefined | null;
|
166
166
|
isAppInitiatedAction: boolean;
|
167
|
-
url: {
|
168
|
-
accountUrl: string;
|
169
|
-
passwordUrl: string;
|
170
|
-
totpUrl: string;
|
171
|
-
socialUrl: string;
|
172
|
-
sessionsUrl: string;
|
173
|
-
applicationsUrl: string;
|
174
|
-
logUrl: string;
|
175
|
-
resourceUrl: string;
|
176
|
-
resourcesCommonPath: string;
|
177
|
-
resourcesPath: string;
|
178
|
-
/** @deprecated, not present in recent keycloak version apparently, use kcContext.referrer instead */
|
179
|
-
referrerURI?: string;
|
180
|
-
getLogoutUrl: () => string;
|
181
|
-
};
|
182
167
|
stateChecker: string;
|
183
168
|
};
|
184
169
|
|
@@ -1,291 +1,189 @@
|
|
1
1
|
<script>const _=
|
2
|
-
<#assign pageId="PAGE_ID_xIgLsPgGId9D8e">
|
3
2
|
(()=>{
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<#
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
<#attempt>
|
39
|
-
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
40
|
-
<#recover>
|
41
|
-
<#assign doExistErrorOnUsernameOrPassword = true>
|
42
|
-
</#attempt>
|
43
|
-
|
44
|
-
<#if doExistErrorOnUsernameOrPassword>
|
45
|
-
return text;
|
46
|
-
<#else>
|
47
|
-
|
48
|
-
<#assign doExistMessageForField = "">
|
49
|
-
|
50
|
-
<#attempt>
|
51
|
-
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
52
|
-
<#recover>
|
53
|
-
<#assign doExistMessageForField = true>
|
54
|
-
</#attempt>
|
55
|
-
|
56
|
-
return <#if doExistMessageForField>text<#else>undefined</#if>;
|
57
|
-
|
58
|
-
</#if>
|
59
|
-
|
3
|
+
<#assign pageId="PAGE_ID_xIgLsPgGId9D8e">
|
4
|
+
const out = ${ftl_object_to_js_code_declaring_an_object(.data_model, [])?no_esc};
|
5
|
+
out["msg"]= function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); };
|
6
|
+
out["advancedMsg"]= function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); };
|
7
|
+
out["messagesPerField"]= {
|
8
|
+
<#assign fieldNames = [ FIELD_NAMES_eKsIY4ZsZ4xeM ]>
|
9
|
+
<#attempt>
|
10
|
+
<#if profile?? && profile.attributes?? && profile.attributes?is_enumerable>
|
11
|
+
<#list profile.attributes as attribute>
|
12
|
+
<#if fieldNames?seq_contains(attribute.name)>
|
13
|
+
<#continue>
|
14
|
+
</#if>
|
15
|
+
<#assign fieldNames += [attribute.name]>
|
16
|
+
</#list>
|
17
|
+
</#if>
|
18
|
+
<#recover>
|
19
|
+
</#attempt>
|
20
|
+
"printIfExists": function (fieldName, text) {
|
21
|
+
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
22
|
+
throw new Error("You're not supposed to use messagesPerField.printIfExists in this page");
|
23
|
+
<#else>
|
24
|
+
<#list fieldNames as fieldName>
|
25
|
+
if(fieldName === "${fieldName}" ){
|
26
|
+
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
27
|
+
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
28
|
+
<#assign doExistErrorOnUsernameOrPassword = "">
|
29
|
+
<#attempt>
|
30
|
+
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
31
|
+
<#recover>
|
32
|
+
<#assign doExistErrorOnUsernameOrPassword = true>
|
33
|
+
</#attempt>
|
34
|
+
<#if doExistErrorOnUsernameOrPassword>
|
35
|
+
return text;
|
60
36
|
<#else>
|
61
|
-
|
62
37
|
<#assign doExistMessageForField = "">
|
63
|
-
|
64
38
|
<#attempt>
|
65
39
|
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
66
40
|
<#recover>
|
67
41
|
<#assign doExistMessageForField = true>
|
68
42
|
</#attempt>
|
69
|
-
|
70
43
|
return <#if doExistMessageForField>text<#else>undefined</#if>;
|
71
|
-
|
72
44
|
</#if>
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
"existsError": function (){
|
83
|
-
|
84
|
-
function existsError_singleFieldName(fieldName) {
|
85
|
-
|
86
|
-
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
87
|
-
throw new Error("You're not supposed to use messagesPerField.printIfExists in this page");
|
88
|
-
<#else>
|
89
|
-
<#list fieldNames as fieldName>
|
90
|
-
if(fieldName === "${fieldName}" ){
|
91
|
-
|
92
|
-
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
93
|
-
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
94
|
-
|
95
|
-
<#assign doExistErrorOnUsernameOrPassword = "">
|
96
|
-
|
97
|
-
<#attempt>
|
98
|
-
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
99
|
-
<#recover>
|
100
|
-
<#assign doExistErrorOnUsernameOrPassword = true>
|
101
|
-
</#attempt>
|
102
|
-
|
103
|
-
return <#if doExistErrorOnUsernameOrPassword>true<#else>false</#if>;
|
104
|
-
|
105
|
-
<#else>
|
106
|
-
|
107
|
-
<#assign doExistErrorMessageForField = "">
|
108
|
-
|
109
|
-
<#attempt>
|
110
|
-
<#assign doExistErrorMessageForField = messagesPerField.existsError('${fieldName}')>
|
111
|
-
<#recover>
|
112
|
-
<#assign doExistErrorMessageForField = true>
|
113
|
-
</#attempt>
|
114
|
-
|
115
|
-
return <#if doExistErrorMessageForField>true<#else>false</#if>;
|
116
|
-
|
117
|
-
</#if>
|
118
|
-
|
119
|
-
}
|
120
|
-
</#list>
|
121
|
-
|
122
|
-
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
123
|
-
|
124
|
-
</#if>
|
125
|
-
|
126
|
-
}
|
127
|
-
|
128
|
-
for( let i = 0; i < arguments.length; i++ ){
|
129
|
-
|
130
|
-
if( existsError_singleFieldName(arguments[i]) ){
|
131
|
-
return true;
|
45
|
+
<#else>
|
46
|
+
<#assign doExistMessageForField = "">
|
47
|
+
<#attempt>
|
48
|
+
<#assign doExistMessageForField = messagesPerField.exists('${fieldName}')>
|
49
|
+
<#recover>
|
50
|
+
<#assign doExistMessageForField = true>
|
51
|
+
</#attempt>
|
52
|
+
return <#if doExistMessageForField>text<#else>undefined</#if>;
|
53
|
+
</#if>
|
132
54
|
}
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
"get": function (fieldName) {
|
140
|
-
|
141
|
-
|
55
|
+
</#list>
|
56
|
+
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
57
|
+
</#if>
|
58
|
+
},
|
59
|
+
"existsError": function (){
|
60
|
+
function existsError_singleFieldName(fieldName) {
|
142
61
|
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
143
|
-
throw new Error("You're not supposed to use messagesPerField.
|
62
|
+
throw new Error("You're not supposed to use messagesPerField.printIfExists in this page");
|
144
63
|
<#else>
|
145
64
|
<#list fieldNames as fieldName>
|
146
65
|
if(fieldName === "${fieldName}" ){
|
147
|
-
|
148
66
|
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
149
67
|
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
150
|
-
|
151
68
|
<#assign doExistErrorOnUsernameOrPassword = "">
|
152
|
-
|
153
69
|
<#attempt>
|
154
70
|
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
155
71
|
<#recover>
|
156
72
|
<#assign doExistErrorOnUsernameOrPassword = true>
|
157
73
|
</#attempt>
|
158
|
-
|
159
|
-
<#if doExistErrorOnUsernameOrPassword>
|
160
|
-
|
161
|
-
<#attempt>
|
162
|
-
return "${kcSanitize(msg('invalidUserMessage'))?no_esc}";
|
163
|
-
<#recover>
|
164
|
-
return "Invalid username or password.";
|
165
|
-
</#attempt>
|
166
|
-
|
167
|
-
<#else>
|
168
|
-
|
169
|
-
<#attempt>
|
170
|
-
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
171
|
-
<#recover>
|
172
|
-
return "";
|
173
|
-
</#attempt>
|
174
|
-
|
175
|
-
</#if>
|
176
|
-
|
74
|
+
return <#if doExistErrorOnUsernameOrPassword>true<#else>false</#if>;
|
177
75
|
<#else>
|
178
|
-
|
76
|
+
<#assign doExistErrorMessageForField = "">
|
179
77
|
<#attempt>
|
180
|
-
|
78
|
+
<#assign doExistErrorMessageForField = messagesPerField.existsError('${fieldName}')>
|
181
79
|
<#recover>
|
182
|
-
|
80
|
+
<#assign doExistErrorMessageForField = true>
|
183
81
|
</#attempt>
|
184
|
-
|
82
|
+
return <#if doExistErrorMessageForField>true<#else>false</#if>;
|
185
83
|
</#if>
|
186
|
-
|
187
84
|
}
|
188
85
|
</#list>
|
189
|
-
|
190
86
|
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
191
|
-
|
192
87
|
</#if>
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
88
|
+
}
|
89
|
+
for( let i = 0; i < arguments.length; i++ ){
|
90
|
+
if( existsError_singleFieldName(arguments[i]) ){
|
91
|
+
return true;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
return false;
|
95
|
+
},
|
96
|
+
"get": function (fieldName) {
|
97
|
+
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
98
|
+
throw new Error("You're not supposed to use messagesPerField.get in this page");
|
99
|
+
<#else>
|
100
|
+
<#list fieldNames as fieldName>
|
101
|
+
if(fieldName === "${fieldName}" ){
|
102
|
+
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
103
|
+
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
104
|
+
<#assign doExistErrorOnUsernameOrPassword = "">
|
105
|
+
<#attempt>
|
106
|
+
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
107
|
+
<#recover>
|
108
|
+
<#assign doExistErrorOnUsernameOrPassword = true>
|
109
|
+
</#attempt>
|
110
|
+
<#if doExistErrorOnUsernameOrPassword>
|
208
111
|
<#attempt>
|
209
|
-
|
112
|
+
return "${kcSanitize(msg('invalidUserMessage'))?no_esc}";
|
210
113
|
<#recover>
|
211
|
-
|
114
|
+
return "Invalid username or password.";
|
212
115
|
</#attempt>
|
213
|
-
|
214
|
-
return <#if doExistErrorOnUsernameOrPassword>true<#else>false</#if>;
|
215
|
-
|
216
116
|
<#else>
|
217
|
-
|
218
|
-
<#assign doExistErrorMessageForField = "">
|
219
|
-
|
220
117
|
<#attempt>
|
221
|
-
|
118
|
+
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
222
119
|
<#recover>
|
223
|
-
|
120
|
+
return "";
|
224
121
|
</#attempt>
|
225
|
-
|
226
|
-
return <#if doExistErrorMessageForField>true<#else>false</#if>;
|
227
|
-
|
228
122
|
</#if>
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
},
|
237
|
-
"getFirstError": function () {
|
238
|
-
|
239
|
-
for( let i = 0; i < arguments.length; i++ ){
|
240
|
-
|
241
|
-
const fieldName = arguments[i];
|
242
|
-
|
243
|
-
if( out.messagesPerField.existsError(fieldName) ){
|
244
|
-
return out.messagesPerField.get(fieldName);
|
123
|
+
<#else>
|
124
|
+
<#attempt>
|
125
|
+
return "${messagesPerField.get('${fieldName}')?no_esc}";
|
126
|
+
<#recover>
|
127
|
+
return "invalid field";
|
128
|
+
</#attempt>
|
129
|
+
</#if>
|
245
130
|
}
|
246
|
-
|
131
|
+
</#list>
|
132
|
+
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
133
|
+
</#if>
|
134
|
+
},
|
135
|
+
"exists": function (fieldName) {
|
136
|
+
<#if !messagesPerField?? || !(messagesPerField?is_hash)>
|
137
|
+
throw new Error("You're not supposed to use messagesPerField.exists in this page");
|
138
|
+
<#else>
|
139
|
+
<#list fieldNames as fieldName>
|
140
|
+
if(fieldName === "${fieldName}" ){
|
141
|
+
<#-- https://github.com/keycloakify/keycloakify/pull/218 -->
|
142
|
+
<#if ('${fieldName}' == 'username' || '${fieldName}' == 'password') && pageId != 'register.ftl' && pageId != 'register-user-profile.ftl'>
|
143
|
+
<#assign doExistErrorOnUsernameOrPassword = "">
|
144
|
+
<#attempt>
|
145
|
+
<#assign doExistErrorOnUsernameOrPassword = messagesPerField.existsError('username', 'password')>
|
146
|
+
<#recover>
|
147
|
+
<#assign doExistErrorOnUsernameOrPassword = true>
|
148
|
+
</#attempt>
|
149
|
+
return <#if doExistErrorOnUsernameOrPassword>true<#else>false</#if>;
|
150
|
+
<#else>
|
151
|
+
<#assign doExistErrorMessageForField = "">
|
152
|
+
<#attempt>
|
153
|
+
<#assign doExistErrorMessageForField = messagesPerField.exists('${fieldName}')>
|
154
|
+
<#recover>
|
155
|
+
<#assign doExistErrorMessageForField = true>
|
156
|
+
</#attempt>
|
157
|
+
return <#if doExistErrorMessageForField>true<#else>false</#if>;
|
158
|
+
</#if>
|
159
|
+
}
|
160
|
+
</#list>
|
161
|
+
throw new Error(fieldName + "is probably runtime generated, see: https://docs.keycloakify.dev/limitations#field-names-cant-be-runtime-generated");
|
162
|
+
</#if>
|
163
|
+
},
|
164
|
+
"getFirstError": function () {
|
165
|
+
for( let i = 0; i < arguments.length; i++ ){
|
166
|
+
const fieldName = arguments[i];
|
167
|
+
if( out.messagesPerField.existsError(fieldName) ){
|
168
|
+
return out.messagesPerField.get(fieldName);
|
247
169
|
}
|
248
|
-
|
249
170
|
}
|
250
|
-
}
|
251
|
-
|
252
|
-
<#if account??>
|
253
|
-
out["url"]["getLogoutUrl"] = function () {
|
254
|
-
<#attempt>
|
255
|
-
return "${url.getLogoutUrl()}";
|
256
|
-
<#recover>
|
257
|
-
throw new Error("Failed to invoke url.getLogoutUrl() in the FreeMarker template");
|
258
|
-
</#attempt>
|
259
|
-
};
|
260
|
-
</#if>
|
261
|
-
|
262
|
-
<#if pageId === "login-config-totp.ftl">
|
263
|
-
out["totp"]["policy"]["getAlgorithmKey"] = function () {
|
264
|
-
<#attempt>
|
265
|
-
return "${totp.policy.getAlgorithmKey()}";
|
266
|
-
<#recover>
|
267
|
-
throw new Error("Failed to invoke totp.policy.getAlgorithmKey() in the FreeMarker template");
|
268
|
-
</#attempt>
|
269
|
-
};
|
270
|
-
</#if>
|
271
|
-
|
272
|
-
out["keycloakifyVersion"] = "KEYCLOAKIFY_VERSION_xEdKd3xEdr";
|
273
|
-
out["themeVersion"] = "KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx";
|
274
|
-
out["themeType"] = "KEYCLOAKIFY_THEME_TYPE_dExKd3xEdr";
|
275
|
-
out["themeName"] = "KEYCLOAKIFY_THEME_NAME_cXxKd3xEer";
|
276
|
-
out["pageId"] = "${pageId}";
|
277
|
-
|
278
|
-
try {
|
171
|
+
}
|
172
|
+
};
|
279
173
|
|
280
|
-
|
174
|
+
out["keycloakifyVersion"] = "KEYCLOAKIFY_VERSION_xEdKd3xEdr";
|
175
|
+
out["themeVersion"] = "KEYCLOAKIFY_THEME_VERSION_sIgKd3xEdr3dx";
|
176
|
+
out["themeType"] = "KEYCLOAKIFY_THEME_TYPE_dExKd3xEdr";
|
177
|
+
out["themeName"] = "KEYCLOAKIFY_THEME_NAME_cXxKd3xEer";
|
178
|
+
out["pageId"] = "${pageId}";
|
281
179
|
|
282
|
-
|
180
|
+
try {
|
181
|
+
out["url"]["resourcesCommonPath"] = out["url"]["resourcesPath"] + "/" + "RESOURCES_COMMON_cLsLsMrtDkpVv";
|
182
|
+
} catch(error) { }
|
283
183
|
|
284
|
-
|
184
|
+
return out;
|
285
185
|
|
286
|
-
|
287
|
-
|
288
|
-
})()
|
186
|
+
})();
|
289
187
|
<#function ftl_object_to_js_code_declaring_an_object object path>
|
290
188
|
|
291
189
|
<#local isHash = "">
|
@@ -309,7 +207,6 @@
|
|
309
207
|
<#return "ABORT: We can't list keys on this object">
|
310
208
|
</#attempt>
|
311
209
|
|
312
|
-
|
313
210
|
<#local out_seq = []>
|
314
211
|
|
315
212
|
<#list keys as key>
|
@@ -378,7 +275,7 @@
|
|
378
275
|
key == "realmAttributes"
|
379
276
|
)
|
380
277
|
>
|
381
|
-
<#local out_seq += ["/*
|
278
|
+
<#local out_seq += ["/*" + path?join(".") + "." + key + " excluded*/"]>
|
382
279
|
<#continue>
|
383
280
|
</#if>
|
384
281
|
|
@@ -390,7 +287,7 @@
|
|
390
287
|
<#attempt>
|
391
288
|
<#-- https://github.com/keycloak/keycloak/blob/3a2bf0c04bcde185e497aaa32d0bb7ab7520cf4a/themes/src/main/resources/theme/base/login/template.ftl#L63 -->
|
392
289
|
<#if !(auth?has_content && auth.showUsername() && !auth.showResetCredentials())>
|
393
|
-
<#local out_seq += ["/*
|
290
|
+
<#local out_seq += ["/*" + path?join(".") + "." + key + " excluded*/"]>
|
394
291
|
<#continue>
|
395
292
|
</#if>
|
396
293
|
<#recover>
|
@@ -470,6 +367,26 @@
|
|
470
367
|
</#attempt>
|
471
368
|
</#if>
|
472
369
|
|
370
|
+
<#if are_same_path(path, ["url", "getLogoutUrl"])>
|
371
|
+
<#local returnValue = "">
|
372
|
+
<#attempt>
|
373
|
+
<#local returnValue = url.getLogoutUrl()>
|
374
|
+
<#recover>
|
375
|
+
<#return "ABORT: Couldn't evaluate url.getLogoutUrl()">
|
376
|
+
</#attempt>
|
377
|
+
<#return 'function(){ return "' + returnValue + '"; }'>
|
378
|
+
</#if>
|
379
|
+
|
380
|
+
<#if are_same_path(path, ["totp", "policy", "getAlgorithmKey"])>
|
381
|
+
<#local returnValue = "">
|
382
|
+
<#attempt>
|
383
|
+
<#local returnValue = totp.policy.getAlgorithmKey()>
|
384
|
+
<#recover>
|
385
|
+
<#return "ABORT: Couldn't evaluate totp.policy.getAlgorithmKey()">
|
386
|
+
</#attempt>
|
387
|
+
<#return 'function(){ return "' + returnValue + '"; }'>
|
388
|
+
</#if>
|
389
|
+
|
473
390
|
<#return "ABORT: It's a method">
|
474
391
|
</#if>
|
475
392
|
|
@@ -108,7 +108,7 @@ export function generateFtlFilesCodeFactory(params: {
|
|
108
108
|
|
109
109
|
const ftlObjectToJsCodeDeclaringAnObjectPlaceholder = '{ "x": "vIdLqMeOed9sdLdIdOxdK0d" }';
|
110
110
|
|
111
|
-
$("head").prepend(
|
111
|
+
$("head").prepend(`<script>\nwindow.${nameOfTheGlobal}=${ftlObjectToJsCodeDeclaringAnObjectPlaceholder}</script>`);
|
112
112
|
|
113
113
|
// Remove part of the document marked as ignored.
|
114
114
|
{
|
@@ -2,9 +2,11 @@ import * as fs from "fs";
|
|
2
2
|
import { join as pathJoin, relative as pathRelative, basename as pathBasename } from "path";
|
3
3
|
import { assert } from "tsafe/assert";
|
4
4
|
import type { BuildOptions } from "./buildOptions";
|
5
|
+
import { accountV1ThemeName } from "../constants";
|
5
6
|
|
6
7
|
export type BuildOptionsLike = {
|
7
8
|
keycloakifyBuildDirPath: string;
|
9
|
+
themeNames: string[];
|
8
10
|
};
|
9
11
|
|
10
12
|
assert<BuildOptions extends BuildOptionsLike ? true : false>();
|
@@ -15,11 +17,14 @@ const containerName = "keycloak-testing-container";
|
|
15
17
|
const keycloakVersion = "24.0.4";
|
16
18
|
|
17
19
|
/** Files for being able to run a hot reload keycloak container */
|
18
|
-
export function generateStartKeycloakTestingContainer(params: {
|
19
|
-
|
20
|
+
export function generateStartKeycloakTestingContainer(params: {
|
21
|
+
jarFilePath: string;
|
22
|
+
doesImplementAccountTheme: boolean;
|
23
|
+
buildOptions: BuildOptionsLike;
|
24
|
+
}) {
|
25
|
+
const { jarFilePath, doesImplementAccountTheme, buildOptions } = params;
|
20
26
|
|
21
27
|
const themeRelativeDirPath = pathJoin("src", "main", "resources", "theme");
|
22
|
-
const themeDirPath = pathJoin(buildOptions.keycloakifyBuildDirPath, themeRelativeDirPath);
|
23
28
|
|
24
29
|
fs.writeFileSync(
|
25
30
|
pathJoin(buildOptions.keycloakifyBuildDirPath, generateStartKeycloakTestingContainer.basename),
|
@@ -40,18 +45,12 @@ export function generateStartKeycloakTestingContainer(params: { jarFilePath: str
|
|
40
45
|
"$(pwd)",
|
41
46
|
pathRelative(buildOptions.keycloakifyBuildDirPath, jarFilePath)
|
42
47
|
)}":"/opt/keycloak/providers/${pathBasename(jarFilePath)}" \\`,
|
43
|
-
...
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
themeName =>
|
48
|
-
` -v "${pathJoin("$(pwd)", themeRelativeDirPath, themeName).replace(
|
49
|
-
/\\/g,
|
50
|
-
"/"
|
51
|
-
)}":"/opt/keycloak/themes/${themeName}":rw \\`
|
52
|
-
),
|
48
|
+
[...(doesImplementAccountTheme ? [accountV1ThemeName] : []), ...buildOptions.themeNames].map(
|
49
|
+
themeName =>
|
50
|
+
` -v "${pathJoin("$(pwd)", themeRelativeDirPath, themeName).replace(/\\/g, "/")}":"/opt/keycloak/themes/${themeName}":rw \\`
|
51
|
+
),
|
53
52
|
` -it quay.io/keycloak/keycloak:${keycloakVersion} \\`,
|
54
|
-
` start-dev
|
53
|
+
` start-dev`,
|
55
54
|
""
|
56
55
|
].join("\n"),
|
57
56
|
"utf8"
|