Skip to content

Commit

Permalink
Refactoring Coap component to use sslContextParameters for TLS certif…
Browse files Browse the repository at this point in the history
…icates
  • Loading branch information
coheigea committed May 2, 2019
1 parent 0799b2f commit 733ca39
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 202 deletions.
13 changes: 5 additions & 8 deletions components/camel-coap/src/main/docs/coap-component.adoc
Expand Up @@ -50,28 +50,25 @@ with the following path and query parameters:
|=== |===




==== Query Parameters (16 parameters): ==== Query Parameters (13 parameters):




[width="100%",cols="2,5,^1,2",options="header"] [width="100%",cols="2,5,^1,2",options="header"]
|=== |===
| Name | Description | Default | Type | Name | Description | Default | Type
| *alias* (common) | Sets the alias used to query the KeyStore for the private key and certificate. | | String | *alias* (common) | Sets the alias used to query the KeyStore for the private key and certificate. This parameter is used when we are enabling TLS with certificates on the service side, and similarly on the client side when TLS is used with certificates and client authentication. If the parameter is not specified then the default behavior is to use the first alias in the keystore that contains a key entry. This configuration parameter does not apply to configuring TLS via a Raw Public Key or a Pre-Shared Key. | | String
| *cipherSuites* (common) | Sets the cipherSuites String. This is a comma separated String of ciphersuites to configure. | | String | *cipherSuites* (common) | Sets the cipherSuites String. This is a comma separated String of ciphersuites to configure. If it is not specified, then it falls back to getting the ciphersuites from the sslContextParameters object. | | String
| *keystore* (common) | Sets the TLS key store. Alternatively, a KeyStoreParameters object can be configured instead. An alias and password should also be configured on the route definition. | | KeyStore | *clientAuthentication* (common) | Sets the configuration options for server-side client-authentication requirements. The value must be one of NONE, WANT, REQUIRE. If this value is not specified, then it falls back to checking the sslContextParameters.getServerParameters().getClientAuthentication() value. | | String
| *keyStoreParameters* (common) | The KeyStoreParameters object to use with TLS to configure the keystore. Alternatively, a keystore parameter can be directly configured instead. An alias and password should also be configured on the route definition. | | KeyStoreParameters
| *privateKey* (common) | Set the configured private key for use with Raw Public Key. | | PrivateKey | *privateKey* (common) | Set the configured private key for use with Raw Public Key. | | PrivateKey
| *pskStore* (common) | Set the PskStore to use for pre-shared key. | | PskStore | *pskStore* (common) | Set the PskStore to use for pre-shared key. | | PskStore
| *publicKey* (common) | Set the configured public key for use with Raw Public Key. | | PublicKey | *publicKey* (common) | Set the configured public key for use with Raw Public Key. | | PublicKey
| *sslContextParameters* (common) | Set the SSLContextParameters object for setting up TLS. This is required for coapstcp, and for coaps when we are using certificates for TLS (as opposed to RPK or PKS). | | SSLContextParameters
| *trustedRpkStore* (common) | Set the TrustedRpkStore to use to determine trust in raw public keys. | | TrustedRpkStore | *trustedRpkStore* (common) | Set the TrustedRpkStore to use to determine trust in raw public keys. | | TrustedRpkStore
| *truststore* (common) | Sets the TLS trust store. Alternatively, a trustStoreParameters object can be configured instead. All certificates in the truststore are used to establish trust. | | KeyStore
| *trustStoreParameters* (common) | The KeyStoreParameters object to use with TLS to configure the truststore. Alternatively, a truststore object can be directly configured instead. All certificates in the truststore are used to establish trust. | | KeyStoreParameters
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
| *coapMethodRestrict* (consumer) | Comma separated list of methods that the CoAP consumer will bind to. The default is to bind to all methods (DELETE, GET, POST, PUT). | | String | *coapMethodRestrict* (consumer) | Comma separated list of methods that the CoAP consumer will bind to. The default is to bind to all methods (DELETE, GET, POST, PUT). | | String
| *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler
| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern
| *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
| *password* (security) | Sets the password used to access an aliased PrivateKey in the KeyStore. | | String
|=== |===
// endpoint options: END // endpoint options: END
// spring-boot-auto-configure options: START // spring-boot-auto-configure options: START
Expand Down
Expand Up @@ -16,6 +16,7 @@
*/ */
package org.apache.camel.coap; package org.apache.camel.coap;


import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
Expand Down Expand Up @@ -55,7 +56,7 @@ public class CoAPComponent extends DefaultComponent implements RestConsumerFacto
public CoAPComponent() { public CoAPComponent() {
} }


public synchronized CoapServer getServer(int port, CoAPEndpoint endpoint) { public synchronized CoapServer getServer(int port, CoAPEndpoint endpoint) throws IOException {
CoapServer server = servers.get(port); CoapServer server = servers.get(port);
if (server == null && port == -1) { if (server == null && port == -1) {
server = getServer(DEFAULT_PORT, endpoint); server = getServer(DEFAULT_PORT, endpoint);
Expand Down

0 comments on commit 733ca39

Please sign in to comment.