Make text encryptor configuration an autoconfig
So that it can be controlled with @ConditionalOnBean etc.
This commit is contained in:
@@ -16,10 +16,10 @@
|
||||
package org.springframework.cloud.config.server;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.cloud.config.server.encryption.SingleTextEncryptorLocator;
|
||||
import org.springframework.cloud.context.encrypt.KeyFormatException;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.crypto.encrypt.Encryptors;
|
||||
import org.springframework.security.rsa.crypto.RsaSecretEncryptor;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -41,6 +41,12 @@ public class EncryptionControllerTests {
|
||||
controller.decrypt("foo", MediaType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test(expected = KeyNotInstalledException.class)
|
||||
public void cannotDecryptWithNoopEncryptor() {
|
||||
textEncryptorLocator.setEncryptor(Encryptors.noOpText());
|
||||
controller.decrypt("foo", MediaType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test(expected = KeyFormatException.class)
|
||||
public void cannotUploadPublicKey() {
|
||||
controller.uploadKey("ssh-rsa ...", MediaType.TEXT_PLAIN);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class JGitEnvironmentRepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import({ PropertyPlaceholderAutoConfiguration.class, ConfigServerConfiguration.class })
|
||||
@Import({ PropertyPlaceholderAutoConfiguration.class, EnvironmentRepositoryConfiguration.class })
|
||||
protected static class TestConfiguration {
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.junit.Test;
|
||||
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.cloud.config.environment.Environment;
|
||||
import org.springframework.cloud.config.server.ConfigServerConfiguration;
|
||||
import org.springframework.cloud.config.server.EnvironmentRepositoryConfiguration;
|
||||
import org.springframework.cloud.config.server.ConfigServerTestUtils;
|
||||
import org.springframework.cloud.config.server.EnvironmentRepository;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -107,7 +107,7 @@ public class MultipleJGitEnvironmentRepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import({ PropertyPlaceholderAutoConfiguration.class, ConfigServerConfiguration.class })
|
||||
@Import({ PropertyPlaceholderAutoConfiguration.class, EnvironmentRepositoryConfiguration.class })
|
||||
protected static class TestConfiguration {
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ public class SVNKitEnvironmentRepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import({ PropertyPlaceholderAutoConfiguration.class, ConfigServerConfiguration.class })
|
||||
@Import({ PropertyPlaceholderAutoConfiguration.class, EnvironmentRepositoryConfiguration.class })
|
||||
protected static class TestConfiguration {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user