cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dval...@apache.org
Subject svn commit: r979457 - in /cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust: STSClient.java STSUtils.java
Date Mon, 26 Jul 2010 21:43:48 GMT
Author: dvaleri
Date: Mon Jul 26 21:43:47 2010
New Revision: 979457

URL: http://svn.apache.org/viewvc?rev=979457&view=rev
Log:
[CXF-2909] Fixed usage of SecondaryParameters in WS-T 1.3+

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=979457&r1=979456&r2=979457&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
Mon Jul 26 21:43:47 2010
@@ -381,8 +381,14 @@ public class STSClient implements Config
         writer.writeStartElement("wst", "RequestSecurityToken", namespace);
         writer.writeNamespace("wst", namespace);
         boolean wroteKeySize = false;
+        
         String keyType = null;
+        
         if (template != null) {
+            if (this.useSecondaryParameters()) {
+                writer.writeStartElement("wst", "SecondaryParameters", namespace);
+            }
+            
             Element tl = DOMUtils.getFirstElement(template);
             while (tl != null) {
                 StaxUtils.copy(tl, writer);
@@ -394,11 +400,13 @@ public class STSClient implements Config
                 }
                 tl = DOMUtils.getNextElement(tl);
             }
+            
+            if (this.useSecondaryParameters()) {
+                writer.writeEndElement();
+            }
         }
 
-        writer.writeStartElement("wst", "RequestType", namespace);
-        writer.writeCharacters(namespace + requestType);
-        writer.writeEndElement();
+        addRequestType(requestType, writer);
         addAppliesTo(writer, appliesTo);
         keyType = writeKeyType(writer, keyType);
 
@@ -477,6 +485,12 @@ public class STSClient implements Config
         }
         return token;
     }
+
+    private void addRequestType(String requestType, W3CDOMStreamWriter writer) throws XMLStreamException
{
+        writer.writeStartElement("wst", "RequestType", namespace);
+        writer.writeCharacters(namespace + requestType);
+        writer.writeEndElement();
+    }
     
     private Element getDocumentElement(DOMSource ds) {
         Node nd = ds.getNode();
@@ -647,6 +661,10 @@ public class STSClient implements Config
             LOG.log(Level.WARNING, "Problem cancelling token", ex);
         }
     }
+    
+    private boolean useSecondaryParameters() {
+        return !STSUtils.WST_NS_05_02.equals(namespace);
+    }
 
     private String writeKeyType(W3CDOMStreamWriter writer, String keyType) throws XMLStreamException
{
         if (isSecureConv) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java?rev=979457&r1=979456&r2=979457&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSUtils.java
Mon Jul 26 21:43:47 2010
@@ -48,9 +48,12 @@ import org.apache.neethi.Policy;
  * 
  */
 public final class STSUtils {
+    /**
+     * WS-T 1.0 Namespace.
+     */
     public static final String WST_NS_05_02 = "http://schemas.xmlsoap.org/ws/2005/02/trust";
     /**
-     * WS-T 1.3 Namespace
+     * WS-T 1.3 Namespace.
      */
     public static final String WST_NS_05_12 = "http://docs.oasis-open.org/ws-sx/ws-trust/200512";
     /**



Mime
View raw message