@Test public void testAnonymousDisallowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(false)); auth.start(); try { URL url = new URL(auth.getBaseURL()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); Assert.assertEquals(HttpURLConnection.HTTP_FORBIDDEN, conn.getResponseCode()); Assert.assertEquals("Anonymous requests are disallowed", conn.getResponseMessage()); } finally { auth.stop(); } }
@Test public void testAnonymousAllowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(true)); auth.start(); try { URL url = new URL(auth.getBaseURL()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode()); } finally { auth.stop(); } }
@Test public void testAnonymousDisallowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(false)); 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.getHeaderFields().containsKey("WWW-Authenticate")); Assert.assertEquals("Authentication required", conn.getResponseMessage()); } finally { auth.stop(); } }
@Test public void testAnonymousDisallowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(false)); 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.getHeaderFields().containsKey("WWW-Authenticate")); Assert.assertEquals("Authentication required", conn.getResponseMessage()); } finally { auth.stop(); } }
@Test public void testAnonymousAllowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(true)); auth.start(); try { URL url = new URL(auth.getBaseURL()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode()); } finally { auth.stop(); } }
@Test public void testAnonymousAllowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(true)); auth.start(); try { URL url = new URL(auth.getBaseURL()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode()); } finally { auth.stop(); } }
@Test public void testAuthenticationAnonymousDisallowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(false)); auth._testAuthentication(new PseudoAuthenticator(), false); }
@Test public void testAuthenticationAnonymousAllowedWithPost() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(true)); auth._testAuthentication(new PseudoAuthenticator(), true); }
@Test public void testAuthenticationAnonymousAllowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(true)); auth._testAuthentication(new PseudoAuthenticator(), false); }
@Test public void testAuthenticationAnonymousDisallowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(false)); auth._testAuthentication(new PseudoAuthenticator(), false); }
@Test public void testAuthenticationAnonymousDisallowedWithPost() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(false)); auth._testAuthentication(new PseudoAuthenticator(), true); }
@Test public void testAuthenticationAnonymousAllowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(true)); auth._testAuthentication(new PseudoAuthenticator(), false); }
@Test public void testAuthenticationAnonymousAllowedWithPost() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(true)); auth._testAuthentication(new PseudoAuthenticator(), true); }
@Test public void testAuthenticationAnonymousAllowedWithPost() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(true)); auth._testAuthentication(new PseudoAuthenticator(), true); }
@Test public void testAuthenticationAnonymousDisallowedWithPost() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(false)); auth._testAuthentication(new PseudoAuthenticator(), true); }
@Test public void testAuthenticationAnonymousDisallowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(false)); auth._testAuthentication(new PseudoAuthenticator(), false); }
@Test public void testAuthenticationAnonymousDisallowedWithPost() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(false)); auth._testAuthentication(new PseudoAuthenticator(), true); }
@Test public void testAuthenticationAnonymousAllowed() throws Exception { AuthenticatorTestCase auth = new AuthenticatorTestCase(); AuthenticatorTestCase.setAuthenticationHandlerConfig( getAuthenticationHandlerConfiguration(true)); auth._testAuthentication(new PseudoAuthenticator(), false); }