Class DefaultKeyAccessor
- java.lang.Object
-
- javax.xml.crypto.KeySelector
-
- org.apache.camel.component.xmlsecurity.api.DefaultKeySelector
-
- org.apache.camel.component.xmlsecurity.api.DefaultKeyAccessor
-
- All Implemented Interfaces:
org.apache.camel.CamelContextAware,KeyAccessor
public class DefaultKeyAccessor extends DefaultKeySelector implements KeyAccessor
Accesses the public key from a key-store and returns a KeyInfo which contains the X.509 certificate chain corresponding to the public key.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.xml.crypto.KeySelector
KeySelector.Purpose
-
-
Constructor Summary
Constructors Constructor Description DefaultKeyAccessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyInfogetKeyInfo(org.apache.camel.Message message, Node messageBody, KeyInfoFactory factory)Returns the optional key info to be incorporated into the XML signature.KeySelectorgetKeySelector(org.apache.camel.Message message)Returns the key selector which determines the key for signing the XML document.StringgetProvider()voidsetProvider(String provider)-
Methods inherited from class org.apache.camel.component.xmlsecurity.api.DefaultKeySelector
getCamelContext, select, setAlias, setCamelContext, setKeyStore, setKeyStoreParameters, setPassword, setPassword
-
Methods inherited from class javax.xml.crypto.KeySelector
singletonKeySelector
-
-
-
-
Method Detail
-
getProvider
public String getProvider()
-
setProvider
public void setProvider(String provider)
-
getKeySelector
public KeySelector getKeySelector(org.apache.camel.Message message) throws Exception
Description copied from interface:KeyAccessorReturns the key selector which determines the key for signing the XML document. The method is called every time a XML document is signed. Ifnullis returned the XML signature generator will throw aXmlSignatureNoKeyException.- Specified by:
getKeySelectorin interfaceKeyAccessor- Parameters:
message- the incoming message, from which you can read headers to configure the key selector, for example, a header could contain a private key for the key selector- Returns:
- key selector, must not be
null - Throws:
Exception- if an error occurs
-
getKeyInfo
public KeyInfo getKeyInfo(org.apache.camel.Message message, Node messageBody, KeyInfoFactory factory) throws Exception
Description copied from interface:KeyAccessorReturns the optional key info to be incorporated into the XML signature. Ifnullis returned, no key info element is created. You can create a key info instance via the key info factory.This method will be called several times if several signatures shall be created for the XML document; for each signature a call is executed. This allows you to create different key info IDs.
- Specified by:
getKeyInfoin interfaceKeyAccessor- Parameters:
message- incoming message, from which you can read headers, for example, there could be a header which contains the public key or certificate for the key infomessageBody- the message body as DOM node. If the message body is plain text then the node will be a text node. If the message body is a XML document, then the node is the root element.factory- key info factory for creating the KeyInfo instance- Returns:
- key info, can be
null - Throws:
Exception- if an error occurs
-
-