summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorThomas Becker2012-01-19 05:20:37 (EST)
committer Greg Wilkins2012-01-19 21:38:42 (EST)
commitde16f7672518ecf4dd61bf8957ecee49fa612fad (patch)
tree5f28ee47624b7b08aea45493c0e60506716fdb35
parenta5947342411fb69f1ab0029c0882e1b24dac6428 (diff)
downloadorg.eclipse.jetty.project-de16f7672518ecf4dd61bf8957ecee49fa612fad.zip
org.eclipse.jetty.project-de16f7672518ecf4dd61bf8957ecee49fa612fad.tar.gz
org.eclipse.jetty.project-de16f7672518ecf4dd61bf8957ecee49fa612fad.tar.bz2
369048: one more test
Signed-off-by: Greg Wilkins <gregw@webtide.com>
-rw-r--r--jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java
index 38a2bb0..fd3ea0f 100644
--- a/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java
+++ b/jetty-security/src/test/java/org/eclipse/jetty/security/DataConstraintsTest.java
@@ -331,6 +331,39 @@ public class DataConstraintsTest
constraint0.setName("restricted");
ConstraintMapping mapping0 = new ConstraintMapping();
mapping0.setPathSpec("/restricted/*");
+ mapping0.setConstraint(constraint0);
+
+ _security.setConstraintMappings(Arrays.asList(new ConstraintMapping[]
+ {
+ mapping0
+ }));
+ _server.start();
+
+ String response;
+
+ response = _connector.getResponses("GET /ctx/restricted/info HTTP/1.0\r\n\r\n");
+ assertThat(response, containsString("HTTP/1.1 403 Forbidden"));
+
+ response = _connectorS.getResponses("GET /ctx/restricted/info HTTP/1.0\r\n\r\n");
+ assertThat(response, containsString("HTTP/1.1 403 Forbidden"));
+
+ response = _connector.getResponses("GET /ctx/restricted/info HTTP/1.0\r\n Authorization: Basic YWRtaW46cGFzc3dvcmQ=\r\n\r\n");
+ assertThat(response, containsString("HTTP/1.1 403 Forbidden"));
+
+ response = _connectorS.getResponses("GET /ctx/restricted/info HTTP/1.0\r\n Authorization: Basic YWRtaW46cGFzc3dvcmQ=\r\n\r\n");
+ assertThat(response, containsString("HTTP/1.1 403 Forbidden"));
+
+ }
+
+ @Test
+ public void testRestrictedWithoutAuthenticatorAndMethod() throws Exception
+ {
+ Constraint constraint0 = new Constraint();
+ constraint0.setAuthenticate(true);
+ constraint0.setRoles(new String[] { "admin" } );
+ constraint0.setName("restricted");
+ ConstraintMapping mapping0 = new ConstraintMapping();
+ mapping0.setPathSpec("/restricted/*");
mapping0.setMethod("GET");
mapping0.setConstraint(constraint0);