You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by co...@apache.org on 2009/02/05 12:44:27 UTC

svn commit: r741080 - in /webservices/wss4j/trunk: src/org/apache/ws/security/message/ src/org/apache/ws/security/message/token/ test/wssec/

Author: coheigea
Date: Thu Feb  5 11:44:26 2009
New Revision: 741080

URL: http://svn.apache.org/viewvc?rev=741080&view=rev
Log:
[WSS-143] - Tidied up some namespace declarations
 - I think I came up with a reasonable interim solution here. The DOM created by any of the
 message tokens (org.apache.ws.security.message.token) will be guaranteed to have all of the 
 required namespace declarations, for backwards compatibility reasons. So for example, they'll
 all define the wsse namespace, even though the security header defines it.
 - BUT any of the child elements of the message tokens will leave the namespace declaration to
 the parent.
 - In practice, this only affects the UsernameToken and Timestamp message tokens. So the DOM
 produced by the Timestamp type now conforms to the example Dan gave in the JIRA.

Modified:
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java
    webservices/wss4j/trunk/test/wssec/TestWSSecurityUTSignature.java

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java?rev=741080&r1=741079&r2=741080&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java Thu Feb  5 11:44:26 2009
@@ -770,7 +770,7 @@
 
         computeSignature();
 
-        return (doc);
+        return doc;
     }
 
     protected Element createSTRParameter(Document doc) {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java?rev=741080&r1=741079&r2=741080&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java Thu Feb  5 11:44:26 2009
@@ -123,7 +123,7 @@
      * Gets the Reference.
      *
      * @return the <code>Reference</code> element contained in this
-     *         SecurityTokeneReference
+     *         SecurityTokenReference
      * @throws WSSecurityException
      */
     public Reference getReference() throws WSSecurityException {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java?rev=741080&r1=741079&r2=741080&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java Thu Feb  5 11:44:26 2009
@@ -141,9 +141,6 @@
         Element elementCreated =
                 doc.createElementNS(WSConstants.WSU_NS,
                         WSConstants.WSU_PREFIX + ":" + WSConstants.CREATED_LN);
-        WSSecurityUtil.setNamespace(elementCreated,
-                WSConstants.WSU_NS,
-                WSConstants.WSU_PREFIX);
         elementCreated.appendChild(doc.createTextNode(zulu.format(created.getTime())));
         element.appendChild(elementCreated);
         if (ttl != 0) {
@@ -155,9 +152,6 @@
             Element elementExpires =
                     doc.createElementNS(WSConstants.WSU_NS,
                             WSConstants.WSU_PREFIX + ":" + WSConstants.EXPIRES_LN);
-            WSSecurityUtil.setNamespace(elementExpires,
-                    WSConstants.WSU_NS,
-                    WSConstants.WSU_PREFIX);
             elementExpires.appendChild(doc.createTextNode(zulu.format(expires.getTime())));
             element.appendChild(elementExpires);
         }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java?rev=741080&r1=741079&r2=741080&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java Thu Feb  5 11:44:26 2009
@@ -191,16 +191,12 @@
 
         this.elementUsername = doc.createElementNS(WSConstants.WSSE_NS, "wsse:"
                 + WSConstants.USERNAME_LN);
-        WSSecurityUtil.setNamespace(this.elementUsername, WSConstants.WSSE_NS,
-                WSConstants.WSSE_PREFIX);
         this.elementUsername.appendChild(doc.createTextNode(""));
         element.appendChild(elementUsername);
 
         if (pwType != null) {
             this.elementPassword = doc.createElementNS(WSConstants.WSSE_NS,
                     "wsse:" + WSConstants.PASSWORD_LN);
-            WSSecurityUtil.setNamespace(this.elementPassword,
-                    WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX);
             this.elementPassword.appendChild(doc.createTextNode(""));
             element.appendChild(elementPassword);
 
@@ -225,8 +221,6 @@
         random.nextBytes(nonceValue);
         this.elementNonce = doc.createElementNS(WSConstants.WSSE_NS, "wsse:"
                 + WSConstants.NONCE_LN);
-        WSSecurityUtil.setNamespace(this.elementNonce, WSConstants.WSSE_NS,
-                WSConstants.WSSE_PREFIX);
         this.elementNonce.appendChild(doc.createTextNode(Base64
                 .encode(nonceValue)));
         element.appendChild(elementNonce);
@@ -249,8 +243,7 @@
         Calendar rightNow = Calendar.getInstance();
         this.elementCreated = doc.createElementNS(WSConstants.WSU_NS,
                 WSConstants.WSU_PREFIX + ":" + WSConstants.CREATED_LN);
-        WSSecurityUtil.setNamespace(this.elementCreated, WSConstants.WSU_NS,
-                WSConstants.WSU_PREFIX);
+        WSSecurityUtil.setNamespace(this.element, WSConstants.WSU_NS, WSConstants.WSU_PREFIX);
         this.elementCreated.appendChild(doc.createTextNode(zulu.format(rightNow
                 .getTime())));
         element.appendChild(elementCreated);
@@ -278,7 +271,7 @@
         }
         this.elementSalt = doc.createElementNS(WSConstants.WSSE11_NS,
                 WSConstants.WSSE11_PREFIX + ":" + WSConstants.SALT_LN);
-        WSSecurityUtil.setNamespace(this.elementSalt, WSConstants.WSSE11_NS,
+        WSSecurityUtil.setNamespace(this.element, WSConstants.WSSE11_NS,
                 WSConstants.WSSE11_PREFIX);
         this.elementSalt.appendChild(doc.createTextNode(Base64
                 .encode(saltValue)));
@@ -293,7 +286,7 @@
         String text = "" + iteration;
         this.elementIteration = doc.createElementNS(WSConstants.WSSE11_NS,
                 WSConstants.WSSE11_PREFIX + ":" + WSConstants.ITERATION_LN);
-        WSSecurityUtil.setNamespace(this.elementIteration,
+        WSSecurityUtil.setNamespace(this.element,
                 WSConstants.WSSE11_NS, WSConstants.WSSE11_PREFIX);
         this.elementIteration.appendChild(doc.createTextNode(text));
         element.appendChild(elementIteration);

Modified: webservices/wss4j/trunk/test/wssec/TestWSSecurityUTSignature.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/test/wssec/TestWSSecurityUTSignature.java?rev=741080&r1=741079&r2=741080&view=diff
==============================================================================
--- webservices/wss4j/trunk/test/wssec/TestWSSecurityUTSignature.java (original)
+++ webservices/wss4j/trunk/test/wssec/TestWSSecurityUTSignature.java Thu Feb  5 11:44:26 2009
@@ -90,7 +90,7 @@
      * @return a junit test suite
      */
     public static Test suite() {
-        return new TestSuite(TestWSSecurityUTDK.class);
+        return new TestSuite(TestWSSecurityUTSignature.class);
     }
 
     /**



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