ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gi...@apache.org
Subject svn commit: r1299259 - in /webservices/wss4j/branches/swssf: streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/ streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/ streaming-xml-security/src/main/java/org/swssf/xmlsec/...
Date Sat, 10 Mar 2012 19:31:14 GMT
Author: giger
Date: Sat Mar 10 19:31:14 2012
New Revision: 1299259

URL: http://svn.apache.org/viewvc?rev=1299259&view=rev
Log:
store XMLEvent in secured parts/elements; Will be needed for policy verification
Refactor secured parts/element securityEvents and use a common code base

Added:
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractElementSecurityEvent.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractSecuredElementSecurityEvent.java
  (with props)
Modified:
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SignatureReferenceVerifyInputProcessor.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/ContentEncryptedElementSecurityEvent.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedElementSecurityEvent.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedPartSecurityEvent.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredElementSecurityEvent.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/RequiredPartSecurityEvent.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedElementSecurityEvent.java
    webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/SignedPartSecurityEvent.java
    webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java?rev=1299259&r1=1299258&r2=1299259&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/DecryptInputProcessor.java
Sat Mar 10 19:31:14 2012
@@ -53,8 +53,8 @@ public class DecryptInputProcessor exten
         super(keyInfoType, referenceList, securityProperties);
     }
 
-    protected void handleEncryptedContent(
-            InputProcessorChain inputProcessorChain, XMLEvent xmlEvent, SecurityToken securityToken)
throws XMLSecurityException {
+    protected void handleEncryptedContent(InputProcessorChain inputProcessorChain, XMLEvent
parentXMLEvent, XMLEvent xmlEvent,
+                                          SecurityToken securityToken) throws XMLSecurityException
{
 
         List<QName> parentElementPath = inputProcessorChain.getDocumentContext().getParentElementPath(xmlEvent.getEventType());
         if (inputProcessorChain.getDocumentContext().getDocumentLevel() == 3
@@ -63,11 +63,13 @@ public class DecryptInputProcessor exten
             EncryptedPartSecurityEvent encryptedPartSecurityEvent =
                     new EncryptedPartSecurityEvent(securityToken, true, inputProcessorChain.getDocumentContext().getProtectionOrder());
             encryptedPartSecurityEvent.setElementPath(parentElementPath);
+            encryptedPartSecurityEvent.setXmlEvent(parentXMLEvent);
             ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(encryptedPartSecurityEvent);
         } else {
             ContentEncryptedElementSecurityEvent contentEncryptedElementSecurityEvent =
                     new ContentEncryptedElementSecurityEvent(securityToken, true, inputProcessorChain.getDocumentContext().getProtectionOrder());
             contentEncryptedElementSecurityEvent.setElementPath(parentElementPath);
+            contentEncryptedElementSecurityEvent.setXmlEvent(parentXMLEvent);
             ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(contentEncryptedElementSecurityEvent);
         }
     }
@@ -124,17 +126,20 @@ public class DecryptInputProcessor exten
         }
 
         protected void handleEncryptedElement(InputProcessorChain inputProcessorChain, XMLEvent
xmlEvent, SecurityToken securityToken) throws XMLSecurityException {
+            //todo Document-Context-Path seems to be wrong! Test with EnDecryptionTest#testEncDecryptionPartsHeaderInbound
             //fire a SecurityEvent:
             if (inputProcessorChain.getDocumentContext().getDocumentLevel() == 3
                     && ((WSSDocumentContext) inputProcessorChain.getDocumentContext()).isInSOAPHeader())
{
                 EncryptedPartSecurityEvent encryptedPartSecurityEvent =
                         new EncryptedPartSecurityEvent(securityToken, true, inputProcessorChain.getDocumentContext().getProtectionOrder());
                 encryptedPartSecurityEvent.setElementPath(inputProcessorChain.getDocumentContext().getPath());
+                encryptedPartSecurityEvent.setXmlEvent(xmlEvent);
                 ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(encryptedPartSecurityEvent);
             } else {
                 EncryptedElementSecurityEvent encryptedElementSecurityEvent =
                         new EncryptedElementSecurityEvent(securityToken, true, inputProcessorChain.getDocumentContext().getProtectionOrder());
                 encryptedElementSecurityEvent.setElementPath(inputProcessorChain.getDocumentContext().getPath());
+                encryptedElementSecurityEvent.setXmlEvent(xmlEvent);
                 ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(encryptedElementSecurityEvent);
             }
         }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SignatureReferenceVerifyInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SignatureReferenceVerifyInputProcessor.java?rev=1299259&r1=1299258&r2=1299259&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SignatureReferenceVerifyInputProcessor.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/input/SignatureReferenceVerifyInputProcessor.java
Sat Mar 10 19:31:14 2012
@@ -107,11 +107,13 @@ public class SignatureReferenceVerifyInp
                     SignedPartSecurityEvent signedPartSecurityEvent =
                             new SignedPartSecurityEvent(getSecurityToken(), true, inputProcessorChain.getDocumentContext().getProtectionOrder());
                     signedPartSecurityEvent.setElementPath(inputProcessorChain.getDocumentContext().getPath());
+                    signedPartSecurityEvent.setXmlEvent(xmlEvent);
                     ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(signedPartSecurityEvent);
                 } else {
                     SignedElementSecurityEvent signedElementSecurityEvent =
                             new SignedElementSecurityEvent(getSecurityToken(), true, inputProcessorChain.getDocumentContext().getProtectionOrder());
                     signedElementSecurityEvent.setElementPath(inputProcessorChain.getDocumentContext().getPath());
+                    signedElementSecurityEvent.setXmlEvent(xmlEvent);
                     ((WSSecurityContext) inputProcessorChain.getSecurityContext()).registerSecurityEvent(signedElementSecurityEvent);
                 }
             }

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractElementSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractElementSecurityEvent.java?rev=1299259&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractElementSecurityEvent.java
(added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractElementSecurityEvent.java
Sat Mar 10 19:31:14 2012
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.wss.securityEvent;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.events.XMLEvent;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author $Author: giger $
+ * @version $Revision: 1296293 $ $Date: 2012-03-02 17:33:09 +0100 (Fri, 02 Mar 2012) $
+ */
+public abstract class AbstractElementSecurityEvent extends SecurityEvent {
+
+    private List<QName> elementPath;
+    private XMLEvent xmlEvent;
+
+    public AbstractElementSecurityEvent(Event securityEventType) {
+        super(securityEventType);
+    }
+
+    public List<QName> getElementPath() {
+        return elementPath;
+    }
+
+    public void setElementPath(List<QName> elementPath) {
+        this.elementPath = new LinkedList<QName>(elementPath);
+    }
+
+    public XMLEvent getXmlEvent() {
+        return xmlEvent;
+    }
+
+    public void setXmlEvent(XMLEvent xmlEvent) {
+        this.xmlEvent = xmlEvent;
+    }
+}

Added: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractSecuredElementSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractSecuredElementSecurityEvent.java?rev=1299259&view=auto
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractSecuredElementSecurityEvent.java
(added)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractSecuredElementSecurityEvent.java
Sat Mar 10 19:31:14 2012
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.swssf.wss.securityEvent;
+
+import org.swssf.xmlsec.ext.SecurityToken;
+import org.swssf.xmlsec.ext.XMLSecurityConstants;
+
+import java.util.List;
+
+/**
+ * @author $Author: $
+ * @version $Revision: $ $Date: $
+ */
+public abstract class AbstractSecuredElementSecurityEvent extends AbstractElementSecurityEvent
{
+
+    private boolean signed;
+    private boolean encrypted;
+    private SecurityToken securityToken;
+    private List<XMLSecurityConstants.ContentType> protectionOrder;
+
+    public AbstractSecuredElementSecurityEvent(Event securityEventType, SecurityToken securityToken,
List<XMLSecurityConstants.ContentType> protectionOrder) {
+        this(securityEventType, securityToken, protectionOrder, false, false);
+    }
+
+    public AbstractSecuredElementSecurityEvent(Event securityEventType, SecurityToken securityToken,
List<XMLSecurityConstants.ContentType> protectionOrder, boolean signed, boolean encrypted)
{
+        super(securityEventType);
+        this.securityToken = securityToken;
+        this.protectionOrder = protectionOrder;
+        this.signed = signed;
+        this.encrypted = encrypted;
+    }
+
+    public SecurityToken getSecurityToken() {
+        return securityToken;
+    }
+
+    public void setSecurityToken(SecurityToken securityToken) {
+        this.securityToken = securityToken;
+    }
+
+    public boolean isSigned() {
+        return signed;
+    }
+
+    public void setSigned(boolean signed) {
+        this.signed = signed;
+    }
+
+    public List<XMLSecurityConstants.ContentType> getProtectionOrder() {
+        return protectionOrder;
+    }
+
+    public void setProtectionOrder(List<XMLSecurityConstants.ContentType> protectionOrder)
{
+        this.protectionOrder = protectionOrder;
+    }
+
+    public boolean isEncrypted() {
+        return encrypted;
+    }
+
+    public void setEncrypted(boolean encrypted) {
+        this.encrypted = encrypted;
+    }
+}

Propchange: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/AbstractSecuredElementSecurityEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/ContentEncryptedElementSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/ContentEncryptedElementSecurityEvent.java?rev=1299259&r1=1299258&r2=1299259&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/ContentEncryptedElementSecurityEvent.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/ContentEncryptedElementSecurityEvent.java
Sat Mar 10 19:31:14 2012
@@ -21,57 +21,15 @@ package org.swssf.wss.securityEvent;
 import org.swssf.xmlsec.ext.SecurityToken;
 import org.swssf.xmlsec.ext.XMLSecurityConstants;
 
-import javax.xml.namespace.QName;
-import java.util.LinkedList;
 import java.util.List;
 
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
-public class ContentEncryptedElementSecurityEvent extends SecurityEvent {
-
-    private List<QName> pathElements; //parent element
-    private boolean encrypted;
-    private SecurityToken securityToken;
-    private List<XMLSecurityConstants.ContentType> protectionOrder;
+public class ContentEncryptedElementSecurityEvent extends AbstractSecuredElementSecurityEvent
{
 
     public ContentEncryptedElementSecurityEvent(SecurityToken securityToken, boolean encrypted,
List<XMLSecurityConstants.ContentType> protectionOrder) {
-        super(Event.ContentEncrypted);
-        this.securityToken = securityToken;
-        this.encrypted = encrypted;
-        this.protectionOrder = protectionOrder;
-    }
-
-    public List<QName> getElementPath() {
-        return pathElements;
-    }
-
-    public void setElementPath(List<QName> elementPath) {
-        this.pathElements = new LinkedList<QName>(elementPath);
-    }
-
-    public boolean isEncrypted() {
-        return encrypted;
-    }
-
-    public void setEncrypted(boolean encrypted) {
-        this.encrypted = encrypted;
-    }
-
-    public SecurityToken getSecurityToken() {
-        return securityToken;
-    }
-
-    public void setSecurityToken(SecurityToken securityToken) {
-        this.securityToken = securityToken;
-    }
-
-    public List<XMLSecurityConstants.ContentType> getProtectionOrder() {
-        return protectionOrder;
-    }
-
-    public void setProtectionOrder(List<XMLSecurityConstants.ContentType> protectionOrder)
{
-        this.protectionOrder = protectionOrder;
+        super(Event.ContentEncrypted, securityToken, protectionOrder, false, encrypted);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedElementSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedElementSecurityEvent.java?rev=1299259&r1=1299258&r2=1299259&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedElementSecurityEvent.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedElementSecurityEvent.java
Sat Mar 10 19:31:14 2012
@@ -21,57 +21,15 @@ package org.swssf.wss.securityEvent;
 import org.swssf.xmlsec.ext.SecurityToken;
 import org.swssf.xmlsec.ext.XMLSecurityConstants;
 
-import javax.xml.namespace.QName;
-import java.util.LinkedList;
 import java.util.List;
 
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
-public class EncryptedElementSecurityEvent extends SecurityEvent {
-
-    private List<QName> elementPath;
-    private boolean encrypted;
-    private SecurityToken securityToken;
-    private List<XMLSecurityConstants.ContentType> protectionOrder;
+public class EncryptedElementSecurityEvent extends AbstractSecuredElementSecurityEvent {
 
     public EncryptedElementSecurityEvent(SecurityToken securityToken, boolean encrypted,
List<XMLSecurityConstants.ContentType> protectionOrder) {
-        super(Event.EncryptedElement);
-        this.securityToken = securityToken;
-        this.encrypted = encrypted;
-        this.protectionOrder = protectionOrder;
-    }
-
-    public List<QName> getElementPath() {
-        return elementPath;
-    }
-
-    public void setElementPath(List<QName> elementPath) {
-        this.elementPath = new LinkedList<QName>(elementPath);
-    }
-
-    public boolean isEncrypted() {
-        return encrypted;
-    }
-
-    public void setEncrypted(boolean encrypted) {
-        this.encrypted = encrypted;
-    }
-
-    public SecurityToken getSecurityToken() {
-        return securityToken;
-    }
-
-    public void setSecurityToken(SecurityToken securityToken) {
-        this.securityToken = securityToken;
-    }
-
-    public List<XMLSecurityConstants.ContentType> getProtectionOrder() {
-        return protectionOrder;
-    }
-
-    public void setProtectionOrder(List<XMLSecurityConstants.ContentType> protectionOrder)
{
-        this.protectionOrder = protectionOrder;
+        super(Event.EncryptedElement, securityToken, protectionOrder, false, encrypted);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedPartSecurityEvent.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedPartSecurityEvent.java?rev=1299259&r1=1299258&r2=1299259&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedPartSecurityEvent.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-ws-security/src/main/java/org/swssf/wss/securityEvent/EncryptedPartSecurityEvent.java
Sat Mar 10 19:31:14 2012
@@ -21,57 +21,15 @@ package org.swssf.wss.securityEvent;
 import org.swssf.xmlsec.ext.SecurityToken;
 import org.swssf.xmlsec.ext.XMLSecurityConstants;
 
-import javax.xml.namespace.QName;
-import java.util.LinkedList;
 import java.util.List;
 
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
-public class EncryptedPartSecurityEvent extends SecurityEvent {
-
-    private List<QName> elementPath;
-    private boolean encrypted;
-    private SecurityToken securityToken;
-    private List<XMLSecurityConstants.ContentType> protectionOrder;
+public class EncryptedPartSecurityEvent extends AbstractSecuredElementSecurityEvent {
 
     public EncryptedPartSecurityEvent(SecurityToken securityToken, boolean encrypted, List<XMLSecurityConstants.ContentType>
protectionOrder) {
-        super(Event.EncryptedPart);
-        this.securityToken = securityToken;
-        this.encrypted = encrypted;
-        this.protectionOrder = protectionOrder;
-    }
-
-    public List<QName> getElementPath() {
-        return elementPath;
-    }
-
-    public void setElementPath(List<QName> elementPath) {
-        this.elementPath = new LinkedList<QName>(elementPath);
-    }
-
-    public boolean isEncrypted() {
-        return encrypted;
-    }
-
-    public void setEncrypted(boolean encrypted) {
-        this.encrypted = encrypted;
-    }
-
-    public SecurityToken getSecurityToken() {
-        return securityToken;
-    }
-
-    public void setSecurityToken(SecurityToken securityToken) {
-        this.securityToken = securityToken;
-    }
-
-    public List<XMLSecurityConstants.ContentType> getProtectionOrder() {
-        return protectionOrder;
-    }
-
-    public void setProtectionOrder(List<XMLSecurityConstants.ContentType> protectionOrder)
{
-        this.protectionOrder = protectionOrder;
+        super(Event.EncryptedPart, securityToken, protectionOrder, false, encrypted);
     }
 }

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=1299259&r1=1299258&r2=1299259&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
Sat Mar 10 19:31:14 2012
@@ -18,27 +18,13 @@
  */
 package org.swssf.wss.securityEvent;
 
-import javax.xml.namespace.QName;
-import java.util.LinkedList;
-import java.util.List;
-
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
-public class RequiredElementSecurityEvent extends SecurityEvent {
-
-    private List<QName> elementPath;
+public class RequiredElementSecurityEvent extends AbstractElementSecurityEvent {
 
     public RequiredElementSecurityEvent() {
         super(Event.RequiredElement);
     }
-
-    public List<QName> getElementPath() {
-        return elementPath;
-    }
-
-    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=1299259&r1=1299258&r2=1299259&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
Sat Mar 10 19:31:14 2012
@@ -18,27 +18,13 @@
  */
 package org.swssf.wss.securityEvent;
 
-import javax.xml.namespace.QName;
-import java.util.LinkedList;
-import java.util.List;
-
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
-public class RequiredPartSecurityEvent extends SecurityEvent {
-
-    private List<QName> elementPath;
+public class RequiredPartSecurityEvent extends AbstractElementSecurityEvent {
 
     public RequiredPartSecurityEvent() {
         super(Event.RequiredPart);
     }
-
-    public List<QName> getElementPath() {
-        return elementPath;
-    }
-
-    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/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=1299259&r1=1299258&r2=1299259&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
Sat Mar 10 19:31:14 2012
@@ -21,57 +21,15 @@ package org.swssf.wss.securityEvent;
 import org.swssf.xmlsec.ext.SecurityToken;
 import org.swssf.xmlsec.ext.XMLSecurityConstants;
 
-import javax.xml.namespace.QName;
-import java.util.LinkedList;
 import java.util.List;
 
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
-public class SignedElementSecurityEvent extends SecurityEvent {
-
-    private List<QName> elementPath;
-    private boolean signed;
-    private SecurityToken securityToken;
-    private List<XMLSecurityConstants.ContentType> protectionOrder;
+public class SignedElementSecurityEvent extends AbstractSecuredElementSecurityEvent {
 
     public SignedElementSecurityEvent(SecurityToken securityToken, boolean signed, List<XMLSecurityConstants.ContentType>
protectionOrder) {
-        super(Event.SignedElement);
-        this.signed = signed;
-        this.securityToken = securityToken;
-        this.protectionOrder = protectionOrder;
-    }
-
-    public List<QName> getElementPath() {
-        return elementPath;
-    }
-
-    public void setElementPath(List<QName> elementPath) {
-        this.elementPath = new LinkedList<QName>(elementPath);
-    }
-
-    public SecurityToken getSecurityToken() {
-        return securityToken;
-    }
-
-    public void setSecurityToken(SecurityToken securityToken) {
-        this.securityToken = securityToken;
-    }
-
-    public boolean isSigned() {
-        return signed;
-    }
-
-    public void setSigned(boolean signed) {
-        this.signed = signed;
-    }
-
-    public List<XMLSecurityConstants.ContentType> getProtectionOrder() {
-        return protectionOrder;
-    }
-
-    public void setProtectionOrder(List<XMLSecurityConstants.ContentType> protectionOrder)
{
-        this.protectionOrder = protectionOrder;
+        super(Event.SignedElement, securityToken, protectionOrder, signed, false);
     }
 }

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=1299259&r1=1299258&r2=1299259&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
Sat Mar 10 19:31:14 2012
@@ -21,57 +21,15 @@ package org.swssf.wss.securityEvent;
 import org.swssf.xmlsec.ext.SecurityToken;
 import org.swssf.xmlsec.ext.XMLSecurityConstants;
 
-import javax.xml.namespace.QName;
-import java.util.LinkedList;
 import java.util.List;
 
 /**
  * @author $Author$
  * @version $Revision$ $Date$
  */
-public class SignedPartSecurityEvent extends SecurityEvent {
-
-    private List<QName> elementPath;
-    private boolean signed;
-    private SecurityToken securityToken;
-    private List<XMLSecurityConstants.ContentType> protectionOrder;
+public class SignedPartSecurityEvent extends AbstractSecuredElementSecurityEvent {
 
     public SignedPartSecurityEvent(SecurityToken securityToken, boolean signed, List<XMLSecurityConstants.ContentType>
protectionOrder) {
-        super(Event.SignedPart);
-        this.signed = signed;
-        this.securityToken = securityToken;
-        this.protectionOrder = protectionOrder;
-    }
-
-    public List<QName> getElementPath() {
-        return elementPath;
-    }
-
-    public void setElementPath(List<QName> elementPath) {
-        this.elementPath = new LinkedList<QName>(elementPath);
-    }
-
-    public List<XMLSecurityConstants.ContentType> getProtectionOrder() {
-        return protectionOrder;
-    }
-
-    public void setProtectionOrder(List<XMLSecurityConstants.ContentType> protectionOrder)
{
-        this.protectionOrder = protectionOrder;
-    }
-
-    public boolean isSigned() {
-        return signed;
-    }
-
-    public void setSigned(boolean signed) {
-        this.signed = signed;
-    }
-
-    public SecurityToken getSecurityToken() {
-        return securityToken;
-    }
-
-    public void setSecurityToken(SecurityToken securityToken) {
-        this.securityToken = securityToken;
+        super(Event.SignedPart, securityToken, protectionOrder, signed, false);
     }
 }

Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java?rev=1299259&r1=1299258&r2=1299259&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java
(original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/input/AbstractDecryptInputProcessor.java
Sat Mar 10 19:31:14 2012
@@ -68,6 +68,7 @@ public abstract class AbstractDecryptInp
     private final QName wrapperElementName = new QName("http://dummy", "dummy", uuid);
 
     private ArrayDeque<XMLEvent> tmpXmlEventList = new ArrayDeque<XMLEvent>();
+    private XMLEvent parentStartXMLEvent;
 
     public AbstractDecryptInputProcessor(ReferenceList referenceList, XMLSecurityProperties
securityProperties) {
         super(securityProperties);
@@ -233,7 +234,7 @@ public abstract class AbstractDecryptInp
                     //only fire here ContentEncryptedElementEvents
                     //the other ones will be fired later, because we don't know the encrypted
element name yet
                     if (SecurePart.Modifier.Content.getModifier().equals(encryptedDataType.getType()))
{
-                        handleEncryptedContent(inputProcessorChain, xmlEvent, securityToken);
+                        handleEncryptedContent(inputProcessorChain, parentStartXMLEvent,
xmlEvent, securityToken);
                     }
 
                     Cipher symCipher = null;
@@ -316,7 +317,9 @@ public abstract class AbstractDecryptInp
             }
             return xmlEvent;
         }
-
+        if (xmlEvent.isStartElement()) {
+            parentStartXMLEvent = xmlEvent;
+        }
         return xmlEvent;
     }
 
@@ -328,7 +331,7 @@ public abstract class AbstractDecryptInp
             SecurityToken securityToken, SecurityContext securityContext, EncryptedDataType
encryptedDataType) throws XMLSecurityException;
 
     protected abstract void handleEncryptedContent(
-            InputProcessorChain inputProcessorChain, XMLEvent xmlEvent, SecurityToken securityToken)
throws XMLSecurityException;
+            InputProcessorChain inputProcessorChain, XMLEvent parentXMLEvent, XMLEvent xmlEvent,
SecurityToken securityToken) throws XMLSecurityException;
 
     protected ReferenceType matchesReferenceId(StartElement startElement) {
 



Mime
View raw message