Search in sources :

Example 1 with AccessControlInterceptor

use of com.predic8.membrane.core.interceptor.acl.AccessControlInterceptor in project service-proxy by membrane.

the class AccessControlParserTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    resources = new AccessControlInterceptor().parse(FILE_NAME, new HttpRouter()).getResources();
}
Also used : HttpRouter(com.predic8.membrane.core.HttpRouter)

Example 2 with AccessControlInterceptor

use of com.predic8.membrane.core.interceptor.acl.AccessControlInterceptor in project service-proxy by membrane.

the class AccessControlInterceptorIntegrationTest method setInterceptor.

/*
	 * This test can only by run on a specific machine.
	 */
/*@Test
	public void testLocalhost() throws Exception {
		setInterceptor(FILE_CLIENTS_FROM_LOCALHOST);

		HttpClient client = new HttpClient();
		HostConfiguration config = new HostConfiguration();
		config.setLocalAddress(InetAddress.getByName("localhost"));
		client.setHostConfiguration(config);

		assertEquals(200, client.executeMethod(getBLZRequestMethod()));
	}*/
/*
	 * This test can only by run on a specific machine.
	 */
/*@Test
	public void test192_168_2_Star() throws Exception {
		setInterceptor(FILE_CLIENTS_FROM_192_168_2_STAR);
		assertEquals(200, getClient(FIXED_IP).executeMethod(getBLZRequestMethod()));
	}*/
private void setInterceptor(String fileName) throws Exception {
    AccessControlInterceptor interceptor = new AccessControlInterceptor();
    interceptor.setFile(fileName);
    router.addUserFeatureInterceptor(interceptor);
    router.init();
}
Also used : AccessControlInterceptor(com.predic8.membrane.core.interceptor.acl.AccessControlInterceptor)

Example 3 with AccessControlInterceptor

use of com.predic8.membrane.core.interceptor.acl.AccessControlInterceptor in project service-proxy by membrane.

the class ProxyRuleTest method getInterceptors.

private List<Interceptor> getInterceptors() {
    List<Interceptor> interceptors = new ArrayList<Interceptor>();
    Interceptor balancer = new LoadBalancingInterceptor();
    balancer.setId("roundRobinBalancer");
    interceptors.add(balancer);
    Interceptor acl = new AccessControlInterceptor();
    acl.setId("accessControlInterceptor");
    interceptors.add(acl);
    return interceptors;
}
Also used : LoadBalancingInterceptor(com.predic8.membrane.core.interceptor.balancer.LoadBalancingInterceptor) AccessControlInterceptor(com.predic8.membrane.core.interceptor.acl.AccessControlInterceptor) ArrayList(java.util.ArrayList) AccessControlInterceptor(com.predic8.membrane.core.interceptor.acl.AccessControlInterceptor) LoadBalancingInterceptor(com.predic8.membrane.core.interceptor.balancer.LoadBalancingInterceptor) Interceptor(com.predic8.membrane.core.interceptor.Interceptor)

Example 4 with AccessControlInterceptor

use of com.predic8.membrane.core.interceptor.acl.AccessControlInterceptor in project service-proxy by membrane.

the class AccessControlInterceptorTest method setUp.

@Before
public void setUp() throws Exception {
    router = new HttpRouter();
    interceptor = new AccessControlInterceptor();
    interceptor.setFile("classpath:/acl/acl.xml");
    Rule rule4000 = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 4000), "oio.de", 80);
    router = new HttpRouter();
    router.getRuleManager().addProxyAndOpenPortIfNew(rule4000);
    router.addUserFeatureInterceptor(interceptor);
    router.init();
}
Also used : ServiceProxyKey(com.predic8.membrane.core.rules.ServiceProxyKey) ServiceProxy(com.predic8.membrane.core.rules.ServiceProxy) Rule(com.predic8.membrane.core.rules.Rule) HttpRouter(com.predic8.membrane.core.HttpRouter) Before(org.junit.Before)

Aggregations

HttpRouter (com.predic8.membrane.core.HttpRouter)2 AccessControlInterceptor (com.predic8.membrane.core.interceptor.acl.AccessControlInterceptor)2 Interceptor (com.predic8.membrane.core.interceptor.Interceptor)1 LoadBalancingInterceptor (com.predic8.membrane.core.interceptor.balancer.LoadBalancingInterceptor)1 Rule (com.predic8.membrane.core.rules.Rule)1 ServiceProxy (com.predic8.membrane.core.rules.ServiceProxy)1 ServiceProxyKey (com.predic8.membrane.core.rules.ServiceProxyKey)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1