use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method noPropertiesSpecified.
@Test
public void noPropertiesSpecified() throws Exception {
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = new XAdESSignatureProperties();
props.setAddSigningTime(false);
endpoint.setProperties(props);
Document doc = testEnveloping();
// expecting no Qualifying Properties
checkNode(doc, "/ds:Signature/ds:Object/etsi:QualifyingProperties", getPrefix2NamespaceMap(), false);
}
use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method invalidXmlFragmentForSigPolicyQualifier.
@Test
public void invalidXmlFragmentForSigPolicyQualifier() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:exception");
mock.expectedMessageCount(1);
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = (XAdESSignatureProperties) endpoint.getProperties();
// end tag is not correct
props.setSigPolicyQualifiers(Collections.singletonList("<SigPolicyQualifier>wrong XML fragment<SigPolicyQualifier>"));
sendBody("direct:enveloping", payload, Collections.<String, Object>emptyMap());
assertMockEndpointsSatisfied();
checkThrownException(mock, XmlSignatureException.class, "The XAdES confguration is invalid. The list of the signatue policy qualifiers contains the invalid entry '<SigPolicyQualifier>wrong XML fragment<SigPolicyQualifier>'." + " An entry must either be a text or an XML fragment with the root element 'SigPolicyQualifier' with the namespace 'http://uri.etsi.org/01903/v1.3.2#'.", null);
}
use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method noSigningTime.
@Test
public void noSigningTime() throws Exception {
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = (XAdESSignatureProperties) endpoint.getProperties();
props.setAddSigningTime(false);
Document doc = testEnveloping();
Map<String, String> prefix2Namespace = getPrefix2NamespaceMap();
String pathToSignatureProperties = getPathToSignatureProperties();
checkNode(doc, pathToSignatureProperties + "etsi:SigningTime", prefix2Namespace, false);
}
use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method invalidNamespaceForTheRootElementInXmlFragmentForSigPolicyQualifier.
@Test
public void invalidNamespaceForTheRootElementInXmlFragmentForSigPolicyQualifier() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:exception");
mock.expectedMessageCount(1);
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = (XAdESSignatureProperties) endpoint.getProperties();
props.setSigPolicyQualifiers(Collections.singletonList("<SigPolicyQualifier xmlns=\"http://invalid.com\">XML fragment with wrong namespace for root element</SigPolicyQualifier>"));
sendBody("direct:enveloping", payload, Collections.<String, Object>emptyMap());
assertMockEndpointsSatisfied();
checkThrownException(mock, XmlSignatureException.class, "The XAdES confguration is invalid. The root element 'SigPolicyQualifier' of the provided XML fragment " + "'<SigPolicyQualifier xmlns=\"http://invalid.com\">XML fragment with wrong namespace for root element</SigPolicyQualifier>' has the invalid namespace 'http://invalid.com'." + " The correct namespace is 'http://uri.etsi.org/01903/v1.3.2#'.", null);
}
use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method policyNone.
@Test
public void policyNone() throws Exception {
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = (XAdESSignatureProperties) endpoint.getProperties();
props.setSignaturePolicy(XAdESSignatureProperties.SIG_POLICY_NONE);
Document doc = testEnveloping();
String pathToSignatureProperties = getPathToSignatureProperties();
checkNode(doc, pathToSignatureProperties + "etsi:SignaturePolicyIdentifier", getPrefix2NamespaceMap(), false);
}
Aggregations