Search in sources :

Example 1 with DataPrepperCoreAuthenticationProvider

use of com.amazon.dataprepper.pipeline.server.DataPrepperCoreAuthenticationProvider in project data-prepper by opensearch-project.

the class DataPrepperServerConfigurationTest method testGivenPluginFactoryAndPluginSettingsThenCreateAuthenticationProvider.

@Test
public void testGivenPluginFactoryAndPluginSettingsThenCreateAuthenticationProvider() {
    final PluginFactory pluginFactory = mock(PluginFactory.class);
    final PluginSetting pluginSetting = mock(PluginSetting.class);
    final DataPrepperCoreAuthenticationProvider expected = mock(DataPrepperCoreAuthenticationProvider.class);
    when(pluginFactory.loadPlugin(eq(DataPrepperCoreAuthenticationProvider.class), eq(pluginSetting))).thenReturn(expected);
    final DataPrepperCoreAuthenticationProvider authenticationProvider = serverConfiguration.authenticationProvider(pluginFactory, pluginSetting);
    assertThat(authenticationProvider, is(expected));
}
Also used : DataPrepperCoreAuthenticationProvider(com.amazon.dataprepper.pipeline.server.DataPrepperCoreAuthenticationProvider) PluginFactory(com.amazon.dataprepper.model.plugin.PluginFactory) PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting) Test(org.junit.jupiter.api.Test)

Example 2 with DataPrepperCoreAuthenticationProvider

use of com.amazon.dataprepper.pipeline.server.DataPrepperCoreAuthenticationProvider in project data-prepper by opensearch-project.

the class DataPrepperServerConfigurationTest method testGivenGetAuthenticatorReturnsValueThenReturnOptionalContainingValue.

@Test
public void testGivenGetAuthenticatorReturnsValueThenReturnOptionalContainingValue() {
    final DataPrepperCoreAuthenticationProvider provider = mock(DataPrepperCoreAuthenticationProvider.class);
    final Authenticator authenticatorMock = mock(Authenticator.class);
    when(provider.getAuthenticator()).thenReturn(authenticatorMock);
    final Authenticator authenticator = serverConfiguration.authenticator(provider);
    assertThat(authenticator, is(authenticatorMock));
}
Also used : DataPrepperCoreAuthenticationProvider(com.amazon.dataprepper.pipeline.server.DataPrepperCoreAuthenticationProvider) Authenticator(com.sun.net.httpserver.Authenticator) Test(org.junit.jupiter.api.Test)

Aggregations

DataPrepperCoreAuthenticationProvider (com.amazon.dataprepper.pipeline.server.DataPrepperCoreAuthenticationProvider)2 Test (org.junit.jupiter.api.Test)2 PluginSetting (com.amazon.dataprepper.model.configuration.PluginSetting)1 PluginFactory (com.amazon.dataprepper.model.plugin.PluginFactory)1 Authenticator (com.sun.net.httpserver.Authenticator)1