Embedded LDAP SSL should not be enabled when its bundle is empty

See gh-50700

Signed-off-by: leestana01 <leestana01@naver.com>
This commit is contained in:
leestana01
2026-06-09 16:07:40 +02:00
committed by Stéphane Nicoll
parent f9fcaa2a67
commit af2f956c7d
2 changed files with 9 additions and 1 deletions
@@ -24,6 +24,7 @@ import org.jspecify.annotations.Nullable;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.convert.Delimiter;
import org.springframework.core.io.Resource;
import org.springframework.util.StringUtils;
/**
* Configuration properties for Embedded LDAP.
@@ -150,7 +151,7 @@ public class EmbeddedLdapProperties {
private @Nullable String bundle;
public boolean isEnabled() {
return (this.enabled != null) ? this.enabled : this.bundle != null;
return (this.enabled != null) ? this.enabled : StringUtils.hasText(this.bundle);
}
public void setEnabled(boolean enabled) {
@@ -411,6 +411,13 @@ class EmbeddedLdapAutoConfigurationTests {
});
}
@Test
void sslIsNotEnabledWhenBundleIsEmpty() {
EmbeddedLdapProperties properties = new EmbeddedLdapProperties();
properties.getSsl().setBundle("");
assertThat(properties.getSsl().isEnabled()).isFalse();
}
@Configuration(proxyBeanMethods = false)
static class LdapClientConfiguration {