Search in sources :

Example 1 with Capabilities

use of com.thoughtworks.go.plugin.access.authorization.models.Capabilities in project gocd by gocd.

the class AuthorizationPluginConfigMetadataStore method add.

@Override
public void add(PluginDescriptor plugin, AuthorizationPluginRegistry extension) {
    try {
        Image icon = extension.getIcon(plugin.id());
        Capabilities capabilities = extension.getCapabilities(plugin.id());
        PluginProfileMetadataKeys authConfigMetadata = extension.getPluginConfigurationMetadata(plugin.id());
        String authConfigView = extension.getPluginConfigurationView(plugin.id());
        cacheRoleMetadataAndView(plugin, extension);
        this.icons.put(plugin, icon);
        this.authConfigMetadata.put(plugin, authConfigMetadata);
        this.authConfigView.put(plugin, authConfigView);
        this.capabilities.put(plugin, capabilities);
    } catch (Exception e) {
        LOGGER.error("Failed to load plugin {}", plugin.id(), e);
        throw e;
    }
}
Also used : PluginProfileMetadataKeys(com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKeys) Capabilities(com.thoughtworks.go.plugin.access.authorization.models.Capabilities) Image(com.thoughtworks.go.plugin.access.common.models.Image)

Example 2 with Capabilities

use of com.thoughtworks.go.plugin.access.authorization.models.Capabilities in project gocd by gocd.

the class CapabilitiesTest method shouldDeserializeFromJSON.

@Test
public void shouldDeserializeFromJSON() throws Exception {
    String json = "" + "{\n" + "  \"supported_auth_type\": \"web\",\n" + "  \"can_search\": true\n" + "}";
    Capabilities capabilities = Capabilities.fromJSON(json);
    assertThat(capabilities.getSupportedAuthType(), is(SupportedAuthType.Web));
    assertThat(capabilities.canSearch(), is(true));
}
Also used : Capabilities(com.thoughtworks.go.plugin.access.authorization.models.Capabilities) Test(org.junit.Test)

Aggregations

Capabilities (com.thoughtworks.go.plugin.access.authorization.models.Capabilities)2 Image (com.thoughtworks.go.plugin.access.common.models.Image)1 PluginProfileMetadataKeys (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKeys)1 Test (org.junit.Test)1