cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] cxf-fediz git commit: Adding an IdP test
Date Wed, 20 Jan 2016 22:18:32 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/1.2.x-fixes 4bea6a111 -> d514e7f41


Adding an IdP 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/f3be2f7d
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/f3be2f7d
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/f3be2f7d

Branch: refs/heads/1.2.x-fixes
Commit: f3be2f7ded8e7a47633760870916c99e2192d8be
Parents: 4bea6a1
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Jan 20 22:10:34 2016 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Jan 20 22:12:05 2016 +0000

----------------------------------------------------------------------
 .../apache/cxf/fediz/systests/idp/IdpTest.java  | 32 ++++++++++++++++++++
 1 file changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/f3be2f7d/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
----------------------------------------------------------------------
diff --git a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
index 3a70ca9..38adc0d 100644
--- a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
+++ b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
@@ -456,4 +456,36 @@ public class IdpTest {
             Assert.assertEquals(ex.getStatusCode(), 400);
         }
     }
+    
+    // Send a bad wreply value
+    @org.junit.Test
+    public void testBadWReply() throws Exception {
+        String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/federation?";
+        url += "wa=wsignin1.0";
+        url += "&whr=urn:org:apache:cxf:fediz:idp:realm-A";
+        url += "&wtrealm=urn:org:apache:cxf:fediz:fedizhelloworld";
+        String wreply = "https://www.apache.org:" + getRpHttpsPort() + "/" 
+            + getServletContextName() + "/secure/fedservlet";
+        url += "&wreply=" + wreply;
+
+        String user = "alice";
+        String password = "ecila";
+
+        final WebClient webClient = new WebClient();
+        webClient.getOptions().setUseInsecureSSL(true);
+        webClient.getCredentialsProvider().setCredentials(
+            new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
+            new UsernamePasswordCredentials(user, password));
+
+        webClient.getOptions().setJavaScriptEnabled(false);
+        try {
+            webClient.getPage(url);
+            Assert.fail("Failure expected on a bad wreply value");
+        } catch (FailingHttpStatusCodeException ex) {
+            Assert.assertEquals(ex.getStatusCode(), 400);
+        }
+
+        webClient.close();
+    }
+    
 }


Mime
View raw message