cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbernha...@apache.org
Subject [2/3] cxf-fediz git commit: [FEDIZ-100] Fixing ApplicationServiceEndpoint in MetadataDocument
Date Thu, 23 Apr 2015 15:36:22 GMT
[FEDIZ-100] Fixing ApplicationServiceEndpoint in MetadataDocument


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/4e2b3009
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/4e2b3009
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/4e2b3009

Branch: refs/heads/master
Commit: 4e2b30097bd44b3bbf04f75aa7eae18c0888b8b5
Parents: 9995c7b
Author: Jan Bernhardt <jbernhardt@talend.com>
Authored: Thu Apr 23 17:08:57 2015 +0200
Committer: Jan Bernhardt <jbernhardt@talend.com>
Committed: Thu Apr 23 17:35:59 2015 +0200

----------------------------------------------------------------------
 .../cxf/fediz/core/metadata/MetadataWriter.java    |  8 ++------
 .../core/federation/FederationMetaDataTest.java    | 13 ++++++++++++-
 .../cxf/fediz/core/samlsso/SAMLMetaDataTest.java   | 17 +++++++++--------
 3 files changed, 23 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/4e2b3009/plugins/core/src/main/java/org/apache/cxf/fediz/core/metadata/MetadataWriter.java
----------------------------------------------------------------------
diff --git a/plugins/core/src/main/java/org/apache/cxf/fediz/core/metadata/MetadataWriter.java
b/plugins/core/src/main/java/org/apache/cxf/fediz/core/metadata/MetadataWriter.java
index 3edde28..1f1d74e 100644
--- a/plugins/core/src/main/java/org/apache/cxf/fediz/core/metadata/MetadataWriter.java
+++ b/plugins/core/src/main/java/org/apache/cxf/fediz/core/metadata/MetadataWriter.java
@@ -37,6 +37,7 @@ import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Document;
+
 import org.apache.cxf.fediz.core.config.Claim;
 import org.apache.cxf.fediz.core.config.FederationProtocol;
 import org.apache.cxf.fediz.core.config.FedizContext;
@@ -87,12 +88,7 @@ public class MetadataWriter {
             
             String serviceURL = protocol.getApplicationServiceURL();
             if (serviceURL == null) {
-                String audience = "_someID";
-                List<String> audienceList = config.getAudienceUris();
-                if (audienceList != null && audienceList.size() > 0 &&
!"".equals(audienceList.get(0))) {
-                    audience = audienceList.get(0);
-                }
-                serviceURL = audience;
+                serviceURL = extractFullContextPath(request);
             }
             
             writer.writeAttribute("entityID", serviceURL);

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/4e2b3009/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationMetaDataTest.java
----------------------------------------------------------------------
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationMetaDataTest.java
b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationMetaDataTest.java
index a0bb6e8..58b51c9 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationMetaDataTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationMetaDataTest.java
@@ -22,11 +22,13 @@ package org.apache.cxf.fediz.core.federation;
 import java.io.File;
 import java.net.URL;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.xml.transform.TransformerException;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+
 import org.apache.cxf.fediz.common.SecurityTestUtil;
 import org.apache.cxf.fediz.core.config.FedizConfigurator;
 import org.apache.cxf.fediz.core.config.FedizContext;
@@ -38,6 +40,7 @@ import org.apache.xml.security.exceptions.XMLSecurityException;
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.signature.XMLSignatureException;
+import org.easymock.EasyMock;
 import org.junit.AfterClass;
 import org.junit.Assert;
 
@@ -45,6 +48,9 @@ import static org.junit.Assert.fail;
 
 public class FederationMetaDataTest {
     private static final String CONFIG_FILE = "fediz_meta_test_config.xml";
+    private static final String TEST_REQUEST_URL = 
+        "https://localhost/fedizhelloworld/FederationMetadata/2007-06/FederationMetadata.xml";
+    private static final String CONTEXT_PATH = "/fedizhelloworld";
     
     @AfterClass
     public static void cleanup() {
@@ -118,8 +124,13 @@ public class FederationMetaDataTest {
 
         FedizContext config = loadConfig("ROOT_NO_SIGNINGKEY");
 
+        HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
+        EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(TEST_REQUEST_URL)).times(2);
+        EasyMock.expect(req.getContextPath()).andReturn(CONTEXT_PATH).times(2);
+        EasyMock.replay(req);
+        
         FedizProcessor wfProc = new FederationProcessorImpl();
-        Document doc = wfProc.getMetaData(null, config);
+        Document doc = wfProc.getMetaData(req, config);
         Assert.assertNotNull(doc);
         
         try {

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/4e2b3009/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLMetaDataTest.java
----------------------------------------------------------------------
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLMetaDataTest.java
b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLMetaDataTest.java
index aafeb34..00eac28 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLMetaDataTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLMetaDataTest.java
@@ -50,8 +50,9 @@ import static org.junit.Assert.fail;
  */
 public class SAMLMetaDataTest {
     private static final String CONFIG_FILE = "fediz_meta_test_config_saml.xml";
-    private static final String TEST_REQUEST_URL = "https://localhost/fedizhelloworld/";
-    private static final String CONTEXT_PATH = "https://localhost:9443/";
+    private static final String TEST_REQUEST_URL = 
+        "https://localhost/fedizhelloworld/FederationMetadata/2007-06/FederationMetadata.xml";
+    private static final String CONTEXT_PATH = "/fedizhelloworld";
     
     @AfterClass
     public static void cleanup() {
@@ -79,8 +80,8 @@ public class SAMLMetaDataTest {
 
         FedizProcessor wfProc = new FederationProcessorImpl();
         HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
-        EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(TEST_REQUEST_URL));
-        EasyMock.expect(req.getContextPath()).andReturn(CONTEXT_PATH);
+        EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(TEST_REQUEST_URL)).times(2);
+        EasyMock.expect(req.getContextPath()).andReturn(CONTEXT_PATH).times(2);
         EasyMock.replay(req);
         
         Document doc = wfProc.getMetaData(req, config);
@@ -117,8 +118,8 @@ public class SAMLMetaDataTest {
             Document doc;
             
             HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
-            EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(TEST_REQUEST_URL));
-            EasyMock.expect(req.getContextPath()).andReturn(CONTEXT_PATH);
+            EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(TEST_REQUEST_URL)).times(2);
+            EasyMock.expect(req.getContextPath()).andReturn(CONTEXT_PATH).times(2);
             EasyMock.replay(req);
            
             doc = wfProc.getMetaData(req, config);
@@ -136,8 +137,8 @@ public class SAMLMetaDataTest {
 
         FedizProcessor wfProc = new FederationProcessorImpl();
         HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
-        EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(TEST_REQUEST_URL));
-        EasyMock.expect(req.getContextPath()).andReturn(CONTEXT_PATH);
+        EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(TEST_REQUEST_URL)).times(2);
+        EasyMock.expect(req.getContextPath()).andReturn(CONTEXT_PATH).times(2);
         EasyMock.replay(req);
         
         Document doc = wfProc.getMetaData(req, config);


Mime
View raw message