You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ru...@apache.org on 2006/04/07 08:13:29 UTC

svn commit: r392195 - in /webservices/wss4j/trunk/src/org/apache/ws/security/message: WSSecDerivedKeyBase.java token/DerivedKeyToken.java

Author: ruchithf
Date: Thu Apr  6 23:13:27 2006
New Revision: 392195

URL: http://svn.apache.org/viewcvs?rev=392195&view=rev
Log:
The derived key can use an external STR element to refer to the token used to derive the key (This is required to support the usage of RequestedAttachedReference and RequestedUnattachedReference in the WS-Trust spec)


Modified:
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java?rev=392195&r1=392194&r2=392195&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java Thu Apr  6 23:13:27 2006
@@ -84,6 +84,10 @@
      */
     protected abstract int getDerivedKeyLength() throws WSSecurityException;
    
+    /**
+     * The wsse:SecurityTokenReference element to be used
+     */
+    protected Element strElem;
     
     /**
      * @param ephemeralKey The ephemeralKey to set.
@@ -93,7 +97,15 @@
         this.ephemeralKey = ephemeralKey;
         this.tokenIdentifier = tokenIdentifier;
     }
-
+    
+    /**
+     * @param ephemeralKey The ephemeralKey to set.
+     */
+    public void setExternalKey(byte[] ephemeralKey, 
+                                Element strElem) {
+        this.ephemeralKey = ephemeralKey;
+        this.strElem = strElem;
+    }
     
     /**
      * @return Returns the tokenIdentifier.
@@ -168,12 +180,17 @@
         dkt.setNonce(Base64.encode(nonce));
         dkt.setOffset(offset);
         dkt.setID(dktId);
-        //Create the SecurityTokenRef to the Encrypted Key
-        SecurityTokenReference strEncKey = new SecurityTokenReference(document);
-        Reference ref = new Reference(document);
-        ref.setURI("#" + this.tokenIdentifier);
-        strEncKey.setReference(ref);
-        dkt.setSecuityTokenReference(strEncKey);
+        
+        if(this.strElem == null) {
+            //Create the SecurityTokenRef to the Encrypted Key
+            SecurityTokenReference strEncKey = new SecurityTokenReference(document);
+            Reference ref = new Reference(document);
+            ref.setURI("#" + this.tokenIdentifier);
+            strEncKey.setReference(ref);
+            dkt.setSecuityTokenReference(strEncKey); 
+        } else {
+            dkt.setSecuityTokenReference(this.strElem);
+        }
     }
 
 

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java
URL: http://svn.apache.org/viewcvs/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java?rev=392195&r1=392194&r2=392195&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java Thu Apr  6 23:13:27 2006
@@ -130,6 +130,11 @@
         //WSSecurityUtil.appendChildElement(doc, this.element, ref.getElement());
         this.element.appendChild(ref.getElement());
     }
+    
+    public void setSecuityTokenReference(Element elem) {
+        this.elementSecurityTokenReference = elem;
+        this.element.appendChild(elem);
+    }
 
     /**
      * Returns the SecurityTokenReference of the derived key token



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org