You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2016/01/20 23:10:44 UTC
cxf-fediz git commit: Adding an IdP test
Repository: cxf-fediz
Updated Branches:
refs/heads/master 31a6884f3 -> e7b2cfba2
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/e7b2cfba
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/e7b2cfba
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/e7b2cfba
Branch: refs/heads/master
Commit: e7b2cfba2ebc9fcba236c4ebde8b84ca8bdec27d
Parents: 31a6884
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed Jan 20 22:10:34 2016 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed Jan 20 22:10:34 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/e7b2cfba/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 601d7c7..3fc1539 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
@@ -476,4 +476,36 @@ public class IdpTest {
webClient.close();
}
+
+ // 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();
+ }
+
}