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 2011/03/22 14:18:30 UTC

svn commit: r1084164 - in /cxf/branches/2.3.x-fixes/rt/ws/security: ./ src/main/java/org/apache/cxf/ws/security/trust/STSClient.java

Author: coheigea
Date: Tue Mar 22 13:18:30 2011
New Revision: 1084164

URL: http://svn.apache.org/viewvc?rev=1084164&view=rev
Log:
[CXF-3224] - Add a boolean parameter to the STSClient to disable sending a default KeyType. 

Modified:
    cxf/branches/2.3.x-fixes/rt/ws/security/   (props changed)
    cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java

Propchange: cxf/branches/2.3.x-fixes/rt/ws/security/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk/rt/ws/security:1083736,1083742,1083826,1084160

Modified: cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=1084164&r1=1084163&r2=1084164&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java Tue Mar 22 13:18:30 2011
@@ -147,6 +147,7 @@ public class STSClient implements Config
     
     Object actAs;
     String tokenType;
+    boolean sendKeyType = true;
 
     Map<String, Object> ctx = new HashMap<String, Object>();
     
@@ -306,6 +307,10 @@ public class STSClient implements Config
     public void setTokenType(String tokenType) {
         this.tokenType = tokenType;
     }
+    
+    public void setSendKeyType(boolean sendKeyType) {
+        this.sendKeyType = sendKeyType;
+    }
 
     /**
      * Indicate whether to use the signer's public X509 certificate for the subject confirmation key info 
@@ -477,9 +482,9 @@ public class STSClient implements Config
         if (keySize <= 0) {
             keySize = 256;
         }
-        if (keyType.endsWith("SymmetricKey")) {
+        if (keyType != null && keyType.endsWith("SymmetricKey")) {
             requestorEntropy = writeElementsForRSTSymmetricKey(writer, wroteKeySize);
-        } else if (keyType.endsWith("PublicKey")) {
+        } else if (keyType != null && keyType.endsWith("PublicKey")) {
             crypto = createCrypto(false);
             cert = getCert(crypto);
             writeElementsForRSTPublicKey(writer, cert);
@@ -771,7 +776,7 @@ public class STSClient implements Config
                 writer.writeEndElement();
                 keyType = namespace + "/SymmetricKey";
             }
-        } else if (keyType == null) {
+        } else if (keyType == null && sendKeyType) {
             writer.writeStartElement("wst", "KeyType", namespace);
             writer.writeCharacters(namespace + "/SymmetricKey");
             writer.writeEndElement();