You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/10/05 17:35:47 UTC

svn commit: r1004675 - in /cxf/branches/2.2.x-fixes: ./ rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java

Author: dkulp
Date: Tue Oct  5 15:35:47 2010
New Revision: 1004675

URL: http://svn.apache.org/viewvc?rev=1004675&view=rev
Log:
Merged revisions 1004674 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1004674 | dkulp | 2010-10-05 11:34:28 -0400 (Tue, 05 Oct 2010) | 2 lines
  
  [CXF-2527] Fix for using relative references with wsc:Identifiers
  Patch from Colm O'hEigeartaigh applied
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java?rev=1004675&r1=1004674&r2=1004675&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java (original)
+++ cxf/branches/2.2.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java Tue Oct  5 15:35:47 2010
@@ -424,7 +424,10 @@ public class SymmetricBindingHandler ext
                     } else {
                         if (attached) {
                             String id = encrTok.getWsuId();
-                            if (id == null) {
+                            if (id == null && encrToken instanceof SecureConversationToken) {
+                                dkEncr.setTokenIdDirectId(true);
+                                id = encrTok.getId();
+                            } else if (id == null) {
                                 id = encrTok.getId();
                             }
                             if (id.startsWith("#")) {
@@ -432,6 +435,7 @@ public class SymmetricBindingHandler ext
                             }
                             dkEncr.setExternalKey(encrTok.getSecret(), id);
                         } else {
+                            dkEncr.setTokenIdDirectId(true);
                             dkEncr.setExternalKey(encrTok.getSecret(), encrTok.getId());
                         }
                     }
@@ -439,6 +443,8 @@ public class SymmetricBindingHandler ext
                     if (encrTok.getSHA1() != null) {
                         dkEncr.setCustomValueType(WSConstants.SOAPMESSAGE_NS11 + "#"
                                 + WSConstants.ENC_KEY_VALUE_TYPE);
+                    } else {
+                        dkEncr.setCustomValueType(encrTok.getTokenType());
                     }
                     
                     dkEncr.setSymmetricEncAlgorithm(sbinding.getAlgorithmSuite().getEncryption());
@@ -464,7 +470,10 @@ public class SymmetricBindingHandler ext
                     String encrTokId = encrTok.getId();
                     if (attached) {
                         encrTokId = encrTok.getWsuId();
-                        if (encrTokId == null) {
+                        if (encrTokId == null && encrToken instanceof SecureConversationToken) {
+                            encr.setEncKeyIdDirectId(true);
+                            encrTokId = encrTok.getId();
+                        } else if (encrTokId == null) {
                             encrTokId = encrTok.getId();
                         }
                         if (encrTokId.startsWith("#")) {
@@ -570,6 +579,9 @@ public class SymmetricBindingHandler ext
             }
             dkSign.setExternalKey(tok.getSecret(), tokenRef.getElement());
         } else {
+            if (policyToken instanceof SecureConversationToken) {
+                dkSign.setTokenIdDirectId(true);
+            }
             dkSign.setExternalKey(tok.getSecret(), tok.getId());
         }
 
@@ -580,6 +592,8 @@ public class SymmetricBindingHandler ext
             //Set the value type of the reference
             dkSign.setCustomValueType(WSConstants.SOAPMESSAGE_NS11 + "#"
                 + WSConstants.ENC_KEY_VALUE_TYPE);
+        } else {
+            dkSign.setCustomValueType(tok.getTokenType());
         }
         
         try {
@@ -652,6 +666,9 @@ public class SymmetricBindingHandler ext
             if (included) {
                 sigTokId = tok.getWsuId();
                 if (sigTokId == null) {
+                    if (policyToken instanceof SecureConversationToken) {
+                        sig.setKeyIdentifierType(WSConstants.CUSTOM_SYMM_SIGNING_DIRECT);
+                    }
                     sigTokId = tok.getId();                    
                 }
                 if (sigTokId.startsWith("#")) {