Add spring.cloud.config.server.encrypt.enabled flag

So server can delegate decryption to the clients.

Fixes gh-162
This commit is contained in:
Dave Syer
2015-06-23 13:53:29 +01:00
parent 772fa118f3
commit 22f241e342
2 changed files with 32 additions and 8 deletions

View File

@@ -66,10 +66,18 @@ public class ConfigServerProperties {
* Default application profile when incoming requests do not have a specific one.
*/
private String defaultProfile = "default";
/**
* Decryption configuration for when server handles encrypted properties before sending them to clients.
*/
private Encrypt encrypt = new Encrypt();
public Encrypt getEncrypt() {
return this.encrypt;
}
public String getDefaultLabel() {
return defaultLabel;
return this.defaultLabel;
}
public void setDefaultLabel(String defaultLabel) {
@@ -77,7 +85,7 @@ public class ConfigServerProperties {
}
public boolean isBootstrap() {
return bootstrap;
return this.bootstrap;
}
public void setBootstrap(boolean bootstrap) {
@@ -85,7 +93,7 @@ public class ConfigServerProperties {
}
public String getPrefix() {
return prefix;
return this.prefix;
}
public void setPrefix(String prefix) {
@@ -93,7 +101,7 @@ public class ConfigServerProperties {
}
public Map<String, String> getOverrides() {
return overrides;
return this.overrides;
}
public void setOverrides(Map<String, String> overrides) {
@@ -101,7 +109,7 @@ public class ConfigServerProperties {
}
public boolean isStripDocumentFromYaml() {
return stripDocumentFromYaml;
return this.stripDocumentFromYaml;
}
public void setStripDocumentFromYaml(boolean stripDocumentFromYaml) {
@@ -109,7 +117,7 @@ public class ConfigServerProperties {
}
public String getDefaultApplicationName() {
return defaultApplicationName;
return this.defaultApplicationName;
}
public void setDefaultApplicationName(String defaultApplicationName) {
@@ -117,10 +125,25 @@ public class ConfigServerProperties {
}
public String getDefaultProfile() {
return defaultProfile;
return this.defaultProfile;
}
public void setDefaultProfile(String defaultProfile) {
this.defaultProfile = defaultProfile;
}
public static class Encrypt {
/**
* Enable decryption of environment properties before sending to client.
*/
private boolean enabled = true;
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
}

View File

@@ -59,6 +59,7 @@ public class EncryptionAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(value = "spring.cloud.config.server.encrypt.enabled", matchIfMissing = true)
public EnvironmentEncryptor environmentEncryptor(
TextEncryptorLocator textEncryptorLocator) {
return new CipherEnvironmentEncryptor(textEncryptorLocator);