use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class ConfigInfoProvider method securityInformation.
private LinkedHashMap<String, Object> securityInformation() {
final LinkedHashMap<String, Object> security = new LinkedHashMap<>();
final ArrayList<Map<String, Object>> pluginsConfigured = new ArrayList<>();
security.put("Plugins", pluginsConfigured);
if (goConfigService.security().securityAuthConfigs().isEmpty()) {
security.put("Enabled", false);
return security;
}
security.put("Enabled", true);
for (AuthorizationPluginInfo pluginInfo : authorizationMetadataStore.allPluginInfos()) {
final String pluginName = pluginInfo.getDescriptor().about().name();
final boolean hashAuthConfig = !goConfigService.security().securityAuthConfigs().findByPluginId(pluginInfo.getDescriptor().id()).isEmpty();
pluginsConfigured.add(singletonMap(pluginName, hashAuthConfig));
}
return security;
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class AuthorizationMetadataStoreTest method pluginInfo.
private AuthorizationPluginInfo pluginInfo(String pluginId, SupportedAuthType supportedAuthType) {
AuthorizationPluginInfo pluginInfo = mock(AuthorizationPluginInfo.class);
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
when(pluginDescriptor.id()).thenReturn(pluginId);
when(pluginInfo.getDescriptor()).thenReturn(pluginDescriptor);
Capabilities capabilities = mock(Capabilities.class);
when(capabilities.getSupportedAuthType()).thenReturn(supportedAuthType);
when(pluginInfo.getCapabilities()).thenReturn(capabilities);
return pluginInfo;
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class AuthorizationMetadataLoaderTest method onPluginUnloded_shouldRemoveTheCorrespondingPluginInfoFromStore.
@Test
public void onPluginUnloded_shouldRemoveTheCorrespondingPluginInfoFromStore() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
AuthorizationMetadataLoader metadataLoader = new AuthorizationMetadataLoader(pluginManager, metadataStore, infoBuilder, extension);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(descriptor, null, null, null, null);
metadataStore.setPluginInfo(pluginInfo);
metadataLoader.pluginUnLoaded(descriptor);
verify(metadataStore).remove(descriptor.id());
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method shouldBuildPluginInfoWithPluginDescriptor.
@Test
public void shouldBuildPluginInfoWithPluginDescriptor() throws Exception {
GoPluginDescriptor descriptor = new GoPluginDescriptor("plugin1", null, null, null, null, false);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertThat(pluginInfo.getDescriptor(), is(descriptor));
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class AuthorizationPluginInfoBuilder method pluginInfoFor.
public AuthorizationPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) {
Capabilities capabilities = capabilities(descriptor.id());
PluggableInstanceSettings authConfigSettings = authConfigSettings(descriptor.id());
PluggableInstanceSettings roleSettings = roleSettings(descriptor.id(), capabilities);
Image image = image(descriptor.id());
return new AuthorizationPluginInfo(descriptor, authConfigSettings, roleSettings, image, capabilities);
}
Aggregations