@Test public void testAnonymousDisallowed() throws Exception { setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration(false)); start(); try { URL url = new URL(getBaseURL()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, conn.getResponseCode()); } finally { stop(); } }
@Test public void testAuthenticationAnonymousDisallowedWithPost() throws Exception { setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration(false)); _testAuthentication(new PseudoAuthenticator(), true); }
@Test public void testAuthenticationAnonymousAllowed() throws Exception { setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration(true)); _testAuthentication(new PseudoAuthenticator(), false); }