Search in sources :

Example 6 with Capabilities

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);
}
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 7 with Capabilities

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;
}
Also used : PluginDescriptor(com.thoughtworks.go.plugin.api.info.PluginDescriptor) Capabilities(com.thoughtworks.go.plugin.domain.authorization.Capabilities) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)

Example 8 with Capabilities

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));
}
Also used : Capabilities(com.thoughtworks.go.plugin.domain.authorization.Capabilities) Before(org.junit.Before)

Example 9 with Capabilities

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);
}
Also used : PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) Capabilities(com.thoughtworks.go.plugin.domain.authorization.Capabilities) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) Image(com.thoughtworks.go.plugin.domain.common.Image)

Example 10 with 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"));
}
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) Image(com.thoughtworks.go.plugin.domain.common.Image) Test(org.junit.Test)

Aggregations

Capabilities (com.thoughtworks.go.plugin.domain.authorization.Capabilities)10 AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)9 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)6 Image (com.thoughtworks.go.plugin.domain.common.Image)3 Test (org.junit.Test)3 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)2 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)1 Before (org.junit.Before)1