public class DefaultXmlSignature2Message extends Object implements XmlSignature2Message
There are three output node search types supported: "Default", "ElementName", and "XPath". All these search types support enveloped XML signature or enveloping XML signature.
Default Output Node Search:
In the enveloping XML signature case, the message body is determined from a referenced Object element in the following way:
DOMStructure
.
<Signature>
<SignedInfo>
<Reference URI="#object"/>
<!-- further references possible but they must not point to an Object or Manifest containing an object reference -->
...
</SignedInfo>
<Object Id="object">
<!-- contains the DOM node which should be extracted to the message body -->
<Object>
<!-- further object elements possible which are not referenced-->
...
(<KeyInfo>)?
</Signature>
or the structure
<Signature>
<SignedInfo>
<Reference URI="#manifest"/>
<!-- further references are possible but they must not point to an Object or other manifest containing an object reference -->
...
</SignedInfo>
<Object >
<Manifest Id="manifest">
<Reference URI=#object/>
</Manifest>
</Objet>
<Object Id="object">
<!-- contains the DOM node which should be extracted to the message body -->
</Object>
<!-- further object elements possible which are not referenced -->
...
(<KeyInfo>)?
</Signature>
XmlSignature2Message.Input
Modifier and Type | Field and Description |
---|---|
static String |
OUTPUT_NODE_SEARCH_TYPE_DEFAULT
Search type 'Default' for determining the output node.
|
static String |
OUTPUT_NODE_SEARCH_TYPE_ELEMENT_NAME
Search type 'ElementName' for determining the output element.
|
static String |
OUTPUT_NODE_SEARCH_TYPE_XPATH
Search type 'XPath' for determining the output node.
|
Constructor and Description |
---|
DefaultXmlSignature2Message() |
Modifier and Type | Method and Description |
---|---|
protected void |
addManifestReferencedObjects(List<XMLObject> allObjects,
List<XMLObject> referencedObjects,
String manifestId) |
protected void |
checkSearchValueNotNull(XmlSignature2Message.Input input) |
protected void |
checkSearchValueOfType(Class<?> cl,
XmlSignature2Message.Input input) |
protected void |
checkStringSarchValueNotEmpty(String searchValue,
String outputNodeSearchType) |
protected DOMStructure |
getDomStructureForMessageBody(List<Reference> relevantReferences,
List<XMLObject> relevantObjects)
Returns the DOM structure which is transformed to a byte array and set to
the camel message body.
|
protected Node |
getNodeForMessageBodyInEnvelopingCase(XmlSignature2Message.Input input) |
protected String |
getNonEmptyStringSearchValue(XmlSignature2Message.Input input) |
protected List<XMLObject> |
getObjectsForMessageMapping(XmlSignature2Message.Input input)
Returns the objects which must be taken into account for the mapping to
the camel message.
|
protected Node |
getOutputElementViaLocalNameAndNamespace(XmlSignature2Message.Input input) |
protected Node |
getOutputNodeViaXPath(XmlSignature2Message.Input input) |
protected Manifest |
getReferencedManifest(List<XMLObject> objects,
String id) |
protected XMLObject |
getReferencedObject(List<XMLObject> objects,
String id) |
protected List<XMLObject> |
getReferencedSameDocumentObjects(List<Reference> relevantReferences,
List<XMLObject> relevantObjects) |
protected List<Reference> |
getReferencesForMessageMapping(XmlSignature2Message.Input input)
Returns the references whose referenced objects are taken into account
for the message body.
|
protected String |
getSameDocumentReferenceUri(Reference ref) |
protected boolean |
isEnveloping(XmlSignature2Message.Input input)
Checks whether the XML document has as root element the signature
element.
|
void |
mapToMessage(XmlSignature2Message.Input input,
org.apache.camel.Message output)
Maps the references and objects of an XML signature to the camel message.
|
protected Boolean |
omitXmlDeclaration(org.apache.camel.Message message,
XmlSignature2Message.Input input) |
protected void |
removeSignatureElements(Node node)
Removes the Signature elements from the document.
|
protected void |
transformNodeToByteArrayAndSetToOutputMessage(XmlSignature2Message.Input input,
org.apache.camel.Message output,
Node node) |
public static final String OUTPUT_NODE_SEARCH_TYPE_DEFAULT
public static final String OUTPUT_NODE_SEARCH_TYPE_ELEMENT_NAME
public static final String OUTPUT_NODE_SEARCH_TYPE_XPATH
XPathFilterParameterSpec
.public void mapToMessage(XmlSignature2Message.Input input, org.apache.camel.Message output) throws Exception
XmlSignature2Message
mapToMessage
in interface XmlSignature2Message
input
- inputoutput
- output messageException
protected void transformNodeToByteArrayAndSetToOutputMessage(XmlSignature2Message.Input input, org.apache.camel.Message output, Node node) throws TransformerFactoryConfigurationError, TransformerConfigurationException, TransformerException, IOException
protected Node getOutputNodeViaXPath(XmlSignature2Message.Input input) throws Exception
Exception
protected Node getOutputElementViaLocalNameAndNamespace(XmlSignature2Message.Input input) throws Exception
Exception
protected String getNonEmptyStringSearchValue(XmlSignature2Message.Input input) throws Exception
Exception
protected void checkSearchValueOfType(Class<?> cl, XmlSignature2Message.Input input) throws Exception
Exception
protected void checkStringSarchValueNotEmpty(String searchValue, String outputNodeSearchType) throws Exception
Exception
protected void checkSearchValueNotNull(XmlSignature2Message.Input input) throws Exception
Exception
protected Node getNodeForMessageBodyInEnvelopingCase(XmlSignature2Message.Input input) throws Exception
Exception
protected void removeSignatureElements(Node node)
doc
- documentprotected boolean isEnveloping(XmlSignature2Message.Input input) throws Exception
input
- XML signature inputtrue
if the root element of the xml signature
document is the signature element; otherwise false
Exception
protected Boolean omitXmlDeclaration(org.apache.camel.Message message, XmlSignature2Message.Input input)
protected List<Reference> getReferencesForMessageMapping(XmlSignature2Message.Input input) throws Exception
input
- references and objectsException
- if an error occursprotected List<XMLObject> getObjectsForMessageMapping(XmlSignature2Message.Input input) throws Exception
input
- references and objectsException
- if an error occursprotected DOMStructure getDomStructureForMessageBody(List<Reference> relevantReferences, List<XMLObject> relevantObjects) throws Exception
relevantReferences
- input from method
#getReferencesForMessageMapping(ReferencesAndObjects)
relevantObjects
- input from method
#getObjectsForMessageMapping(ReferencesAndObjects)
Exception
- if an error occursprotected List<XMLObject> getReferencedSameDocumentObjects(List<Reference> relevantReferences, List<XMLObject> relevantObjects)
protected void addManifestReferencedObjects(List<XMLObject> allObjects, List<XMLObject> referencedObjects, String manifestId)
Apache Camel