Skip to content

Commit af2f956

Browse files
leestana01snicoll
authored andcommitted
Embedded LDAP SSL should not be enabled when its bundle is empty
See gh-50700 Signed-off-by: leestana01 <leestana01@naver.com>
1 parent f9fcaa2 commit af2f956

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

module/spring-boot-ldap/src/main/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapProperties.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.springframework.boot.context.properties.ConfigurationProperties;
2525
import org.springframework.boot.convert.Delimiter;
2626
import org.springframework.core.io.Resource;
27+
import org.springframework.util.StringUtils;
2728

2829
/**
2930
* Configuration properties for Embedded LDAP.
@@ -150,7 +151,7 @@ public static class Ssl {
150151
private @Nullable String bundle;
151152

152153
public boolean isEnabled() {
153-
return (this.enabled != null) ? this.enabled : this.bundle != null;
154+
return (this.enabled != null) ? this.enabled : StringUtils.hasText(this.bundle);
154155
}
155156

156157
public void setEnabled(boolean enabled) {

module/spring-boot-ldap/src/test/java/org/springframework/boot/ldap/autoconfigure/embedded/EmbeddedLdapAutoConfigurationTests.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,13 @@ void whenInvalidSslBundleIsConfiguredThenStartFails() {
411411
});
412412
}
413413

414+
@Test
415+
void sslIsNotEnabledWhenBundleIsEmpty() {
416+
EmbeddedLdapProperties properties = new EmbeddedLdapProperties();
417+
properties.getSsl().setBundle("");
418+
assertThat(properties.getSsl().isEnabled()).isFalse();
419+
}
420+
414421
@Configuration(proxyBeanMethods = false)
415422
static class LdapClientConfiguration {
416423

0 commit comments

Comments
 (0)