From 3f001899b4f1f71ea94fcba0c2a3f7310c30f6da Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 29 May 2018 17:51:01 +0200 Subject: [PATCH] Harmonize ssl properties for Kafka Closes gh-13239 --- .../autoconfigure/kafka/KafkaProperties.java | 48 +++++++++---------- .../kafka/KafkaAutoConfigurationTests.java | 36 +++++++------- .../appendix-application-properties.adoc | 48 +++++++++---------- 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java index 1788a8c7fd..5716bcffe8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java @@ -823,12 +823,12 @@ public class KafkaProperties { /** * Location of the key store file. */ - private Resource keystoreLocation; + private Resource keyStoreLocation; /** * Store password for the key store file. */ - private String keystorePassword; + private String keyStorePassword; /** * Type of the key store. @@ -838,12 +838,12 @@ public class KafkaProperties { /** * Location of the trust store file. */ - private Resource truststoreLocation; + private Resource trustStoreLocation; /** * Store password for the trust store file. */ - private String truststorePassword; + private String trustStorePassword; /** * Type of the trust store. @@ -863,20 +863,20 @@ public class KafkaProperties { this.keyPassword = keyPassword; } - public Resource getKeystoreLocation() { - return this.keystoreLocation; + public Resource getKeyStoreLocation() { + return this.keyStoreLocation; } - public void setKeystoreLocation(Resource keystoreLocation) { - this.keystoreLocation = keystoreLocation; + public void setKeyStoreLocation(Resource keyStoreLocation) { + this.keyStoreLocation = keyStoreLocation; } - public String getKeystorePassword() { - return this.keystorePassword; + public String getKeyStorePassword() { + return this.keyStorePassword; } - public void setKeystorePassword(String keystorePassword) { - this.keystorePassword = keystorePassword; + public void setKeyStorePassword(String keyStorePassword) { + this.keyStorePassword = keyStorePassword; } public String getKeyStoreType() { @@ -887,20 +887,20 @@ public class KafkaProperties { this.keyStoreType = keyStoreType; } - public Resource getTruststoreLocation() { - return this.truststoreLocation; + public Resource getTrustStoreLocation() { + return this.trustStoreLocation; } - public void setTruststoreLocation(Resource truststoreLocation) { - this.truststoreLocation = truststoreLocation; + public void setTrustStoreLocation(Resource trustStoreLocation) { + this.trustStoreLocation = trustStoreLocation; } - public String getTruststorePassword() { - return this.truststorePassword; + public String getTrustStorePassword() { + return this.trustStorePassword; } - public void setTruststorePassword(String truststorePassword) { - this.truststorePassword = truststorePassword; + public void setTrustStorePassword(String trustStorePassword) { + this.trustStorePassword = trustStorePassword; } public String getTrustStoreType() { @@ -924,15 +924,15 @@ public class KafkaProperties { PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(this::getKeyPassword) .to(properties.in(SslConfigs.SSL_KEY_PASSWORD_CONFIG)); - map.from(this::getKeystoreLocation).as(this::resourceToPath) + map.from(this::getKeyStoreLocation).as(this::resourceToPath) .to(properties.in(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG)); - map.from(this::getKeystorePassword) + map.from(this::getKeyStorePassword) .to(properties.in(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG)); map.from(this::getKeyStoreType) .to(properties.in(SslConfigs.SSL_KEYSTORE_TYPE_CONFIG)); - map.from(this::getTruststoreLocation).as(this::resourceToPath) + map.from(this::getTrustStoreLocation).as(this::resourceToPath) .to(properties.in(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG)); - map.from(this::getTruststorePassword) + map.from(this::getTrustStorePassword) .to(properties.in(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG)); map.from(this::getTrustStoreType) .to(properties.in(SslConfigs.SSL_TRUSTSTORE_TYPE_CONFIG)); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java index 732fa3fd3e..3e91f1d12c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java @@ -75,12 +75,12 @@ public class KafkaAutoConfigurationTests { "spring.kafka.properties.baz=qux", "spring.kafka.properties.foo.bar.baz=qux.fiz.buz", "spring.kafka.ssl.key-password=p1", - "spring.kafka.ssl.keystore-location=classpath:ksLoc", - "spring.kafka.ssl.keystore-password=p2", - "spring.kafka.ssl.keystore-type=PKCS12", - "spring.kafka.ssl.truststore-location=classpath:tsLoc", - "spring.kafka.ssl.truststore-password=p3", - "spring.kafka.ssl.truststore-type=PKCS12", + "spring.kafka.ssl.key-store-location=classpath:ksLoc", + "spring.kafka.ssl.key-store-password=p2", + "spring.kafka.ssl.key-store-type=PKCS12", + "spring.kafka.ssl.trust-store-location=classpath:tsLoc", + "spring.kafka.ssl.trust-store-password=p3", + "spring.kafka.ssl.trust-store-type=PKCS12", "spring.kafka.ssl.protocol=TLSv1.2", "spring.kafka.consumer.auto-commit-interval=123", "spring.kafka.consumer.max-poll-records=42", @@ -166,12 +166,12 @@ public class KafkaAutoConfigurationTests { "spring.kafka.producer.retries=2", "spring.kafka.producer.properties.fiz.buz=fix.fox", "spring.kafka.producer.ssl.key-password=p4", - "spring.kafka.producer.ssl.keystore-location=classpath:ksLocP", - "spring.kafka.producer.ssl.keystore-password=p5", - "spring.kafka.producer.ssl.keystore-type=PKCS12", - "spring.kafka.producer.ssl.truststore-location=classpath:tsLocP", - "spring.kafka.producer.ssl.truststore-password=p6", - "spring.kafka.producer.ssl.truststore-type=PKCS12", + "spring.kafka.producer.ssl.key-store-location=classpath:ksLocP", + "spring.kafka.producer.ssl.key-store-password=p5", + "spring.kafka.producer.ssl.key-store-type=PKCS12", + "spring.kafka.producer.ssl.trust-store-location=classpath:tsLocP", + "spring.kafka.producer.ssl.trust-store-password=p6", + "spring.kafka.producer.ssl.trust-store-type=PKCS12", "spring.kafka.producer.ssl.protocol=TLSv1.2", "spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.IntegerSerializer") .run((context) -> { @@ -232,12 +232,12 @@ public class KafkaAutoConfigurationTests { "spring.kafka.admin.fail-fast=true", "spring.kafka.admin.properties.fiz.buz=fix.fox", "spring.kafka.admin.ssl.key-password=p4", - "spring.kafka.admin.ssl.keystore-location=classpath:ksLocP", - "spring.kafka.admin.ssl.keystore-password=p5", - "spring.kafka.admin.ssl.keystore-type=PKCS12", - "spring.kafka.admin.ssl.truststore-location=classpath:tsLocP", - "spring.kafka.admin.ssl.truststore-password=p6", - "spring.kafka.admin.ssl.truststore-type=PKCS12", + "spring.kafka.admin.ssl.key-store-location=classpath:ksLocP", + "spring.kafka.admin.ssl.key-store-password=p5", + "spring.kafka.admin.ssl.key-store-type=PKCS12", + "spring.kafka.admin.ssl.trust-store-location=classpath:tsLocP", + "spring.kafka.admin.ssl.trust-store-password=p6", + "spring.kafka.admin.ssl.trust-store-type=PKCS12", "spring.kafka.admin.ssl.protocol=TLSv1.2").run((context) -> { KafkaAdmin admin = context.getBean(KafkaAdmin.class); Map configs = admin.getConfig(); diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 10d8267eaf..76dc71da75 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -1002,13 +1002,13 @@ content into your application. Rather, pick only the properties that you need. spring.kafka.admin.fail-fast=false # Whether to fail fast if the broker is not available on startup. spring.kafka.admin.properties.*= # Additional admin-specific properties used to configure the client. spring.kafka.admin.ssl.key-password= # Password of the private key in the key store file. - spring.kafka.admin.ssl.keystore-location= # Location of the key store file. - spring.kafka.admin.ssl.keystore-password= # Store password for the key store file. - spring.kafka.admin.ssl.keystore-type= # Type of the key store. + spring.kafka.admin.ssl.key-store-location= # Location of the key store file. + spring.kafka.admin.ssl.key-store-password= # Store password for the key store file. + spring.kafka.admin.ssl.key-store-type= # Type of the key store. spring.kafka.admin.ssl.protocol= # SSL protocol to use. - spring.kafka.admin.ssl.truststore-location= # Location of the trust store file. - spring.kafka.admin.ssl.truststore-password= # Store password for the trust store file. - spring.kafka.admin.ssl.truststore-type= # Type of the trust store. + spring.kafka.admin.ssl.trust-store-location= # Location of the trust store file. + spring.kafka.admin.ssl.trust-store-password= # Store password for the trust store file. + spring.kafka.admin.ssl.trust-store-type= # Type of the trust store. spring.kafka.bootstrap-servers= # Comma-delimited list of host:port pairs to use for establishing the initial connection to the Kafka cluster. spring.kafka.client-id= # ID to pass to the server when making requests. Used for server-side logging. spring.kafka.consumer.auto-commit-interval= # Frequency with which the consumer offsets are auto-committed to Kafka if 'enable.auto.commit' is set to true. @@ -1024,13 +1024,13 @@ content into your application. Rather, pick only the properties that you need. spring.kafka.consumer.max-poll-records= # Maximum number of records returned in a single call to poll(). spring.kafka.consumer.properties.*= # Additional consumer-specific properties used to configure the client. spring.kafka.consumer.ssl.key-password= # Password of the private key in the key store file. - spring.kafka.consumer.ssl.keystore-location= # Location of the key store file. - spring.kafka.consumer.ssl.keystore-password= # Store password for the key store file. - spring.kafka.consumer.ssl.keystore-type= # Type of the key store. + spring.kafka.consumer.ssl.key-store-location= # Location of the key store file. + spring.kafka.consumer.ssl.key-store-password= # Store password for the key store file. + spring.kafka.consumer.ssl.key-store-type= # Type of the key store. spring.kafka.consumer.ssl.protocol= # SSL protocol to use. - spring.kafka.consumer.ssl.truststore-location= # Location of the trust store file. - spring.kafka.consumer.ssl.truststore-password= # Store password for the trust store file. - spring.kafka.consumer.ssl.truststore-type= # Type of the trust store. + spring.kafka.consumer.ssl.trust-store-location= # Location of the trust store file. + spring.kafka.consumer.ssl.trust-store-password= # Store password for the trust store file. + spring.kafka.consumer.ssl.trust-store-type= # Type of the trust store. spring.kafka.consumer.value-deserializer= # Deserializer class for values. spring.kafka.jaas.control-flag=required # Control flag for login configuration. spring.kafka.jaas.enabled=false # Whether to enable JAAS configuration. @@ -1057,24 +1057,24 @@ content into your application. Rather, pick only the properties that you need. spring.kafka.producer.properties.*= # Additional producer-specific properties used to configure the client. spring.kafka.producer.retries= # When greater than zero, enables retrying of failed sends. spring.kafka.producer.ssl.key-password= # Password of the private key in the key store file. - spring.kafka.producer.ssl.keystore-location= # Location of the key store file. - spring.kafka.producer.ssl.keystore-password= # Store password for the key store file. - spring.kafka.producer.ssl.keystore-type= # Type of the key store. + spring.kafka.producer.ssl.key-store-location= # Location of the key store file. + spring.kafka.producer.ssl.key-store-password= # Store password for the key store file. + spring.kafka.producer.ssl.key-store-type= # Type of the key store. spring.kafka.producer.ssl.protocol= # SSL protocol to use. - spring.kafka.producer.ssl.truststore-location= # Location of the trust store file. - spring.kafka.producer.ssl.truststore-password= # Store password for the trust store file. - spring.kafka.producer.ssl.truststore-type= # Type of the trust store. + spring.kafka.producer.ssl.trust-store-location= # Location of the trust store file. + spring.kafka.producer.ssl.trust-store-password= # Store password for the trust store file. + spring.kafka.producer.ssl.trust-store-type= # Type of the trust store. spring.kafka.producer.transaction-id-prefix= # When non empty, enables transaction support for producer. spring.kafka.producer.value-serializer= # Serializer class for values. spring.kafka.properties.*= # Additional properties, common to producers and consumers, used to configure the client. spring.kafka.ssl.key-password= # Password of the private key in the key store file. - spring.kafka.ssl.keystore-location= # Location of the key store file. - spring.kafka.ssl.keystore-password= # Store password for the key store file. - spring.kafka.ssl.keystore-type= # Type of the key store. + spring.kafka.ssl.key-store-location= # Location of the key store file. + spring.kafka.ssl.key-store-password= # Store password for the key store file. + spring.kafka.ssl.key-store-type= # Type of the key store. spring.kafka.ssl.protocol= # SSL protocol to use. - spring.kafka.ssl.truststore-location= # Location of the trust store file. - spring.kafka.ssl.truststore-password= # Store password for the trust store file. - spring.kafka.ssl.truststore-type= # Type of the trust store. + spring.kafka.ssl.trust-store-location= # Location of the trust store file. + spring.kafka.ssl.trust-store-password= # Store password for the trust store file. + spring.kafka.ssl.trust-store-type= # Type of the trust store. spring.kafka.template.default-topic= # Default topic to which messages are sent. # RABBIT ({sc-spring-boot-autoconfigure}/amqp/RabbitProperties.{sc-ext}[RabbitProperties])