CXF-6464 Add attachment support to derived key sign/encrypt
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/bb0a9473 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/bb0a9473 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/bb0a9473 Branch: refs/heads/master Commit: bb0a94734f583e5b6b1e42303aa6ba7a49958f18 Parents: b4aa01a Author: Hugo Trippaers <[email protected]> Authored: Tue Jun 16 14:35:31 2015 +0200 Committer: Colm O hEigeartaigh <[email protected]> Committed: Thu Jun 18 14:12:37 2015 +0100 ---------------------------------------------------------------------- parent/pom.xml | 2 +- .../policyhandlers/SymmetricBindingHandler.java | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/bb0a9473/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 2954af8..225199f 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -146,7 +146,7 @@ <cxf.woodstox.core.version>4.4.1</cxf.woodstox.core.version> <cxf.woodstox.stax2-api.version>3.1.4</cxf.woodstox.stax2-api.version> <cxf.wsdl4j.version>1.6.3</cxf.wsdl4j.version> - <cxf.wss4j.version>2.1.1</cxf.wss4j.version> + <cxf.wss4j.version>2.1.2-SNAPSHOT</cxf.wss4j.version> <cxf.xerces.version>2.11.0</cxf.xerces.version> <cxf.xmlbeans.version>2.6.0</cxf.xmlbeans.version> <cxf.xmlschema.version>2.2.1</cxf.xmlschema.version> http://git-wip-us.apache.org/repos/asf/cxf/blob/bb0a9473/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java index 64f6d5e..8068e34 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java @@ -403,6 +403,7 @@ public class SymmetricBindingHandler extends AbstractBindingBuilder { WSSecDKEncrypt dkEncr = new WSSecDKEncrypt(); dkEncr.setIdAllocator(wssConfig.getIdAllocator()); dkEncr.setCallbackLookup(callbackLookup); + dkEncr.setAttachmentCallbackHandler(new AttachmentCallbackHandler(message)); if (recToken.getToken().getVersion() == SPConstants.SPVersion.SP11) { dkEncr.setWscVersion(ConversationConstants.VERSION_05_02); } @@ -486,10 +487,21 @@ public class SymmetricBindingHandler extends AbstractBindingBuilder { encrDKTokenElem = dkEncr.getdktElement(); addDerivedKeyElement(encrDKTokenElem); Element refList = dkEncr.encryptForExternalRef(null, encrParts); + List<Element> attachments = dkEncr.getAttachmentEncryptedDataElements(); if (atEnd) { this.insertBeforeBottomUp(refList); + if (attachments != null) { + for (Element attachment : attachments) { + this.insertBeforeBottomUp(attachment); + } + } } else { - this.addDerivedKeyElement(refList); + this.addDerivedKeyElement(refList); + if (attachments != null) { + for (Element attachment : attachments) { + this.addDerivedKeyElement(attachment); + } + } } return dkEncr; } catch (Exception e) { @@ -631,6 +643,7 @@ public class SymmetricBindingHandler extends AbstractBindingBuilder { WSSecDKSign dkSign = new WSSecDKSign(); dkSign.setIdAllocator(wssConfig.getIdAllocator()); dkSign.setCallbackLookup(callbackLookup); + dkSign.setAttachmentCallbackHandler(new AttachmentCallbackHandler(message)); if (policyAbstractTokenWrapper.getToken().getVersion() == SPConstants.SPVersion.SP11) { dkSign.setWscVersion(ConversationConstants.VERSION_05_02); }
