ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1295267 [9/11] - in /webservices/wss4j/branches/swssf: rampart-policy/src/main/java/org/apache/ws/secpolicy/builders/ streaming-ws-policy/src/main/java/org/swssf/policy/ streaming-ws-policy/src/main/java/org/swssf/policy/assertionStates/ s...
Date Wed, 29 Feb 2012 20:54:56 GMT
Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/HttpsTokenSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/HttpsTokenSecurityEvent.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/HttpsTokenSecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/HttpsTokenSecurityEvent.java Wed Feb 29 20:54:51 2012
@@ -18,6 +18,15 @@
  */
 package org.swssf.wss.securityEvent;
 
+import org.swssf.wss.ext.WSSConstants;
+import org.swssf.wss.impl.securityToken.AbstractSecurityToken;
+import org.swssf.xmlsec.ext.SecurityToken;
+import org.swssf.xmlsec.ext.XMLSecurityConstants;
+import org.swssf.xmlsec.ext.XMLSecurityException;
+
+import java.security.Key;
+import java.security.PublicKey;
+
 /**
  * @author $Author$
  * @version $Revision$ $Date$
@@ -54,4 +63,39 @@ public class HttpsTokenSecurityEvent ext
     public void setIssuerName(String issuerName) {
         this.issuerName = issuerName;
     }
+
+    @Override
+    public SecurityToken getSecurityToken() {
+        SecurityToken securityToken = super.getSecurityToken();
+        if (securityToken == null) {
+            securityToken = new AbstractSecurityToken(null, null, null, null, null) {
+                @Override
+                protected Key getKey(String algorithmURI, XMLSecurityConstants.KeyUsage keyUsage) throws XMLSecurityException {
+                    return null;
+                }
+
+                @Override
+                protected PublicKey getPubKey(String algorithmURI, XMLSecurityConstants.KeyUsage keyUsage) throws XMLSecurityException {
+                    return null;
+                }
+
+                @Override
+                public boolean isAsymmetric() {
+                    return false;
+                }
+
+                @Override
+                public SecurityToken getKeyWrappingToken() throws XMLSecurityException {
+                    return null;
+                }
+
+                @Override
+                public XMLSecurityConstants.TokenType getTokenType() {
+                    return WSSConstants.HttpsToken;
+                }
+            };
+        }
+        setSecurityToken(securityToken);
+        return securityToken;
+    }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/OperationSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/OperationSecurityEvent.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/OperationSecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/OperationSecurityEvent.java Wed Feb 29 20:54:51 2012
@@ -18,6 +18,9 @@
  */
 package org.swssf.wss.securityEvent;
 
+import org.swssf.wss.ext.WSSSecurityProperties;
+import org.swssf.wss.ext.WSSecurityContext;
+
 import javax.xml.namespace.QName;
 
 /**
@@ -27,6 +30,8 @@ import javax.xml.namespace.QName;
 public class OperationSecurityEvent extends SecurityEvent {
 
     private QName operation;
+    private WSSecurityContext wsSecurityContext;
+    private WSSSecurityProperties wssSecurityProperties;
 
     public OperationSecurityEvent() {
         super(Event.Operation);
@@ -39,4 +44,20 @@ public class OperationSecurityEvent exte
     public void setOperation(QName operation) {
         this.operation = operation;
     }
+
+    public WSSecurityContext getWsSecurityContext() {
+        return wsSecurityContext;
+    }
+
+    public void setWsSecurityContext(WSSecurityContext wsSecurityContext) {
+        this.wsSecurityContext = wsSecurityContext;
+    }
+
+    public WSSSecurityProperties getWssSecurityProperties() {
+        return wssSecurityProperties;
+    }
+
+    public void setWssSecurityProperties(WSSSecurityProperties wssSecurityProperties) {
+        this.wssSecurityProperties = wssSecurityProperties;
+    }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredElementSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredElementSecurityEvent.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredElementSecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredElementSecurityEvent.java Wed Feb 29 20:54:51 2012
@@ -19,6 +19,8 @@
 package org.swssf.wss.securityEvent;
 
 import javax.xml.namespace.QName;
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * @author $Author$
@@ -26,18 +28,17 @@ import javax.xml.namespace.QName;
  */
 public class RequiredElementSecurityEvent extends SecurityEvent {
 
-    //todo xpath or something unique
-    private QName element;
+    private List<QName> elementPath;
 
     public RequiredElementSecurityEvent() {
         super(Event.RequiredElement);
     }
 
-    public QName getElement() {
-        return element;
+    public List<QName> getElementPath() {
+        return elementPath;
     }
 
-    public void setElement(QName element) {
-        this.element = element;
+    public void setElementPath(List<QName> elementPath) {
+        this.elementPath = new LinkedList<QName>(elementPath);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredPartSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredPartSecurityEvent.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredPartSecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredPartSecurityEvent.java Wed Feb 29 20:54:51 2012
@@ -19,6 +19,8 @@
 package org.swssf.wss.securityEvent;
 
 import javax.xml.namespace.QName;
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * @author $Author$
@@ -26,18 +28,17 @@ import javax.xml.namespace.QName;
  */
 public class RequiredPartSecurityEvent extends SecurityEvent {
 
-    //todo xpath or something unique
-    private QName element;
+    private List<QName> elementPath;
 
     public RequiredPartSecurityEvent() {
         super(Event.RequiredPart);
     }
 
-    public QName getElement() {
-        return element;
+    public List<QName> getElementPath() {
+        return elementPath;
     }
 
-    public void setElement(QName element) {
-        this.element = element;
+    public void setElementPath(List<QName> elementPath) {
+        this.elementPath = new LinkedList<QName>(elementPath);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SecurityEvent.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SecurityEvent.java Wed Feb 29 20:54:51 2012
@@ -60,8 +60,4 @@ public abstract class SecurityEvent {
     public Event getSecurityEventType() {
         return securityEventType;
     }
-
-    public void setSecurityEventType(Event securityEventType) {
-        this.securityEventType = securityEventType;
-    }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedElementSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedElementSecurityEvent.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedElementSecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedElementSecurityEvent.java Wed Feb 29 20:54:51 2012
@@ -21,6 +21,8 @@ package org.swssf.wss.securityEvent;
 import org.swssf.xmlsec.ext.SecurityToken;
 
 import javax.xml.namespace.QName;
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * @author $Author$
@@ -28,9 +30,7 @@ import javax.xml.namespace.QName;
  */
 public class SignedElementSecurityEvent extends SecurityEvent {
 
-    //todo xpath or something unique
-    //todo message signature or supporting sig
-    private QName element;
+    private List<QName> elementPath;
     private SecurityToken securityToken;
     private boolean signed;
 
@@ -40,12 +40,12 @@ public class SignedElementSecurityEvent 
         this.signed = signed;
     }
 
-    public QName getElement() {
-        return element;
+    public List<QName> getElementPath() {
+        return elementPath;
     }
 
-    public void setElement(QName element) {
-        this.element = element;
+    public void setElementPath(List<QName> elementPath) {
+        this.elementPath = new LinkedList<QName>(elementPath);
     }
 
     public SecurityToken getSecurityToken() {

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedPartSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedPartSecurityEvent.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedPartSecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedPartSecurityEvent.java Wed Feb 29 20:54:51 2012
@@ -21,6 +21,8 @@ package org.swssf.wss.securityEvent;
 import org.swssf.xmlsec.ext.SecurityToken;
 
 import javax.xml.namespace.QName;
+import java.util.LinkedList;
+import java.util.List;
 
 /**
  * @author $Author$
@@ -28,9 +30,7 @@ import javax.xml.namespace.QName;
  */
 public class SignedPartSecurityEvent extends SecurityEvent {
 
-    //todo xpath or something unique
-    //todo message signature or supporting sig
-    private QName element;
+    private List<QName> elementPath;
     private boolean signed;
     private SecurityToken securityToken;
 
@@ -40,12 +40,12 @@ public class SignedPartSecurityEvent ext
         this.signed = signed;
     }
 
-    public QName getElement() {
-        return element;
+    public List<QName> getElementPath() {
+        return elementPath;
     }
 
-    public void setElement(QName element) {
-        this.element = element;
+    public void setElementPath(List<QName> elementPath) {
+        this.elementPath = new LinkedList<QName>(elementPath);
     }
 
     public boolean isSigned() {

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/TokenSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/TokenSecurityEvent.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/TokenSecurityEvent.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/TokenSecurityEvent.java Wed Feb 29 20:54:51 2012
@@ -26,22 +26,7 @@ import org.swssf.xmlsec.ext.SecurityToke
  */
 public abstract class TokenSecurityEvent extends SecurityEvent {
 
-    public enum TokenUsage {
-        Signature,
-        MainSignature,
-        Encryption,
-        MainEncryption,
-        SupportingToken,
-        SignedSupportingTokens,
-        EndorsingSupportingTokens,
-        SignedEndorsingSupportingTokens,
-        SignedEncryptedSupportingTokens,
-        EndorsingEncryptedSupportingTokens,
-        SignedEndorsingEncryptedSupportingTokens,
-    }
-
     private SecurityToken securityToken;
-    private TokenUsage tokenUsage;
 
     public TokenSecurityEvent(Event securityEventType) {
         super(securityEventType);
@@ -54,12 +39,4 @@ public abstract class TokenSecurityEvent
     public void setSecurityToken(SecurityToken securityToken) {
         this.securityToken = securityToken;
     }
-
-    public TokenUsage getTokenUsage() {
-        return tokenUsage;
-    }
-
-    public void setTokenUsage(TokenUsage tokenUsage) {
-        this.tokenUsage = tokenUsage;
-    }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/AbstractTestBase.java Wed Feb 29 20:54:51 2012
@@ -89,21 +89,34 @@ public abstract class AbstractTestBase {
         //xmlInputFactory.setProperty(WstxInputProperties.P_MIN_TEXT_SEGMENT, new Integer(5 * 8192));
     }
 
-    public Document doInboundSecurity(WSSSecurityProperties securityProperties, InputStream inputStream) throws WSSecurityException, WSSConfigurationException, XMLStreamException, ParserConfigurationException {
+    public Document doInboundSecurity(WSSSecurityProperties securityProperties, InputStream inputStream)
+            throws WSSecurityException, WSSConfigurationException, XMLStreamException, ParserConfigurationException {
         return doInboundSecurity(securityProperties, xmlInputFactory.createXMLStreamReader(inputStream), null);
     }
 
-    public Document doInboundSecurity(WSSSecurityProperties securityProperties, InputStream inputStream, SecurityEventListener securityEventListener) throws WSSecurityException, WSSConfigurationException, XMLStreamException, ParserConfigurationException {
+    public Document doInboundSecurity(WSSSecurityProperties securityProperties, InputStream inputStream,
+                                      SecurityEventListener securityEventListener)
+            throws WSSecurityException, WSSConfigurationException, XMLStreamException, ParserConfigurationException {
         return doInboundSecurity(securityProperties, xmlInputFactory.createXMLStreamReader(inputStream), securityEventListener);
     }
 
+    public Document doInboundSecurity(WSSSecurityProperties securityProperties, InputStream inputStream,
+                                      List<SecurityEvent> securityEventList, SecurityEventListener securityEventListener)
+            throws WSSecurityException, WSSConfigurationException, XMLStreamException, ParserConfigurationException {
+        return doInboundSecurity(securityProperties, xmlInputFactory.createXMLStreamReader(inputStream), securityEventList, securityEventListener);
+    }
+
     public Document doInboundSecurity(WSSSecurityProperties securityProperties, XMLStreamReader xmlStreamReader) throws WSSecurityException, WSSConfigurationException, XMLStreamException, ParserConfigurationException {
         return doInboundSecurity(securityProperties, xmlStreamReader, null);
     }
 
     public Document doInboundSecurity(WSSSecurityProperties securityProperties, XMLStreamReader xmlStreamReader, SecurityEventListener securityEventListener) throws WSSecurityException, XMLStreamException, ParserConfigurationException {
+        return doInboundSecurity(securityProperties, xmlStreamReader, new ArrayList<SecurityEvent>(), securityEventListener);
+    }
+
+    public Document doInboundSecurity(WSSSecurityProperties securityProperties, XMLStreamReader xmlStreamReader, List<SecurityEvent> securityEventList, SecurityEventListener securityEventListener) throws WSSecurityException, XMLStreamException, ParserConfigurationException {
         InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
-        XMLStreamReader outXmlStreamReader = wsSecIn.processInMessage(xmlStreamReader, new ArrayList<SecurityEvent>(), securityEventListener);
+        XMLStreamReader outXmlStreamReader = wsSecIn.processInMessage(xmlStreamReader, securityEventList, securityEventListener);
         return StAX2DOM.readDoc(documentBuilderFactory.newDocumentBuilder(), outXmlStreamReader);
     }
 
@@ -123,13 +136,13 @@ public abstract class AbstractTestBase {
     }
 
     protected Map<String, Object> doOutboundSecurityWithWSS4J_1(
-        InputStream sourceDocument, String action, final Properties properties
+            InputStream sourceDocument, String action, final Properties properties
     ) throws org.apache.ws.security.WSSecurityException {
         CustomWSS4JHandler wss4JHandler = new CustomWSS4JHandler();
         final Map<String, Object> messageContext = getMessageContext(sourceDocument);
         messageContext.put(WSHandlerConstants.ACTION, action);
         messageContext.put(WSHandlerConstants.USER, "transmitter");
-        
+
         Properties sigProperties = new Properties();
         sigProperties.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
         sigProperties.setProperty("org.apache.ws.security.crypto.merlin.file", "transmitter.jks");
@@ -161,7 +174,7 @@ public abstract class AbstractTestBase {
         requestData.setMsgContext(messageContext);
         requestData.setNoSerialization(true);
         requestData.setCallbackHandler(new WSS4JCallbackHandlerImpl());
-        
+
         wss4JHandler.doSender(messageContext, requestData, true);
 
         return messageContext;
@@ -177,7 +190,7 @@ public abstract class AbstractTestBase {
     }
 
     protected Map<String, Object> doInboundSecurityWithWSS4J_1(
-        Document document, String action, Properties properties, boolean client
+            Document document, String action, Properties properties, boolean client
     ) throws Exception {
         CustomWSS4JHandler wss4JHandler = new CustomWSS4JHandler();
         Map<String, Object> messageContext = getMessageContext(document);
@@ -187,7 +200,7 @@ public abstract class AbstractTestBase {
         } else {
             messageContext.put(WSHandlerConstants.USER, "receiver");
         }
-        
+
         //handlerInfo.getHandlerConfig().put(WSHandlerConstants.ACTOR, "receiver");
         Properties sigProperties = new Properties();
         sigProperties.setProperty("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin");
@@ -200,7 +213,7 @@ public abstract class AbstractTestBase {
         sigProperties.setProperty("org.apache.ws.security.crypto.merlin.keystore.password", "default");
         //sigProperties.setProperty("org.apache.ws.security.crypto.merlin.keystore.alias", "transmitter");
         wss4JHandler.setPassword(messageContext, "default");
-        
+
         messageContext.put(WSHandlerConstants.SIG_PROP_REF_ID, "" + sigProperties.hashCode());
         messageContext.put("" + sigProperties.hashCode(), sigProperties);
         if (properties.get(WSHandlerConstants.PW_CALLBACK_REF) != null) {
@@ -305,8 +318,8 @@ public abstract class AbstractTestBase {
         /**
          * Handles incoming web service requests and outgoing responses
          */
-        public boolean doSender(Map<String, Object> mc, RequestData reqData, boolean isRequest) 
-            throws org.apache.ws.security.WSSecurityException {
+        public boolean doSender(Map<String, Object> mc, RequestData reqData, boolean isRequest)
+                throws org.apache.ws.security.WSSecurityException {
 
             reqData.getSignatureParts().clear();
             reqData.getEncryptParts().clear();
@@ -344,7 +357,7 @@ public abstract class AbstractTestBase {
                  * there is a specific parameter to get a username.
                  */
                 throw new org.apache.ws.security.WSSecurityException(
-                    "WSS4JHandler: Empty username for specified action"
+                        "WSS4JHandler: Empty username for specified action"
                 );
             }
             if (doDebug) {
@@ -360,7 +373,7 @@ public abstract class AbstractTestBase {
             Document doc = (Document) mc.get(SECURED_DOCUMENT);
             if (doc == null) {
                 throw new org.apache.ws.security.WSSecurityException(
-                    "WSS4JHandler: cannot get SOAP envlope from message"
+                        "WSS4JHandler: cannot get SOAP envlope from message"
                 );
             }
             if (doDebug) {
@@ -370,13 +383,13 @@ public abstract class AbstractTestBase {
             doSenderAction(doAction, doc, reqData, actions, isRequest);
 
             mc.put(SECURED_DOCUMENT, doc);
-            
+
             return true;
         }
 
         @SuppressWarnings("unchecked")
-        public boolean doReceiver(Map<String, Object> mc, RequestData reqData, boolean isRequest) 
-            throws org.apache.ws.security.WSSecurityException {
+        public boolean doReceiver(Map<String, Object> mc, RequestData reqData, boolean isRequest)
+                throws org.apache.ws.security.WSSecurityException {
             String action = (String) mc.get(WSHandlerConstants.ACTION);
             if (action == null) {
                 throw new org.apache.ws.security.WSSecurityException("WSS4JHandler: No action defined");
@@ -392,10 +405,10 @@ public abstract class AbstractTestBase {
              * Check if it's a fault. Don't process faults.
              */
             org.apache.ws.security.SOAPConstants soapConstants =
-                WSSecurityUtil.getSOAPConstants(doc.getDocumentElement());
+                    WSSecurityUtil.getSOAPConstants(doc.getDocumentElement());
             if (WSSecurityUtil.findElement(
-                doc.getDocumentElement(), "Fault", soapConstants.getEnvelopeURI()) != null
-            ) {
+                    doc.getDocumentElement(), "Fault", soapConstants.getEnvelopeURI()) != null
+                    ) {
                 return false;
             }
 
@@ -422,7 +435,7 @@ public abstract class AbstractTestBase {
                     log.debug(ex.getMessage(), ex);
                 }
                 throw new org.apache.ws.security.WSSecurityException(
-                    "WSS4JHandler: security processing failed", ex
+                        "WSS4JHandler: security processing failed", ex
                 );
             }
             if (wsResult == null || wsResult.size() == 0) {
@@ -431,7 +444,7 @@ public abstract class AbstractTestBase {
                     return true;
                 } else {
                     throw new org.apache.ws.security.WSSecurityException(
-                        "WSS4JHandler: Request does not contain required Security header"
+                            "WSS4JHandler: Request does not contain required Security header"
                     );
                 }
             }
@@ -448,7 +461,7 @@ public abstract class AbstractTestBase {
              */
             if (!checkReceiverResults(wsResult, actions)) {
                 throw new org.apache.ws.security.WSSecurityException(
-                    "WSS4JHandler: security processing failed (actions mismatch)"
+                        "WSS4JHandler: security processing failed (actions mismatch)"
                 );
             }
 
@@ -472,7 +485,7 @@ public abstract class AbstractTestBase {
         }
 
         protected boolean checkReceiverResults(
-            List<WSSecurityEngineResult> wsResult, List<Integer> actions
+                List<WSSecurityEngineResult> wsResult, List<Integer> actions
         ) {
             List<WSSecurityEngineResult> wsSecurityEngineResults = new ArrayList<WSSecurityEngineResult>();
             for (WSSecurityEngineResult result : wsResult) {
@@ -534,8 +547,8 @@ public abstract class AbstractTestBase {
     }
 
     protected class TestSecurityEventListener implements SecurityEventListener {
-        private int eventNr = 0;
         private SecurityEvent.Event[] expectedEvents;
+        private List<SecurityEvent> receivedSecurityEvents = new ArrayList<SecurityEvent>();
 
         public TestSecurityEventListener(SecurityEvent.Event[] expectedEvents) {
             this.expectedEvents = expectedEvents;
@@ -543,7 +556,38 @@ public abstract class AbstractTestBase {
 
         @Override
         public void registerSecurityEvent(SecurityEvent securityEvent) throws WSSecurityException {
-            Assert.assertEquals(securityEvent.getSecurityEventType(), expectedEvents[eventNr++]);
+            receivedSecurityEvents.add(securityEvent);
+        }
+
+        public void compare() {
+            if (expectedEvents.length != receivedSecurityEvents.size()) {
+                printEvents();
+                Assert.fail("event count mismatch");
+            }
+            boolean asserted = true;
+            for (int i = 0; i < expectedEvents.length; i++) {
+                if (!expectedEvents[i].equals(receivedSecurityEvents.get(i).getSecurityEventType())) {
+                    asserted = false;
+                    break;
+                }
+            }
+            if (!asserted) {
+                printEvents();
+                Assert.fail("event mismatch");
+            }
+        }
+
+        private void printEvents() {
+            System.out.println("expected events:");
+            for (int i = 0; i < expectedEvents.length; i++) {
+                SecurityEvent.Event expectedEvent = expectedEvents[i];
+                System.out.println("SecurityEvent.Event." + expectedEvent + ",");
+            }
+            System.out.println("received events:");
+            for (int i = 0; i < receivedSecurityEvents.size(); i++) {
+                SecurityEvent securityEvent = receivedSecurityEvents.get(i);
+                System.out.println("SecurityEvent.Event." + securityEvent.getSecurityEventType() + ",");
+            }
         }
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/CallbackHandlerImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/CallbackHandlerImpl.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/CallbackHandlerImpl.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/CallbackHandlerImpl.java Wed Feb 29 20:54:51 2012
@@ -64,7 +64,7 @@ public class CallbackHandlerImpl impleme
     private byte[] ephemeralKey = null;
     private String issuer = null;
     private SAMLVersion samlVersion = SAMLVersion.VERSION_11;
-    
+
     private String subjectNameIDFormat = null;
     private String subjectLocalityIpAddress = null;
     private String subjectLocalityDnsAddress = null;
@@ -115,17 +115,17 @@ public class CallbackHandlerImpl impleme
                 samlCallback.setIssuerKeyPassword("default");
                 samlCallback.setSignAssertion(this.signAssertion);
                 samlCallback.setIssuer(issuer);
-                
+
                 if (conditions != null) {
                     samlCallback.setConditions(conditions);
                 }
-                
+
                 SubjectBean subjectBean =
                         new SubjectBean(subjectName, subjectQualifier, confirmationMethod);
                 if (subjectNameIDFormat != null) {
                     subjectBean.setSubjectNameIDFormat(subjectNameIDFormat);
                 }
-                
+
                 if (SAML1Constants.CONF_HOLDER_KEY.equals(confirmationMethod)
                         || SAML2Constants.CONF_HOLDER_KEY.equals(confirmationMethod)) {
                     try {
@@ -178,7 +178,7 @@ public class CallbackHandlerImpl impleme
                 attributeBean.setQualifiedName("role");
             }
             if (customAttributeValues != null) {
-                attributeBean.setCustomAttributeValues(customAttributeValues);   
+                attributeBean.setCustomAttributeValues(customAttributeValues);
             } else {
                 attributeBean.setAttributeValues(Collections.singletonList("user"));
             }
@@ -330,24 +330,24 @@ public class CallbackHandlerImpl impleme
     public void setSecret(byte[] secret) {
         this.secret = secret;
     }
-    
+
     public void setConditions(ConditionsBean conditionsBean) {
         this.conditions = conditionsBean;
     }
-    
+
     public void setSubjectNameIDFormat(String subjectNameIDFormat) {
         this.subjectNameIDFormat = subjectNameIDFormat;
     }
-    
+
     public void setSubjectLocality(String ipAddress, String dnsAddress) {
         this.subjectLocalityIpAddress = ipAddress;
         this.subjectLocalityDnsAddress = dnsAddress;
     }
-    
+
     public void setResource(String resource) {
         this.resource = resource;
     }
-    
+
     public void setCustomAttributeValues(List<?> customAttributeValues) {
         this.customAttributeValues = customAttributeValues;
     }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/DerivedKeyTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/DerivedKeyTokenTest.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/DerivedKeyTokenTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/DerivedKeyTokenTest.java Wed Feb 29 20:54:51 2012
@@ -152,21 +152,27 @@ public class DerivedKeyTokenTest extends
             InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
 
             SecurityEvent.Event[] expectedSecurityEvents = new SecurityEvent.Event[]{
-                    SecurityEvent.Event.AlgorithmSuite,
+                    SecurityEvent.Event.Operation,
+                    SecurityEvent.Event.X509Token,
                     SecurityEvent.Event.EncryptedKeyToken,
                     SecurityEvent.Event.DerivedKeyToken,
+                    SecurityEvent.Event.DerivedKeyToken,
                     SecurityEvent.Event.EncryptedPart,
                     SecurityEvent.Event.AlgorithmSuite,
                     SecurityEvent.Event.AlgorithmSuite,
+                    SecurityEvent.Event.AlgorithmSuite,
             };
+            final TestSecurityEventListener securityEventListener = new TestSecurityEventListener(expectedSecurityEvents);
             XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(
                     xmlInputFactory.createXMLStreamReader(
-                            new ByteArrayInputStream(baos.toByteArray())), null, new TestSecurityEventListener(expectedSecurityEvents));
+                            new ByteArrayInputStream(baos.toByteArray())), null, securityEventListener);
 
             Document document = StAX2DOM.readDoc(documentBuilderFactory.newDocumentBuilder(), xmlStreamReader);
 
             NodeList nodeList = document.getElementsByTagNameNS(WSSConstants.TAG_xenc_EncryptedData.getNamespaceURI(), WSSConstants.TAG_xenc_EncryptedData.getLocalPart());
             Assert.assertEquals(nodeList.getLength(), 0);
+
+            securityEventListener.compare();
         }
     }
 
@@ -219,7 +225,7 @@ public class DerivedKeyTokenTest extends
             //EncryptedKey
             WSSecEncryptedKey encrKeyBuilder = new WSSecEncryptedKey();
             encrKeyBuilder.setUserInfo("receiver");
-            encrKeyBuilder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
+            encrKeyBuilder.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
             encrKeyBuilder.prepare(doc, crypto);
 
             //Key information from the EncryptedKey
@@ -242,7 +248,6 @@ public class DerivedKeyTokenTest extends
             javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
             transformer.transform(new DOMSource(doc), new StreamResult(baos));
         }
-
         {
             WSSSecurityProperties securityProperties = new WSSSecurityProperties();
             securityProperties.loadDecryptionKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/InteroperabilityTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/InteroperabilityTest.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/InteroperabilityTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/InteroperabilityTest.java Wed Feb 29 20:54:51 2012
@@ -71,7 +71,8 @@ public class InteroperabilityTest extend
         securityProperties.loadDecryptionKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
 
         SecurityEvent.Event[] expectedSecurityEvents = new SecurityEvent.Event[]{
-                SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.Operation,
+                SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.SignatureValue,
@@ -87,10 +88,12 @@ public class InteroperabilityTest extend
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.EncryptedPart,
                 SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.AlgorithmSuite,
         };
+        final TestSecurityEventListener securityEventListener = new TestSecurityEventListener(expectedSecurityEvents);
         Document document = doInboundSecurity(securityProperties,
                 xmlInputFactory.createXMLStreamReader(
-                        new ByteArrayInputStream(baos.toByteArray())), new TestSecurityEventListener(expectedSecurityEvents));
+                        new ByteArrayInputStream(baos.toByteArray())), securityEventListener);
 
         //read the whole stream:
         transformer = TRANSFORMER_FACTORY.newTransformer();
@@ -102,6 +105,7 @@ public class InteroperabilityTest extend
                     }
                 }
         ));
+        securityEventListener.compare();
     }
 
     @Test(invocationCount = 1)
@@ -124,7 +128,8 @@ public class InteroperabilityTest extend
         securityProperties.loadDecryptionKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
 
         SecurityEvent.Event[] expectedSecurityEvents = new SecurityEvent.Event[]{
-                SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.Operation,
+                SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.SignatureValue,
@@ -140,10 +145,12 @@ public class InteroperabilityTest extend
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.EncryptedPart,
                 SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.AlgorithmSuite,
         };
+        final TestSecurityEventListener securityEventListener = new TestSecurityEventListener(expectedSecurityEvents);
         Document document = doInboundSecurity(
                 securityProperties,
-                xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), new TestSecurityEventListener(expectedSecurityEvents));
+                xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), securityEventListener);
 
         //read the whole stream:
         transformer = TRANSFORMER_FACTORY.newTransformer();
@@ -155,6 +162,7 @@ public class InteroperabilityTest extend
                     }
                 }
         ));
+        securityEventListener.compare();
     }
 
     @Test(invocationCount = 1)
@@ -178,10 +186,12 @@ public class InteroperabilityTest extend
         securityProperties.loadDecryptionKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
 
         SecurityEvent.Event[] expectedSecurityEvents = new SecurityEvent.Event[]{
-                SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.Operation,
+                SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.AlgorithmSuite,
                 SecurityEvent.Event.EncryptedElement,
                 SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.SignatureValue,
@@ -198,9 +208,10 @@ public class InteroperabilityTest extend
                 SecurityEvent.Event.EncryptedPart,
                 SecurityEvent.Event.AlgorithmSuite,
         };
+        final TestSecurityEventListener securityEventListener = new TestSecurityEventListener(expectedSecurityEvents);
         Document document = doInboundSecurity(
                 securityProperties,
-                xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), new TestSecurityEventListener(expectedSecurityEvents));
+                xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), securityEventListener);
 
         //read the whole stream:
         transformer = TRANSFORMER_FACTORY.newTransformer();
@@ -212,6 +223,8 @@ public class InteroperabilityTest extend
                     }
                 }
         ));
+
+        securityEventListener.compare();
     }
 
     //Not supported ATM: Timestamp encrypted and then Signed
@@ -270,12 +283,13 @@ public class InteroperabilityTest extend
         securityProperties.loadDecryptionKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
 
         SecurityEvent.Event[] expectedSecurityEvents = new SecurityEvent.Event[]{
+                SecurityEvent.Event.Operation,
+                SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.Timestamp,
                 SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.SignatureValue,
                 SecurityEvent.Event.AlgorithmSuite,
                 SecurityEvent.Event.AlgorithmSuite,
-                SecurityEvent.Event.AlgorithmSuite,
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.AlgorithmSuite,
                 SecurityEvent.Event.AlgorithmSuite,
@@ -283,10 +297,12 @@ public class InteroperabilityTest extend
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.EncryptedPart,
                 SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.AlgorithmSuite,
         };
+        final TestSecurityEventListener securityEventListener = new TestSecurityEventListener(expectedSecurityEvents);
         Document document = doInboundSecurity(
                 securityProperties,
-                xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), new TestSecurityEventListener(expectedSecurityEvents));
+                xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), securityEventListener);
 
         //read the whole stream:
         transformer = TRANSFORMER_FACTORY.newTransformer();
@@ -298,6 +314,7 @@ public class InteroperabilityTest extend
                     }
                 }
         ));
+        securityEventListener.compare();
     }
 
     @Test
@@ -388,7 +405,8 @@ public class InteroperabilityTest extend
         securityProperties.loadDecryptionKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
 
         SecurityEvent.Event[] expectedSecurityEvents = new SecurityEvent.Event[]{
-                SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.Operation,
+                SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.SignatureValue,
@@ -396,6 +414,7 @@ public class InteroperabilityTest extend
                 SecurityEvent.Event.AlgorithmSuite,
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.AlgorithmSuite,
                 SecurityEvent.Event.EncryptedElement,
                 SecurityEvent.Event.Timestamp,
                 SecurityEvent.Event.AlgorithmSuite,
@@ -408,8 +427,9 @@ public class InteroperabilityTest extend
                 SecurityEvent.Event.EncryptedPart,
                 SecurityEvent.Event.AlgorithmSuite,
         };
+        final TestSecurityEventListener securityEventListener = new TestSecurityEventListener(expectedSecurityEvents);
         Document document = doInboundSecurity(
-                securityProperties, xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), new TestSecurityEventListener(expectedSecurityEvents));
+                securityProperties, xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), securityEventListener);
 
         //read the whole stream:
         transformer = TRANSFORMER_FACTORY.newTransformer();
@@ -421,6 +441,7 @@ public class InteroperabilityTest extend
                     }
                 }
         ));
+        securityEventListener.compare();
     }
 
     @Test
@@ -601,7 +622,8 @@ public class InteroperabilityTest extend
             InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
 
             SecurityEvent.Event[] expectedSecurityEvents = new SecurityEvent.Event[]{
-                    SecurityEvent.Event.AlgorithmSuite,
+                    SecurityEvent.Event.Operation,
+                    SecurityEvent.Event.X509Token,
                     SecurityEvent.Event.EncryptedKeyToken,
                     SecurityEvent.Event.X509Token,
                     SecurityEvent.Event.SignatureValue,
@@ -612,8 +634,6 @@ public class InteroperabilityTest extend
                     SecurityEvent.Event.AlgorithmSuite,
                     SecurityEvent.Event.AlgorithmSuite,
                     SecurityEvent.Event.AlgorithmSuite,
-                    SecurityEvent.Event.SignedElement,
-                    SecurityEvent.Event.AlgorithmSuite,
                     SecurityEvent.Event.AlgorithmSuite,
                     SecurityEvent.Event.SignedElement,
                     SecurityEvent.Event.AlgorithmSuite,
@@ -687,9 +707,11 @@ public class InteroperabilityTest extend
                     SecurityEvent.Event.SignedElement,
                     SecurityEvent.Event.AlgorithmSuite,
                     SecurityEvent.Event.AlgorithmSuite,
+                    SecurityEvent.Event.SignedElement,
             };
+            final TestSecurityEventListener securityEventListener = new TestSecurityEventListener(expectedSecurityEvents);
             XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(
-                    xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), null, new TestSecurityEventListener(expectedSecurityEvents));
+                    xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), null, securityEventListener);
 
             Document document = StAX2DOM.readDoc(documentBuilderFactory.newDocumentBuilder(), xmlStreamReader);
 
@@ -697,6 +719,8 @@ public class InteroperabilityTest extend
             NodeList nodeList = document.getElementsByTagNameNS(WSSConstants.TAG_dsig_Signature.getNamespaceURI(), WSSConstants.TAG_dsig_Signature.getLocalPart());
             Assert.assertEquals(nodeList.getLength(), 1);
             Assert.assertEquals(nodeList.item(0).getParentNode().getLocalName(), WSSConstants.TAG_wsse_Security.getLocalPart());
+
+            securityEventListener.compare();
         }
     }
 
@@ -722,7 +746,8 @@ public class InteroperabilityTest extend
         securityProperties.loadDecryptionKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
 
         SecurityEvent.Event[] expectedSecurityEvents = new SecurityEvent.Event[]{
-                SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.Operation,
+                SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.SignatureValue,
@@ -738,9 +763,11 @@ public class InteroperabilityTest extend
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.EncryptedPart,
                 SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.AlgorithmSuite,
         };
+        final TestSecurityEventListener securityEventListener = new TestSecurityEventListener(expectedSecurityEvents);
         Document document = doInboundSecurity(
-                securityProperties, xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), new TestSecurityEventListener(expectedSecurityEvents));
+                securityProperties, xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), securityEventListener);
 
         //read the whole stream:
         transformer = TRANSFORMER_FACTORY.newTransformer();
@@ -752,6 +779,7 @@ public class InteroperabilityTest extend
                     }
                 }
         ));
+        securityEventListener.compare();
     }
 
     @Test(invocationCount = 1)
@@ -816,7 +844,8 @@ public class InteroperabilityTest extend
         securityProperties.loadDecryptionKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
 
         SecurityEvent.Event[] expectedSecurityEvents = new SecurityEvent.Event[]{
-                SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.Operation,
+                SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.X509Token,
                 SecurityEvent.Event.SignatureValue,
@@ -832,9 +861,11 @@ public class InteroperabilityTest extend
                 SecurityEvent.Event.EncryptedKeyToken,
                 SecurityEvent.Event.EncryptedPart,
                 SecurityEvent.Event.AlgorithmSuite,
+                SecurityEvent.Event.AlgorithmSuite,
         };
+        final TestSecurityEventListener securityEventListener = new TestSecurityEventListener(expectedSecurityEvents);
         Document document = doInboundSecurity(
-                securityProperties, xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), new TestSecurityEventListener(expectedSecurityEvents));
+                securityProperties, xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), securityEventListener);
 
         //read the whole stream:
         transformer = TRANSFORMER_FACTORY.newTransformer();
@@ -846,6 +877,7 @@ public class InteroperabilityTest extend
                     }
                 }
         ));
+        securityEventListener.compare();
     }
 
     @Test(invocationCount = 1)

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/PerformanceMemoryTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/PerformanceMemoryTest.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/PerformanceMemoryTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/PerformanceMemoryTest.java Wed Feb 29 20:54:51 2012
@@ -130,7 +130,7 @@ public class PerformanceMemoryTest exten
     @Test(groups = "streaming-memory-out")
     public void testStreamingOutMemoryPerformance() throws Exception {
 
-        FileWriter samples = new FileWriter("memory-samples-stream-out.txt");
+        FileWriter samples = new FileWriter("target/memory-samples-stream-out.txt");
         long memoryDiff = 0;
 
         for (int i = 1; i <= 15; i++) {
@@ -176,7 +176,7 @@ public class PerformanceMemoryTest exten
     @Test(groups = "dom-memory-out")
     public void testDOMOutMemoryPerformance() throws Exception {
 
-        FileWriter samples = new FileWriter("memory-samples-dom-out.txt");
+        FileWriter samples = new FileWriter("target/memory-samples-dom-out.txt");
         long memoryDiff = 0;
         long leakedMemory = 0;
 
@@ -227,7 +227,7 @@ public class PerformanceMemoryTest exten
     @Test(groups = "stream")
     public void testStreamingMemoryPerformance() throws Exception {
 
-        FileWriter samples = new FileWriter("memory-samples-stream.txt");
+        FileWriter samples = new FileWriter("target/memory-samples-stream.txt");
         long memoryDiff = 0;
 
         for (int i = 1; i <= 15; i++) {
@@ -302,7 +302,7 @@ public class PerformanceMemoryTest exten
     @Test(groups = "dom")
     public void testDOMMemoryPerformance() throws Exception {
 
-        FileWriter samples = new FileWriter("memory-samples-dom.txt");
+        FileWriter samples = new FileWriter("target/memory-samples-dom.txt");
         long memoryDiff = 0;
         long leakedMemory = 0;
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/PerformanceTimingTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/PerformanceTimingTest.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/PerformanceTimingTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/PerformanceTimingTest.java Wed Feb 29 20:54:51 2012
@@ -175,7 +175,7 @@ public class PerformanceTimingTest exten
     @Test(groups = "timing-out")
     public void testStreamingOutTimePerformance() throws Exception {
 
-        FileWriter samples = new FileWriter("timing-out-samples.txt");
+        FileWriter samples = new FileWriter("target/timing-out-samples.txt");
 
         for (int i = 1; i <= 15; i++) {
             System.out.println("Run " + i);

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureConfirmationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureConfirmationTest.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureConfirmationTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/SignatureConfirmationTest.java Wed Feb 29 20:54:51 2012
@@ -222,7 +222,11 @@ public class SignatureConfirmationTest e
             securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("transmitter.jks"), "default".toCharArray());
             InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
 
-            XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())), securityEventList, null);
+            XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(
+                    xmlInputFactory.createXMLStreamReader(
+                            new ByteArrayInputStream(baos.toByteArray())
+                    ),
+                    securityEventList, null);
 
             Document document = StAX2DOM.readDoc(documentBuilderFactory.newDocumentBuilder(), xmlStreamReader);
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/VulnerabliltyVectorsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/VulnerabliltyVectorsTest.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/VulnerabliltyVectorsTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/VulnerabliltyVectorsTest.java Wed Feb 29 20:54:51 2012
@@ -110,7 +110,7 @@ public class VulnerabliltyVectorsTest ex
             //we expect a "No SecurityToken found" since WSS says that a token must be declared before use.
             //the declare before use is in the nature of streaming xml-security and therefore expected
             //Assert.assertEquals(throwable.getMessage(), "An invalid security token was provided");
-            Assert.assertEquals(throwable.getMessage(), "Referenced security token could not be retrieved (Reference \"2\")");
+            Assert.assertEquals(throwable.getMessage(), "An invalid security token was provided");
         }
     }
 

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/AbstractSAMLCallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/AbstractSAMLCallbackHandler.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/AbstractSAMLCallbackHandler.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/AbstractSAMLCallbackHandler.java Wed Feb 29 20:54:51 2012
@@ -22,15 +22,7 @@ package org.swssf.wss.test.saml;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.message.WSSecEncryptedKey;
 import org.apache.ws.security.saml.ext.SAMLCallback;
-import org.apache.ws.security.saml.ext.bean.ActionBean;
-import org.apache.ws.security.saml.ext.bean.AttributeBean;
-import org.apache.ws.security.saml.ext.bean.AttributeStatementBean;
-import org.apache.ws.security.saml.ext.bean.AuthenticationStatementBean;
-import org.apache.ws.security.saml.ext.bean.AuthDecisionStatementBean;
-import org.apache.ws.security.saml.ext.bean.ConditionsBean;
-import org.apache.ws.security.saml.ext.bean.KeyInfoBean;
-import org.apache.ws.security.saml.ext.bean.SubjectBean;
-import org.apache.ws.security.saml.ext.bean.SubjectLocalityBean;
+import org.apache.ws.security.saml.ext.bean.*;
 import org.apache.ws.security.saml.ext.bean.KeyInfoBean.CERT_IDENTIFIER;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -38,7 +30,6 @@ import org.w3c.dom.Element;
 import javax.security.auth.callback.CallbackHandler;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-
 import java.security.cert.X509Certificate;
 import java.util.Collections;
 import java.util.List;
@@ -48,11 +39,13 @@ import java.util.List;
  * authentication assertion.
  */
 public abstract class AbstractSAMLCallbackHandler implements CallbackHandler {
-    
+
     public enum Statement {
         AUTHN, ATTR, AUTHZ
-    };
-    
+    }
+
+    ;
+
     protected String subjectName = null;
     protected String subjectQualifier = null;
     protected String confirmationMethod = null;
@@ -67,52 +60,52 @@ public abstract class AbstractSAMLCallba
     protected String resource = null;
     protected List<?> customAttributeValues = null;
     protected ConditionsBean conditions = null;
-    
+
     public void setConditions(ConditionsBean conditionsBean) {
         this.conditions = conditionsBean;
     }
-    
+
     public void setConfirmationMethod(String confMethod) {
         confirmationMethod = confMethod;
     }
-    
+
     public void setStatement(Statement statement) {
         this.statement = statement;
     }
-    
+
     public void setCertIdentifier(CERT_IDENTIFIER certIdentifier) {
         this.certIdentifier = certIdentifier;
     }
-    
+
     public void setCerts(X509Certificate[] certs) {
         this.certs = certs;
     }
-    
+
     public byte[] getEphemeralKey() {
         return ephemeralKey;
     }
-    
+
     public void setIssuer(String issuer) {
         this.issuer = issuer;
     }
-    
+
     public void setSubjectNameIDFormat(String subjectNameIDFormat) {
         this.subjectNameIDFormat = subjectNameIDFormat;
     }
-    
+
     public void setSubjectLocality(String ipAddress, String dnsAddress) {
         this.subjectLocalityIpAddress = ipAddress;
         this.subjectLocalityDnsAddress = dnsAddress;
     }
-    
+
     public void setResource(String resource) {
         this.resource = resource;
     }
-    
+
     public void setCustomAttributeValues(List<?> customAttributeValues) {
         this.customAttributeValues = customAttributeValues;
     }
-    
+
     /**
      * Note that the SubjectBean parameter should be null for SAML2.0
      */
@@ -141,7 +134,7 @@ public abstract class AbstractSAMLCallba
                 attributeBean.setQualifiedName("role");
             }
             if (customAttributeValues != null) {
-                attributeBean.setCustomAttributeValues(customAttributeValues);   
+                attributeBean.setCustomAttributeValues(customAttributeValues);
             } else {
                 attributeBean.setAttributeValues(Collections.singletonList("user"));
             }
@@ -161,7 +154,7 @@ public abstract class AbstractSAMLCallba
             callback.setAuthDecisionStatementData(Collections.singletonList(authzBean));
         }
     }
-    
+
     protected KeyInfoBean createKeyInfo() throws Exception {
         KeyInfoBean keyInfo = new KeyInfoBean();
         if (statement == Statement.AUTHN) {
@@ -169,12 +162,12 @@ public abstract class AbstractSAMLCallba
             keyInfo.setCertIdentifer(certIdentifier);
         } else if (statement == Statement.ATTR) {
             // Build a new Document
-            DocumentBuilderFactory docBuilderFactory = 
-                DocumentBuilderFactory.newInstance();
+            DocumentBuilderFactory docBuilderFactory =
+                    DocumentBuilderFactory.newInstance();
             docBuilderFactory.setNamespaceAware(true);
             DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
             Document doc = docBuilder.newDocument();
-                  
+
             // Create an Encrypted Key
             WSSecEncryptedKey encrKey = new WSSecEncryptedKey();
             encrKey.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
@@ -182,17 +175,17 @@ public abstract class AbstractSAMLCallba
             encrKey.prepare(doc, null);
             ephemeralKey = encrKey.getEphemeralKey();
             Element encryptedKeyElement = encrKey.getEncryptedKeyElement();
-            
+
             // Append the EncryptedKey to a KeyInfo element
-            Element keyInfoElement = 
-                doc.createElementNS(
-                    WSConstants.SIG_NS, WSConstants.SIG_PREFIX + ":" + WSConstants.KEYINFO_LN
-                );
+            Element keyInfoElement =
+                    doc.createElementNS(
+                            WSConstants.SIG_NS, WSConstants.SIG_PREFIX + ":" + WSConstants.KEYINFO_LN
+                    );
             keyInfoElement.setAttributeNS(
-                WSConstants.XMLNS_NS, "xmlns:" + WSConstants.SIG_PREFIX, WSConstants.SIG_NS
+                    WSConstants.XMLNS_NS, "xmlns:" + WSConstants.SIG_PREFIX, WSConstants.SIG_NS
             );
             keyInfoElement.appendChild(encryptedKeyElement);
-            
+
             keyInfo.setElement(keyInfoElement);
         }
         return keyInfo;

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML1AuthnHOKHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML1AuthnHOKHandler.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML1AuthnHOKHandler.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML1AuthnHOKHandler.java Wed Feb 29 20:54:51 2012
@@ -42,28 +42,28 @@ import java.util.Collections;
  * Holder of Key.
  */
 public class SAML1AuthnHOKHandler implements CallbackHandler {
-    
+
     private String subjectName = "uid=joe,ou=people,ou=saml-demo,o=example.com";
     private String subjectQualifier = "www.example.com";
     private X509Certificate[] certs;
-    
+
     public SAML1AuthnHOKHandler() throws WSSecurityException {
         Crypto crypto = CryptoFactory.getInstance("saml/saml-signed.properties");
         CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
         cryptoType.setAlias("transmitter");
         certs = crypto.getX509Certificates(cryptoType);
     }
-    
+
     public void handle(Callback[] callbacks)
-        throws IOException, UnsupportedCallbackException {
+            throws IOException, UnsupportedCallbackException {
         for (int i = 0; i < callbacks.length; i++) {
             if (callbacks[i] instanceof SAMLCallback) {
                 SAMLCallback callback = (SAMLCallback) callbacks[i];
                 callback.setSamlVersion(SAMLVersion.VERSION_11);
-                SubjectBean subjectBean = 
-                    new SubjectBean(
-                        subjectName, subjectQualifier, SAML1Constants.CONF_HOLDER_KEY
-                    );
+                SubjectBean subjectBean =
+                        new SubjectBean(
+                                subjectName, subjectQualifier, SAML1Constants.CONF_HOLDER_KEY
+                        );
                 KeyInfoBean keyInfo = new KeyInfoBean();
                 keyInfo.setCertificate(certs[0]);
                 subjectBean.setKeyInfo(keyInfo);

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML1CallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML1CallbackHandler.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML1CallbackHandler.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML1CallbackHandler.java Wed Feb 29 20:54:51 2012
@@ -30,7 +30,6 @@ import org.opensaml.common.SAMLVersion;
 
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.UnsupportedCallbackException;
-
 import java.io.IOException;
 
 /**
@@ -38,7 +37,7 @@ import java.io.IOException;
  * authentication assertion using Sender Vouches.
  */
 public class SAML1CallbackHandler extends AbstractSAMLCallbackHandler {
-    
+
     public SAML1CallbackHandler() throws Exception {
         if (certs == null) {
             Crypto crypto = CryptoFactory.getInstance("saml/saml-signed.properties");
@@ -46,14 +45,14 @@ public class SAML1CallbackHandler extend
             cryptoType.setAlias("transmitter");
             certs = crypto.getX509Certificates(cryptoType);
         }
-        
+
         subjectName = "uid=joe,ou=people,ou=saml-demo,o=example.com";
         subjectQualifier = "www.example.com";
         confirmationMethod = SAML1Constants.CONF_SENDER_VOUCHES;
     }
-    
+
     public void handle(Callback[] callbacks)
-        throws IOException, UnsupportedCallbackException {
+            throws IOException, UnsupportedCallbackException {
         for (int i = 0; i < callbacks.length; i++) {
             if (callbacks[i] instanceof SAMLCallback) {
                 SAMLCallback callback = (SAMLCallback) callbacks[i];
@@ -62,11 +61,11 @@ public class SAML1CallbackHandler extend
                 if (conditions != null) {
                     callback.setConditions(conditions);
                 }
-                
-                SubjectBean subjectBean = 
-                    new SubjectBean(
-                        subjectName, subjectQualifier, confirmationMethod
-                    );
+
+                SubjectBean subjectBean =
+                        new SubjectBean(
+                                subjectName, subjectQualifier, confirmationMethod
+                        );
                 if (subjectNameIDFormat != null) {
                     subjectBean.setSubjectNameIDFormat(subjectNameIDFormat);
                 }
@@ -75,7 +74,7 @@ public class SAML1CallbackHandler extend
                         KeyInfoBean keyInfo = createKeyInfo();
                         subjectBean.setKeyInfo(keyInfo);
                     } catch (Exception ex) {
-                        throw new IOException("Problem creating KeyInfo: " +  ex.getMessage());
+                        throw new IOException("Problem creating KeyInfo: " + ex.getMessage());
                     }
                 }
                 createAndSetStatement(subjectBean, callback);
@@ -84,5 +83,5 @@ public class SAML1CallbackHandler extend
             }
         }
     }
-    
+
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML2CallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML2CallbackHandler.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML2CallbackHandler.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAML2CallbackHandler.java Wed Feb 29 20:54:51 2012
@@ -37,7 +37,7 @@ import java.io.IOException;
  * authentication assertion using Sender Vouches.
  */
 public class SAML2CallbackHandler extends AbstractSAMLCallbackHandler {
-    
+
     public SAML2CallbackHandler() throws Exception {
         if (certs == null) {
             Crypto crypto = CryptoFactory.getInstance("saml/saml-signed.properties");
@@ -45,14 +45,14 @@ public class SAML2CallbackHandler extend
             cryptoType.setAlias("transmitter");
             certs = crypto.getX509Certificates(cryptoType);
         }
-        
+
         subjectName = "uid=joe,ou=people,ou=saml-demo,o=example.com";
         subjectQualifier = "www.example.com";
         confirmationMethod = SAML2Constants.CONF_SENDER_VOUCHES;
     }
-    
+
     public void handle(Callback[] callbacks)
-        throws IOException, UnsupportedCallbackException {
+            throws IOException, UnsupportedCallbackException {
         for (int i = 0; i < callbacks.length; i++) {
             if (callbacks[i] instanceof SAMLCallback) {
                 SAMLCallback callback = (SAMLCallback) callbacks[i];
@@ -61,11 +61,11 @@ public class SAML2CallbackHandler extend
                 if (conditions != null) {
                     callback.setConditions(conditions);
                 }
-                
-                SubjectBean subjectBean = 
-                    new SubjectBean(
-                        subjectName, subjectQualifier, confirmationMethod
-                    );
+
+                SubjectBean subjectBean =
+                        new SubjectBean(
+                                subjectName, subjectQualifier, confirmationMethod
+                        );
                 if (subjectNameIDFormat != null) {
                     subjectBean.setSubjectNameIDFormat(subjectNameIDFormat);
                 }
@@ -74,7 +74,7 @@ public class SAML2CallbackHandler extend
                         KeyInfoBean keyInfo = createKeyInfo();
                         subjectBean.setKeyInfo(keyInfo);
                     } catch (Exception ex) {
-                        throw new IOException("Problem creating KeyInfo: " +  ex.getMessage());
+                        throw new IOException("Problem creating KeyInfo: " + ex.getMessage());
                     }
                 }
                 callback.setSubject(subjectBean);
@@ -84,5 +84,5 @@ public class SAML2CallbackHandler extend
             }
         }
     }
-    
+
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAMLTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAMLTokenTest.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAMLTokenTest.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/saml/SAMLTokenTest.java Wed Feb 29 20:54:51 2012
@@ -120,6 +120,8 @@ public class SAMLTokenTest extends Abstr
         //done signature; now test sig-verification:
         {
             WSSSecurityProperties securityProperties = new WSSSecurityProperties();
+            securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
+            securityProperties.setCallbackHandler(new CallbackHandlerImpl());
             InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
             XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
 
@@ -190,6 +192,8 @@ public class SAMLTokenTest extends Abstr
         //done signature; now test sig-verification:
         {
             WSSSecurityProperties securityProperties = new WSSSecurityProperties();
+            securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
+            securityProperties.setCallbackHandler(new CallbackHandlerImpl());
             InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
             XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
 
@@ -260,6 +264,8 @@ public class SAMLTokenTest extends Abstr
         //done signature; now test sig-verification:
         {
             WSSSecurityProperties securityProperties = new WSSSecurityProperties();
+            securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
+            securityProperties.setCallbackHandler(new CallbackHandlerImpl());
             InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
             XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
 
@@ -331,6 +337,8 @@ public class SAMLTokenTest extends Abstr
         //done signature; now test sig-verification:
         {
             WSSSecurityProperties securityProperties = new WSSSecurityProperties();
+            securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
+            securityProperties.setCallbackHandler(new CallbackHandlerImpl());
             InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
             XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
 
@@ -402,6 +410,8 @@ public class SAMLTokenTest extends Abstr
         //done signature; now test sig-verification:
         {
             WSSSecurityProperties securityProperties = new WSSSecurityProperties();
+            securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
+            securityProperties.setCallbackHandler(new CallbackHandlerImpl());
             InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
             XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
 
@@ -473,6 +483,8 @@ public class SAMLTokenTest extends Abstr
         //done signature; now test sig-verification:
         {
             WSSSecurityProperties securityProperties = new WSSSecurityProperties();
+            securityProperties.loadSignatureVerificationKeystore(this.getClass().getClassLoader().getResource("receiver.jks"), "default".toCharArray());
+            securityProperties.setCallbackHandler(new CallbackHandlerImpl());
             InboundWSSec wsSecIn = WSSec.getInboundWSSec(securityProperties);
             XMLStreamReader xmlStreamReader = wsSecIn.processInMessage(xmlInputFactory.createXMLStreamReader(new ByteArrayInputStream(baos.toByteArray())));
 
@@ -483,7 +495,7 @@ public class SAMLTokenTest extends Abstr
             Assert.assertEquals(nodeList.getLength(), 0);
         }
     }
-    
+
     /**
      * Test that creates, sends and processes an unsigned SAML 1.1 authentication assertion with
      * a user-specified SubjectNameIDFormat.
@@ -520,7 +532,7 @@ public class SAMLTokenTest extends Abstr
             doInboundSecurityWithWSS4J(documentBuilderFactory.newDocumentBuilder().parse(new ByteArrayInputStream(baos.toByteArray())), action);
         }
     }
-    
+
     /**
      * Test that creates, sends and processes an unsigned SAML 2 authentication assertion with
      * a user-specified SubjectNameIDFormat.
@@ -558,7 +570,7 @@ public class SAMLTokenTest extends Abstr
             doInboundSecurityWithWSS4J(documentBuilderFactory.newDocumentBuilder().parse(new ByteArrayInputStream(baos.toByteArray())), action);
         }
     }
-    
+
     /**
      * Test that creates, sends and processes an unsigned SAML 1.1 authentication assertion with
      * a user-specified SubjectLocality statement.
@@ -595,7 +607,7 @@ public class SAMLTokenTest extends Abstr
             doInboundSecurityWithWSS4J(documentBuilderFactory.newDocumentBuilder().parse(new ByteArrayInputStream(baos.toByteArray())), action);
         }
     }
-    
+
     /**
      * Test that creates, sends and processes an unsigned SAML 2 authentication assertion with
      * a user-specified SubjectLocality statement.
@@ -633,7 +645,7 @@ public class SAMLTokenTest extends Abstr
             doInboundSecurityWithWSS4J(documentBuilderFactory.newDocumentBuilder().parse(new ByteArrayInputStream(baos.toByteArray())), action);
         }
     }
-    
+
     /**
      * Test that creates, sends and processes an unsigned SAML 1.1 authz assertion with
      * a Resource URI
@@ -670,8 +682,8 @@ public class SAMLTokenTest extends Abstr
             doInboundSecurityWithWSS4J(documentBuilderFactory.newDocumentBuilder().parse(new ByteArrayInputStream(baos.toByteArray())), action);
         }
     }
-    
-    
+
+
     /**
      * Test that creates, sends and processes an unsigned SAML 2 attribute assertion. The attributeValue
      * has a custom XMLObject (not a String) value.
@@ -690,23 +702,23 @@ public class SAMLTokenTest extends Abstr
             callbackHandler.setIssuer("www.example.com");
             callbackHandler.setSignAssertion(false);
             callbackHandler.setSamlVersion(SAMLVersion.VERSION_20);
-            
+
             // Create and add a custom Attribute (conditions Object)
             XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
-            
-            SAMLObjectBuilder<Conditions> conditionsV2Builder = 
-                    (SAMLObjectBuilder<Conditions>)builderFactory.getBuilder(Conditions.DEFAULT_ELEMENT_NAME);
+
+            SAMLObjectBuilder<Conditions> conditionsV2Builder =
+                    (SAMLObjectBuilder<Conditions>) builderFactory.getBuilder(Conditions.DEFAULT_ELEMENT_NAME);
             Conditions conditions = conditionsV2Builder.buildObject();
             DateTime newNotBefore = new DateTime();
             conditions.setNotBefore(newNotBefore);
             conditions.setNotOnOrAfter(newNotBefore.plusMinutes(5));
-            
+
             XMLObjectBuilder<XSAny> xsAnyBuilder = builderFactory.getBuilder(XSAny.TYPE_NAME);
             XSAny attributeValue = xsAnyBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME);
             attributeValue.getUnknownXMLObjects().add(conditions);
-            
+
             callbackHandler.setCustomAttributeValues(Collections.singletonList(attributeValue));
-            
+
             securityProperties.setCallbackHandler(callbackHandler);
 
             OutboundWSSec wsSecOut = WSSec.getOutboundWSSec(securityProperties);
@@ -726,5 +738,5 @@ public class SAMLTokenTest extends Abstr
             doInboundSecurityWithWSS4J(documentBuilderFactory.newDocumentBuilder().parse(new ByteArrayInputStream(baos.toByteArray())), action);
         }
     }
-    
+
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/utils/SOAPUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/utils/SOAPUtil.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/utils/SOAPUtil.java (original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/test/java/org/swssf/wss/test/utils/SOAPUtil.java Wed Feb 29 20:54:51 2012
@@ -53,7 +53,7 @@ public class SOAPUtil {
         DocumentBuilder builder = factory.newDocumentBuilder();
         return builder.parse(in);
     }
-    
+
     /**
      * Convert an SOAP Envelope as an InputStream to a org.w3c.dom.Document.
      */

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/crypto/Crypto.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/crypto/Crypto.java?rev=1295267&r1=1295266&r2=1295267&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/crypto/Crypto.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/crypto/Crypto.java Wed Feb 29 20:54:51 2012
@@ -18,74 +18,77 @@
  */
 package org.swssf.xmlsec.crypto;
 
+import org.swssf.xmlsec.ext.XMLSecurityException;
+
 import java.io.InputStream;
 import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
 
-import org.swssf.xmlsec.ext.XMLSecurityException;
-
 public interface Crypto {
-    
+
     //
     // Accessor methods
     //
-    
+
     /**
      * Get the crypto provider associated with this implementation
+     *
      * @return the crypto provider
      */
     public String getCryptoProvider();
-    
+
     /**
      * Set the crypto provider associated with this implementation
+     *
      * @param provider the crypto provider to set
      */
     public void setCryptoProvider(String provider);
-    
+
     /**
-     * Retrieves the identifier name of the default certificate. This should be the certificate 
-     * that is used for signature and encryption. This identifier corresponds to the certificate 
-     * that should be used whenever KeyInfo is not present in a signed or an encrypted 
+     * Retrieves the identifier name of the default certificate. This should be the certificate
+     * that is used for signature and encryption. This identifier corresponds to the certificate
+     * that should be used whenever KeyInfo is not present in a signed or an encrypted
      * message. May return null. The identifier is implementation specific, e.g. it could be the
      * KeyStore alias.
      *
      * @return name of the default X509 certificate.
      */
     public String getDefaultX509Identifier() throws XMLSecurityException;
-    
+
     /**
-     * Sets the identifier name of the default certificate. This should be the certificate 
-     * that is used for signature and encryption. This identifier corresponds to the certificate 
-     * that should be used whenever KeyInfo is not present in a signed or an encrypted 
+     * Sets the identifier name of the default certificate. This should be the certificate
+     * that is used for signature and encryption. This identifier corresponds to the certificate
+     * that should be used whenever KeyInfo is not present in a signed or an encrypted
      * message. The identifier is implementation specific, e.g. it could be the KeyStore alias.
      *
      * @param identifier name of the default X509 certificate.
      */
     public void setDefaultX509Identifier(String identifier);
-    
+
     /**
      * Sets the CertificateFactory instance on this Crypto instance
      *
-     * @param provider the CertificateFactory provider name
+     * @param provider    the CertificateFactory provider name
      * @param certFactory the CertificateFactory the CertificateFactory instance to set
      */
     public void setCertificateFactory(String provider, CertificateFactory certFactory);
-    
+
     /**
      * Get the CertificateFactory instance on this Crypto instance
      *
      * @return Returns a <code>CertificateFactory</code> to construct
      *         X509 certificates
      * @throws org.apache.ws.security.XMLSecurityException
+     *
      */
     public CertificateFactory getCertificateFactory() throws XMLSecurityException;
-    
+
     //
     // Base Crypto functionality methods
     //
-    
+
     /**
      * Load a X509Certificate from the input stream.
      *
@@ -94,7 +97,7 @@ public interface Crypto {
      * @throws XMLSecurityException
      */
     public X509Certificate loadCertificate(InputStream in) throws XMLSecurityException;
-    
+
     /**
      * Reads the SubjectKeyIdentifier information from the certificate.
      * <p/>
@@ -108,7 +111,7 @@ public interface Crypto {
      * @return The byte array containing the binary SKI data
      */
     public byte[] getSKIBytesFromCert(X509Certificate cert) throws XMLSecurityException;
-    
+
     /**
      * Get a byte array given an array of X509 certificates.
      * <p/>
@@ -127,15 +130,15 @@ public interface Crypto {
      * @throws XMLSecurityException
      */
     public X509Certificate[] getCertificatesFromBytes(byte[] data) throws XMLSecurityException;
-    
+
     //
     // Implementation-specific Crypto functionality methods
     //
-    
+
     /**
      * Get an X509Certificate (chain) corresponding to the CryptoType argument. The supported
      * types are as follows:
-     * 
+     * <p/>
      * TYPE.ISSUER_SERIAL - A certificate (chain) is located by the issuer name and serial number
      * TYPE.THUMBPRINT_SHA1 - A certificate (chain) is located by the SHA1 of the (root) cert
      * TYPE.SKI_BYTES - A certificate (chain) is located by the SKI bytes of the (root) cert
@@ -144,27 +147,28 @@ public interface Crypto {
      * specific, for example - it could be a java KeyStore alias.
      */
     public X509Certificate[] getX509Certificates(CryptoType cryptoType) throws XMLSecurityException;
-    
+
     /**
      * Get the implementation-specific identifier corresponding to the cert parameter, e.g. the
      * identifier could be a KeyStore alias.
+     *
      * @param cert The X509Certificate for which to search for an identifier
      * @return the identifier corresponding to the cert parameter
      * @throws XMLSecurityException
      */
     public String getX509Identifier(X509Certificate cert) throws XMLSecurityException;
-    
+
     /**
      * Gets the private key corresponding to the identifier.
      *
      * @param identifier The implementation-specific identifier corresponding to the key
-     * @param password The password needed to get the key
+     * @param password   The password needed to get the key
      * @return The private key
      */
     public PrivateKey getPrivateKey(
-        String identifier, String password
+            String identifier, String password
     ) throws XMLSecurityException;
-    
+
     /**
      * Evaluate whether a given certificate chain should be trusted.
      *
@@ -174,22 +178,22 @@ public interface Crypto {
      */
     @Deprecated
     public boolean verifyTrust(X509Certificate[] certs) throws XMLSecurityException;
-    
+
     /**
      * Evaluate whether a given certificate chain should be trusted.
      *
-     * @param certs Certificate chain to validate
+     * @param certs            Certificate chain to validate
      * @param enableRevocation whether to enable CRL verification or not
      * @return true if the certificate chain is valid, false otherwise
      * @throws XMLSecurityException
      */
     public boolean verifyTrust(
-        X509Certificate[] certs, boolean enableRevocation
+            X509Certificate[] certs, boolean enableRevocation
     ) throws XMLSecurityException;
-    
+
     /**
      * Evaluate whether a given public key should be trusted.
-     * 
+     *
      * @param publicKey The PublicKey to be evaluated
      * @return whether the PublicKey parameter is trusted or not
      */



Mime
View raw message