Allow Couchbase SSL to be enabled without custom trust material
Closes gh-35147
This commit is contained in:
parent
1d44b45b5d
commit
ff35cc80d7
|
|
@ -125,8 +125,14 @@ public class CouchbaseAutoConfiguration {
|
|||
}
|
||||
|
||||
private void configureSsl(Builder builder, SslBundles sslBundles) {
|
||||
builder.securityConfig((config) -> config.enableTls(true)
|
||||
.trustManagerFactory(getTrustManagerFactory(this.properties.getEnv().getSsl(), sslBundles)));
|
||||
builder.securityConfig((config) -> {
|
||||
config.enableTls(true);
|
||||
TrustManagerFactory trustManagerFactory = getTrustManagerFactory(this.properties.getEnv().getSsl(),
|
||||
sslBundles);
|
||||
if (trustManagerFactory != null) {
|
||||
config.trustManagerFactory(trustManagerFactory);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
|
|
@ -138,7 +144,7 @@ public class CouchbaseAutoConfiguration {
|
|||
SslBundle bundle = sslBundles.getBundle(ssl.getBundle());
|
||||
return bundle.getManagers().getTrustManagerFactory();
|
||||
}
|
||||
throw new IllegalStateException("A key store or bundle must be configured when SSL is enabled");
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
|
|
|
|||
|
|
@ -180,6 +180,15 @@ class CouchbaseAutoConfigurationTests {
|
|||
"spring.couchbase.env.timeouts.analytics=6s", "spring.couchbase.env.timeouts.management=7s");
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableSsl() {
|
||||
testClusterEnvironment((env) -> {
|
||||
SecurityConfig securityConfig = env.securityConfig();
|
||||
assertThat(securityConfig.tlsEnabled()).isTrue();
|
||||
assertThat(securityConfig.trustManagerFactory()).isNull();
|
||||
}, "spring.couchbase.env.ssl.enabled=true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void enableSslWithKeyStore() {
|
||||
testClusterEnvironment((env) -> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue