You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by gi...@apache.org on 2011/11/02 12:40:55 UTC
svn commit: r1196546 [2/2] - in /webservices/wss4j/branches/swssf:
streaming-ws-security/src/main/java/org/swssf/wss/ext/
streaming-ws-security/src/main/java/org/swssf/wss/impl/processor/output/
streaming-xml-security/src/main/java/org/swssf/xmlsec/ext...
Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractOutputProcessor.java?rev=1196546&r1=1196545&r2=1196546&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/ext/AbstractOutputProcessor.java Wed Nov 2 11:40:54 2011
@@ -151,7 +151,7 @@ public abstract class AbstractOutputProc
outputAsEvent(outputProcessorChain, startElement);
}
- protected void createStartElementAndOutputAsEvent(OutputProcessorChain outputProcessorChain, QName element, Map<QName, String> attributes) throws XMLStreamException, XMLSecurityException {
+ public void createStartElementAndOutputAsEvent(OutputProcessorChain outputProcessorChain, QName element, Map<QName, String> attributes) throws XMLStreamException, XMLSecurityException {
List<Namespace> namespaceList = new LinkedList<Namespace>();
namespaceList.add(xmlEventFactory.createNamespace(element.getPrefix(), element.getNamespaceURI()));
@@ -191,11 +191,11 @@ public abstract class AbstractOutputProc
return xmlEventFactory.createEndElement(element, namespaceList.iterator());
}
- protected void createEndElementAndOutputAsEvent(OutputProcessorChain outputProcessorChain, QName element) throws XMLStreamException, XMLSecurityException {
+ public void createEndElementAndOutputAsEvent(OutputProcessorChain outputProcessorChain, QName element) throws XMLStreamException, XMLSecurityException {
outputAsEvent(outputProcessorChain, createEndElement(element));
}
- protected void createCharactersAndOutputAsEvent(OutputProcessorChain outputProcessorChain, String characters) throws XMLStreamException, XMLSecurityException {
+ public void createCharactersAndOutputAsEvent(OutputProcessorChain outputProcessorChain, String characters) throws XMLStreamException, XMLSecurityException {
outputAsEvent(outputProcessorChain, createCharacters(characters));
}
@@ -248,4 +248,43 @@ public abstract class AbstractOutputProc
}
createEndElementAndOutputAsEvent(outputProcessorChain, XMLSecurityConstants.TAG_xenc_ReferenceList);
}
+
+ protected SecurePart securePartMatches(StartElement startElement, OutputProcessorChain outputProcessorChain, List<SecurePart> secureParts) {
+ SecurePart securePart = securePartMatches(startElement, secureParts);
+ if (securePart != null) {
+ return securePart;
+ }
+ List<SecurePart> dynamicSecureParts = outputProcessorChain.getSecurityContext().getAsList(SecurePart.class);
+ if (dynamicSecureParts == null) {
+ return null;
+ }
+ return securePartMatches(startElement, dynamicSecureParts);
+ }
+
+ protected SecurePart securePartMatches(StartElement startElement, List<SecurePart> secureParts) {
+ Iterator<SecurePart> securePartIterator = secureParts.iterator();
+ while (securePartIterator.hasNext()) {
+ SecurePart securePart = securePartIterator.next();
+ if (securePart.getIdToSign() == null) {
+ if (startElement.getName().getLocalPart().equals(securePart.getName())
+ && startElement.getName().getNamespaceURI().equals(securePart.getNamespace())) {
+ return securePart;
+ }
+ } else {
+ @SuppressWarnings("unchecked")
+ Iterator<Attribute> attributeIterator = startElement.getAttributes();
+ while (attributeIterator.hasNext()) {
+ Attribute attribute = attributeIterator.next();
+ if (attribute != null) {
+ QName attributeName = attribute.getName();
+ if ((attributeName.equals(XMLSecurityConstants.ATT_NULL_Id))
+ && attribute.getValue().equals(securePart.getIdToSign())) {
+ return securePart;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
}
Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptEndingOutputProcessor.java?rev=1196546&r1=1196545&r2=1196546&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptEndingOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptEndingOutputProcessor.java Wed Nov 2 11:40:54 2011
@@ -35,8 +35,5 @@ public abstract class AbstractEncryptEnd
}
@Override
- protected abstract void processHeaderEvent(OutputProcessorChain outputProcessorChain) throws XMLStreamException, XMLSecurityException;
-
- @Override
public abstract void doFinal(OutputProcessorChain outputProcessorChain) throws XMLStreamException, XMLSecurityException;
}
Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptOutputProcessor.java?rev=1196546&r1=1196545&r2=1196546&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractEncryptOutputProcessor.java Wed Nov 2 11:40:54 2011
@@ -32,7 +32,10 @@ import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.*;
+import javax.xml.stream.events.Characters;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -48,56 +51,15 @@ import java.util.*;
*/
public abstract class AbstractEncryptOutputProcessor extends AbstractOutputProcessor {
- private List<SecurePart> secureParts;
private AbstractInternalEncryptionOutputProcessor activeInternalEncryptionOutputProcessor = null;
public AbstractEncryptOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
super(securityProperties, action);
- secureParts = securityProperties.getEncryptionSecureParts();
}
@Override
public abstract void processEvent(XMLEvent xmlEvent, OutputProcessorChain outputProcessorChain) throws XMLStreamException, XMLSecurityException;
- protected SecurePart securePartMatches(StartElement startElement, OutputProcessorChain outputProcessorChain) {
- SecurePart securePart = securePartMatches(startElement, this.secureParts);
- if (securePart != null) {
- return securePart;
- }
- List<SecurePart> secureParts = outputProcessorChain.getSecurityContext().getAsList(SecurePart.class);
- if (secureParts == null) {
- return null;
- }
- return securePartMatches(startElement, secureParts);
- }
-
- protected SecurePart securePartMatches(StartElement startElement, List<SecurePart> secureParts) {
- Iterator<SecurePart> securePartIterator = secureParts.iterator();
- while (securePartIterator.hasNext()) {
- SecurePart securePart = securePartIterator.next();
- if (securePart.getIdToSign() == null) {
- if (startElement.getName().getLocalPart().equals(securePart.getName())
- && startElement.getName().getNamespaceURI().equals(securePart.getNamespace())) {
- return securePart;
- }
- } else {
- @SuppressWarnings("unchecked")
- Iterator<Attribute> attributeIterator = startElement.getAttributes();
- while (attributeIterator.hasNext()) {
- Attribute attribute = attributeIterator.next();
- if (attribute != null) {
- QName attributeName = attribute.getName();
- if ((attributeName.equals(XMLSecurityConstants.ATT_NULL_Id))
- && attribute.getValue().equals(securePart.getIdToSign())) {
- return securePart;
- }
- }
- }
- }
- }
- return null;
- }
-
protected AbstractInternalEncryptionOutputProcessor getActiveInternalEncryptionOutputProcessor() {
return activeInternalEncryptionOutputProcessor;
}
Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java?rev=1196546&r1=1196545&r2=1196546&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureEndingOutputProcessor.java Wed Nov 2 11:40:54 2011
@@ -85,7 +85,7 @@ public abstract class AbstractSignatureE
@Override
public abstract void doFinal(OutputProcessorChain outputProcessorChain) throws XMLStreamException, XMLSecurityException;
- protected void processHeaderEvent(OutputProcessorChain outputProcessorChain) throws XMLStreamException, XMLSecurityException {
+ public void processHeaderEvent(OutputProcessorChain outputProcessorChain) throws XMLStreamException, XMLSecurityException {
OutputProcessorChain subOutputProcessorChain = outputProcessorChain.createSubChain(this);
Modified: webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureOutputProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureOutputProcessor.java?rev=1196546&r1=1196545&r2=1196546&view=diff
==============================================================================
--- webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureOutputProcessor.java (original)
+++ webservices/wss4j/branches/swssf/streaming-xml-security/src/main/java/org/swssf/xmlsec/impl/processor/output/AbstractSignatureOutputProcessor.java Wed Nov 2 11:40:54 2011
@@ -27,9 +27,7 @@ import org.xmlsecurity.ns.configuration.
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.EndElement;
-import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import java.io.BufferedOutputStream;
import java.io.IOException;
@@ -38,7 +36,6 @@ import java.lang.reflect.InvocationTarge
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -48,14 +45,12 @@ import java.util.List;
*/
public abstract class AbstractSignatureOutputProcessor extends AbstractOutputProcessor {
- private List<SecurePart> secureParts;
private List<SignaturePartDef> signaturePartDefList = new LinkedList<SignaturePartDef>();
private InternalSignatureOutputProcessor activeInternalSignatureOutputProcessor = null;
public AbstractSignatureOutputProcessor(XMLSecurityProperties securityProperties, XMLSecurityConstants.Action action) throws XMLSecurityException {
super(securityProperties, action);
- secureParts = securityProperties.getSignatureSecureParts();
}
public List<SignaturePartDef> getSignaturePartDefList() {
@@ -65,46 +60,6 @@ public abstract class AbstractSignatureO
@Override
public abstract void processEvent(XMLEvent xmlEvent, OutputProcessorChain outputProcessorChain) throws XMLStreamException, XMLSecurityException;
-
- protected SecurePart securePartMatches(StartElement startElement, OutputProcessorChain outputProcessorChain) {
- SecurePart securePart = securePartMatches(startElement, this.secureParts);
- if (securePart != null) {
- return securePart;
- }
- List<SecurePart> secureParts = outputProcessorChain.getSecurityContext().getAsList(SecurePart.class);
- if (secureParts == null) {
- return null;
- }
- return securePartMatches(startElement, secureParts);
- }
-
- protected SecurePart securePartMatches(StartElement startElement, List<SecurePart> secureParts) {
- Iterator<SecurePart> securePartIterator = secureParts.iterator();
- while (securePartIterator.hasNext()) {
- SecurePart securePart = securePartIterator.next();
- if (securePart.getIdToSign() == null) {
- if (startElement.getName().getLocalPart().equals(securePart.getName())
- && startElement.getName().getNamespaceURI().equals(securePart.getNamespace())) {
- return securePart;
- }
- } else {
- @SuppressWarnings("unchecked")
- Iterator<Attribute> attributeIterator = startElement.getAttributes();
- while (attributeIterator.hasNext()) {
- Attribute attribute = attributeIterator.next();
- if (attribute != null) {
- QName attributeName = attribute.getName();
- if ((attributeName.equals(XMLSecurityConstants.ATT_NULL_Id))
- && attribute.getValue().equals(securePart.getIdToSign())) {
- return securePart;
- }
- }
- }
- }
- }
- return null;
- }
-
protected InternalSignatureOutputProcessor getActiveInternalSignatureOutputProcessor() {
return activeInternalSignatureOutputProcessor;
}