Search in sources :

Example 6 with Metadata

use of com.thoughtworks.go.plugin.domain.common.Metadata 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 7 with Metadata

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

the class GoConfigServiceIntegrationTest method setupMetadataForPlugin.

private void setupMetadataForPlugin() {
    PluginDescriptor pluginDescriptor = GoPluginDescriptor.builder().id("cd.go.artifact.docker.registry").build();
    PluginConfiguration buildFile = new PluginConfiguration("BuildFile", new Metadata(false, false));
    PluginConfiguration image = new PluginConfiguration("Image", new Metadata(false, true));
    PluginConfiguration tag = new PluginConfiguration("Tag", new Metadata(false, false));
    PluginConfiguration fetchProperty = new PluginConfiguration("FetchProperty", new Metadata(false, true));
    PluginConfiguration fetchTag = new PluginConfiguration("Tag", new Metadata(false, false));
    PluginConfiguration registryUrl = new PluginConfiguration("RegistryURL", new Metadata(true, false));
    PluginConfiguration username = new PluginConfiguration("Username", new Metadata(false, false));
    PluginConfiguration password = new PluginConfiguration("Password", new Metadata(false, true));
    PluggableInstanceSettings storeConfigSettings = new PluggableInstanceSettings(asList(registryUrl, username, password));
    PluggableInstanceSettings publishArtifactSettings = new PluggableInstanceSettings(asList(buildFile, image, tag));
    PluggableInstanceSettings fetchArtifactSettings = new PluggableInstanceSettings(asList(fetchProperty, fetchTag));
    ArtifactPluginInfo artifactPluginInfo = new ArtifactPluginInfo(pluginDescriptor, storeConfigSettings, publishArtifactSettings, fetchArtifactSettings, null, new Capabilities());
    ArtifactMetadataStore.instance().setPluginInfo(artifactPluginInfo);
}
Also used : GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) Capabilities(com.thoughtworks.go.plugin.domain.artifact.Capabilities) Metadata(com.thoughtworks.go.plugin.domain.common.Metadata) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration) ArtifactPluginInfo(com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo)

Example 8 with Metadata

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

the class PluginRoleConfigTest method setAuthorizationPluginInfo.

private void setAuthorizationPluginInfo() {
    PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
    PluginConfiguration k1 = new PluginConfiguration("k1", new Metadata(false, true));
    PluginConfiguration k2 = new PluginConfiguration("k2", new Metadata(false, false));
    PluginConfiguration k3 = new PluginConfiguration("k3", new Metadata(false, true));
    PluggableInstanceSettings authConfigSettins = new PluggableInstanceSettings(asList(k1, k2, k3));
    PluggableInstanceSettings roleConfigSettings = new PluggableInstanceSettings(asList(k1, k2, k3));
    com.thoughtworks.go.plugin.domain.authorization.Capabilities capabilities = new com.thoughtworks.go.plugin.domain.authorization.Capabilities(SupportedAuthType.Web, true, true, true);
    AuthorizationPluginInfo artifactPluginInfo = new AuthorizationPluginInfo(pluginDescriptor, authConfigSettins, roleConfigSettings, null, capabilities);
    when(pluginDescriptor.id()).thenReturn("cd.go.github");
    AuthorizationMetadataStore.instance().setPluginInfo(artifactPluginInfo);
}
Also used : Metadata(com.thoughtworks.go.plugin.domain.common.Metadata) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration)

Example 9 with Metadata

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

the class ElasticProfileTest method shouldEncryptSecureConfigurations.

@Test
public void shouldEncryptSecureConfigurations() {
    PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
    ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfo(pluginDescriptor(pluginId), profileSettings, profileSettings, null, null, null);
    store.setPluginInfo(pluginInfo);
    ElasticProfile profile = new ElasticProfile("id", clusterProfileId, new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass")));
    profile.encryptSecureProperties(config);
    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.jupiter.api.Test)

Example 10 with Metadata

use of com.thoughtworks.go.plugin.domain.common.Metadata 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.jupiter.api.Test)

Aggregations

Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)51 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)51 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)33 Test (org.junit.jupiter.api.Test)33 GoCipher (com.thoughtworks.go.security.GoCipher)13 ArrayList (java.util.ArrayList)13 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)11 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)10 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)10 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)10 EncryptedConfigurationValue (com.thoughtworks.go.domain.config.EncryptedConfigurationValue)9 Test (org.junit.Test)9 AgentMetadata (com.thoughtworks.go.plugin.access.elastic.models.AgentMetadata)8 ArtifactPluginInfo (com.thoughtworks.go.plugin.domain.artifact.ArtifactPluginInfo)8 Capabilities (com.thoughtworks.go.plugin.domain.artifact.Capabilities)8 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)8 GoPluginApiRequest (com.thoughtworks.go.plugin.api.request.GoPluginApiRequest)6 AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)5 ElasticAgentPluginInfo (com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo)5 PluginView (com.thoughtworks.go.plugin.domain.common.PluginView)3