@Test(timeout = 60000) public void testNotAuthenticatedWithMultiAuthHandler() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat); AuthenticatorTestCase .setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration()); auth.start(); try { URL url = new URL(auth.getBaseURL()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); Assert.assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, conn.getResponseCode()); Assert.assertTrue(conn .getHeaderField(KerberosAuthenticator.WWW_AUTHENTICATE) != null); } finally { auth.stop(); } }
@Test(timeout = 60000) public void testNotAuthenticatedWithMultiAuthHandler() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat); AuthenticatorTestCase .setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration()); auth.start(); try { URL url = new URL(auth.getBaseURL()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); Assert.assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, conn.getResponseCode()); Assert.assertTrue(conn .getHeaderField(KerberosAuthenticator.WWW_AUTHENTICATE) != null); } finally { auth.stop(); } }
@Test(timeout = 60000) public void testAuthenticationWithMultiAuthHandler() throws Exception { final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat); AuthenticatorTestCase .setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration()); KerberosTestUtils.doAsClient(new Callable<Void>() { @Override public Void call() throws Exception { auth._testAuthentication(new KerberosAuthenticator(), false); return null; } }); }
@Test(timeout = 60000) public void testAuthenticationWithMultiAuthHandler() throws Exception { final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat); AuthenticatorTestCase .setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration()); KerberosTestUtils.doAsClient(new Callable<Void>() { @Override public Void call() throws Exception { auth._testAuthentication(new KerberosAuthenticator(), false); return null; } }); }
@Test(timeout = 60000) public void testAuthenticationHttpClientPostWithMultiAuthHandler() throws Exception { final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat); AuthenticatorTestCase .setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration()); KerberosTestUtils.doAsClient(new Callable<Void>() { @Override public Void call() throws Exception { auth._testAuthenticationHttpClient(new KerberosAuthenticator(), true); return null; } }); }
@Test(timeout = 60000) public void testAuthenticationHttpClientPostWithMultiAuthHandler() throws Exception { final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat); AuthenticatorTestCase .setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration()); KerberosTestUtils.doAsClient(new Callable<Void>() { @Override public Void call() throws Exception { auth._testAuthenticationHttpClient(new KerberosAuthenticator(), true); return null; } }); }