From b4b298ffc43aee88f97eb7972558748b7a01afa0 Mon Sep 17 00:00:00 2001 From: John Blum Date: Mon, 28 May 2018 17:28:10 -0700 Subject: [PATCH] Add capability to disable Environment post processing for SSL based on System property. --- .../geode/autoconfigure/SslAutoConfiguration.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/geode-spring-boot-starter/src/main/java/org/springframework/boot/data/geode/autoconfigure/SslAutoConfiguration.java b/geode-spring-boot-starter/src/main/java/org/springframework/boot/data/geode/autoconfigure/SslAutoConfiguration.java index aed6b77b..f71084a8 100644 --- a/geode-spring-boot-starter/src/main/java/org/springframework/boot/data/geode/autoconfigure/SslAutoConfiguration.java +++ b/geode-spring-boot-starter/src/main/java/org/springframework/boot/data/geode/autoconfigure/SslAutoConfiguration.java @@ -79,6 +79,9 @@ import org.springframework.util.StringUtils; @SuppressWarnings("unused") public class SslAutoConfiguration { + public static final String SSL_ENVIRONMENT_POST_PROCESSOR_DISABLED_PROPERTY = + "spring.boot.data.geode.security.ssl.environment.post-processor.disabled"; + private static final String CURRENT_WORKING_DIRECTORY = System.getProperty("user.dir"); private static final String GEMFIRE_SSL_KEYSTORE_PROPERTY = "gemfire.ssl-keystore"; private static final String GEMFIRE_SSL_PROPERTY_SOURCE_NAME = "gemfire-ssl"; @@ -281,6 +284,7 @@ public class SslAutoConfiguration { public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { Optional.of(environment) + .filter(this::isEnabled) .filter(SslAutoConfiguration::isSslNotConfigured) .map(SslAutoConfiguration::resolveTrustedKeyStore) .filter(StringUtils::hasText) @@ -295,6 +299,14 @@ public class SslAutoConfiguration { .addFirst(new PropertiesPropertySource(GEMFIRE_SSL_PROPERTY_SOURCE_NAME, gemfireSslProperties)); }); } + + private boolean isEnabled(Environment environment) { + return !isDisabled(environment); + } + + private boolean isDisabled(Environment environment) { + return Boolean.getBoolean(SSL_ENVIRONMENT_POST_PROCESSOR_DISABLED_PROPERTY); + } } static class TrustedKeyStoreIsPresentCondition implements Condition {