Merge branch '2.0.x'

This commit is contained in:
Spencer Gibb
2018-10-05 17:46:12 -04:00
2 changed files with 5 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ public class CommonsClientAutoConfiguration {
@Bean
@ConditionalOnProperty(value = "spring.cloud.discovery.client.composite-indicator.enabled", matchIfMissing = true)
@ConditionalOnBean(DiscoveryHealthIndicator.class)
@ConditionalOnBean({ DiscoveryHealthIndicator.class, HealthAggregator.class })
public DiscoveryCompositeHealthIndicator discoveryCompositeHealthIndicator(
HealthAggregator aggregator, List<DiscoveryHealthIndicator> indicators) {
return new DiscoveryCompositeHealthIndicator(aggregator, indicators);

View File

@@ -18,6 +18,7 @@ package org.springframework.cloud.context.encrypt;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.regex.Pattern;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.openssl.MiscPEMGenerator;
@@ -36,6 +37,8 @@ import org.springframework.security.rsa.crypto.RsaSecretEncryptor;
*/
public class EncryptorFactory {
private static final Pattern NEWLINE_ESCAPE_PATTERN = Pattern.compile("\\r|\\n");
private String salt = "deadbeef";
public EncryptorFactory() {
@@ -53,7 +56,7 @@ public class EncryptorFactory {
try {
String normalizedPemData = normalizePem(data);
encryptor = new RsaSecretEncryptor(
normalizedPemData.replaceAll("\\n", "").replaceAll("\\r", ""));
NEWLINE_ESCAPE_PATTERN.matcher(normalizedPemData).replaceAll(""));
}
catch (IllegalArgumentException e) {
throw new KeyFormatException(e);