[jboss-cvs] JBossAS SVN: r108448 - trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Oct 5 10:11:31 EDT 2010


Author: rsvoboda at redhat.com
Date: 2010-10-05 10:11:30 -0400 (Tue, 05 Oct 2010)
New Revision: 108448

Added:
   trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJBossWSAuthenticationUnitTestCase.java
Removed:
   trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestStatusServletAuthenticationUnitTestCase.java
Log:
JBQA-3817 test for security bypass on jbossws console

Copied: trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJBossWSAuthenticationUnitTestCase.java (from rev 108386, trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestStatusServletAuthenticationUnitTestCase.java)
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJBossWSAuthenticationUnitTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJBossWSAuthenticationUnitTestCase.java	2010-10-05 14:11:30 UTC (rev 108448)
@@ -0,0 +1,112 @@
+package org.jboss.test.security.test.authorization.secured;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.JBossTestSetup;
+
+/**
+ * Test verifies that there is no /jbossws servlet security baypass in secured profiles.
+ *
+ * @author rsvoboda at redhat.com
+ */
+public class HttpRequestJBossWSAuthenticationUnitTestCase extends JBossTestCase {
+	
+	private URL u;
+	private HttpURLConnection con;
+	private static final String GET = "GET";
+	private static final String POST = "POST";
+	private static final String HEAD = "HEAD";
+	private static final String OPTIONS = "OPTIONS";
+	private static final String PUT = "PUT";
+	private static final String DELETE = "DELETE";
+	private static final String TRACE = "TRACE"; 
+	
+	public HttpRequestJBoosWSAuthenticationUnitTestCase(String name){
+		super(name);
+	}
+	
+	public static Test suite() throws Exception {
+		TestSuite suite = new TestSuite();
+		suite.addTest(new TestSuite(HttpRequestJBoosWSAuthenticationUnitTestCase.class));
+		// Create an initializer for the test suite
+		TestSetup wrapper = new JBossTestSetup(suite)
+	      		{
+         		@Override
+        	 	protected void setUp() throws Exception
+	         	{
+            			super.setUp();
+         		}
+
+        	 	@Override
+	         	protected void tearDown() throws Exception
+         		{
+        	    		super.tearDown();
+        		}
+      		};
+      		return wrapper;
+	}
+
+	public void testGet() throws Exception {
+		con.setRequestMethod(GET);
+		con.connect();			
+		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+	}
+	
+	public void testPost() throws Exception {
+		con.setRequestMethod(POST);
+		con.connect();
+		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+	}
+	
+	public void testHead() throws Exception {
+		con.setRequestMethod(HEAD);
+		con.connect();			
+		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+	}
+	
+	public void testOptions() throws Exception {
+		con.setRequestMethod(OPTIONS);
+		con.connect();
+		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+	}
+	
+	public void testPut() throws Exception {
+		con.setRequestMethod(PUT);
+		con.connect();			
+		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+	}
+	
+	public void testTrace()  throws Exception {
+		con.setRequestMethod(TRACE);
+		con.connect();
+                assertEquals(HttpURLConnection.HTTP_BAD_METHOD, con.getResponseCode());
+	}
+	
+	public void testDelete()  throws Exception {
+		con.setRequestMethod(DELETE);
+		con.connect();
+		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+	}
+	
+	protected void setUp() throws Exception {
+		super.setUp();
+		u = new URL("http://" + getServerHost() + ":8080/jbossws");
+		con = (HttpURLConnection) u.openConnection();
+		try {
+			con.setDoInput(true);
+			con.setRequestProperty("Cookie","MODIFY ME IF NEEDED");
+		} finally {
+			con.disconnect();
+		}
+	}
+	
+	protected void tearDown(){
+		if (con != null)
+			con.disconnect();
+	}
+}

Deleted: trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestStatusServletAuthenticationUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestStatusServletAuthenticationUnitTestCase.java	2010-10-05 13:52:51 UTC (rev 108447)
+++ trunk/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestStatusServletAuthenticationUnitTestCase.java	2010-10-05 14:11:30 UTC (rev 108448)
@@ -1,112 +0,0 @@
-package org.jboss.test.security.test.authorization.secured;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.jboss.test.JBossTestCase;
-import org.jboss.test.JBossTestSetup;
-
-/**
- * Test verifies that there is no /status servlet security baypass in secured profiles.
- *
- * @author rsvoboda at redhat.com
- */
-public class HttpRequestStatusServletAuthenticationUnitTestCase extends JBossTestCase {
-	
-	private URL u;
-	private HttpURLConnection con;
-	private static final String GET = "GET";
-	private static final String POST = "POST";
-	private static final String HEAD = "HEAD";
-	private static final String OPTIONS = "OPTIONS";
-	private static final String PUT = "PUT";
-	private static final String DELETE = "DELETE";
-	private static final String TRACE = "TRACE"; 
-	
-	public HttpRequestStatusServletAuthenticationUnitTestCase(String name){
-		super(name);
-	}
-	
-	public static Test suite() throws Exception {
-		TestSuite suite = new TestSuite();
-		suite.addTest(new TestSuite(HttpRequestStatusServletAuthenticationUnitTestCase.class));
-		// Create an initializer for the test suite
-		TestSetup wrapper = new JBossTestSetup(suite)
-	      		{
-         		@Override
-        	 	protected void setUp() throws Exception
-	         	{
-            			super.setUp();
-         		}
-
-        	 	@Override
-	         	protected void tearDown() throws Exception
-         		{
-        	    		super.tearDown();
-        		}
-      		};
-      		return wrapper;
-	}
-
-	public void testGet() throws Exception {
-		con.setRequestMethod(GET);
-		con.connect();			
-		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
-	}
-	
-	public void testPost() throws Exception {
-		con.setRequestMethod(POST);
-		con.connect();
-		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
-	}
-	
-	public void testHead() throws Exception {
-		con.setRequestMethod(HEAD);
-		con.connect();			
-		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
-	}
-	
-	public void testOptions() throws Exception {
-		con.setRequestMethod(OPTIONS);
-		con.connect();
-		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
-	}
-	
-	public void testPut() throws Exception {
-		con.setRequestMethod(PUT);
-		con.connect();			
-		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
-	}
-	
-	public void testTrace()  throws Exception {
-		con.setRequestMethod(TRACE);
-		con.connect();
-                assertEquals(HttpURLConnection.HTTP_BAD_METHOD, con.getResponseCode());
-	}
-	
-	public void testDelete()  throws Exception {
-		con.setRequestMethod(DELETE);
-		con.connect();
-		assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
-	}
-	
-	protected void setUp() throws Exception {
-		super.setUp();
-		u = new URL("http://" + getServerHost() + ":8080/status");
-		con = (HttpURLConnection) u.openConnection();
-		try {
-			con.setDoInput(true);
-			con.setRequestProperty("Cookie","MODIFY ME IF NEEDED");
-		} finally {
-			con.disconnect();
-		}
-	}
-	
-	protected void tearDown(){
-		if (con != null)
-			con.disconnect();
-	}
-}



More information about the jboss-cvs-commits mailing list