You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2014/01/29 16:26:27 UTC

svn commit: r1562477 - /cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java

Author: coheigea
Date: Wed Jan 29 15:26:26 2014
New Revision: 1562477

URL: http://svn.apache.org/r1562477
Log:
Add outbound support for streaming Signatures with no KeyInfo Elements

Modified:
    cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java?rev=1562477&r1=1562476&r2=1562477&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java (original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java Wed Jan 29 15:26:26 2014
@@ -88,6 +88,7 @@ public class XmlSecOutInterceptor implem
     private boolean encryptRequest;
     private List<QName> elementsToSign = new ArrayList<QName>();
     private List<QName> elementsToEncrypt = new ArrayList<QName>();
+    private boolean keyInfoMustBeAvailable = true;
 
     public XmlSecOutInterceptor() {
         setPhase(Phase.PRE_STREAM);
@@ -282,8 +283,12 @@ public class XmlSecOutInterceptor implem
             ? Constants.ALGO_ID_DIGEST_SHA1 : sigProps.getSignatureDigestAlgo();
         properties.setSignatureDigestAlgorithm(digestAlgo);
         
-        properties.setSignatureKeyIdentifier(
-            convertKeyIdentifier(sigProps.getSignatureKeyIdType()));
+        if (this.keyInfoMustBeAvailable) {
+            properties.setSignatureKeyIdentifier(
+                convertKeyIdentifier(sigProps.getSignatureKeyIdType()));
+        } else {
+            properties.setSignatureKeyIdentifier(SecurityTokenConstants.KeyIdentifier_NoKeyInfo);
+        }
         
         String c14nMethod = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
         if (sigProps.getSignatureC14Method() != null) {
@@ -369,6 +374,10 @@ public class XmlSecOutInterceptor implem
         encryptionProperties.setEncryptionDigestAlgo(algo);
     }
     
+    public void setKeyInfoMustBeAvailable(boolean use) {
+        this.keyInfoMustBeAvailable = use;
+    }
+    
     public void setSignatureProperties(SignatureProperties props) {
         this.sigProps = props;
     }