Search in sources :

Example 11 with AuthorizationPluginInfo

use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo 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)

Example 12 with AuthorizationPluginInfo

use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo 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());
}
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)

Example 13 with AuthorizationPluginInfo

use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.

the class UserSearchServiceTest method addPluginSupportingUserSearch.

private void addPluginSupportingUserSearch(String pluginId) {
    AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(new GoPluginDescriptor(pluginId, null, null, null, null, false), null, null, null, new Capabilities(SupportedAuthType.Password, true, true));
    AuthorizationMetadataStore.instance().setPluginInfo(pluginInfo);
}
Also used : Capabilities(com.thoughtworks.go.plugin.domain.authorization.Capabilities) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)

Example 14 with AuthorizationPluginInfo

use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.

the class PluginAuthenticationProviderTest method addPluginSupportingPasswordBasedAuthentication.

private void addPluginSupportingPasswordBasedAuthentication(String pluginId) {
    AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(new GoPluginDescriptor(pluginId, null, null, null, null, false), null, null, null, new Capabilities(SupportedAuthType.Password, true, false));
    AuthorizationMetadataStore.instance().setPluginInfo(pluginInfo);
}
Also used : Capabilities(com.thoughtworks.go.plugin.domain.authorization.Capabilities) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)

Example 15 with AuthorizationPluginInfo

use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.

the class SecurityAuthConfigService method getAllConfiguredWebBasedAuthorizationPlugins.

public List<AuthPluginInfoViewModel> getAllConfiguredWebBasedAuthorizationPlugins() {
    ArrayList<AuthPluginInfoViewModel> result = new ArrayList();
    Set<AuthorizationPluginInfo> loadedWebBasedAuthPlugins = authorizationMetadataStore.getPluginsThatSupportsWebBasedAuthentication();
    SecurityAuthConfigs configuredAuthPluginProfiles = getPluginProfiles();
    for (SecurityAuthConfig authConfig : configuredAuthPluginProfiles) {
        AuthorizationPluginInfo authorizationPluginInfo = loadedWebBasedAuthPlugins.stream().filter(new Predicate<AuthorizationPluginInfo>() {

            @Override
            public boolean test(AuthorizationPluginInfo authorizationPluginInfo1) {
                return authorizationPluginInfo1.getDescriptor().id().equals(authConfig.getPluginId());
            }
        }).findFirst().orElse(null);
        if (authorizationPluginInfo != null) {
            result.add(new AuthPluginInfoViewModel(authorizationPluginInfo));
        }
    }
    return result;
}
Also used : SecurityAuthConfig(com.thoughtworks.go.config.SecurityAuthConfig) ArrayList(java.util.ArrayList) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) SecurityAuthConfigs(com.thoughtworks.go.config.SecurityAuthConfigs) AuthPluginInfoViewModel(com.thoughtworks.go.server.ui.AuthPluginInfoViewModel)

Aggregations

AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)24 Test (org.junit.Test)16 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)12 Capabilities (com.thoughtworks.go.plugin.domain.authorization.Capabilities)9 ArrayList (java.util.ArrayList)5 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)4 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)3 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)3 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)3 EncryptedConfigurationValue (com.thoughtworks.go.domain.config.EncryptedConfigurationValue)3 Image (com.thoughtworks.go.plugin.domain.common.Image)3 Map (java.util.Map)3 SecurityAuthConfig (com.thoughtworks.go.config.SecurityAuthConfig)2 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)2 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)2 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)2 GoConfigService (com.thoughtworks.go.server.service.GoConfigService)2 AuthPluginInfoViewModel (com.thoughtworks.go.server.ui.AuthPluginInfoViewModel)2 SecurityAuthConfigs (com.thoughtworks.go.config.SecurityAuthConfigs)1 SecurityConfig (com.thoughtworks.go.config.SecurityConfig)1