cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject git commit: Metadata document fixes
Date Thu, 02 Oct 2014 21:35:03 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/1.1.x-fixes d0774e84f -> 1a8c5a0d2


Metadata document fixes


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

Branch: refs/heads/1.1.x-fixes
Commit: 1a8c5a0d229fc5e1c31c4233846a09b6a6a7a805
Parents: d0774e8
Author: Oliver Wulff <owulff@talend.com>
Authored: Thu Oct 2 23:34:45 2014 +0200
Committer: Oliver Wulff <owulff@talend.com>
Committed: Thu Oct 2 23:34:45 2014 +0200

----------------------------------------------------------------------
 .../org/apache/cxf/fediz/core/metadata/MetadataWriter.java    | 7 ++++---
 .../org/apache/cxf/fediz/service/idp/MetadataServlet.java     | 2 +-
 .../org/apache/cxf/fediz/service/idp/util/MetadataWriter.java | 7 ++++---
 .../org/apache/cxf/fediz/integrationtests/TomcatTest.java     | 4 ++--
 4 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1a8c5a0d/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 a746757..2b2dc5d 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
@@ -74,10 +74,10 @@ public class MetadataWriter {
 
             Protocol protocol = config.getProtocol();
 
-            writer.writeStartDocument();
+            writer.writeStartDocument("UTF-8", "1.0");
 
             String referenceID = "_" + UUIDGenerator.getUUID();
-            writer.writeStartElement("", "EntityDescriptor", SAML2_METADATA_NS);
+            writer.writeStartElement("md", "EntityDescriptor", SAML2_METADATA_NS);
             writer.writeAttribute("ID", referenceID);
             
             String audience = "_someID";
@@ -95,12 +95,13 @@ public class MetadataWriter {
             
             writer.writeAttribute("entityID", serviceURL);
 
+            writer.writeNamespace("md", SAML2_METADATA_NS);
             writer.writeNamespace("fed", WS_FEDERATION_NS);
             writer.writeNamespace("wsa", WS_ADDRESSING_NS);
             writer.writeNamespace("auth", WS_FEDERATION_NS);
             writer.writeNamespace("xsi", SCHEMA_INSTANCE_NS);
 
-            writer.writeStartElement("fed", "RoleDescriptor", WS_FEDERATION_NS);
+            writer.writeStartElement("md", "RoleDescriptor", SAML2_METADATA_NS);
             writer.writeAttribute(SCHEMA_INSTANCE_NS, "type", "fed:ApplicationServiceType");
             writer.writeAttribute("protocolSupportEnumeration", WS_FEDERATION_NS);
 

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1a8c5a0d/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/MetadataServlet.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/MetadataServlet.java
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/MetadataServlet.java
index 9ee9927..45184f5 100644
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/MetadataServlet.java
+++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/MetadataServlet.java
@@ -56,7 +56,7 @@ public class MetadataServlet extends HttpServlet {
     @Override
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException,
         IOException {
-        response.setContentType("text/xml");
+        response.setContentType("text/xml; charset=utf-8");
         PrintWriter out = response.getWriter();
         try {
             ConfigService cs = (ConfigService)getApplicationContext().getBean("config");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1a8c5a0d/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
----------------------------------------------------------------------
diff --git a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
index 8841e62..3a8652c 100644
--- a/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
+++ b/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/util/MetadataWriter.java
@@ -71,20 +71,21 @@ public class MetadataWriter {
             Writer streamWriter = new OutputStreamWriter(bout, "UTF-8");
             XMLStreamWriter writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(streamWriter);
 
-            writer.writeStartDocument();
+            writer.writeStartDocument("UTF-8", "1.0");
 
             String referenceID = "_" + UUIDGenerator.getUUID();
-            writer.writeStartElement("", "EntityDescriptor", SAML2_METADATA_NS);
+            writer.writeStartElement("md", "EntityDescriptor", SAML2_METADATA_NS);
             writer.writeAttribute("ID", referenceID);
                       
             writer.writeAttribute("entityID", config.getIdpUrl());
 
+            writer.writeNamespace("md", SAML2_METADATA_NS);
             writer.writeNamespace("fed", WS_FEDERATION_NS);
             writer.writeNamespace("wsa", WS_ADDRESSING_NS);
             writer.writeNamespace("auth", WS_FEDERATION_NS);
             writer.writeNamespace("xsi", SCHEMA_INSTANCE_NS);
 
-            writer.writeStartElement("fed", "RoleDescriptor", WS_FEDERATION_NS);
+            writer.writeStartElement("md", "RoleDescriptor", SAML2_METADATA_NS);
             writer.writeAttribute(SCHEMA_INSTANCE_NS, "type", "fed:SecurityTokenServiceType");
             writer.writeAttribute("protocolSupportEnumeration", WS_FEDERATION_NS);
             if (config.getServiceDescription() != null && config.getServiceDescription().length()
> 0 ) {

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/1a8c5a0d/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
index 4db1b56..2539560 100644
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
+++ b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
@@ -268,7 +268,7 @@ public class TomcatTest extends AbstractTests {
             Assert.assertEquals(200, response.getStatusLine().getStatusCode());
 
             String metadata = EntityUtils.toString(entity);
-            Assert.assertTrue(metadata.startsWith("<EntityDescriptor"));
+            Assert.assertTrue(metadata.startsWith("<md:EntityDescriptor"));
             
             // Now validate the Signature
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -339,7 +339,7 @@ public class TomcatTest extends AbstractTests {
             Assert.assertEquals(200, response.getStatusLine().getStatusCode());
 
             String metadata = EntityUtils.toString(entity);
-            Assert.assertTrue(metadata.startsWith("<EntityDescriptor"));
+            Assert.assertTrue(metadata.startsWith("<md:EntityDescriptor"));
             
             // Now validate the Signature
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();


Mime
View raw message