ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1172654 - in /webservices/wss4j/trunk/src: main/java/org/apache/ws/security/ main/java/org/apache/ws/security/processor/ test/java/org/apache/ws/security/common/ test/java/org/apache/ws/security/handler/
Date Mon, 19 Sep 2011 15:07:28 GMT
Author: coheigea
Date: Mon Sep 19 15:07:27 2011
New Revision: 1172654

URL: http://svn.apache.org/viewvc?rev=1172654&view=rev
Log:
Adding a convenience tag to WSSecurityEngineResult to return the DOM element of a processed
token

Modified:
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngineResult.java
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
    webservices/wss4j/trunk/src/test/java/org/apache/ws/security/common/CustomProcessor.java
    webservices/wss4j/trunk/src/test/java/org/apache/ws/security/handler/ResultsOrderTest.java

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngineResult.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngineResult.java?rev=1172654&r1=1172653&r2=1172654&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngineResult.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/WSSecurityEngineResult.java
Mon Sep 19 15:07:27 2011
@@ -115,6 +115,13 @@ public class WSSecurityEngineResult exte
      */
     public static final String TAG_VALIDATED_TOKEN = "validated-token";
     
+    /**
+     * Tag denoting the DOM Element of the processed token (if a token has been processed).
+     * 
+     * The value under this tag is of type org.w3c.dom.Element
+     */
+    public static final String TAG_TOKEN_ELEMENT = "token-element";
+    
     //
     // Keys and certs
     //
@@ -208,6 +215,10 @@ public class WSSecurityEngineResult exte
      */
     public static final String TAG_ID = "id";
     
+    public WSSecurityEngineResult(int act) {
+        put(TAG_ACTION, new Integer(act));
+    }
+    
     public WSSecurityEngineResult(
         int act, 
         AssertionWrapper ass
@@ -215,6 +226,7 @@ public class WSSecurityEngineResult exte
         put(TAG_ACTION, new Integer(act));
         put(TAG_SAML_ASSERTION, ass);
         put(TAG_VALIDATED_TOKEN, Boolean.FALSE);
+        put(TAG_TOKEN_ELEMENT, ass.getElement());
     }
 
     public WSSecurityEngineResult(
@@ -286,18 +298,21 @@ public class WSSecurityEngineResult exte
         put(TAG_ACTION, new Integer(act));
         put(TAG_TIMESTAMP, tstamp);
         put(TAG_VALIDATED_TOKEN, Boolean.FALSE);
+        put(TAG_TOKEN_ELEMENT, tstamp.getElement());
     }
     
     public WSSecurityEngineResult(int act, SecurityContextToken sct) {
         put(TAG_ACTION, new Integer(act));
         put(TAG_SECURITY_CONTEXT_TOKEN, sct);
         put(TAG_VALIDATED_TOKEN, Boolean.FALSE);
+        put(TAG_TOKEN_ELEMENT, sct.getElement());
     }
     
     public WSSecurityEngineResult(int act, SignatureConfirmation sc) {
         put(TAG_ACTION, new Integer(act));
         put(TAG_SIGNATURE_CONFIRMATION, sc);
         put(TAG_VALIDATED_TOKEN, Boolean.FALSE);
+        put(TAG_TOKEN_ELEMENT, sc.getElement());
     }
     
     public WSSecurityEngineResult(int act, UsernameToken usernameToken) {
@@ -309,6 +324,7 @@ public class WSSecurityEngineResult exte
         put(TAG_USERNAME_TOKEN, usernameToken);
         put(TAG_PRINCIPAL, principal);
         put(TAG_VALIDATED_TOKEN, Boolean.FALSE);
+        put(TAG_TOKEN_ELEMENT, usernameToken.getElement());
     }
 
     public WSSecurityEngineResult(int act, BinarySecurity token, X509Certificate[] certs)
{
@@ -319,6 +335,7 @@ public class WSSecurityEngineResult exte
             put(TAG_X509_CERTIFICATE, certs[0]);
         }
         put(TAG_VALIDATED_TOKEN, Boolean.FALSE);
+        put(TAG_TOKEN_ELEMENT, token.getElement());
     }
 
     

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java?rev=1172654&r1=1172653&r2=1172654&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
Mon Sep 19 15:07:27 2011
@@ -70,6 +70,7 @@ public class DerivedKeyTokenProcessor im
         result.put(WSSecurityEngineResult.TAG_ID, dkt.getID());
         result.put(WSSecurityEngineResult.TAG_DERIVED_KEY_TOKEN, dkt);
         result.put(WSSecurityEngineResult.TAG_SECRET, secret);
+        result.put(WSSecurityEngineResult.TAG_TOKEN_ELEMENT, dkt.getElement());
         wsDocInfo.addResult(result);
         return java.util.Collections.singletonList(result);
     }

Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/common/CustomProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/common/CustomProcessor.java?rev=1172654&r1=1172653&r2=1172654&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/common/CustomProcessor.java
(original)
+++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/common/CustomProcessor.java
Mon Sep 19 15:07:27 2011
@@ -20,7 +20,6 @@
 package org.apache.ws.security.common;
 
 import org.apache.ws.security.handler.RequestData;
-import org.apache.ws.security.message.token.SecurityContextToken;
 import org.apache.ws.security.processor.Processor;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.WSDocInfo;
@@ -39,10 +38,7 @@ public class CustomProcessor implements 
         final WSDocInfo wsDocInfo 
     ) throws WSSecurityException {
         final WSSecurityEngineResult result = 
-            new WSSecurityEngineResult(
-                WSConstants.UT_SIGN, 
-                (SecurityContextToken) null
-            );
+            new WSSecurityEngineResult(WSConstants.UT_SIGN);
         result.put("foo", this);
         return java.util.Collections.singletonList(result);
     }

Modified: webservices/wss4j/trunk/src/test/java/org/apache/ws/security/handler/ResultsOrderTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/test/java/org/apache/ws/security/handler/ResultsOrderTest.java?rev=1172654&r1=1172653&r2=1172654&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/test/java/org/apache/ws/security/handler/ResultsOrderTest.java
(original)
+++ webservices/wss4j/trunk/src/test/java/org/apache/ws/security/handler/ResultsOrderTest.java
Mon Sep 19 15:07:27 2011
@@ -41,16 +41,16 @@ public class ResultsOrderTest extends or
         
         java.util.List<WSSecurityEngineResult> results = new java.util.ArrayList<WSSecurityEngineResult>();
         results.add(
-            new WSSecurityEngineResult(WSConstants.UT, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.UT)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.TS, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.TS)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SC, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SC)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SIGN, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SIGN)
         );
         
         java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
@@ -71,16 +71,16 @@ public class ResultsOrderTest extends or
         
         java.util.List<WSSecurityEngineResult> results = new java.util.ArrayList<WSSecurityEngineResult>();
         results.add(
-            new WSSecurityEngineResult(WSConstants.SIGN, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SIGN)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SC, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SC)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.TS, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.TS)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.UT, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.UT)
         );
         
         java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
@@ -103,16 +103,16 @@ public class ResultsOrderTest extends or
         java.util.List<WSSecurityEngineResult> results = 
             new java.util.ArrayList<WSSecurityEngineResult>();
         results.add(
-            new WSSecurityEngineResult(WSConstants.TS, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.TS)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SIGN, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SIGN)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SC, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SC)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.UT, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.UT)
         );
         
         java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
@@ -135,16 +135,16 @@ public class ResultsOrderTest extends or
         java.util.List<WSSecurityEngineResult> results = 
             new java.util.ArrayList<WSSecurityEngineResult>();
         results.add(
-            new WSSecurityEngineResult(WSConstants.TS, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.TS)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SIGN, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SIGN)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SC, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SC)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.UT, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.UT)
         );
         
         java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
@@ -166,13 +166,13 @@ public class ResultsOrderTest extends or
         java.util.List<WSSecurityEngineResult> results = 
             new java.util.ArrayList<WSSecurityEngineResult>();
         results.add(
-            new WSSecurityEngineResult(WSConstants.UT, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.UT)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.TS, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.TS)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SC, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SC)
         );
         
         java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
@@ -194,16 +194,16 @@ public class ResultsOrderTest extends or
         java.util.List<WSSecurityEngineResult> results = 
             new java.util.ArrayList<WSSecurityEngineResult>();
         results.add(
-            new WSSecurityEngineResult(WSConstants.UT, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.UT)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.TS, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.TS)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SIGN, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SIGN)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.SC, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.SC)
         );
         
         java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
@@ -241,7 +241,7 @@ public class ResultsOrderTest extends or
         java.util.List<WSSecurityEngineResult> results = 
             new java.util.ArrayList<WSSecurityEngineResult>();
         results.add(
-            new WSSecurityEngineResult(WSConstants.TS, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.TS)
         );
         
         java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
@@ -260,13 +260,13 @@ public class ResultsOrderTest extends or
         java.util.List<WSSecurityEngineResult> results = 
             new java.util.ArrayList<WSSecurityEngineResult>();
         results.add(
-            new WSSecurityEngineResult(WSConstants.ENCR, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.ENCR)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.UT, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.UT)
         );
         results.add(
-            new WSSecurityEngineResult(WSConstants.ENCR, (Timestamp)null)
+            new WSSecurityEngineResult(WSConstants.ENCR)
         );
         
         java.util.List<Integer> actions = new java.util.ArrayList<Integer>();



Mime
View raw message