Search in sources :

Example 6 with PluggableInstanceSettings

use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.

the class ArtifactStoreTest method postConstruct_shouldEncryptSecureConfigurations.

@Test
public void postConstruct_shouldEncryptSecureConfigurations() {
    final PluggableInstanceSettings storeConfig = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
    final ArtifactPluginInfo pluginInfo = new ArtifactPluginInfo(pluginDescriptor("plugin_id"), storeConfig, null, null, null, null);
    store.setPluginInfo(pluginInfo);
    ArtifactStore artifactStore = new ArtifactStore("id", "plugin_id", new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass")));
    artifactStore.encryptSecureConfigurations();
    assertThat(artifactStore.size(), is(1));
    assertTrue(artifactStore.first().isSecure());
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationValue(com.thoughtworks.go.domain.config.ConfigurationValue) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) ConfigurationKey(com.thoughtworks.go.domain.config.ConfigurationKey) Metadata(com.thoughtworks.go.plugin.domain.common.Metadata) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration) ArtifactPluginInfo(com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo) Test(org.junit.Test)

Example 7 with PluggableInstanceSettings

use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.

the class ElasticProfileTest method postConstruct_shouldEncryptSecureConfigurations.

@Test
public void postConstruct_shouldEncryptSecureConfigurations() {
    PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
    ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfo(pluginDescriptor("plugin_id"), profileSettings, null, null, null);
    store.setPluginInfo(pluginInfo);
    ElasticProfile profile = new ElasticProfile("id", "plugin_id", new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass")));
    profile.encryptSecureConfigurations();
    assertThat(profile.size(), is(1));
    assertTrue(profile.first().isSecure());
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationValue(com.thoughtworks.go.domain.config.ConfigurationValue) EncryptedConfigurationValue(com.thoughtworks.go.domain.config.EncryptedConfigurationValue) ElasticAgentPluginInfo(com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) ConfigurationKey(com.thoughtworks.go.domain.config.ConfigurationKey) Metadata(com.thoughtworks.go.plugin.domain.common.Metadata) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration) Test(org.junit.Test)

Example 8 with PluggableInstanceSettings

use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.

the class ElasticProfileTest method addConfiguration_shouldEncryptASecureVariable.

@Test
public void addConfiguration_shouldEncryptASecureVariable() throws Exception {
    PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
    ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfo(pluginDescriptor("plugin_id"), profileSettings, null, null, null);
    store.setPluginInfo(pluginInfo);
    ElasticProfile profile = new ElasticProfile("id", "plugin_id");
    profile.addConfigurations(Arrays.asList(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
    assertThat(profile.size(), is(1));
    assertTrue(profile.first().isSecure());
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationValue(com.thoughtworks.go.domain.config.ConfigurationValue) EncryptedConfigurationValue(com.thoughtworks.go.domain.config.EncryptedConfigurationValue) ElasticAgentPluginInfo(com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) ConfigurationKey(com.thoughtworks.go.domain.config.ConfigurationKey) Metadata(com.thoughtworks.go.plugin.domain.common.Metadata) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration) Test(org.junit.Test)

Example 9 with PluggableInstanceSettings

use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.

the class SecurityAuthConfigTest method addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore.

@Test
public void addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore() throws Exception {
    AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(pluginDescriptor("plugin_id"), new PluggableInstanceSettings(new ArrayList<>()), null, null, null);
    store.setPluginInfo(pluginInfo);
    SecurityAuthConfig authConfig = new SecurityAuthConfig("id", "plugin_id");
    authConfig.addConfigurations(Arrays.asList(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
    assertThat(authConfig.size(), is(1));
    assertFalse(authConfig.first().isSecure());
    assertThat(authConfig, contains(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationValue(com.thoughtworks.go.domain.config.ConfigurationValue) EncryptedConfigurationValue(com.thoughtworks.go.domain.config.EncryptedConfigurationValue) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) ConfigurationKey(com.thoughtworks.go.domain.config.ConfigurationKey) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 10 with PluggableInstanceSettings

use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.

the class SecurityAuthConfigTest method addConfiguration_shouldEncryptASecureVariable.

@Test
public void addConfiguration_shouldEncryptASecureVariable() 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");
    authConfig.addConfigurations(Arrays.asList(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
    assertThat(authConfig.size(), is(1));
    assertTrue(authConfig.first().isSecure());
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationValue(com.thoughtworks.go.domain.config.ConfigurationValue) EncryptedConfigurationValue(com.thoughtworks.go.domain.config.EncryptedConfigurationValue) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) ConfigurationKey(com.thoughtworks.go.domain.config.ConfigurationKey) Metadata(com.thoughtworks.go.plugin.domain.common.Metadata) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration) Test(org.junit.Test)

Aggregations

PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)18 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)12 Test (org.junit.Test)12 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)10 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)10 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)9 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)9 EncryptedConfigurationValue (com.thoughtworks.go.domain.config.EncryptedConfigurationValue)8 PluginView (com.thoughtworks.go.plugin.domain.common.PluginView)5 AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)4 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)4 ConfigRepoPluginInfo (com.thoughtworks.go.plugin.domain.configrepo.ConfigRepoPluginInfo)3 ElasticAgentPluginInfo (com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo)3 Image (com.thoughtworks.go.plugin.domain.common.Image)2 PluggableTaskPluginInfo (com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo)2 GoCipher (com.thoughtworks.go.security.GoCipher)2 ArrayList (java.util.ArrayList)2 ConfigurationPropertyBuilder (com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder)1 PluginSettingsConfiguration (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration)1 RepositoryConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)1