cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1088648 - in /cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers: AbstractBindingBuilder.java SymmetricBindingHandler.java TransportBindingHandler.java
Date Mon, 04 Apr 2011 14:43:42 GMT
Author: coheigea
Date: Mon Apr  4 14:43:41 2011
New Revision: 1088648

URL: http://svn.apache.org/viewvc?rev=1088648&view=rev
Log:
Back-merged ValueType fix to 2.3.x-fixes.

Modified:
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java?rev=1088648&r1=1088647&r2=1088648&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
Mon Apr  4 14:43:41 2011
@@ -130,6 +130,14 @@ import org.apache.xml.security.transform
  */
 public abstract class AbstractBindingBuilder {
     public static final String CRYPTO_CACHE = "ws-security.crypto.cache";
+    
+    // TODO Remove these once WSS4J 1.5.12 is released
+    public static final String SAMLTOKEN_NS11 = 
+        "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1";
+    public static final String WSS_SAML_TOKEN_TYPE = SAMLTOKEN_NS11 + "#SAMLV1.1";
+    public static final String WSS_SAML2_TOKEN_TYPE = SAMLTOKEN_NS11 + "#SAMLV2.0";
+    public static final String WSS_SAML2_KI_VALUE_TYPE = SAMLTOKEN_NS11 + "#SAMLID";
+    
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractBindingBuilder.class);
     
     
@@ -474,11 +482,16 @@ public abstract class AbstractBindingBui
                     sig.setX509Certificate(secToken.getX509Certificate());
                     sig.setCustomTokenId(secToken.getId());
                     sig.setKeyIdentifierType(WSConstants.CUSTOM_KEY_IDENTIFIER);
-                    if (secToken.getTokenType() == null) {
+                    String tokenType = secToken.getTokenType();
+                    if (WSS_SAML_TOKEN_TYPE.equals(tokenType)) {
                         sig.setCustomTokenValueType(WSConstants.WSS_SAML_NS
                                                     + WSConstants.SAML_ASSERTION_ID);
+                    } else if (WSS_SAML2_TOKEN_TYPE.equals(tokenType)) {
+                        sig.setCustomTokenValueType(WSS_SAML2_KI_VALUE_TYPE);
+                    } else if (tokenType != null) {
+                        sig.setCustomTokenValueType(tokenType);
                     } else {
-                        sig.setCustomTokenValueType(secToken.getTokenType());
+                        sig.setCustomTokenValueType(WSConstants.WSS_SAML_KI_VALUE_TYPE);
                     }
                     sig.setSignatureAlgorithm(binding.getAlgorithmSuite().getAsymmetricSignature());
                     sig.setSigCanonicalization(binding.getAlgorithmSuite().getInclusiveC14n());
@@ -1519,11 +1532,15 @@ public abstract class AbstractBindingBui
             }
             
         } else {
-            if (tok.getTokenType() != null) {
-                sig.setCustomTokenValueType(tok.getTokenType());
+            String tokenType = tok.getTokenType();
+            if (WSS_SAML_TOKEN_TYPE.equals(tokenType)) {
+                sig.setCustomTokenValueType(WSConstants.WSS_SAML_KI_VALUE_TYPE);
+            } else if (WSS_SAML2_TOKEN_TYPE.equals(tokenType)) {
+                sig.setCustomTokenValueType(WSS_SAML2_KI_VALUE_TYPE);
+            } else if (tokenType != null) {
+                sig.setCustomTokenValueType(tokenType);
             } else {
-                sig.setCustomTokenValueType(WSConstants.WSS_SAML_NS
-                                            + WSConstants.SAML_ASSERTION_ID);
+                sig.setCustomTokenValueType(WSConstants.WSS_SAML_KI_VALUE_TYPE);
             }
             sig.setKeyIdentifierType(WSConstants.CUSTOM_SYMM_SIGNING);
         }

Modified: cxf/branches/2.3.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.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java?rev=1088648&r1=1088647&r2=1088648&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/SymmetricBindingHandler.java
Mon Apr  4 14:43:41 2011
@@ -663,6 +663,11 @@ public class SymmetricBindingHandler ext
                     sig.setEncrKeySha1value(tok.getSHA1());
                     sig.setKeyIdentifierType(WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER);
                 }
+            } else if (WSS_SAML_TOKEN_TYPE.equals(tok.getTokenType())) {
+                sig.setCustomTokenValueType(WSConstants.WSS_SAML_NS
+                                            + WSConstants.SAML_ASSERTION_ID);
+            } else if (WSS_SAML2_TOKEN_TYPE.equals(tok.getTokenType())) {
+                sig.setCustomTokenValueType(WSS_SAML2_KI_VALUE_TYPE);
             } else if (tok.getTokenType() != null) { 
                 sig.setCustomTokenValueType(tok.getTokenType());
                 sig.setKeyIdentifierType(type);

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java?rev=1088648&r1=1088647&r2=1088648&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
Mon Apr  4 14:43:41 2011
@@ -387,8 +387,7 @@ public class TransportBindingHandler ext
             WSSecSignature sig = new WSSecSignature();
             if (secTok.getTokenType() == null) {
                 sig.setCustomTokenId(secTok.getId());
-                sig.setCustomTokenValueType(WSConstants.WSS_SAML_NS
-                                            + WSConstants.SAML_ASSERTION_ID);
+                sig.setCustomTokenValueType(WSConstants.WSS_SAML_KI_VALUE_TYPE);
                 sig.setKeyIdentifierType(WSConstants.CUSTOM_KEY_IDENTIFIER);
             } else {
                 String id = secTok.getWsuId();
@@ -399,8 +398,14 @@ public class TransportBindingHandler ext
                     sig.setCustomTokenId(secTok.getWsuId());
                     sig.setKeyIdentifierType(WSConstants.CUSTOM_SYMM_SIGNING);
                 }
-                sig.setCustomTokenValueType(secTok.getTokenType());
-                sig.setCustomTokenValueType(secTok.getTokenType());
+                String tokenType = secTok.getTokenType();
+                if (WSS_SAML_TOKEN_TYPE.equals(tokenType)) {
+                    sig.setCustomTokenValueType(WSConstants.WSS_SAML_KI_VALUE_TYPE);
+                } else if (WSS_SAML2_TOKEN_TYPE.equals(tokenType)) {
+                    sig.setCustomTokenValueType(WSS_SAML2_KI_VALUE_TYPE);
+                } else {
+                    sig.setCustomTokenValueType(tokenType);
+                }
                 sig.setKeyIdentifierType(WSConstants.CUSTOM_SYMM_SIGNING);
             }
             Crypto crypto = null;



Mime
View raw message