+
Skip to content

[26.3.x] Unable to configure TLS reloading in Keycloak version 26.2.0 or later #40881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ public static PropertyMapper<?>[] getHttpPropertyMappers() {
.build(),
fromOption(HttpOptions.HTTPS_CERTIFICATES_RELOAD_PERIOD)
.to("quarkus.http.ssl.certificate.reload-period")
// -1 means no reload
.transformer((value, context) -> "-1".equals(value) ? null : value)
.transformer(HttpPropertyMappers::transformNegativeReloadPeriod)
.paramLabel("reload period")
.build(),
fromOption(HttpOptions.HTTPS_CERTIFICATE_FILE)
Expand Down Expand Up @@ -178,6 +177,11 @@ private static String getHttpEnabledTransformer(String value, ConfigSourceInterc
return isHttpEnabled(value) ? "enabled" : "disabled";
}

static String transformNegativeReloadPeriod(String value, ConfigSourceInterceptorContext context) {
// -1 means no reload
return "-1".equals(value) ? null : value;
}

private static boolean isHttpEnabled(String value) {
if (Environment.isDevMode() || Environment.isNonServerMode()) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public static PropertyMapper<?>[] getManagementPropertyMappers() {
fromOption(ManagementOptions.HTTPS_MANAGEMENT_CERTIFICATES_RELOAD_PERIOD)
.mapFrom(HttpOptions.HTTPS_CERTIFICATES_RELOAD_PERIOD)
.to("quarkus.management.ssl.certificate.reload-period")
// -1 means no reload
.transformer((value, context) -> "-1".equals(value) ? null : value)
.transformer(HttpPropertyMappers::transformNegativeReloadPeriod)
.paramLabel("reload period")
.build(),
fromOption(ManagementOptions.HTTPS_MANAGEMENT_CERTIFICATE_FILE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ private ConfigValue transformValue(String name, ConfigValue configValue, ConfigS
String mappedValue = value;

boolean mapped = false;
var theMapper = parentValue ? this.parentMapper : this.mapper;
// fall back to the transformer when no mapper is explicitly specified in .mapFrom()
var theMapper = parentValue && parentMapper != null ? this.parentMapper : this.mapper;
if (theMapper != null && (!name.equals(getFrom()) || parentValue)) {
mappedValue = theMapper.map(getNamedProperty().orElse(null), value, context);
mapped = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ public void testNegativeArgument() {
assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode);
assertEquals("1h",
nonRunningPicocli.config.getConfigValue("quarkus.http.ssl.certificate.reload-period").getValue());
assertEquals("1h",
nonRunningPicocli.config.getConfigValue("quarkus.management.ssl.certificate.reload-period").getValue());

nonRunningPicocli = pseudoLaunch("start-dev", "--https-certificates-reload-period=-1");
assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode);
assertNull(nonRunningPicocli.config.getConfigValue("quarkus.http.ssl.certificate.reload-period").getValue());
assertNull(nonRunningPicocli.config.getConfigValue("quarkus.management.ssl.certificate.reload-period").getValue());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,23 @@ public void testKeystoreConfigSourcePropertyMapping() {
@Test
public void testReloadPeriod() {
ConfigArgsConfigSource.setCliArgs("");
assertEquals("1h", createConfig().getConfigValue("quarkus.http.ssl.certificate.reload-period").getValue());
initConfig();
assertExternalConfig(Map.of(
"quarkus.http.ssl.certificate.reload-period", "1h",
"quarkus.management.ssl.certificate.reload-period", "1h"
));

ConfigArgsConfigSource.setCliArgs("--https-certificates-reload-period=-1");
assertNull(createConfig().getConfigValue("quarkus.http.ssl.certificate.reload-period").getValue());
initConfig();
assertExternalConfigNull("quarkus.http.ssl.certificate.reload-period");
assertExternalConfigNull("quarkus.management.ssl.certificate.reload-period");

ConfigArgsConfigSource.setCliArgs("--https-certificates-reload-period=2h");
assertEquals("2h", createConfig().getConfigValue("quarkus.http.ssl.certificate.reload-period").getValue());
initConfig();
assertExternalConfig(Map.of(
"quarkus.http.ssl.certificate.reload-period", "2h",
"quarkus.management.ssl.certificate.reload-period", "2h"
));
}

@Test
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载