diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ssl/PropertiesSslBundle.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ssl/PropertiesSslBundle.java index b25b88ad14f..102703d142c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ssl/PropertiesSslBundle.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ssl/PropertiesSslBundle.java @@ -16,6 +16,8 @@ package org.springframework.boot.autoconfigure.ssl; +import java.util.Arrays; + import org.springframework.boot.autoconfigure.ssl.SslBundleProperties.Key; import org.springframework.boot.ssl.SslBundle; import org.springframework.boot.ssl.SslBundleKey; @@ -26,6 +28,7 @@ import org.springframework.boot.ssl.jks.JksSslStoreBundle; import org.springframework.boot.ssl.jks.JksSslStoreDetails; import org.springframework.boot.ssl.pem.PemSslStoreBundle; import org.springframework.boot.ssl.pem.PemSslStoreDetails; +import org.springframework.core.style.ToStringCreator; /** * {@link SslBundle} backed by {@link JksSslBundleProperties} or @@ -128,4 +131,17 @@ public final class PropertiesSslBundle implements SslBundle { properties.getPassword()); } + @Override + public String toString() { + ToStringCreator creator = new ToStringCreator(this); + creator.append("key-alias", this.key.getAlias()); + creator.append("protocol", this.protocol); + creator.append("keystore-type", this.stores.getKeyStore().getType()); + creator.append("truststore-type", + (this.stores.getTrustStore() != null) ? this.stores.getTrustStore().getType() : ""); + creator.append("ciphers", Arrays.toString(this.options.getCiphers())); + creator.append("enabled-protocols", Arrays.toString(this.options.getEnabledProtocols())); + return creator.toString(); + } + } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/WebServerSslBundle.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/WebServerSslBundle.java index 0e10ace7fda..48865151f7e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/WebServerSslBundle.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/WebServerSslBundle.java @@ -17,6 +17,7 @@ package org.springframework.boot.web.server; import java.security.KeyStore; +import java.util.Arrays; import org.springframework.boot.ssl.NoSuchSslBundleException; import org.springframework.boot.ssl.SslBundle; @@ -29,6 +30,7 @@ import org.springframework.boot.ssl.jks.JksSslStoreBundle; import org.springframework.boot.ssl.jks.JksSslStoreDetails; import org.springframework.boot.ssl.pem.PemSslStoreBundle; import org.springframework.boot.ssl.pem.PemSslStoreDetails; +import org.springframework.core.style.ToStringCreator; import org.springframework.util.Assert; import org.springframework.util.StringUtils; import org.springframework.util.function.ThrowingSupplier; @@ -284,4 +286,17 @@ public final class WebServerSslBundle implements SslBundle { } + @Override + public String toString() { + ToStringCreator creator = new ToStringCreator(this); + creator.append("key-alias", this.key.getAlias()); + creator.append("protocol", this.protocol); + creator.append("keystore-type", this.stores.getKeyStore().getType()); + creator.append("truststore-type", + (this.stores.getTrustStore() != null) ? this.stores.getTrustStore().getType() : ""); + creator.append("ciphers", Arrays.toString(this.options.getCiphers())); + creator.append("enabled-protocols", Arrays.toString(this.options.getEnabledProtocols())); + return creator.toString(); + } + }