use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class SecurityAuthConfigTest method addConfiguration_shouldEncryptASecureVariable.
@Test
public void addConfiguration_shouldEncryptASecureVariable() throws Exception {
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(pluginDescriptor("plugin_id"), profileSettings, 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));
assertTrue(authConfig.first().isSecure());
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class SecurityAuthConfigTest method postConstruct_shouldEncryptSecureConfigurations.
@Test
public void postConstruct_shouldEncryptSecureConfigurations() throws Exception {
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(pluginDescriptor("plugin_id"), profileSettings, null, null, null);
store.setPluginInfo(pluginInfo);
SecurityAuthConfig authConfig = new SecurityAuthConfig("id", "plugin_id", new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass")));
authConfig.encryptSecureConfigurations();
assertThat(authConfig.size(), is(1));
assertTrue(authConfig.first().isSecure());
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo in project gocd by gocd.
the class UserSearchServiceTest method addPluginSupportingUserSearch.
private void addPluginSupportingUserSearch(String pluginId) {
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfo(new GoPluginDescriptor(pluginId, null, null, null, null, false), null, null, null, new Capabilities(SupportedAuthType.Password, true, true));
AuthorizationMetadataStore.instance().setPluginInfo(pluginInfo);
}
use of com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo 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.AuthorizationPluginInfo in project gocd by gocd.
the class SecurityAuthConfigService method getAllConfiguredWebBasedAuthorizationPlugins.
public List<AuthPluginInfoViewModel> getAllConfiguredWebBasedAuthorizationPlugins() {
ArrayList<AuthPluginInfoViewModel> result = new ArrayList();
Set<AuthorizationPluginInfo> loadedWebBasedAuthPlugins = authorizationMetadataStore.getPluginsThatSupportsWebBasedAuthentication();
SecurityAuthConfigs configuredAuthPluginProfiles = getPluginProfiles();
for (SecurityAuthConfig authConfig : configuredAuthPluginProfiles) {
AuthorizationPluginInfo authorizationPluginInfo = loadedWebBasedAuthPlugins.stream().filter(new Predicate<AuthorizationPluginInfo>() {
@Override
public boolean test(AuthorizationPluginInfo authorizationPluginInfo1) {
return authorizationPluginInfo1.getDescriptor().id().equals(authConfig.getPluginId());
}
}).findFirst().orElse(null);
if (authorizationPluginInfo != null) {
result.add(new AuthPluginInfoViewModel(authorizationPluginInfo));
}
}
return result;
}
Aggregations