Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B27AB200BD8 for ; Wed, 7 Dec 2016 13:38:36 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id B11E7160B31; Wed, 7 Dec 2016 12:38:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0A202160AFD for ; Wed, 7 Dec 2016 13:38:35 +0100 (CET) Received: (qmail 14142 invoked by uid 500); 7 Dec 2016 12:38:35 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 14128 invoked by uid 99); 7 Dec 2016 12:38:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Dec 2016 12:38:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 121DCF179B; Wed, 7 Dec 2016 12:38:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: coheigea@apache.org To: commits@cxf.apache.org Date: Wed, 07 Dec 2016 12:38:34 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/6] cxf-fediz git commit: Adding another logout test archived-at: Wed, 07 Dec 2016 12:38:36 -0000 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 Authored: Tue Dec 6 17:30:18 2016 +0000 Committer: Colm O hEigeartaigh 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());