use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class SecurityAuthConfigTest method postConstruct_shouldEncryptSecureConfigurations.
@Test
public void postConstruct_shouldEncryptSecureConfigurations() throws Exception {
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(pluginDescriptor("plugin_id"), profileSettings, null, null, null);
store.setPluginInfo(pluginInfo);
SecurityAuthConfig authConfig = new SecurityAuthConfig("id", "plugin_id", new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass")));
authConfig.encryptSecureConfigurations();
assertThat(authConfig.size(), is(1));
assertTrue(authConfig.first().isSecure());
}
use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class SecurityAuthConfigTest method addConfigurations_shouldAddConfigurationsWithEncryptedValue.
@Test
public void addConfigurations_shouldAddConfigurationsWithEncryptedValue() throws Exception {
ConfigurationProperty property = new ConfigurationProperty(new ConfigurationKey("username"), new EncryptedConfigurationValue("some_name"));
SecurityAuthConfig authConfig = new SecurityAuthConfig("id", "plugin_id");
authConfig.addConfigurations(Arrays.asList(property));
assertThat(authConfig.size(), is(1));
assertThat(authConfig, contains(new ConfigurationProperty(new ConfigurationKey("username"), new EncryptedConfigurationValue("some_name"))));
}
use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class SecurityAuthConfigTest method postConstruct_shouldIgnoreEncryptionIfPluginInfoIsNotDefined.
@Test
public void postConstruct_shouldIgnoreEncryptionIfPluginInfoIsNotDefined() throws Exception {
SecurityAuthConfig authConfig = new SecurityAuthConfig("id", "plugin_id", new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass")));
authConfig.encryptSecureConfigurations();
assertThat(authConfig.size(), is(1));
assertFalse(authConfig.first().isSecure());
}
use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class ElasticProfileTest method addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore.
@Test
public void addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore() throws Exception {
ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfo(pluginDescriptor("plugin_id"), new PluggableInstanceSettings(new ArrayList<>()), null, null, null, null);
store.setPluginInfo(pluginInfo);
ElasticProfile profile = new ElasticProfile("id", "prod-cluster");
profile.addConfigurations(Arrays.asList(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
assertThat(profile.size(), is(1));
assertFalse(profile.first().isSecure());
assertThat(profile, contains(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
}
use of com.thoughtworks.go.domain.config.ConfigurationKey in project gocd by gocd.
the class ConfigurationPropertyMother method create.
public static ConfigurationProperty create(String key, boolean isSecure, String value) {
ConfigurationProperty property = new ConfigurationProperty(new ConfigurationKey(key), new ConfigurationValue(value), null, new GoCipher());
property.handleSecureValueConfiguration(isSecure);
return property;
}
Aggregations