cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: Some fixes relating to the latest OpenSAML changes in WSS4J
Date Thu, 19 Mar 2015 17:11:45 GMT
Repository: cxf
Updated Branches:
  refs/heads/master e1246b3d0 -> 5fc6229a6


Some fixes relating to the latest OpenSAML changes in WSS4J


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

Branch: refs/heads/master
Commit: 5fc6229a6d289a6a4f23fac4f1d7750285c85d1a
Parents: e1246b3
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Mar 19 17:11:26 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Mar 19 17:11:39 2015 +0000

----------------------------------------------------------------------
 .../security/saml/SamlFormOutInterceptor.java   |  8 +++++--
 .../security/saml/SamlHeaderOutInterceptor.java |  8 +++++--
 .../jaxrs/security/oauth2/JAXRSOAuth2Test.java  | 22 +++++++++++++++-----
 3 files changed, 29 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5fc6229a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormOutInterceptor.java
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormOutInterceptor.java
index 8911178..62756a9 100644
--- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormOutInterceptor.java
+++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormOutInterceptor.java
@@ -26,13 +26,15 @@ import javax.ws.rs.core.Form;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
 import org.apache.wss4j.common.saml.SamlAssertionWrapper;
+import org.apache.wss4j.common.util.DOM2Writer;
 
 public class SamlFormOutInterceptor extends AbstractSamlOutInterceptor {
     private static final Logger LOG = 
@@ -55,7 +57,9 @@ public class SamlFormOutInterceptor extends AbstractSamlOutInterceptor {
                 assertionWrapper = createAssertion(message);
             }
             
-            String encodedToken = encodeToken(assertionWrapper.assertionToString());
+            Document doc = DOMUtils.newDocument();
+            Element assertionElement = assertionWrapper.toDOM(doc);
+            String encodedToken = encodeToken(DOM2Writer.nodeToString(assertionElement));
                 
             updateForm(form, encodedToken);
         } catch (Exception ex) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/5fc6229a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderOutInterceptor.java
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderOutInterceptor.java
index 60cb0c8..f93d626 100644
--- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderOutInterceptor.java
+++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderOutInterceptor.java
@@ -26,13 +26,15 @@ import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.wss4j.common.saml.SamlAssertionWrapper;
+import org.apache.wss4j.common.util.DOM2Writer;
 
 public class SamlHeaderOutInterceptor extends AbstractSamlOutInterceptor {
     private static final Logger LOG = 
@@ -49,7 +51,9 @@ public class SamlHeaderOutInterceptor extends AbstractSamlOutInterceptor
{
                 assertionWrapper = createAssertion(message);
             }
             
-            String encodedToken = encodeToken(assertionWrapper.assertionToString());
+            Document doc = DOMUtils.newDocument();
+            Element assertionElement = assertionWrapper.toDOM(doc);
+            String encodedToken = encodeToken(DOM2Writer.nodeToString(assertionElement));
             
             Map<String, List<String>> headers = getHeaders(message);
             

http://git-wip-us.apache.org/repos/asf/cxf/blob/5fc6229a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/JAXRSOAuth2Test.java
----------------------------------------------------------------------
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/JAXRSOAuth2Test.java
b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/JAXRSOAuth2Test.java
index 2a713b6..4ea9fec 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/JAXRSOAuth2Test.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/JAXRSOAuth2Test.java
@@ -26,9 +26,13 @@ import java.util.Map;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.common.util.Base64UrlUtility;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.jaxrs.impl.MetadataMap;
@@ -45,7 +49,8 @@ import org.apache.cxf.rs.security.saml.SAMLUtils;
 import org.apache.cxf.rs.security.saml.SAMLUtils.SelfSignInfo;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.wss4j.common.crypto.Crypto;
-
+import org.apache.wss4j.common.saml.SamlAssertionWrapper;
+import org.apache.wss4j.common.util.DOM2Writer;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -68,8 +73,12 @@ public class JAXRSOAuth2Test extends AbstractBusClientServerTestBase {
         Crypto crypto = new CryptoLoader().loadCrypto(CRYPTO_RESOURCE_PROPERTIES);
         SelfSignInfo signInfo = new SelfSignInfo(crypto, "alice", "password"); 
         
-        String assertion =  SAMLUtils.createAssertion(new SamlCallbackHandler(),
-                                                      signInfo).assertionToString();
+        SamlAssertionWrapper assertionWrapper = SAMLUtils.createAssertion(new SamlCallbackHandler(),
+                                                                          signInfo);
+        Document doc = DOMUtils.newDocument();
+        Element assertionElement = assertionWrapper.toDOM(doc);
+        String assertion = DOM2Writer.nodeToString(assertionElement);
+        
         Saml2BearerGrant grant = new Saml2BearerGrant(assertion);
         ClientAccessToken at = OAuthClientUtils.getAccessToken(wc, 
                                         new Consumer("alice", "alice"), 
@@ -86,8 +95,11 @@ public class JAXRSOAuth2Test extends AbstractBusClientServerTestBase {
         Crypto crypto = new CryptoLoader().loadCrypto(CRYPTO_RESOURCE_PROPERTIES);
         SelfSignInfo signInfo = new SelfSignInfo(crypto, "alice", "password"); 
         
-        String assertion =  SAMLUtils.createAssertion(new SamlCallbackHandler2(),
-                                                      signInfo).assertionToString();
+        SamlAssertionWrapper assertionWrapper = SAMLUtils.createAssertion(new SamlCallbackHandler2(),
+                                                                          signInfo);
+        Document doc = DOMUtils.newDocument();
+        Element assertionElement = assertionWrapper.toDOM(doc);
+        String assertion = DOM2Writer.nodeToString(assertionElement);
         
         String encodedAssertion = Base64UrlUtility.encode(assertion);
         


Mime
View raw message