use of com.yahoo.pulsar.broker.ServiceConfiguration in project pulsar by yahoo.
the class AuthenticationServiceTest method testAuthenticationHttp.
@Test
public void testAuthenticationHttp() throws Exception {
ServiceConfiguration config = new ServiceConfiguration();
Set<String> providersClassNames = Sets.newHashSet(MockAuthenticationProvider.class.getName());
config.setAuthenticationProviders(providersClassNames);
config.setAuthenticationEnabled(true);
AuthenticationService service = new AuthenticationService(config);
HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getRemoteAddr()).thenReturn("192.168.1.1");
when(request.getRemotePort()).thenReturn(8080);
when(request.getHeader(anyString())).thenReturn("data");
String result = service.authenticateHttpRequest(request);
assertEquals(result, s_authentication_success);
}
Aggregations