@Test public void testAuthAfterProxyAuthGet() throws Exception { JettyProxyProvider proxy = new JettyProxyProvider("u", "p"); proxy.addBehaviour("/*", new Debug(), new Content()); proxy.addAuthentication("/*", "BASIC"); proxy.addUser("user", "password"); proxy.start(); Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { if (getRequestingHost().equals("localhost")) { String password = "p"; return new PasswordAuthentication("u", password.toCharArray()); } else { String password = "password"; return new PasswordAuthentication("user", password.toCharArray()); } } }); URL url = new URL("http: SocketAddress sa = new InetSocketAddress("localhost", proxy.getPort()); Proxy p = new Proxy(Type.HTTP, sa); HttpURLConnection conn = (HttpURLConnection) url.openConnection(p); try { conn.setDoInput(true); conn.connect(); assertEquals(200, conn.getResponseCode()); } finally { conn.disconnect(); } }
@Override public void addAuthentication(String pathSpec, String authName) { setSecurityHandler(new ProxyAuthHandler()); super.addAuthentication(pathSpec, authName); }
JettyProxyProvider extends JettyServerProvider { @Override public void addAuthentication(String pathSpec, String authName) { setSecurityHandler(new ProxyAuthHandler()); super.addAuthentication(pathSpec, authName); } }
JettyProxyProvider extends JettyServerProvider { @Override public void addAuthentication(String pathSpec, String authName) { setSecurityHandler(new ProxyAuthHandler()); super.addAuthentication(pathSpec, authName); } JettyProxyProvider();  JettyProxyProvider(String user, String pw); }
JettyProxyProvider extends JettyServerProvider { @Override public void addAuthentication(String pathSpec, String authName) { setSecurityHandler(new ProxyAuthHandler()); super.addAuthentication(pathSpec, authName); } JettyProxyProvider();  JettyProxyProvider(String user, String pw); @Override void addAuthentication(String pathSpec, String authName); }
JettyProxyProvider extends JettyServerProvider { @Override public void addAuthentication(String pathSpec, String authName) { setSecurityHandler(new ProxyAuthHandler()); super.addAuthentication(pathSpec, authName); } JettyProxyProvider();  JettyProxyProvider(String user, String pw); @Override void addAuthentication(String pathSpec, String authName);  }