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 Wed, 24 Sep 2014 16:25:51 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master 5333692bf -> 85f7dda77


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

Branch: refs/heads/master
Commit: 85f7dda77873d5201d26f613725a1a07fa7aa3d5
Parents: 5333692
Author: Oliver Wulff <owulff@talend.com>
Authored: Wed Sep 24 18:17:31 2014 +0200
Committer: Oliver Wulff <owulff@talend.com>
Committed: Wed Sep 24 18:17:31 2014 +0200

----------------------------------------------------------------------
 .../cxf/fediz/core/metadata/MetadataWriter.java     | 16 +++++++++-------
 .../cxf/fediz/service/idp/MetadataServlet.java      |  2 +-
 .../cxf/fediz/service/idp/util/MetadataWriter.java  |  7 ++++---
 .../cxf/fediz/integrationtests/AbstractTests.java   |  2 +-
 4 files changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/85f7dda7/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 86c446f..a522c95 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
@@ -75,7 +75,7 @@ public class MetadataWriter {
 
             Protocol protocol = config.getProtocol();
 
-            writer.writeStartDocument();
+            writer.writeStartDocument("UTF-8", "1.0");
 
             String referenceID = IDGenerator.generateID("_");
             writer.writeStartElement("", "EntityDescriptor", SAML2_METADATA_NS);
@@ -92,6 +92,12 @@ 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);
 
             if (protocol instanceof FederationProtocol) {
                 writeFederationMetadata(writer, config, serviceURL);
@@ -148,12 +154,8 @@ public class MetadataWriter {
         FedizContext config,
         String serviceURL
     ) throws XMLStreamException {
-        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", WS_FEDERATION_NS);
         writer.writeAttribute(SCHEMA_INSTANCE_NS, "type", "fed:ApplicationServiceType");
         writer.writeAttribute("protocolSupportEnumeration", WS_FEDERATION_NS);
 
@@ -239,7 +241,7 @@ public class MetadataWriter {
         
         SAMLProtocol protocol = (SAMLProtocol)config.getProtocol();
         
-        writer.writeStartElement("", "SPSSODescriptor", SAML2_METADATA_NS);
+        writer.writeStartElement("md", "SPSSODescriptor", SAML2_METADATA_NS);
         writer.writeAttribute("AuthnRequestsSigned", Boolean.toString(protocol.isSignRequest()));
         writer.writeAttribute("WantAssertionsSigned", "true");
         writer.writeAttribute("protocolSupportEnumeration", "urn:oasis:names:tc:SAML:2.0:protocol");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/85f7dda7/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 31f69cb..5d76072 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
@@ -54,7 +54,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/85f7dda7/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 b50961b..bc34ab4 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
@@ -69,20 +69,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 = IDGenerator.generateID("_");
-            writer.writeStartElement("", "EntityDescriptor", SAML2_METADATA_NS);
+            writer.writeStartElement("md", "EntityDescriptor", SAML2_METADATA_NS);
             writer.writeAttribute("ID", referenceID);
                       
             writer.writeAttribute("entityID", config.getIdpUrl().toString());
 
+            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", WS_FEDERATION_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/85f7dda7/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 63e3313..0892d9e 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
@@ -344,7 +344,7 @@ public abstract class AbstractTests {
 
         final XmlPage rpPage = webClient.getPage(url);
         final String xmlContent = rpPage.asXml();
-        Assert.assertTrue(xmlContent.startsWith("<EntityDescriptor"));
+        Assert.assertTrue(xmlContent.startsWith("<md:EntityDescriptor"));
         
         // Now validate the Signature
         Document doc = rpPage.getXmlDocument();


Mime
View raw message