use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method shouldBuildPluginInfoWithCapablities.
@Test
public void shouldBuildPluginInfoWithCapablities() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
Capabilities capabilities = new Capabilities(SupportedAuthType.Password, true, true);
when(extension.getCapabilities(descriptor.id())).thenReturn(capabilities);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertThat(pluginInfo.getCapabilities(), is(capabilities));
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method shouldBuildPluginInfoWithRoleSettings.
@Test
public void shouldBuildPluginInfoWithRoleSettings() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("group", new Metadata(true, false)), new PluginConfiguration("something_secure", new Metadata(true, true)));
when(extension.getRoleConfigurationMetadata(descriptor.id())).thenReturn(pluginConfigurations);
when(extension.getRoleConfigurationView(descriptor.id())).thenReturn("role_config");
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertThat(pluginInfo.getRoleSettings(), is(new PluggableInstanceSettings(pluginConfigurations, new PluginView("role_config"))));
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method shouldBuildPluginInfoWithAuthSettings.
@Test
public void shouldBuildPluginInfoWithAuthSettings() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
List<PluginConfiguration> pluginConfigurations = Arrays.asList(new PluginConfiguration("username", new Metadata(true, false)), new PluginConfiguration("password", new Metadata(true, true)));
when(extension.getAuthConfigMetadata(descriptor.id())).thenReturn(pluginConfigurations);
when(extension.getAuthConfigView(descriptor.id())).thenReturn("auth_config");
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertThat(pluginInfo.getAuthConfigSettings(), is(new PluggableInstanceSettings(pluginConfigurations, new PluginView("auth_config"))));
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class SecurityAuthConfigServiceTest method pluginInfo.
private AuthorizationPluginInfo pluginInfo(String githubPluginId, String name, SupportedAuthType supportedAuthType) {
GoPluginDescriptor.About about = new GoPluginDescriptor.About(name, "1.0", null, null, null, null);
GoPluginDescriptor descriptor = new GoPluginDescriptor(githubPluginId, "1.0", about, null, null, false);
return new AuthorizationPluginInfo(descriptor, null, null, new Image("svg", "data", "hash"), new Capabilities(supportedAuthType, true, true));
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo 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"))));
}
Aggregations