cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [cxf-fediz] branch master updated: Enabled modified signature test for SAML SSO
Date Thu, 17 May 2018 09:53:06 GMT
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git


The following commit(s) were added to refs/heads/master by this push:
     new d8c7bb8  Enabled modified signature test for SAML SSO
d8c7bb8 is described below

commit d8c7bb876d1fbc409748ab73f3db9d6177406e8e
Author: Colm O hEigeartaigh <coheigea@apache.org>
AuthorDate: Thu May 17 10:52:52 2018 +0100

    Enabled modified signature test for SAML SSO
---
 .../fediz/core/processor/SAMLProcessorImpl.java    |  2 +-
 .../cxf/fediz/systests/common/AbstractTests.java   | 22 +++++++++++++++-------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/SAMLProcessorImpl.java
b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/SAMLProcessorImpl.java
index 6f8d167..4fd1be8 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/SAMLProcessorImpl.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/processor/SAMLProcessorImpl.java
@@ -133,7 +133,7 @@ public class SAMLProcessorImpl extends AbstractFedizProcessor {
             } else {
                 tokenStream = CompressionUtils.inflate(deflatedToken);
             }
-        } catch (DataFormatException ex) {
+        } catch (IllegalArgumentException | DataFormatException ex) {
             LOG.warn("Invalid data format", ex);
             throw new ProcessingException(TYPE.INVALID_REQUEST);
         }
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
index a310449..32e1499 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
@@ -79,6 +79,14 @@ public abstract class AbstractTests {
         return "samlsigninresponseform";
     }
 
+    private String getTokenNameFromForm() {
+        if (isWSFederation()) {
+            return "wresult";
+        }
+
+        return "SAMLResponse";
+    }
+
     @Test
     public void testAlice() throws Exception {
         String url = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
@@ -569,10 +577,6 @@ public abstract class AbstractTests {
     @Test
     public void testAliceModifiedSignature() throws Exception {
 
-        if (!isWSFederation()) {
-            return;
-        }
-
         String url = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()
             + "/secure/fedservlet";
         String user = "alice";
@@ -596,17 +600,21 @@ public abstract class AbstractTests {
         DomNodeList<DomElement> results = idpPage.getElementsByTagName("input");
 
         for (DomElement result : results) {
-            if ("wresult".equals(result.getAttributeNS(null, "name"))) {
+            if (getTokenNameFromForm().equals(result.getAttributeNS(null, "name"))) {
                 // Now modify the Signature
                 String value = result.getAttributeNS(null, "value");
-                value = value.replace("alice", "bob");
+                if (value.contains("alice")) {
+                    value = value.replace("alice", "bob");
+                } else {
+                    value += "H";
+                }
                 result.setAttributeNS(null, "value", value);
             }
         }
 
         // Invoke back on the RP
 
-        final HtmlForm form = idpPage.getFormByName("signinresponseform");
+        final HtmlForm form = idpPage.getFormByName(getLoginFormName());
         final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
 
         try {

-- 
To stop receiving notification emails like this one, please contact
coheigea@apache.org.

Mime
View raw message