Author: coheigea
Date: Tue Feb 25 10:57:15 2014
New Revision: 1571645

URL: http://svn.apache.org/r1571645
Log:
Add support to be able to sign an already encrypted token

Modified:
    
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java

Modified: 
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java?rev=1571645&r1=1571644&r2=1571645&view=diff
==============================================================================
--- 
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
 (original)
+++ 
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
 Tue Feb 25 10:57:15 2014
@@ -97,6 +97,19 @@ public class EncryptOutputProcessor exte
                     encryptionPartDef.setSecurePart(securePart);
                     encryptionPartDef.setModifier(securePart.getModifier());
                     
encryptionPartDef.setEncRefId(IDGenerator.generateID(null));
+                    
+                    Map<Object, SecurePart> dynamicSecureParts = 
+                        
outputProcessorChain.getSecurityContext().getAsMap(WSSConstants.SIGNATURE_PARTS);
+                    if (dynamicSecureParts != null && securePart.getName() != 
null
+                        && 
securePart.equals(dynamicSecureParts.get(securePart.getName()))) {
+                        
securePart.setIdToSign(encryptionPartDef.getEncRefId());
+                        outputProcessorChain.getSecurityContext().putAsMap(
+                            WSSConstants.SIGNATURE_PARTS,
+                            securePart.getIdToSign(),
+                            securePart
+                        );
+                    }
+                    
                     encryptionPartDef.setKeyId(securityTokenProvider.getId());
                     
encryptionPartDef.setSymmetricKey(securityToken.getSecretKey(getSecurityProperties().getEncryptionSymAlgorithm()));
                     
outputProcessorChain.getSecurityContext().putAsList(EncryptionPartDef.class, 
encryptionPartDef);


Reply via email to