Browse Source

Revert "Allow overriding encrypted properties with unencrypted properties (#459)"

This reverts commit 4a66435d38.
pull/486/head
Ryan Baxter 6 years ago
parent
commit
5e52806440
  1. 5
      spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/encrypt/EnvironmentDecryptApplicationInitializer.java
  2. 11
      spring-cloud-context/src/test/java/org/springframework/cloud/bootstrap/encrypt/EnvironmentDecryptApplicationInitializerTests.java

5
spring-cloud-context/src/main/java/org/springframework/cloud/bootstrap/encrypt/EnvironmentDecryptApplicationInitializer.java

@ -199,13 +199,10 @@ public class EnvironmentDecryptApplicationInitializer implements @@ -199,13 +199,10 @@ public class EnvironmentDecryptApplicationInitializer implements
}
}
else if (COLLECTION_PROPERTY.matcher(key).matches()) {
// put non-encrypted properties so merging of index properties
// put non-ecrypted properties so merging of index properties
// happens correctly
otherCollectionProperties.put(key, value);
}
else {
overrides.remove(key);
}
}
}
// copy all indexed properties even if not encrypted

11
spring-cloud-context/src/test/java/org/springframework/cloud/bootstrap/encrypt/EnvironmentDecryptApplicationInitializerTests.java

@ -78,17 +78,6 @@ public class EnvironmentDecryptApplicationInitializerTests { @@ -78,17 +78,6 @@ public class EnvironmentDecryptApplicationInitializerTests {
assertEquals("spam", context.getEnvironment().getProperty("foo"));
}
@Test
public void propertySourcesOrderedCorrectlyWithUnencryptedOverrides() {
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("foo: {cipher}bar").applyTo(context);
context.getEnvironment().getPropertySources()
.addFirst(new MapPropertySource("test_override",
Collections.<String, Object>singletonMap("foo", "spam")));
this.listener.initialize(context);
assertEquals("spam", context.getEnvironment().getProperty("foo"));
}
@Test(expected = IllegalStateException.class)
public void errorOnDecrypt() {
this.listener = new EnvironmentDecryptApplicationInitializer(

Loading…
Cancel
Save