summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-02-26 19:39:00 (GMT)
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-02-26 19:39:00 (GMT)
commit6576428966f1e3d688269a407b072fb01f9f7647 (patch)
treef79a9c3c70c27477133c9283dd4b0440b7559d05 /utils
parentbd18d9084fd139aaae40ad8d525c1d0e626f2e5e (diff)
downloadmocca-6576428966f1e3d688269a407b072fb01f9f7647.zip
mocca-6576428966f1e3d688269a407b072fb01f9f7647.tar.gz
mocca-6576428966f1e3d688269a407b072fb01f9f7647.tar.bz2
1.1 candidate (activation)
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@309 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'utils')
-rw-r--r--utils/src/main/java/at/gv/egiz/marshal/NamespacePrefix.java34
-rw-r--r--utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java16
-rw-r--r--utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java389
-rw-r--r--utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java1
-rw-r--r--utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java2
-rw-r--r--utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java1
-rw-r--r--utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java2
-rw-r--r--utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java29
-rw-r--r--utils/src/test/requests/CreateXMLSignatureRequest02.xml_redirect.txt5
9 files changed, 274 insertions, 205 deletions
diff --git a/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefix.java b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefix.java
new file mode 100644
index 0000000..c03f17c
--- /dev/null
+++ b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefix.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed 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 at.gv.egiz.marshal;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public interface NamespacePrefix {
+ String CARDCHANNEL_PREFIX = "cc";
+ String ECDSA_PREFIX = "ecdsa";
+ String PERSONDATA_PREFIX = "pr";
+ String SAML10_PREFIX = "saml";
+ String SL_PREFIX = "sl";
+ String XADES_PREFIX = "xades";
+ String XMLDSIG_PREFIX = "xmldsig";
+ String XSI_PREFIX = "xsi";
+
+}
diff --git a/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java
index a08c118..519f6b1 100644
--- a/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java
+++ b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java
@@ -36,35 +36,35 @@ public class NamespacePrefixMapperImpl extends NamespacePrefixMapper {
log.trace("prefix for namespace " + namespaceUri + " requested");
}
if ("http://www.w3.org/2001/XMLSchema-instance".equals(namespaceUri)) {
- return "xsi";
+ return NamespacePrefix.XSI_PREFIX;
}
if ("http://www.w3.org/2000/09/xmldsig#".equals(namespaceUri)) {
- return "dsig";
+ return NamespacePrefix.XMLDSIG_PREFIX;
}
if ("http://www.buergerkarte.at/namespaces/securitylayer/1.2#".equals(namespaceUri)) {
- return "sl";
+ return NamespacePrefix.SL_PREFIX;
}
if ("http://www.buergerkarte.at/cardchannel".equals(namespaceUri)) {
- return "cc";
+ return NamespacePrefix.CARDCHANNEL_PREFIX;
}
if ("http://www.w3.org/2001/04/xmldsig-more#".equals(namespaceUri)) {
- return "ecdsa";
+ return NamespacePrefix.ECDSA_PREFIX;
}
if ("http://reference.e-government.gv.at/namespace/persondata/20020228#".equals(namespaceUri)) {
- return "pr";
+ return NamespacePrefix.PERSONDATA_PREFIX;
}
if ("urn:oasis:names:tc:SAML:1.0:assertion".equals(namespaceUri)) {
- return "saml";
+ return NamespacePrefix.SAML10_PREFIX;
}
if ("http://uri.etsi.org/01903/v1.1.1#".equals(namespaceUri)) {
- return "xades";
+ return NamespacePrefix.XADES_PREFIX;
}
return suggestion;
diff --git a/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java b/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java
index d2a7fb3..14c5ba4 100644
--- a/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java
+++ b/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java
@@ -1,19 +1,19 @@
/*
-* Copyright 2008 Federal Chancellery Austria and
-* Graz University of Technology
-*
-* Licensed 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.
-*/
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed 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.
+ */
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -33,79 +33,84 @@ import javax.xml.stream.events.XMLEvent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+/*
+ * TODO: don't set redirect stream from caller (caller does not know whether redirection will be triggered)
+ * rather create on trigger and pass to caller
+ */
public class RedirectEventFilter implements EventFilter {
- public static final String DEFAULT_ENCODING = "UTF-8";
- private static Log log = LogFactory.getLog(RedirectEventFilter.class);
- protected XMLEventWriter redirectWriter = null;
- protected Set<QName> redirectTriggers = null;
- private int depth = -1;
- protected NamespaceContext currentNamespaceContext = null;
+ public static final String DEFAULT_ENCODING = "UTF-8";
+ private static Log log = LogFactory.getLog(RedirectEventFilter.class);
+ protected XMLEventWriter redirectWriter = null;
+ protected Set<QName> redirectTriggers = null;
+ private int depth = -1;
+ protected NamespaceContext currentNamespaceContext = null;
- /**
- * Event redirection is disabled, set a redirect stream to enable.
- */
- public RedirectEventFilter() {
- redirectWriter = null;
- // redirectTriggers = null;
- }
+ /**
+ * Event redirection is disabled, set a redirect stream to enable.
+ */
+ public RedirectEventFilter() {
+ redirectWriter = null;
+ // redirectTriggers = null;
+ }
- /**
- *
- * @param redirectStream
- * if null, no events are redirected
- * @param redirectTriggers
- * if null, all events are redirected
- */
- public RedirectEventFilter(OutputStream redirectStream, String encoding)
- throws XMLStreamException { // , List<QName> redirectTriggers
- if (redirectStream != null) {
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- if (encoding == null) {
- encoding = DEFAULT_ENCODING;
- }
- this.redirectWriter = outputFactory.createXMLEventWriter(redirectStream,
+ /**
+ *
+ * @param redirectStream
+ * if null, no events are redirected
+ * @param redirectTriggers
+ * if null, all events are redirected
+ */
+ public RedirectEventFilter(OutputStream redirectStream, String encoding)
+ throws XMLStreamException { // , List<QName> redirectTriggers
+ if (redirectStream != null) {
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ if (encoding == null) {
+ encoding = DEFAULT_ENCODING;
+ }
+ this.redirectWriter = outputFactory.createXMLEventWriter(redirectStream,
encoding);
- }
- // this.redirectTriggers = redirectTriggers;
}
+ // this.redirectTriggers = redirectTriggers;
+ }
- /**
- * All startElement events occuring in the redirectTriggers list will trigger
- * redirection of the entire (sub-)fragment.
- *
- * @param event
- * @return false if an event is redirected
- */
- @Override
- public boolean accept(XMLEvent event) {
- int eventType = event.getEventType();
+ /**
+ * All startElement events occuring in the redirectTriggers list will trigger
+ * redirection of the entire (sub-)fragment.
+ *
+ * @param event
+ * @return false if an event is redirected
+ */
+ @Override
+ public boolean accept(XMLEvent event) {
+ int eventType = event.getEventType();
- if (eventType == XMLStreamConstants.START_ELEMENT) {
- currentNamespaceContext = event.asStartElement().getNamespaceContext();
- }
- if (redirectWriter == null) {
- return true;
- }
- if (eventType == XMLStreamConstants.START_ELEMENT) {
- if (depth >= 0 || triggersRedirect(event.asStartElement().getName())) {
- depth++;
- }
- } else if (eventType == XMLStreamConstants.END_ELEMENT) {
- if (depth >= 0 && --depth < 0) {
- // redirect the end element of the trigger,
- // but do not redirect the end element of the calling type
- if (redirectTriggers != null) {
- redirectEvent(event);
- return false;
- }
- }
- }
- if (depth >= 0) { //|| (depth == 0 && redirectTriggers == null)) {
- redirectEvent(event);
- return false;
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ //hopefully, this is a copy
+ currentNamespaceContext = event.asStartElement().getNamespaceContext();
+ }
+ if (redirectWriter == null) {
+ return true;
+ }
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (depth >= 0 || triggersRedirect(event.asStartElement().getName())) {
+ depth++;
+ }
+ } else if (eventType == XMLStreamConstants.END_ELEMENT) {
+ if (depth >= 0 && --depth < 0) {
+ // redirect the end element of the trigger,
+ // but do not redirect the end element of the calling type
+ if (redirectTriggers != null) {
+ redirectEvent(event);
+ return false;
}
- return true; // depth < 0;
+ }
+ }
+ if (depth >= 0) { //|| (depth == 0 && redirectTriggers == null)) {
+ redirectEvent(event);
+ return false;
+ }
+ return true; // depth < 0;
// switch (event.getEventType()) {
// case XMLStreamConstants.START_ELEMENT:
@@ -132,128 +137,130 @@ public class RedirectEventFilter implements EventFilter {
// return false;
// }
// return true; // depth < 0;
- }
+ }
- /**
- * @param startElt
- * @return true if the set of triggers contains startElement
- * (or no triggers are registered, i.e. everything is redirected)
- */
- private boolean triggersRedirect(QName startElement) {
- if (redirectTriggers != null) {
- return redirectTriggers.contains(startElement);
- }
- return true;
+ /**
+ * @param startElt
+ * @return true if the set of triggers contains startElement
+ * (or no triggers are registered, i.e. everything is redirected)
+ */
+ private boolean triggersRedirect(QName startElement) {
+ if (redirectTriggers != null) {
+ return redirectTriggers.contains(startElement);
}
+ return true;
+ }
- private void redirectEvent(XMLEvent event) {
- try {
- if (log.isTraceEnabled()) {
- log.trace("redirecting StAX event " + event);
- }
- redirectWriter.add(event);
- } catch (XMLStreamException ex) {
- ex.printStackTrace();
- }
+ private void redirectEvent(XMLEvent event) {
+ try {
+ if (log.isTraceEnabled()) {
+ log.trace("redirecting StAX event " + event);
+ }
+ redirectWriter.add(event);
+ } catch (XMLStreamException ex) {
+ ex.printStackTrace();
}
+ }
- /**
- * Enable/disable redirection of <em>all</em> events from now on.
- * The redirected events will be UTF-8 encoded and written to the stream.
- *
- * @param redirectstream
- * if null, redirection is disabled
- */
- public void setRedirectStream(OutputStream redirectStream) throws XMLStreamException {
- setRedirectStream(redirectStream, DEFAULT_ENCODING, null);
- }
+ /**
+ * Enable/disable redirection of <em>all</em> events from now on.
+ * The redirected events will be UTF-8 encoded and written to the stream.
+ *
+ * @param redirectstream
+ * if null, redirection is disabled
+ */
+ public void setRedirectStream(OutputStream redirectStream) throws XMLStreamException {
+ setRedirectStream(redirectStream, DEFAULT_ENCODING, null);
+ }
- /**
- * Enable/disable redirection of <em>all</em> events from now on.
- *
- * @param redirectStream if null, redirection is disabled
- * @param encoding The encoding for the redirect stream
- * @throws javax.xml.stream.XMLStreamException
- */
- public void setRedirectStream(OutputStream redirectStream, String encoding) throws XMLStreamException {
- setRedirectStream(redirectStream, encoding, null);
- }
+ /**
+ * Enable/disable redirection of <em>all</em> events from now on.
+ *
+ * @param redirectStream if null, redirection is disabled
+ * @param encoding The encoding for the redirect stream
+ * @throws javax.xml.stream.XMLStreamException
+ */
+ public void setRedirectStream(OutputStream redirectStream, String encoding) throws XMLStreamException {
+ setRedirectStream(redirectStream, encoding, null);
+ }
- /**
- * Enable/disable redirection of all (child) elements contained in redirect triggers.
- * The redirected events will be UTF-8 encoded and written to the stream.
- *
- * @param redirectstream
- * if null, redirection is disabled
- * @param redirectTriggers elements that trigger the redirection
- */
- public void setRedirectStream(OutputStream redirectStream, Set<QName> redirectTriggers) throws XMLStreamException {
- setRedirectStream(redirectStream, DEFAULT_ENCODING, redirectTriggers);
- }
+ /**
+ * Enable/disable redirection of all (child) elements contained in redirect triggers.
+ * The redirected events will be UTF-8 encoded and written to the stream.
+ *
+ * @param redirectstream
+ * if null, redirection is disabled
+ * @param redirectTriggers elements that trigger the redirection
+ */
+ public void setRedirectStream(OutputStream redirectStream, Set<QName> redirectTriggers) throws XMLStreamException {
+ setRedirectStream(redirectStream, DEFAULT_ENCODING, redirectTriggers);
+ }
- /**
- * Enable/disable redirection of all (child) elements contained in redirect triggers.
- *
- * @param redirectstream
- * if null, redirection is disabled
- * @param encoding The encoding for the redirect stream
- * @param redirectTriggers elements that trigger the redirection
- */
- public void setRedirectStream(OutputStream redirectStream, String encoding, Set<QName> redirectTriggers) throws XMLStreamException {
- if (redirectStream != null) {
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- if (encoding == null) {
- encoding = DEFAULT_ENCODING;
- }
- redirectWriter = outputFactory.createXMLEventWriter(redirectStream,
+ /**
+ * Enable/disable redirection of all (child) elements contained in redirect triggers.
+ *
+ * TODO: don't set redirect stream from caller (caller does not know whether redirection will be triggered)
+ * rather create on trigger and pass to caller
+ * @param redirectstream
+ * if null, redirection is disabled
+ * @param encoding The encoding for the redirect stream
+ * @param redirectTriggers elements that trigger the redirection
+ */
+ public void setRedirectStream(OutputStream redirectStream, String encoding, Set<QName> redirectTriggers) throws XMLStreamException {
+ if (redirectStream != null) {
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ if (encoding == null) {
+ encoding = DEFAULT_ENCODING;
+ }
+ redirectWriter = outputFactory.createXMLEventWriter(redirectStream,
encoding);
- if (redirectTriggers == null) {
- // start redirecting
- depth = 0;
- }
- this.redirectTriggers = redirectTriggers;
- } else {
- redirectWriter = null;
- this.redirectTriggers = null;
- }
+ if (redirectTriggers == null) {
+ // start redirecting
+ depth = 0;
+ }
+ this.redirectTriggers = redirectTriggers;
+ } else {
+ redirectWriter = null;
+ this.redirectTriggers = null;
}
+ }
- /**
- * Enable/disable redirection of fragments (defined by elements in
- * redirectTriggers)
- *
- * @param redirectStream
- * if null, redirection is disabled
- * @param redirectTriggers
- * All startElement events occuring in this list will trigger
- * redirection of the entire fragment. If null, all events are
- * redirected
- */
- // public void setRedirectStream(OutputStream redirectStream, List<QName>
- // redirectTriggers) throws XMLStreamException {
- // if (redirectStream != null) {
- // XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- // redirectWriter = outputFactory.createXMLEventWriter(redirectStream);
- // } else {
- // redirectWriter = null;
- // }
- // this.redirectTriggers = (redirectStream == null) ? null : redirectTriggers;
- // }
- /**
- * flushes the internal EventWriter
- *
- * @throws javax.xml.stream.XMLStreamException
- */
- public void flushRedirectStream() throws XMLStreamException {
- redirectWriter.flush();
- }
+ /**
+ * Enable/disable redirection of fragments (defined by elements in
+ * redirectTriggers)
+ *
+ * @param redirectStream
+ * if null, redirection is disabled
+ * @param redirectTriggers
+ * All startElement events occuring in this list will trigger
+ * redirection of the entire fragment. If null, all events are
+ * redirected
+ */
+ // public void setRedirectStream(OutputStream redirectStream, List<QName>
+ // redirectTriggers) throws XMLStreamException {
+ // if (redirectStream != null) {
+ // XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ // redirectWriter = outputFactory.createXMLEventWriter(redirectStream);
+ // } else {
+ // redirectWriter = null;
+ // }
+ // this.redirectTriggers = (redirectStream == null) ? null : redirectTriggers;
+ // }
+ /**
+ * flushes the internal EventWriter
+ *
+ * @throws javax.xml.stream.XMLStreamException
+ */
+ public void flushRedirectStream() throws XMLStreamException {
+ redirectWriter.flush();
+ }
- /**
- * the namespaceContext of the last startelement event read
- *
- * @return
- */
- public NamespaceContext getCurrentNamespaceContext() {
- return currentNamespaceContext;
- }
+ /**
+ * the namespaceContext of the last startelement event read
+ *
+ * @return
+ */
+ public NamespaceContext getCurrentNamespaceContext() {
+ return currentNamespaceContext;
+ }
}
diff --git a/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java b/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java
index b4e988f..1180e9f 100644
--- a/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java
+++ b/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java
@@ -25,6 +25,7 @@ import java.io.ByteArrayOutputStream;
import java.util.HashSet;
import java.util.Set;
import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import org.apache.commons.logging.Log;
diff --git a/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java b/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java
index c32542a..eb147f8 100644
--- a/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java
+++ b/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java
@@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory;
public class XMLContentType extends at.buergerkarte.namespaces.securitylayer._1.XMLContentType implements RedirectCallback {
@XmlTransient
- private static Log log = LogFactory.getLog(TransformsInfoType.class);
+ private static Log log = LogFactory.getLog(XMLContentType.class);
@XmlTransient
protected ByteArrayOutputStream redirectOS = null;
diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java
index 4ab376f..fae7745 100644
--- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java
+++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java
@@ -167,6 +167,7 @@ public class ObjectFactory {
*
*/
public TransformType createTransformType() {
+// return new at.gv.egiz.slbinding.impl.TransformType();
return new TransformType();
}
diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java
index 584baf8..c7044c4 100644
--- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java
+++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java
@@ -57,7 +57,7 @@ import javax.xml.bind.annotation.XmlType;
})
public class TransformsType {
- @XmlElement(name = "Transform", required = true)
+ @XmlElement(name = "Transform", required = true) //, type=at.gv.egiz.slbinding.impl.TransformType.class)
protected List<TransformType> transform;
/**
diff --git a/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java b/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java
index 99d353a..7c8c206 100644
--- a/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java
+++ b/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java
@@ -52,6 +52,8 @@ import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import static org.junit.Assert.*;
+import org.w3._2000._09.xmldsig_.TransformType;
+import org.w3._2000._09.xmldsig_.TransformsType;
/**
*
@@ -131,11 +133,34 @@ public class RedirectTest {
Iterator<TransformsInfoType> tiIt = transformsInfos.iterator();
while (tiIt.hasNext()) {
at.gv.egiz.slbinding.impl.TransformsInfoType ti = (at.gv.egiz.slbinding.impl.TransformsInfoType) tiIt.next();
+// TransformsInfoType ti = tiIt.next();
assertNotNull(ti);
- System.out.println("found at.gv.egiz.slbinding.impl.TransformsInfoType TransformsInfo");
+ System.out.println("found sl:TransformsInfo: " + ti.getClass().getName()); //at.gv.egiz.slbinding.impl.TransformsInfoType TransformsInfo");
+// TransformsType ts = ti.getTransforms();
+// assertNotNull(ts);
+// System.out.println("found dsig:Transforms " + ts.getClass().getName()); //org.w3._2000._09.xmldsig_.TransformsType dsig:Transforms");
+// List<TransformType> tL = ts.getTransform();
+// assertNotNull(tL);
+// System.out.println("found " + tL.size() + " org.w3._2000._09.xmldsig_.TransformType dsig:Transform");
+// for (TransformType t : tL) {
+// if (t instanceof at.gv.egiz.slbinding.impl.TransformType) {
+// System.out.println("found at.gv.egiz.slbinding.impl.TransformType");
+// byte[] redirectedBytes = ((at.gv.egiz.slbinding.impl.TransformType) t).getRedirectedStream().toByteArray();
+// if (redirectedBytes != null && redirectedBytes.length > 0) {
+// System.out.println("reading redirected stream...");
+// os.write("--- redirected Transform ---".getBytes());
+// os.write(redirectedBytes);
+// os.write("\n".getBytes());
+// } else {
+// System.out.println("no redirected stream");
+// }
+// }
+// }
+
ByteArrayOutputStream dsigTransforms = ti.getRedirectedStream();
+ os.write("--- redirected TransformsInfo content ---".getBytes());
os.write(dsigTransforms.toByteArray());
- os.write("\n".getBytes());
+ os.write("\n---".getBytes());
MetaInfoType mi = ti.getFinalDataMetaInfo();
assertNotNull(mi);
diff --git a/utils/src/test/requests/CreateXMLSignatureRequest02.xml_redirect.txt b/utils/src/test/requests/CreateXMLSignatureRequest02.xml_redirect.txt
index 31be50b..fc0e4f1 100644
--- a/utils/src/test/requests/CreateXMLSignatureRequest02.xml_redirect.txt
+++ b/utils/src/test/requests/CreateXMLSignatureRequest02.xml_redirect.txt
@@ -1,4 +1,4 @@
-<dsig:Transforms>
+--- redirected TransformsInfo content ---<dsig:Transforms>
<dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></dsig:Transform>
<dsig:Transform Algorithm="http://www.w3.org/TR/1999/REC-xslt-19991116">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:pr="http://reference.e-government.gv.at/namespace/persondata/20020228#" version="1.0">
@@ -82,7 +82,7 @@
</dsig:Transform>
<dsig:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"></dsig:Transform>
</dsig:Transforms>
-<dsig:Transforms>
+------ redirected TransformsInfo content ---<dsig:Transforms>
<dsig:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></dsig:Transform>
<dsig:Transform Algorithm="http://www.w3.org/TR/1999/REC-xslt-19991116">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:pr="http://reference.e-government.gv.at/namespace/persondata/20020228#" version="1.0">
@@ -162,3 +162,4 @@
</dsig:Transform>
<dsig:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"></dsig:Transform>
</dsig:Transforms>
+--- \ No newline at end of file