diff --git a/integration-test/src/net/sf/acegisecurity/integrationtests/web/AbstractContactsTests.java b/integration-test/src/net/sf/acegisecurity/integrationtests/web/AbstractContactsTests.java
new file mode 100644
index 0000000000..83cf139167
--- /dev/null
+++ b/integration-test/src/net/sf/acegisecurity/integrationtests/web/AbstractContactsTests.java
@@ -0,0 +1,270 @@
+/* Copyright 2004 Acegi Technology Pty Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.sf.acegisecurity.integrationtests.web;
+
+import com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebForm;
+import com.meterware.httpunit.WebLink;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+import junit.framework.TestCase;
+
+import java.net.URL;
+
+
+/**
+ * Tests the Contacts sample application from a HTTP user's perspective.
+ *
+ * @author Ben Alex
+ * @version $Id$
+ */
+public abstract class AbstractContactsTests extends TestCase {
+ //~ Methods ================================================================
+
+ /**
+ * Returns the base URL where the Contacts application can be found, such
+ * as http://localhost:8080/contacts. There should be no
+ * ending slash.
+ *
+ * @return DOCUMENT ME!
+ */
+ public abstract String getBaseUrl();
+
+ public final void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(AbstractContactsTests.class);
+ }
+
+ public void testHelloPageAccessible() throws Exception {
+ WebConversation conversation = new WebConversation();
+ WebRequest request = new GetMethodWebRequest(getBaseUrl());
+
+ WebResponse response = conversation.getResponse(request);
+ assertEquals("Contacts Security Demo", response.getTitle());
+ assertEquals(2, response.getLinks().length); // debug and manage links
+ assertTrue(response.getText().lastIndexOf("sample.contact.Contact@") != -1);
+ }
+
+ public void testLoginNameCaseSensitive() throws Exception {
+ WebConversation conversation = new WebConversation();
+ WebRequest request = new GetMethodWebRequest(getBaseUrl());
+
+ WebResponse helloPage = conversation.getResponse(request);
+ WebLink debugLink = helloPage.getLinkWith("Debug");
+ WebResponse loginPage = debugLink.click();
+ assertEquals(1, loginPage.getForms()[0].getSubmitButtons().length);
+
+ WebForm loginForm = loginPage.getForms()[0];
+ loginPage = null;
+
+ loginForm.setParameter("j_username", "mArIsSA");
+ loginForm.setParameter("j_password", "koala");
+
+ WebResponse loginOutcome = conversation.getResponse(loginForm
+ .getRequest("submit"));
+
+ assertTrue(loginOutcome.getText().lastIndexOf("SUCCESS!") != -1);
+ }
+
+ public void testLoginPasswordCaseSensitive() throws Exception {
+ WebConversation conversation = new WebConversation();
+ WebRequest request = new GetMethodWebRequest(getBaseUrl());
+
+ WebResponse helloPage = conversation.getResponse(request);
+ WebLink debugLink = helloPage.getLinkWith("Debug");
+ WebResponse loginPage = debugLink.click();
+ assertEquals(1, loginPage.getForms()[0].getSubmitButtons().length);
+
+ WebForm loginForm = loginPage.getForms()[0];
+ loginPage = null;
+
+ loginForm.setParameter("j_username", "dianne");
+ loginForm.setParameter("j_password", "EmU");
+
+ WebResponse loginOutcome = conversation.getResponse(loginForm
+ .getRequest("submit"));
+
+ assertEquals("Login", loginOutcome.getTitle());
+ }
+
+ public void testLoginSuccess() throws Exception {
+ WebConversation conversation = new WebConversation();
+ WebRequest request = new GetMethodWebRequest(getBaseUrl());
+
+ WebResponse helloPage = conversation.getResponse(request);
+ WebLink debugLink = helloPage.getLinkWith("Debug");
+ WebResponse loginPage = debugLink.click();
+ assertEquals(1, loginPage.getForms()[0].getSubmitButtons().length);
+
+ WebForm loginForm = loginPage.getForms()[0];
+ loginPage = null;
+
+ loginForm.setParameter("j_username", "marissa");
+ loginForm.setParameter("j_password", "koala");
+
+ WebResponse loginOutcome = conversation.getResponse(loginForm
+ .getRequest("submit"));
+
+ assertTrue(loginOutcome.getText().lastIndexOf("SUCCESS!") != -1);
+ }
+
+ public void testLoginUnknownUsername() throws Exception {
+ WebConversation conversation = new WebConversation();
+ WebRequest request = new GetMethodWebRequest(getBaseUrl());
+
+ WebResponse helloPage = conversation.getResponse(request);
+ WebLink debugLink = helloPage.getLinkWith("Debug");
+ WebResponse loginPage = debugLink.click();
+ assertEquals(1, loginPage.getForms()[0].getSubmitButtons().length);
+
+ WebForm loginForm = loginPage.getForms()[0];
+ loginPage = null;
+
+ loginForm.setParameter("j_username", "angella");
+ loginForm.setParameter("j_password", "echidna");
+
+ WebResponse loginOutcome = conversation.getResponse(loginForm
+ .getRequest("submit"));
+
+ assertEquals("Login", loginOutcome.getTitle());
+ }
+
+ public void testSessionAsMarissa() throws Exception {
+ WebConversation conversation = new WebConversation();
+ WebRequest request = new GetMethodWebRequest(getBaseUrl());
+
+ WebResponse helloPage = conversation.getResponse(request);
+ WebLink manageLink = helloPage.getLinkWith("Manage");
+ WebResponse loginPage = manageLink.click();
+ manageLink = null;
+ assertEquals(1, loginPage.getForms()[0].getSubmitButtons().length);
+
+ WebForm loginForm = loginPage.getForms()[0];
+ loginPage = null;
+
+ loginForm.setParameter("j_username", "marissa");
+ loginForm.setParameter("j_password", "koala");
+
+ WebResponse loginOutcome = conversation.getResponse(loginForm
+ .getRequest("submit"));
+
+ assertEquals("Your Contacts", loginOutcome.getTitle());
+ assertTrue(loginOutcome.getText().lastIndexOf("marissa's Contacts") != -1);
+ assertEquals(4, loginOutcome.getTables()[0].getRowCount()); // 3 contacts + header
+ assertEquals(5, loginOutcome.getLinks().length); // 3 contacts + add + logoff
+
+ WebLink addLink = loginOutcome.getLinkWith("Add");
+ loginOutcome = null;
+
+ WebResponse addPage = addLink.click();
+ WebForm addForm = addPage.getForms()[0];
+ addPage = null;
+
+ addForm.setParameter("name", "");
+ addForm.setParameter("email", "");
+
+ WebResponse addOutcomeFail = conversation.getResponse(addForm
+ .getRequest("execute"));
+
+ assertEquals(new URL(getBaseUrl() + "/secure/add.htm"),
+ addOutcomeFail.getURL());
+ assertTrue(addOutcomeFail.getText().lastIndexOf("Please fix all errors!") != -1);
+ addOutcomeFail = null;
+
+ addForm.setParameter("name", "somebody");
+ addForm.setParameter("email", "them@somewhere.com");
+
+ WebResponse addOutcomeSuccess = conversation.getResponse(addForm
+ .getRequest("execute"));
+
+ assertEquals("Your Contacts", addOutcomeSuccess.getTitle());
+ assertTrue(addOutcomeSuccess.getText().lastIndexOf("marissa's Contacts") != -1);
+ assertEquals(5, addOutcomeSuccess.getTables()[0].getRowCount()); // 4 contacts + header
+ assertEquals(6, addOutcomeSuccess.getLinks().length); // 4 contacts + add + logoff
+
+ WebLink logout = addOutcomeSuccess.getLinkWith("Logoff");
+ addOutcomeSuccess = null;
+
+ WebResponse loggedOut = logout.click();
+ assertEquals("Contacts Security Demo", loggedOut.getTitle());
+
+ WebLink debugLink = loggedOut.getLinkWith("Debug");
+ loggedOut = null;
+
+ WebResponse loginAgainPage = debugLink.click();
+ assertEquals("Login", loginAgainPage.getTitle());
+ }
+
+ public void testSessionAsScott() throws Exception {
+ WebConversation conversation = new WebConversation();
+ WebRequest request = new GetMethodWebRequest(getBaseUrl());
+
+ WebResponse helloPage = conversation.getResponse(request);
+ WebLink manageLink = helloPage.getLinkWith("Manage");
+ WebResponse loginPage = manageLink.click();
+ manageLink = null;
+ assertEquals(1, loginPage.getForms()[0].getSubmitButtons().length);
+
+ WebForm loginForm = loginPage.getForms()[0];
+ loginPage = null;
+
+ loginForm.setParameter("j_username", "scott");
+ loginForm.setParameter("j_password", "wombat");
+
+ WebResponse loginOutcome = conversation.getResponse(loginForm
+ .getRequest("submit"));
+
+ assertEquals("Your Contacts", loginOutcome.getTitle());
+ assertTrue(loginOutcome.getText().lastIndexOf("scott's Contacts") != -1);
+ assertEquals(3, loginOutcome.getTables()[0].getRowCount()); // 2 contacts + header
+ assertEquals(2, loginOutcome.getLinks().length); // add + logoff only
+
+ WebLink addLink = loginOutcome.getLinkWith("Add");
+ loginOutcome = null;
+
+ WebResponse addPage = addLink.click();
+ WebForm addForm = addPage.getForms()[0];
+ addPage = null;
+
+ addForm.setParameter("name", "somebody");
+ addForm.setParameter("email", "them@somewhere.com");
+
+ WebResponse addOutcomeSuccess = conversation.getResponse(addForm
+ .getRequest("execute"));
+
+ assertEquals("Your Contacts", addOutcomeSuccess.getTitle());
+ assertTrue(addOutcomeSuccess.getText().lastIndexOf("scott's Contacts") != -1);
+ assertEquals(4, addOutcomeSuccess.getTables()[0].getRowCount()); // 3 contacts + header
+ assertEquals(2, addOutcomeSuccess.getLinks().length); // add + logoff only
+
+ WebLink logout = addOutcomeSuccess.getLinkWith("Logoff");
+ addOutcomeSuccess = null;
+
+ WebResponse loggedOut = logout.click();
+ assertEquals("Contacts Security Demo", loggedOut.getTitle());
+
+ WebLink debugLink = loggedOut.getLinkWith("Debug");
+ loggedOut = null;
+
+ WebResponse loginAgainPage = debugLink.click();
+ assertEquals("Login", loginAgainPage.getTitle());
+ }
+}
diff --git a/integration-test/src/net/sf/acegisecurity/integrationtests/web/ContainerAdapterContactsTests.java b/integration-test/src/net/sf/acegisecurity/integrationtests/web/ContainerAdapterContactsTests.java
new file mode 100644
index 0000000000..b3efd3e871
--- /dev/null
+++ b/integration-test/src/net/sf/acegisecurity/integrationtests/web/ContainerAdapterContactsTests.java
@@ -0,0 +1,31 @@
+/* Copyright 2004 Acegi Technology Pty Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.sf.acegisecurity.integrationtests.web;
+
+/**
+ * Returns information required to run container adapters version of Contacts
+ * application test.
+ *
+ * @author Ben Alex
+ * @version $Id$
+ */
+public class ContainerAdapterContactsTests extends AbstractContactsTests {
+ //~ Methods ================================================================
+
+ public String getBaseUrl() {
+ return "http://localhost:8080/contacts-container-adapter";
+ }
+}
diff --git a/integration-test/src/net/sf/acegisecurity/integrationtests/web/FilterContactsTests.java b/integration-test/src/net/sf/acegisecurity/integrationtests/web/FilterContactsTests.java
new file mode 100644
index 0000000000..b62a6eedbf
--- /dev/null
+++ b/integration-test/src/net/sf/acegisecurity/integrationtests/web/FilterContactsTests.java
@@ -0,0 +1,31 @@
+/* Copyright 2004 Acegi Technology Pty Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.sf.acegisecurity.integrationtests.web;
+
+/**
+ * Returns information required to run filters version of Contacts application
+ * test.
+ *
+ * @author Ben Alex
+ * @version $Id$
+ */
+public class FilterContactsTests extends AbstractContactsTests {
+ //~ Methods ================================================================
+
+ public String getBaseUrl() {
+ return "http://localhost:8080/contacts";
+ }
+}
diff --git a/samples/contacts/etc/ca/jboss-web.xml b/samples/contacts/etc/ca/jboss-web.xml
new file mode 100644
index 0000000000..042053ac6c
--- /dev/null
+++ b/samples/contacts/etc/ca/jboss-web.xml
@@ -0,0 +1,7 @@
+
+
If you've used the standard springsecurity.xml, try these users: +
+
username marissa, password koala (granted ROLE_SUPERVISOR) +
username dianne, password emu (not a supervisor) +
username scott, password wombat (not a supervisor) +
+
+ <%-- this form-login-page form is also used as the
+ form-error-page to ask for a login again.
+ --%>
+
If you've used the standard springsecurity.xml, try these users: +
+
username marissa, password koala (granted ROLE_SUPERVISOR) +
username dianne, password emu (not a supervisor) +
username scott, password wombat (not a supervisor) +
+
+ <%-- this form-login-page form is also used as the
+ form-error-page to ask for a login again.
+ --%>
+