use of com.thoughtworks.go.plugin.domain.authorization.Capabilities 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);
}
use of com.thoughtworks.go.plugin.domain.authorization.Capabilities 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.Capabilities in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method setUp.
@Before
public void setUp() throws Exception {
extension = mock(AuthorizationExtension.class);
stub(extension.getCapabilities(any(String.class))).toReturn(new Capabilities(SupportedAuthType.Password, true, true));
}
use of com.thoughtworks.go.plugin.domain.authorization.Capabilities 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);
}
use of com.thoughtworks.go.plugin.domain.authorization.Capabilities in project gocd by gocd.
the class AuthPluginInfoViewModelTest method shouldGetDetailsAboutThePlugin.
@Test
public void shouldGetDetailsAboutThePlugin() {
GoPluginDescriptor.About about = new GoPluginDescriptor.About("GitHub Auth Plugin", "1.0", null, null, null, null);
String pluginId = "github";
GoPluginDescriptor descriptor = new GoPluginDescriptor(pluginId, "1.0", about, null, null, false);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(descriptor, null, null, new Image("svg", "data", "hash"), new Capabilities(SupportedAuthType.Web, true, true));
AuthPluginInfoViewModel model = new AuthPluginInfoViewModel(pluginInfo);
assertThat(model.imageUrl(), is("/go/api/plugin_images/github/hash"));
assertThat(model.pluginId(), is("github"));
assertThat(model.name(), is("GitHub Auth Plugin"));
}
Aggregations