use of com.amazon.dataprepper.model.configuration.PluginModel in project data-prepper by opensearch-project.
the class OTelMetricsSource method createAuthenticationProvider.
private GrpcAuthenticationProvider createAuthenticationProvider(final PluginFactory pluginFactory) {
final PluginModel authenticationConfiguration = oTelMetricsSourceConfig.getAuthentication();
if (authenticationConfiguration == null || authenticationConfiguration.getPluginName().equals(GrpcAuthenticationProvider.UNAUTHENTICATED_PLUGIN_NAME)) {
LOG.warn("Creating otel-metrics-source without authentication. This is not secure.");
LOG.warn("In order to set up Http Basic authentication for the otel-metrics-source, go here: https://github.com/opensearch-project/data-prepper/tree/main/data-prepper-plugins/otel-metrics-source#authentication-configurations");
}
final PluginSetting authenticationPluginSetting;
if (authenticationConfiguration != null) {
authenticationPluginSetting = new PluginSetting(authenticationConfiguration.getPluginName(), authenticationConfiguration.getPluginSettings());
} else {
authenticationPluginSetting = new PluginSetting(GrpcAuthenticationProvider.UNAUTHENTICATED_PLUGIN_NAME, Collections.emptyMap());
}
return pluginFactory.loadPlugin(GrpcAuthenticationProvider.class, authenticationPluginSetting);
}
use of com.amazon.dataprepper.model.configuration.PluginModel in project data-prepper by opensearch-project.
the class OTelTraceSource method createAuthenticationProvider.
private GrpcAuthenticationProvider createAuthenticationProvider(final PluginFactory pluginFactory) {
final PluginModel authenticationConfiguration = oTelTraceSourceConfig.getAuthentication();
if (authenticationConfiguration == null || authenticationConfiguration.getPluginName().equals(GrpcAuthenticationProvider.UNAUTHENTICATED_PLUGIN_NAME)) {
LOG.warn("Creating otel-trace-source without authentication. This is not secure.");
LOG.warn("In order to set up Http Basic authentication for the otel-trace-source, go here: https://github.com/opensearch-project/data-prepper/tree/main/data-prepper-plugins/otel-trace-source#authentication-configurations");
}
final PluginSetting authenticationPluginSetting;
if (authenticationConfiguration != null) {
authenticationPluginSetting = new PluginSetting(authenticationConfiguration.getPluginName(), authenticationConfiguration.getPluginSettings());
} else {
authenticationPluginSetting = new PluginSetting(GrpcAuthenticationProvider.UNAUTHENTICATED_PLUGIN_NAME, Collections.emptyMap());
}
return pluginFactory.loadPlugin(GrpcAuthenticationProvider.class, authenticationPluginSetting);
}
use of com.amazon.dataprepper.model.configuration.PluginModel in project data-prepper by opensearch-project.
the class DataPrepperServerConfigurationTest method testGivingSecureConfigThenCreateInsecureSettings.
@Test
public void testGivingSecureConfigThenCreateInsecureSettings() {
final PluginModel pluginModel = mock(PluginModel.class);
final Map<String, Object> settings = new HashMap<>();
when(pluginModel.getPluginName()).thenReturn("super secure plugin");
when(pluginModel.getPluginSettings()).thenReturn(settings);
final PluginSetting pluginSetting = serverConfiguration.pluginSetting(pluginModel);
assertThat(pluginSetting.getName(), is("super secure plugin"));
assertThat(pluginSetting.getSettings(), is(settings));
}
use of com.amazon.dataprepper.model.configuration.PluginModel in project data-prepper by opensearch-project.
the class DataPrepperAppConfigurationTest method testPluginModelFromDataPrepperConfigurationAuthentication.
@Test
public void testPluginModelFromDataPrepperConfigurationAuthentication() {
final DataPrepperConfiguration configuration = mock(DataPrepperConfiguration.class);
final PluginModel pluginModel = appConfiguration.authentication(configuration);
assertThat(pluginModel, is(nullValue()));
verify(configuration).getAuthentication();
}
use of com.amazon.dataprepper.model.configuration.PluginModel in project data-prepper by opensearch-project.
the class DataPrepperAppConfigurationTest method testGivenReturnAuthenticationThenBeanShouldEqualAuthentication.
@Test
public void testGivenReturnAuthenticationThenBeanShouldEqualAuthentication() {
final DataPrepperConfiguration configuration = mock(DataPrepperConfiguration.class);
final PluginModel expected = mock(PluginModel.class);
when(configuration.getAuthentication()).thenReturn(expected);
final PluginModel pluginModel = appConfiguration.authentication(configuration);
assertThat(pluginModel, is(expected));
verify(configuration).getAuthentication();
}
Aggregations