cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/4] cxf-fediz git commit: Minor tweak to test
Date Fri, 16 Dec 2016 17:11:44 GMT
Minor tweak to test


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/21ef968d
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/21ef968d
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/21ef968d

Branch: refs/heads/1.3.x-fixes
Commit: 21ef968dcdebb85d1e57f89da806c951478813a8
Parents: 33f91bc
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Dec 16 16:27:43 2016 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Dec 16 17:11:19 2016 +0000

----------------------------------------------------------------------
 .../cxf/fediz/integrationtests/AbstractTests.java  | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/21ef968d/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
----------------------------------------------------------------------
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
index 1efff45..cf9edbc 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
@@ -731,11 +731,11 @@ public abstract class AbstractTests {
 
         // webClient.close();
     }
-    
+
     @org.junit.Test
     @org.junit.Ignore
     public void testCSRFAttack() throws Exception {
-        String url = "https://localhost:" + getRpHttpsPort() + "/fedizhelloworld/secure/fedservlet";
+        String url = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
+ "/secure/fedservlet";
         String user = "alice";
         String password = "ecila";
         
@@ -790,7 +790,10 @@ public abstract class AbstractTests {
         
         webClient.getOptions().setJavaScriptEnabled(false);
         try {
-            webClient.getPage(request);
+            HtmlPage rpPage2 = webClient.getPage(request);
+            String bodyTextContent = rpPage2.getBody().getTextContent();
+            Assert.assertTrue("Principal not " + user,
+                              bodyTextContent.contains("userPrincipal=" + user));
             Assert.fail("Failure expected on a CSRF attack");
         } catch (FailingHttpStatusCodeException ex) {
             // expected
@@ -810,13 +813,13 @@ public abstract class AbstractTests {
         
         webClient.getOptions().setJavaScriptEnabled(false);
         try {
-            webClient.getPage(request);
+            HtmlPage rpPage2 = webClient.getPage(request);
+            String bodyTextContent = rpPage2.getBody().getTextContent();
+            Assert.assertTrue("Principal not " + user,
+                              bodyTextContent.contains("userPrincipal=" + user));
             Assert.fail("Failure expected on a CSRF attack");
         } catch (FailingHttpStatusCodeException ex) {
             // expected
-            Assert.assertTrue(ex.getMessage().contains("401 Unauthorized")
-                              || ex.getMessage().contains("401 Authentication Failed")
-                              || ex.getMessage().contains("403 Forbidden"));
         }
         
         // webClient.close();


Mime
View raw message