use of com.yahoo.pulsar.broker.authentication.AuthenticationService in project pulsar by yahoo.
the class AuthenticationServiceTest method testAuthentication.
@Test
public void testAuthentication() 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);
String result = service.authenticate(null, "auth");
assertEquals(result, s_authentication_success);
}
use of com.yahoo.pulsar.broker.authentication.AuthenticationService 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);
}
use of com.yahoo.pulsar.broker.authentication.AuthenticationService 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);
}
use of com.yahoo.pulsar.broker.authentication.AuthenticationService in project pulsar by yahoo.
the class AuthenticationServiceTest method testAuthentication.
@Test
public void testAuthentication() 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);
String result = service.authenticate(null, "auth");
assertEquals(result, s_authentication_success);
}
Aggregations