cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/6] cxf-fediz git commit: Adding another logout test
Date Wed, 07 Dec 2016 12:38:34 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/1.3.x-fixes 33f1cb9ba -> 7a71e333a


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

Branch: refs/heads/1.3.x-fixes
Commit: d1bf3fe52a0c9cc804acdb607ae7cd5c300e4b8b
Parents: 33f1cb9
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Tue Dec 6 17:30:18 2016 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Dec 7 12:13:41 2016 +0000

----------------------------------------------------------------------
 .../fediz/integrationtests/AbstractTests.java   | 55 ++++++++++++++++----
 1 file changed, 46 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/d1bf3fe5/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 547115e..79749dd 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
@@ -387,21 +387,62 @@ public abstract class AbstractTests {
 
         // 4. now we try to access the RP and idp without authentication but with the existing
cookies
         // to see if we are really logged out
-        String rpUrl = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
-            + "/secure/fedservlet";
 
         // webClient.close();
         webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
-        final HtmlPage idpPage = webClient.getPage(rpUrl);
+        final HtmlPage idpPage = webClient.getPage(url);
 
         Assert.assertEquals(401, idpPage.getWebResponse().getStatusCode());
 
         // webClient.close();
     }
+    
+    @Test
+    public void testRPLogoutViaAction() throws Exception {
+
+        String url = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
+            + "/secure/fedservlet";
+        String user = "alice";
+        String password = "ecila";
+
+        CookieManager cookieManager = new CookieManager();
+
+        // 1. Login
+        HTTPTestUtils.loginWithCookieManager(url, user, password, getIdpHttpsPort(), cookieManager);
+
+        // 2. Now we should have a cookie from the RP and IdP and should be able to do
+        // subsequent requests without authenticate again. Lets test this first.
+        WebClient webClient = new WebClient();
+        webClient.setCookieManager(cookieManager);
+        webClient.getOptions().setUseInsecureSSL(true);
+        final HtmlPage rpPage = webClient.getPage(url);
+        Assert.assertTrue("WS Federation Systests Examples".equals(rpPage.getTitleText())
+                          || "WS Federation Systests Spring Examples".equals(rpPage.getTitleText()));
 
+        // 3. now we logout from RP
+        String rpLogoutUrl = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
+            + "?wa=" + FederationConstants.ACTION_SIGNOUT;
+
+        HTTPTestUtils.logout(rpLogoutUrl, cookieManager);
+
+        // 4. now we try to access the RP and idp without authentication but with the existing
cookies
+        // to see if we are really logged out
+
+        // webClient.close();
+        webClient = new WebClient();
+        webClient.setCookieManager(cookieManager);
+        webClient.getOptions().setUseInsecureSSL(true);
+        webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
+        final HtmlPage idpPage = webClient.getPage(url);
+
+        Assert.assertEquals(401, idpPage.getWebResponse().getStatusCode());
+
+        // webClient.close();
+    }
+    
     @Test
     public void testIdPLogout() throws Exception {
 
@@ -432,15 +473,13 @@ public abstract class AbstractTests {
 
         // 4. now we try to access the RP and idp without authentication but with the existing
cookies
         // to see if we are really logged out
-        String rpUrl = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
-            + "/secure/fedservlet";
 
         // webClient.close();
         webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
-        final HtmlPage idpPage = webClient.getPage(rpUrl);
+        final HtmlPage idpPage = webClient.getPage(url);
 
         Assert.assertEquals(401, idpPage.getWebResponse().getStatusCode());
 
@@ -477,15 +516,13 @@ public abstract class AbstractTests {
 
         // 4. now we try to access the RP and idp without authentication but with the existing
cookies
         // to see if we are really logged out
-        String rpUrl = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
-            + "/secure/fedservlet";
 
         // webClient.close();
         webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
         webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
-        final HtmlPage idpPage = webClient.getPage(rpUrl);
+        final HtmlPage idpPage = webClient.getPage(url);
 
         Assert.assertEquals(401, idpPage.getWebResponse().getStatusCode());
 


Mime
View raw message