This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit f7a41c1ade68cced5ac22ed3660c82ecef61486b Author: Nicolas Filotto <nfilo...@talend.com> AuthorDate: Thu Mar 17 18:46:59 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-crypto --- .../resources/org/apache/camel/component/crypto/crypto.json | 6 ++++++ components/camel-crypto/src/main/docs/crypto-component.adoc | 5 ++++- .../apache/camel/component/crypto/DigitalSignatureConstants.java | 9 +++++++++ .../apache/camel/component/crypto/DigitalSignatureEndpoint.java | 3 ++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/components/camel-crypto/src/generated/resources/org/apache/camel/component/crypto/crypto.json b/components/camel-crypto/src/generated/resources/org/apache/camel/component/crypto/crypto.json index 2405e57..2245c27 100644 --- a/components/camel-crypto/src/generated/resources/org/apache/camel/component/crypto/crypto.json +++ b/components/camel-crypto/src/generated/resources/org/apache/camel/component/crypto/crypto.json @@ -44,6 +44,12 @@ "secureRandom": { "kind": "property", "displayName": "Secure Random", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.security.SecureRandom", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.crypto.DigitalSignatureConfiguration", "configurationField": "configuration", "description": "Set the SecureRandom used to initialize the Signature service" }, "password": { "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.crypto.DigitalSignatureConfiguration", "configurationField": "configuration", "description": "Sets the password used to access an aliased PrivateKey in the KeyStore." } }, + "headers": { + "CamelSignaturePrivateKey": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.security.PrivateKey", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The PrivateKey that should be used to sign the message" }, + "CamelSignaturePublicKeyOrCert": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Certificate or PublicKey", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Certificate or PublicKey that should be used to verify the signature" }, + "CamelSignatureKeyStoreAlias": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The alias used to query the KeyStore for keys and Certificates to be\n used in signing and verifying exchanges" }, + "CamelSignatureKeyStorePassword": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "char[]", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The password used to access an aliased PrivateKey in the KeyStore." } + }, "properties": { "cryptoOperation": { "kind": "path", "displayName": "Crypto Operation", "group": "producer", "label": "", "required": true, "type": "object", "javaType": "org.apache.camel.component.crypto.CryptoOperation", "enum": [ "sign", "verify" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.crypto.DigitalSignatureConfiguration", "configurationField": "configuration", "description": "Set the Crypto operation f [...] "name": { "kind": "path", "displayName": "Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.crypto.DigitalSignatureConfiguration", "configurationField": "configuration", "description": "The logical name of this operation." }, diff --git a/components/camel-crypto/src/main/docs/crypto-component.adoc b/components/camel-crypto/src/main/docs/crypto-component.adoc index 3ff4975..9e85d7e 100644 --- a/components/camel-crypto/src/main/docs/crypto-component.adoc +++ b/components/camel-crypto/src/main/docs/crypto-component.adoc @@ -101,12 +101,15 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END == Using === Raw keys -The most basic way to way to sign and verify an exchange is with a +The most basic way to sign and verify an exchange is with a KeyPair as follows. The same can be achieved with the xref:manual::spring-xml-extensions.adoc[Spring diff --git a/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConstants.java b/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConstants.java index 0a02a63..d94677d 100644 --- a/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConstants.java +++ b/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConstants.java @@ -16,14 +16,23 @@ */ package org.apache.camel.component.crypto; +import org.apache.camel.spi.Metadata; + /** * <code>DigitalSignatureConstants</code> contains Constants for use as Message header keys. */ public final class DigitalSignatureConstants { + @Metadata(description = "The PrivateKey that should be used to sign the message", javaType = "java.security.PrivateKey") public static final String SIGNATURE_PRIVATE_KEY = "CamelSignaturePrivateKey"; + @Metadata(description = "The Certificate or PublicKey that should be used to verify the signature", + javaType = "Certificate or PublicKey") public static final String SIGNATURE_PUBLIC_KEY_OR_CERT = "CamelSignaturePublicKeyOrCert"; public static final String SIGNATURE = "CamelDigitalSignature"; + @Metadata(description = "The alias used to query the KeyStore for keys and Certificates to be\n" + + " used in signing and verifying exchanges", + javaType = "String") public static final String KEYSTORE_ALIAS = "CamelSignatureKeyStoreAlias"; + @Metadata(description = "The password used to access an aliased PrivateKey in the KeyStore.", javaType = "char[]") public static final String KEYSTORE_PASSWORD = "CamelSignatureKeyStorePassword"; private DigitalSignatureConstants() { diff --git a/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureEndpoint.java b/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureEndpoint.java index 69ce2e7..664015c 100644 --- a/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureEndpoint.java +++ b/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureEndpoint.java @@ -36,7 +36,8 @@ import org.apache.camel.support.DefaultEndpoint; * Sign and verify exchanges using the Signature Service of the Java Cryptographic Extension (JCE). */ @UriEndpoint(firstVersion = "2.3.0", scheme = "crypto", title = "Crypto (JCE)", syntax = "crypto:cryptoOperation:name", - producerOnly = true, category = { Category.SECURITY, Category.TRANSFORMATION }) + producerOnly = true, category = { Category.SECURITY, Category.TRANSFORMATION }, + headersClass = DigitalSignatureConstants.class) public class DigitalSignatureEndpoint extends DefaultEndpoint { @UriParam private DigitalSignatureConfiguration configuration;