keycloakify 10.1.0-rc.0 → 10.1.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/PUBLIC_URL.js +2 -2
- package/PUBLIC_URL.js.map +1 -1
- package/account/KcContext/kcContextMocks.js +3 -3
- package/account/KcContext/kcContextMocks.js.map +1 -1
- package/bin/193.index.js +198 -62
- package/bin/{365.index.js → 20.index.js} +302 -263
- package/bin/31.index.js +15 -23
- package/bin/{430.index.js → 33.index.js} +579 -4
- package/bin/{678.index.js → 36.index.js} +2 -577
- package/bin/{440.index.js → 499.index.js} +259 -181
- package/bin/526.index.js +3 -784
- package/bin/599.index.js +4 -1
- package/bin/780.index.js +1 -1
- package/bin/{525.index.js → 903.index.js} +4840 -97
- package/bin/932.index.js +115 -886
- package/bin/main.js +4 -4
- package/bin/shared/buildContext.d.ts +0 -2
- package/bin/shared/buildContext.js.map +1 -1
- package/bin/shared/constants.d.ts +5 -6
- package/bin/shared/constants.js +5 -6
- package/bin/shared/constants.js.map +1 -1
- package/bin/shared/copyKeycloakResourcesToPublic.d.ts +2 -4
- package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -1
- package/login/KcContext/KcContext.d.ts +9 -18
- package/login/KcContext/KcContext.js.map +1 -1
- package/login/KcContext/kcContextMocks.js +6 -10
- package/login/KcContext/kcContextMocks.js.map +1 -1
- package/login/Template.js +4 -59
- package/login/Template.js.map +1 -1
- package/login/Template.useStylesAndScripts.d.ts +17 -0
- package/login/Template.useStylesAndScripts.js +69 -0
- package/login/Template.useStylesAndScripts.js.map +1 -0
- package/login/pages/Login.js +1 -1
- package/login/pages/Login.js.map +1 -1
- package/login/pages/LoginIdpLinkConfirmOverride.js +0 -1
- package/login/pages/LoginIdpLinkConfirmOverride.js.map +1 -1
- package/login/pages/LoginPasskeysConditionalAuthenticate.js +6 -49
- package/login/pages/LoginPasskeysConditionalAuthenticate.js.map +1 -1
- package/login/pages/LoginPasskeysConditionalAuthenticate.useScript.d.ts +20 -0
- package/login/pages/LoginPasskeysConditionalAuthenticate.useScript.js +49 -0
- package/login/pages/LoginPasskeysConditionalAuthenticate.useScript.js.map +1 -0
- package/login/pages/LoginRecoveryAuthnCodeConfig.js +4 -126
- package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
- package/login/pages/LoginRecoveryAuthnCodeConfig.useScript.d.ts +9 -0
- package/login/pages/LoginRecoveryAuthnCodeConfig.useScript.js +133 -0
- package/login/pages/LoginRecoveryAuthnCodeConfig.useScript.js.map +1 -0
- package/login/pages/LoginUsername.js +1 -1
- package/login/pages/LoginUsername.js.map +1 -1
- package/login/pages/Register.js +6 -3
- package/login/pages/Register.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.js +13 -116
- package/login/pages/WebauthnAuthenticate.js.map +1 -1
- package/login/pages/WebauthnAuthenticate.useScript.d.ts +21 -0
- package/login/pages/WebauthnAuthenticate.useScript.js +41 -0
- package/login/pages/WebauthnAuthenticate.useScript.js.map +1 -0
- package/login/pages/WebauthnRegister.js +8 -178
- package/login/pages/WebauthnRegister.js.map +1 -1
- package/login/pages/WebauthnRegister.useScript.d.ts +27 -0
- package/login/pages/WebauthnRegister.useScript.js +49 -0
- package/login/pages/WebauthnRegister.useScript.js.map +1 -0
- package/package.json +125 -15
- package/res/account-v1/account.ftl +70 -0
- package/res/account-v1/applications.ftl +76 -0
- package/res/account-v1/federatedIdentity.ftl +42 -0
- package/res/account-v1/log.ftl +35 -0
- package/res/account-v1/messages/messages_ar.properties +406 -0
- package/res/account-v1/messages/messages_ca.properties +147 -0
- package/res/account-v1/messages/messages_cs.properties +171 -0
- package/res/account-v1/messages/messages_da.properties +339 -0
- package/res/account-v1/messages/messages_de.properties +353 -0
- package/res/account-v1/messages/messages_en.properties +404 -0
- package/res/account-v1/messages/messages_es.properties +147 -0
- package/res/account-v1/messages/messages_fi.properties +400 -0
- package/res/account-v1/messages/messages_fr.properties +180 -0
- package/res/account-v1/messages/messages_hu.properties +334 -0
- package/res/account-v1/messages/messages_it.properties +336 -0
- package/res/account-v1/messages/messages_ja.properties +335 -0
- package/res/account-v1/messages/messages_lt.properties +154 -0
- package/res/account-v1/messages/messages_lv.properties +197 -0
- package/res/account-v1/messages/messages_nl.properties +371 -0
- package/res/account-v1/messages/messages_no.properties +152 -0
- package/res/account-v1/messages/messages_pl.properties +248 -0
- package/res/account-v1/messages/messages_pt_BR.properties +349 -0
- package/res/account-v1/messages/messages_ru.properties +235 -0
- package/res/account-v1/messages/messages_sk.properties +196 -0
- package/res/account-v1/messages/messages_sv.properties +150 -0
- package/res/account-v1/messages/messages_tr.properties +315 -0
- package/res/account-v1/messages/messages_zh_CN.properties +153 -0
- package/res/account-v1/password.ftl +59 -0
- package/res/account-v1/resource-detail.ftl +277 -0
- package/res/account-v1/resources/css/account.css +277 -0
- package/res/account-v1/resources/img/icon-sidebar-active.png +0 -0
- package/res/account-v1/resources/img/keycloak-logo.png +0 -0
- package/res/account-v1/resources/img/logo.png +0 -0
- package/res/account-v1/resources/resources-common/img/favicon.ico +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css +5 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/css/patternfly.min.css +8 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff2 +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Light-webfont.woff2 +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Regular-webfont.woff2 +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Semibold-webfont.woff2 +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.ttf +0 -0
- package/res/account-v1/resources/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.woff +0 -0
- package/res/account-v1/resources.ftl +403 -0
- package/res/account-v1/sessions.ftl +44 -0
- package/res/account-v1/template.ftl +88 -0
- package/res/account-v1/theme.properties +14 -0
- package/res/account-v1/totp.ftl +141 -0
- package/res/public/.keycloakify/account/css/account.css +277 -0
- package/res/public/.keycloakify/account/img/icon-sidebar-active.png +0 -0
- package/res/public/.keycloakify/account/img/keycloak-logo.png +0 -0
- package/res/public/.keycloakify/account/img/logo.png +0 -0
- package/res/public/.keycloakify/account/resources-common/img/favicon.ico +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css +5 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/css/patternfly.min.css +8 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff2 +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Light-webfont.woff2 +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Regular-webfont.woff2 +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Semibold-webfont.woff2 +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.ttf +0 -0
- package/res/public/.keycloakify/account/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.woff +0 -0
- package/res/public/.keycloakify/login/css/login.css +629 -0
- package/res/public/.keycloakify/login/img/feedback-error-arrow-down.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-error-sign.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-success-arrow-down.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-success-sign.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-warning-arrow-down.png +0 -0
- package/res/public/.keycloakify/login/img/feedback-warning-sign.png +0 -0
- package/res/public/.keycloakify/login/img/keycloak-bg.png +0 -0
- package/res/public/.keycloakify/login/img/keycloak-logo-text.png +0 -0
- package/res/public/.keycloakify/login/img/keycloak-logo.png +0 -0
- package/res/public/.keycloakify/login/js/authChecker.js +49 -0
- package/res/public/.keycloakify/login/js/common.js +48 -0
- package/res/public/.keycloakify/login/js/kcMultivalued.js +106 -0
- package/res/public/.keycloakify/login/js/kcNumberFormat.js +21 -0
- package/res/public/.keycloakify/login/js/kcNumberUnFormat.js +19 -0
- package/res/public/.keycloakify/login/js/menu-button-links.js +315 -0
- package/{src/bin/shared/downloadKeycloakDefaultTheme/extra-assets → res/public/.keycloakify/login/js}/passkeysConditionalAuth.js +1 -1
- package/res/public/.keycloakify/login/js/passwordVisibility.js +15 -0
- package/res/public/.keycloakify/login/js/userProfile.js +71 -0
- package/res/public/.keycloakify/login/js/webauthnRegister.js +140 -0
- package/res/public/.keycloakify/login/resources-common/img/favicon.ico +0 -0
- package/res/public/.keycloakify/login/resources-common/lib/pficon/pficon.css +22 -0
- package/res/public/.keycloakify/login/resources-common/lib/pficon/pficon.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/@patternfly/patternfly/patternfly.min.css +2 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/jquery/dist/jquery.min.js +2 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/css/patternfly-additions.min.css +5 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/css/patternfly.min.css +8 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.ttf +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Bold-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Light-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Regular-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/OpenSans-Semibold-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.ttf +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/PatternFlyIcons-webfont.woff +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/fonts/fontawesome-webfont.woff2 +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/patternfly/dist/img/bg-login.jpg +0 -0
- package/res/public/.keycloakify/login/resources-common/node_modules/rfc4648/lib/rfc4648.js +178 -0
- package/src/PUBLIC_URL.ts +5 -3
- package/src/account/KcContext/kcContextMocks.ts +3 -3
- package/src/bin/copy-keycloak-resources-to-public.ts +1 -1
- package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +4 -1
- package/src/bin/initialize-email-theme.ts +28 -8
- package/src/bin/keycloakify/buildJars/buildJar.ts +3 -7
- package/src/bin/keycloakify/generateFtl/generateFtl.ts +3 -7
- package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +65 -90
- package/src/bin/keycloakify/keycloakify.ts +38 -21
- package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +2 -2
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +3 -3
- package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +3 -3
- package/src/bin/shared/buildContext.ts +1 -8
- package/src/bin/shared/constants.ts +5 -7
- package/src/bin/shared/copyKeycloakResourcesToPublic.ts +30 -40
- package/src/bin/start-keycloak/start-keycloak.ts +3 -7
- package/src/login/KcContext/KcContext.ts +9 -18
- package/src/login/KcContext/kcContextMocks.ts +5 -13
- package/src/login/Template.tsx +4 -67
- package/src/login/Template.useStylesAndScripts.ts +94 -0
- package/src/login/pages/Login.tsx +1 -1
- package/src/login/pages/LoginIdpLinkConfirmOverride.tsx +0 -1
- package/src/login/pages/LoginPasskeysConditionalAuthenticate.tsx +6 -81
- package/src/login/pages/LoginPasskeysConditionalAuthenticate.useScript.tsx +72 -0
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +4 -126
- package/src/login/pages/LoginRecoveryAuthnCodeConfig.useScript.tsx +142 -0
- package/src/login/pages/LoginUsername.tsx +1 -1
- package/src/login/pages/Register.tsx +35 -13
- package/src/login/pages/WebauthnAuthenticate.tsx +20 -133
- package/src/login/pages/WebauthnAuthenticate.useScript.tsx +64 -0
- package/src/login/pages/WebauthnRegister.tsx +8 -195
- package/src/login/pages/WebauthnRegister.useScript.tsx +93 -0
- package/src/tools/useInsertScriptTags.ts +14 -4
- package/src/vite-plugin/vite-plugin.ts +11 -15
- package/tools/useInsertScriptTags.d.ts +2 -2
- package/tools/useInsertScriptTags.js +8 -2
- package/tools/useInsertScriptTags.js.map +1 -1
- package/vite-plugin/index.js +3357 -47132
- package/bin/697.index.js +0 -4749
- package/bin/shared/downloadKeycloakStaticResources.d.ts +0 -9
- package/bin/shared/downloadKeycloakStaticResources.js.map +0 -1
- package/src/bin/keycloakify/generateResources/bringInAccountV1.ts +0 -89
- package/src/bin/shared/downloadKeycloakDefaultTheme/downloadKeycloakDefaultTheme.ts +0 -337
- package/src/bin/shared/downloadKeycloakDefaultTheme/index.ts +0 -1
- package/src/bin/shared/downloadKeycloakStaticResources.ts +0 -53
- /package/{src/bin/shared/downloadKeycloakDefaultTheme/extra-assets → res/public/.keycloakify/login/js}/webauthnAuthenticate.js +0 -0
@@ -0,0 +1,178 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
2
|
+
function parse(string, encoding, opts) {
|
3
|
+
var _opts$out;
|
4
|
+
|
5
|
+
if (opts === void 0) {
|
6
|
+
opts = {};
|
7
|
+
}
|
8
|
+
|
9
|
+
// Build the character lookup table:
|
10
|
+
if (!encoding.codes) {
|
11
|
+
encoding.codes = {};
|
12
|
+
|
13
|
+
for (var i = 0; i < encoding.chars.length; ++i) {
|
14
|
+
encoding.codes[encoding.chars[i]] = i;
|
15
|
+
}
|
16
|
+
} // The string must have a whole number of bytes:
|
17
|
+
|
18
|
+
|
19
|
+
if (!opts.loose && string.length * encoding.bits & 7) {
|
20
|
+
throw new SyntaxError('Invalid padding');
|
21
|
+
} // Count the padding bytes:
|
22
|
+
|
23
|
+
|
24
|
+
var end = string.length;
|
25
|
+
|
26
|
+
while (string[end - 1] === '=') {
|
27
|
+
--end; // If we get a whole number of bytes, there is too much padding:
|
28
|
+
|
29
|
+
if (!opts.loose && !((string.length - end) * encoding.bits & 7)) {
|
30
|
+
throw new SyntaxError('Invalid padding');
|
31
|
+
}
|
32
|
+
} // Allocate the output:
|
33
|
+
|
34
|
+
|
35
|
+
var out = new ((_opts$out = opts.out) != null ? _opts$out : Uint8Array)(end * encoding.bits / 8 | 0); // Parse the data:
|
36
|
+
|
37
|
+
var bits = 0; // Number of bits currently in the buffer
|
38
|
+
|
39
|
+
var buffer = 0; // Bits waiting to be written out, MSB first
|
40
|
+
|
41
|
+
var written = 0; // Next byte to write
|
42
|
+
|
43
|
+
for (var _i = 0; _i < end; ++_i) {
|
44
|
+
// Read one character from the string:
|
45
|
+
var value = encoding.codes[string[_i]];
|
46
|
+
|
47
|
+
if (value === undefined) {
|
48
|
+
throw new SyntaxError('Invalid character ' + string[_i]);
|
49
|
+
} // Append the bits to the buffer:
|
50
|
+
|
51
|
+
|
52
|
+
buffer = buffer << encoding.bits | value;
|
53
|
+
bits += encoding.bits; // Write out some bits if the buffer has a byte's worth:
|
54
|
+
|
55
|
+
if (bits >= 8) {
|
56
|
+
bits -= 8;
|
57
|
+
out[written++] = 0xff & buffer >> bits;
|
58
|
+
}
|
59
|
+
} // Verify that we have received just enough bits:
|
60
|
+
|
61
|
+
|
62
|
+
if (bits >= encoding.bits || 0xff & buffer << 8 - bits) {
|
63
|
+
throw new SyntaxError('Unexpected end of data');
|
64
|
+
}
|
65
|
+
|
66
|
+
return out;
|
67
|
+
}
|
68
|
+
function stringify(data, encoding, opts) {
|
69
|
+
if (opts === void 0) {
|
70
|
+
opts = {};
|
71
|
+
}
|
72
|
+
|
73
|
+
var _opts = opts,
|
74
|
+
_opts$pad = _opts.pad,
|
75
|
+
pad = _opts$pad === void 0 ? true : _opts$pad;
|
76
|
+
var mask = (1 << encoding.bits) - 1;
|
77
|
+
var out = '';
|
78
|
+
var bits = 0; // Number of bits currently in the buffer
|
79
|
+
|
80
|
+
var buffer = 0; // Bits waiting to be written out, MSB first
|
81
|
+
|
82
|
+
for (var i = 0; i < data.length; ++i) {
|
83
|
+
// Slurp data into the buffer:
|
84
|
+
buffer = buffer << 8 | 0xff & data[i];
|
85
|
+
bits += 8; // Write out as much as we can:
|
86
|
+
|
87
|
+
while (bits > encoding.bits) {
|
88
|
+
bits -= encoding.bits;
|
89
|
+
out += encoding.chars[mask & buffer >> bits];
|
90
|
+
}
|
91
|
+
} // Partial character:
|
92
|
+
|
93
|
+
|
94
|
+
if (bits) {
|
95
|
+
out += encoding.chars[mask & buffer << encoding.bits - bits];
|
96
|
+
} // Add padding characters until we hit a byte boundary:
|
97
|
+
|
98
|
+
|
99
|
+
if (pad) {
|
100
|
+
while (out.length * encoding.bits & 7) {
|
101
|
+
out += '=';
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
return out;
|
106
|
+
}
|
107
|
+
|
108
|
+
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
109
|
+
var base16Encoding = {
|
110
|
+
chars: '0123456789ABCDEF',
|
111
|
+
bits: 4
|
112
|
+
};
|
113
|
+
var base32Encoding = {
|
114
|
+
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
|
115
|
+
bits: 5
|
116
|
+
};
|
117
|
+
var base32HexEncoding = {
|
118
|
+
chars: '0123456789ABCDEFGHIJKLMNOPQRSTUV',
|
119
|
+
bits: 5
|
120
|
+
};
|
121
|
+
var base64Encoding = {
|
122
|
+
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
|
123
|
+
bits: 6
|
124
|
+
};
|
125
|
+
var base64UrlEncoding = {
|
126
|
+
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
|
127
|
+
bits: 6
|
128
|
+
};
|
129
|
+
var base16 = {
|
130
|
+
parse: function parse$1(string, opts) {
|
131
|
+
return parse(string.toUpperCase(), base16Encoding, opts);
|
132
|
+
},
|
133
|
+
stringify: function stringify$1(data, opts) {
|
134
|
+
return stringify(data, base16Encoding, opts);
|
135
|
+
}
|
136
|
+
};
|
137
|
+
var base32 = {
|
138
|
+
parse: function parse$1(string, opts) {
|
139
|
+
if (opts === void 0) {
|
140
|
+
opts = {};
|
141
|
+
}
|
142
|
+
|
143
|
+
return parse(opts.loose ? string.toUpperCase().replace(/0/g, 'O').replace(/1/g, 'L').replace(/8/g, 'B') : string, base32Encoding, opts);
|
144
|
+
},
|
145
|
+
stringify: function stringify$1(data, opts) {
|
146
|
+
return stringify(data, base32Encoding, opts);
|
147
|
+
}
|
148
|
+
};
|
149
|
+
var base32hex = {
|
150
|
+
parse: function parse$1(string, opts) {
|
151
|
+
return parse(string, base32HexEncoding, opts);
|
152
|
+
},
|
153
|
+
stringify: function stringify$1(data, opts) {
|
154
|
+
return stringify(data, base32HexEncoding, opts);
|
155
|
+
}
|
156
|
+
};
|
157
|
+
var base64 = {
|
158
|
+
parse: function parse$1(string, opts) {
|
159
|
+
return parse(string, base64Encoding, opts);
|
160
|
+
},
|
161
|
+
stringify: function stringify$1(data, opts) {
|
162
|
+
return stringify(data, base64Encoding, opts);
|
163
|
+
}
|
164
|
+
};
|
165
|
+
var base64url = {
|
166
|
+
parse: function parse$1(string, opts) {
|
167
|
+
return parse(string, base64UrlEncoding, opts);
|
168
|
+
},
|
169
|
+
stringify: function stringify$1(data, opts) {
|
170
|
+
return stringify(data, base64UrlEncoding, opts);
|
171
|
+
}
|
172
|
+
};
|
173
|
+
var codec = {
|
174
|
+
parse: parse,
|
175
|
+
stringify: stringify
|
176
|
+
};
|
177
|
+
|
178
|
+
export { base16, base32, base32hex, base64, base64url, codec };
|
package/src/PUBLIC_URL.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { WELL_KNOWN_DIRECTORY_BASE_NAME } from "keycloakify/bin/shared/constants";
|
2
2
|
import { assert } from "tsafe/assert";
|
3
3
|
|
4
4
|
/**
|
@@ -6,7 +6,9 @@ import { assert } from "tsafe/assert";
|
|
6
6
|
* This works both in your main app and in your Keycloak theme.
|
7
7
|
*/
|
8
8
|
export const PUBLIC_URL = (() => {
|
9
|
-
const kcContext = (
|
9
|
+
const kcContext: { "x-keycloakify": { resourcesPath: string } } | undefined = (
|
10
|
+
window as any
|
11
|
+
).kcContext;
|
10
12
|
|
11
13
|
if (kcContext === undefined || process.env.NODE_ENV === "development") {
|
12
14
|
assert(
|
@@ -17,5 +19,5 @@ export const PUBLIC_URL = (() => {
|
|
17
19
|
return process.env.PUBLIC_URL;
|
18
20
|
}
|
19
21
|
|
20
|
-
return `${kcContext.
|
22
|
+
return `${kcContext["x-keycloakify"].resourcesPath}/${WELL_KNOWN_DIRECTORY_BASE_NAME.DIST}`;
|
21
23
|
})();
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import "keycloakify/tools/Object.fromEntries";
|
2
|
-
import {
|
2
|
+
import { WELL_KNOWN_DIRECTORY_BASE_NAME } from "keycloakify/bin/shared/constants";
|
3
3
|
import { id } from "tsafe/id";
|
4
4
|
import type { KcContext } from "./KcContext";
|
5
5
|
import { BASE_URL } from "keycloakify/lib/BASE_URL";
|
6
6
|
|
7
|
-
const resourcesPath = `${BASE_URL}${
|
7
|
+
const resourcesPath = `${BASE_URL}${WELL_KNOWN_DIRECTORY_BASE_NAME.DOT_KEYCLOAKIFY}/account`;
|
8
8
|
|
9
9
|
export const kcContextCommonMock: KcContext.Common = {
|
10
10
|
themeVersion: "0.0.0",
|
@@ -13,7 +13,7 @@ export const kcContextCommonMock: KcContext.Common = {
|
|
13
13
|
themeName: "my-theme-name",
|
14
14
|
url: {
|
15
15
|
resourcesPath,
|
16
|
-
resourcesCommonPath: `${resourcesPath}/${RESOURCES_COMMON}`,
|
16
|
+
resourcesCommonPath: `${resourcesPath}/${WELL_KNOWN_DIRECTORY_BASE_NAME.RESOURCES_COMMON}`,
|
17
17
|
resourceUrl: "#",
|
18
18
|
accountUrl: "#",
|
19
19
|
applicationsUrl: "#",
|
@@ -6,6 +6,7 @@ import {
|
|
6
6
|
getLatestsSemVersionedTag,
|
7
7
|
type BuildContextLike as BuildContextLike_getLatestsSemVersionedTag
|
8
8
|
} from "../shared/getLatestsSemVersionedTag";
|
9
|
+
import { SemVer } from "../tools/SemVer";
|
9
10
|
import fetch from "make-fetch-happen";
|
10
11
|
import { z } from "zod";
|
11
12
|
import { assert, type Equals } from "tsafe/assert";
|
@@ -68,7 +69,9 @@ export async function initializeAccountTheme_singlePage(params: {
|
|
68
69
|
})()
|
69
70
|
);
|
70
71
|
|
71
|
-
dependencies.dependencies["@keycloakify/keycloak-account-ui"] =
|
72
|
+
dependencies.dependencies["@keycloakify/keycloak-account-ui"] = SemVer.stringify(
|
73
|
+
semVersionedTag.version
|
74
|
+
);
|
72
75
|
|
73
76
|
const parsedPackageJson = (() => {
|
74
77
|
type ParsedPackageJson = {
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { downloadKeycloakDefaultTheme } from "./shared/downloadKeycloakDefaultTheme";
|
2
1
|
import { join as pathJoin, relative as pathRelative } from "path";
|
3
2
|
import { transformCodebase } from "./tools/transformCodebase";
|
4
3
|
import { promptKeycloakVersion } from "./shared/promptKeycloakVersion";
|
5
4
|
import { getBuildContext } from "./shared/buildContext";
|
6
5
|
import * as fs from "fs";
|
7
6
|
import type { CliCommandOptions } from "./main";
|
7
|
+
import { downloadAndExtractArchive } from "./tools/downloadAndExtractArchive";
|
8
8
|
|
9
9
|
export async function command(params: { cliCommandOptions: CliCommandOptions }) {
|
10
10
|
const { cliCommandOptions } = params;
|
@@ -13,9 +13,12 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
13
13
|
|
14
14
|
const emailThemeSrcDirPath = pathJoin(buildContext.themeSrcDirPath, "email");
|
15
15
|
|
16
|
-
if (
|
16
|
+
if (
|
17
|
+
fs.existsSync(emailThemeSrcDirPath) &&
|
18
|
+
fs.readdirSync(emailThemeSrcDirPath).length > 0
|
19
|
+
) {
|
17
20
|
console.warn(
|
18
|
-
`There is already a ${pathRelative(
|
21
|
+
`There is already a non empty ${pathRelative(
|
19
22
|
process.cwd(),
|
20
23
|
emailThemeSrcDirPath
|
21
24
|
)} directory in your project. Aborting.`
|
@@ -34,13 +37,27 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
34
37
|
buildContext
|
35
38
|
});
|
36
39
|
|
37
|
-
const {
|
38
|
-
keycloakVersion
|
39
|
-
buildContext
|
40
|
+
const { extractedDirPath } = await downloadAndExtractArchive({
|
41
|
+
url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
|
42
|
+
cacheDirPath: buildContext.cacheDirPath,
|
43
|
+
fetchOptions: buildContext.fetchOptions,
|
44
|
+
uniqueIdOfOnArchiveFile: "extractOnlyEmailTheme",
|
45
|
+
onArchiveFile: async ({ fileRelativePath, writeFile }) => {
|
46
|
+
const fileRelativePath_target = pathRelative(
|
47
|
+
pathJoin("theme", "base", "email"),
|
48
|
+
fileRelativePath
|
49
|
+
);
|
50
|
+
|
51
|
+
if (fileRelativePath_target.startsWith("..")) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
|
55
|
+
await writeFile({ fileRelativePath: fileRelativePath_target });
|
56
|
+
}
|
40
57
|
});
|
41
58
|
|
42
59
|
transformCodebase({
|
43
|
-
srcDirPath:
|
60
|
+
srcDirPath: extractedDirPath,
|
44
61
|
destDirPath: emailThemeSrcDirPath
|
45
62
|
});
|
46
63
|
|
@@ -50,7 +67,10 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|
50
67
|
fs.writeFileSync(
|
51
68
|
themePropertyFilePath,
|
52
69
|
Buffer.from(
|
53
|
-
|
70
|
+
[
|
71
|
+
`parent=base`,
|
72
|
+
fs.readFileSync(themePropertyFilePath).toString("utf8")
|
73
|
+
].join("\n"),
|
54
74
|
"utf8"
|
55
75
|
)
|
56
76
|
);
|
@@ -7,7 +7,6 @@ import { join as pathJoin, dirname as pathDirname } from "path";
|
|
7
7
|
import { transformCodebase } from "../../tools/transformCodebase";
|
8
8
|
import type { BuildContext } from "../../shared/buildContext";
|
9
9
|
import * as fs from "fs/promises";
|
10
|
-
import { ACCOUNT_V1_THEME_NAME } from "../../shared/constants";
|
11
10
|
import {
|
12
11
|
generatePom,
|
13
12
|
BuildContextLike as BuildContextLike_generatePom
|
@@ -75,7 +74,7 @@ export async function buildJar(params: {
|
|
75
74
|
|
76
75
|
if (
|
77
76
|
isInside({
|
78
|
-
dirPath: pathJoin("theme",
|
77
|
+
dirPath: pathJoin("theme", "account-v1"),
|
79
78
|
filePath: fileRelativePath
|
80
79
|
})
|
81
80
|
) {
|
@@ -90,10 +89,7 @@ export async function buildJar(params: {
|
|
90
89
|
const modifiedSourceCode = Buffer.from(
|
91
90
|
sourceCode
|
92
91
|
.toString("utf8")
|
93
|
-
.replace(
|
94
|
-
`parent=${ACCOUNT_V1_THEME_NAME}`,
|
95
|
-
"parent=keycloak"
|
96
|
-
),
|
92
|
+
.replace(`parent=account-v1`, "parent=keycloak"),
|
97
93
|
"utf8"
|
98
94
|
);
|
99
95
|
|
@@ -126,7 +122,7 @@ export async function buildJar(params: {
|
|
126
122
|
assert(metaInfKeycloakTheme !== undefined);
|
127
123
|
|
128
124
|
metaInfKeycloakTheme.themes = metaInfKeycloakTheme.themes.filter(
|
129
|
-
({ name }) => name !==
|
125
|
+
({ name }) => name !== "account-v1"
|
130
126
|
);
|
131
127
|
|
132
128
|
return metaInfKeycloakTheme;
|
@@ -11,11 +11,7 @@ import * as fs from "fs";
|
|
11
11
|
import { join as pathJoin } from "path";
|
12
12
|
import type { BuildContext } from "../../shared/buildContext";
|
13
13
|
import { assert } from "tsafe/assert";
|
14
|
-
import {
|
15
|
-
type ThemeType,
|
16
|
-
BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR,
|
17
|
-
RESOURCES_COMMON
|
18
|
-
} from "../../shared/constants";
|
14
|
+
import { type ThemeType, WELL_KNOWN_DIRECTORY_BASE_NAME } from "../../shared/constants";
|
19
15
|
import { getThisCodebaseRootDirPath } from "../../tools/getThisCodebaseRootDirPath";
|
20
16
|
|
21
17
|
export type BuildContextLike = BuildContextLike_replaceImportsInJsCode &
|
@@ -94,7 +90,7 @@ export function generateFtlFilesCodeFactory(params: {
|
|
94
90
|
new RegExp(
|
95
91
|
`^${(buildContext.urlPathname ?? "/").replace(/\//g, "\\/")}`
|
96
92
|
),
|
97
|
-
`\${xKeycloakify.resourcesPath}/${
|
93
|
+
`\${xKeycloakify.resourcesPath}/${WELL_KNOWN_DIRECTORY_BASE_NAME.DIST}/`
|
98
94
|
)
|
99
95
|
);
|
100
96
|
})
|
@@ -119,7 +115,7 @@ export function generateFtlFilesCodeFactory(params: {
|
|
119
115
|
.replace("{{keycloakifyVersion}}", keycloakifyVersion)
|
120
116
|
.replace("{{themeVersion}}", buildContext.themeVersion)
|
121
117
|
.replace("{{fieldNames}}", fieldNames.map(name => `"${name}"`).join(", "))
|
122
|
-
.replace("{{RESOURCES_COMMON}}", RESOURCES_COMMON)
|
118
|
+
.replace("{{RESOURCES_COMMON}}", WELL_KNOWN_DIRECTORY_BASE_NAME.RESOURCES_COMMON)
|
123
119
|
.replace(
|
124
120
|
"{{userDefinedExclusions}}",
|
125
121
|
buildContext.kcContextExclusionsFtlCode ?? ""
|
@@ -1,12 +1,6 @@
|
|
1
1
|
import { transformCodebase } from "../../tools/transformCodebase";
|
2
2
|
import * as fs from "fs";
|
3
|
-
import {
|
4
|
-
join as pathJoin,
|
5
|
-
resolve as pathResolve,
|
6
|
-
relative as pathRelative,
|
7
|
-
dirname as pathDirname,
|
8
|
-
basename as pathBasename
|
9
|
-
} from "path";
|
3
|
+
import { join as pathJoin, relative as pathRelative, dirname as pathDirname } from "path";
|
10
4
|
import { replaceImportsInJsCode } from "../replacers/replaceImportsInJsCode";
|
11
5
|
import { replaceImportsInCssCode } from "../replacers/replaceImportsInCssCode";
|
12
6
|
import {
|
@@ -15,26 +9,15 @@ import {
|
|
15
9
|
} from "../generateFtl";
|
16
10
|
import {
|
17
11
|
type ThemeType,
|
18
|
-
LAST_KEYCLOAK_VERSION_WITH_ACCOUNT_V1,
|
19
|
-
KEYCLOAK_RESOURCES,
|
20
|
-
ACCOUNT_V1_THEME_NAME,
|
21
|
-
BASENAME_OF_KEYCLOAKIFY_RESOURCES_DIR,
|
22
12
|
LOGIN_THEME_PAGE_IDS,
|
23
|
-
ACCOUNT_THEME_PAGE_IDS
|
13
|
+
ACCOUNT_THEME_PAGE_IDS,
|
14
|
+
WELL_KNOWN_DIRECTORY_BASE_NAME
|
24
15
|
} from "../../shared/constants";
|
25
16
|
import type { BuildContext } from "../../shared/buildContext";
|
26
17
|
import { assert, type Equals } from "tsafe/assert";
|
27
|
-
import {
|
28
|
-
downloadKeycloakStaticResources,
|
29
|
-
type BuildContextLike as BuildContextLike_downloadKeycloakStaticResources
|
30
|
-
} from "../../shared/downloadKeycloakStaticResources";
|
31
18
|
import { readFieldNameUsage } from "./readFieldNameUsage";
|
32
19
|
import { readExtraPagesNames } from "./readExtraPageNames";
|
33
20
|
import { generateMessageProperties } from "./generateMessageProperties";
|
34
|
-
import {
|
35
|
-
bringInAccountV1,
|
36
|
-
type BuildContextLike as BuildContextLike_bringInAccountV1
|
37
|
-
} from "./bringInAccountV1";
|
38
21
|
import { rmSync } from "../../tools/fs.rmSync";
|
39
22
|
import { readThisNpmPackageVersion } from "../../tools/readThisNpmPackageVersion";
|
40
23
|
import {
|
@@ -43,20 +26,19 @@ import {
|
|
43
26
|
} from "../../shared/metaInfKeycloakThemes";
|
44
27
|
import { objectEntries } from "tsafe/objectEntries";
|
45
28
|
import { escapeStringForPropertiesFile } from "../../tools/escapeStringForPropertiesFile";
|
46
|
-
import
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
};
|
29
|
+
import * as child_process from "child_process";
|
30
|
+
import { getThisCodebaseRootDirPath } from "../../tools/getThisCodebaseRootDirPath";
|
31
|
+
|
32
|
+
export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode & {
|
33
|
+
extraThemeProperties: string[] | undefined;
|
34
|
+
projectDirPath: string;
|
35
|
+
projectBuildDirPath: string;
|
36
|
+
environmentVariables: { name: string; default: string }[];
|
37
|
+
implementedThemeTypes: BuildContext["implementedThemeTypes"];
|
38
|
+
themeSrcDirPath: string;
|
39
|
+
bundler: "vite" | "webpack";
|
40
|
+
packageJsonFilePath: string;
|
41
|
+
};
|
60
42
|
|
61
43
|
assert<BuildContext extends BuildContextLike ? true : false>();
|
62
44
|
|
@@ -88,7 +70,7 @@ export async function generateResourcesForMainTheme(params: {
|
|
88
70
|
const destDirPath = pathJoin(
|
89
71
|
themeTypeDirPath,
|
90
72
|
"resources",
|
91
|
-
|
73
|
+
WELL_KNOWN_DIRECTORY_BASE_NAME.DIST
|
92
74
|
);
|
93
75
|
|
94
76
|
// NOTE: Prevent accumulation of files in the assets dir, as names are hashed they pile up.
|
@@ -106,7 +88,7 @@ export async function generateResourcesForMainTheme(params: {
|
|
106
88
|
themeType: "login"
|
107
89
|
}),
|
108
90
|
"resources",
|
109
|
-
|
91
|
+
WELL_KNOWN_DIRECTORY_BASE_NAME.DIST
|
110
92
|
),
|
111
93
|
destDirPath
|
112
94
|
});
|
@@ -117,7 +99,7 @@ export async function generateResourcesForMainTheme(params: {
|
|
117
99
|
{
|
118
100
|
const dirPath = pathJoin(
|
119
101
|
buildContext.projectBuildDirPath,
|
120
|
-
|
102
|
+
WELL_KNOWN_DIRECTORY_BASE_NAME.DOT_KEYCLOAKIFY
|
121
103
|
);
|
122
104
|
|
123
105
|
if (fs.existsSync(dirPath)) {
|
@@ -125,7 +107,7 @@ export async function generateResourcesForMainTheme(params: {
|
|
125
107
|
|
126
108
|
throw new Error(
|
127
109
|
[
|
128
|
-
`Keycloakify build error: The ${
|
110
|
+
`Keycloakify build error: The ${WELL_KNOWN_DIRECTORY_BASE_NAME.DOT_KEYCLOAKIFY} directory shouldn't exist in your build directory.`,
|
129
111
|
`(${pathRelative(process.cwd(), dirPath)}).\n`,
|
130
112
|
`Theses assets are only required for local development with Storybook.",
|
131
113
|
"Please remove this directory as an additional step of your command.\n`,
|
@@ -232,23 +214,52 @@ export async function generateResourcesForMainTheme(params: {
|
|
232
214
|
});
|
233
215
|
}
|
234
216
|
|
217
|
+
bring_in_account_v3_i18n_messages: {
|
218
|
+
if (!buildContext.implementedThemeTypes.account.isImplemented) {
|
219
|
+
break bring_in_account_v3_i18n_messages;
|
220
|
+
}
|
221
|
+
if (buildContext.implementedThemeTypes.account.type !== "Single-Page") {
|
222
|
+
break bring_in_account_v3_i18n_messages;
|
223
|
+
}
|
224
|
+
|
225
|
+
const accountUiDirPath = child_process
|
226
|
+
.execSync("npm list @keycloakify/keycloak-account-ui --parseable", {
|
227
|
+
cwd: pathDirname(buildContext.packageJsonFilePath)
|
228
|
+
})
|
229
|
+
.toString("utf8")
|
230
|
+
.trim();
|
231
|
+
|
232
|
+
const messagesDirPath = pathJoin(accountUiDirPath, "messages");
|
233
|
+
|
234
|
+
if (!fs.existsSync(messagesDirPath)) {
|
235
|
+
throw new Error(
|
236
|
+
`Please update @keycloakify/keycloak-account-ui to 25.0.4-rc.5 or later.`
|
237
|
+
);
|
238
|
+
}
|
239
|
+
|
240
|
+
transformCodebase({
|
241
|
+
srcDirPath: messagesDirPath,
|
242
|
+
destDirPath: pathJoin(
|
243
|
+
getThemeTypeDirPath({ themeType: "account" }),
|
244
|
+
"messages"
|
245
|
+
)
|
246
|
+
});
|
247
|
+
}
|
248
|
+
|
235
249
|
keycloak_static_resources: {
|
236
250
|
if (isForAccountSpa) {
|
237
251
|
break keycloak_static_resources;
|
238
252
|
}
|
239
253
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
themeDirPath: pathResolve(pathJoin(themeTypeDirPath, "..")),
|
250
|
-
themeType,
|
251
|
-
buildContext
|
254
|
+
transformCodebase({
|
255
|
+
srcDirPath: pathJoin(
|
256
|
+
getThisCodebaseRootDirPath(),
|
257
|
+
"res",
|
258
|
+
"public",
|
259
|
+
WELL_KNOWN_DIRECTORY_BASE_NAME.DOT_KEYCLOAKIFY,
|
260
|
+
themeType
|
261
|
+
),
|
262
|
+
destDirPath: pathJoin(themeTypeDirPath, "resources")
|
252
263
|
});
|
253
264
|
}
|
254
265
|
|
@@ -259,7 +270,7 @@ export async function generateResourcesForMainTheme(params: {
|
|
259
270
|
`parent=${(() => {
|
260
271
|
switch (themeType) {
|
261
272
|
case "account":
|
262
|
-
return isForAccountSpa ? "base" :
|
273
|
+
return isForAccountSpa ? "base" : "account-v1";
|
263
274
|
case "login":
|
264
275
|
return "keycloak";
|
265
276
|
}
|
@@ -299,45 +310,9 @@ export async function generateResourcesForMainTheme(params: {
|
|
299
310
|
break bring_in_account_v1;
|
300
311
|
}
|
301
312
|
|
302
|
-
await bringInAccountV1({
|
303
|
-
resourcesDirPath,
|
304
|
-
buildContext
|
305
|
-
});
|
306
|
-
}
|
307
|
-
|
308
|
-
bring_in_account_v3_i18n_messages: {
|
309
|
-
if (!buildContext.implementedThemeTypes.account.isImplemented) {
|
310
|
-
break bring_in_account_v3_i18n_messages;
|
311
|
-
}
|
312
|
-
if (buildContext.implementedThemeTypes.account.type !== "Single-Page") {
|
313
|
-
break bring_in_account_v3_i18n_messages;
|
314
|
-
}
|
315
|
-
|
316
|
-
const { extractedDirPath } = await downloadAndExtractArchive({
|
317
|
-
url: "https://repo1.maven.org/maven2/org/keycloak/keycloak-account-ui/25.0.1/keycloak-account-ui-25.0.1.jar",
|
318
|
-
cacheDirPath: buildContext.cacheDirPath,
|
319
|
-
fetchOptions: buildContext.fetchOptions,
|
320
|
-
uniqueIdOfOnArchiveFile: "bring_in_account_v3_i18n_messages",
|
321
|
-
onArchiveFile: async ({ fileRelativePath, writeFile }) => {
|
322
|
-
if (
|
323
|
-
!fileRelativePath.startsWith(
|
324
|
-
pathJoin("theme", "keycloak.v3", "account", "messages")
|
325
|
-
)
|
326
|
-
) {
|
327
|
-
return;
|
328
|
-
}
|
329
|
-
await writeFile({
|
330
|
-
fileRelativePath: pathBasename(fileRelativePath)
|
331
|
-
});
|
332
|
-
}
|
333
|
-
});
|
334
|
-
|
335
313
|
transformCodebase({
|
336
|
-
srcDirPath:
|
337
|
-
destDirPath: pathJoin(
|
338
|
-
getThemeTypeDirPath({ themeType: "account" }),
|
339
|
-
"messages"
|
340
|
-
)
|
314
|
+
srcDirPath: pathJoin(getThisCodebaseRootDirPath(), "res", "account-v1"),
|
315
|
+
destDirPath: pathJoin(resourcesDirPath, "theme", "account-v1", "account")
|
341
316
|
});
|
342
317
|
}
|
343
318
|
|
@@ -353,7 +328,7 @@ export async function generateResourcesForMainTheme(params: {
|
|
353
328
|
|
354
329
|
if (buildContext.implementedThemeTypes.account.isImplemented) {
|
355
330
|
metaInfKeycloakThemes.themes.push({
|
356
|
-
name:
|
331
|
+
name: "account-v1",
|
357
332
|
types: ["account"]
|
358
333
|
});
|
359
334
|
}
|