Class BasicConfiguration

java.lang.Object
de.iip_ecosphere.platform.transport.spring.BasicConfiguration

public class BasicConfiguration extends Object
Defines a basic TLS-prepared configuration for binders.
Author:
Holger Eichelberger, SSE
  • Field Details

    • host

      private String host
    • port

      private int port
    • keystoreKey

      private String keystoreKey
    • keyAlias

      private String keyAlias
    • hostnameVerification

      private boolean hostnameVerification
    • authenticationKey

      private String authenticationKey
  • Constructor Details

    • BasicConfiguration

      public BasicConfiguration()
  • Method Details

    • getHost

      public String getHost()
      Returns the broker host name.
      Returns:
      the broker host name
    • getPort

      public int getPort()
      Returns the broker port number.
      Returns:
      the broker port number to connect to
    • getKeystoreKey

      public String getKeystoreKey()
      Returns the optional identity key for the TLS keystore.
      Returns:
      the identity key, null for none
    • getKeyAlias

      public String getKeyAlias()
      Returns the alias denoting the key to use.
      Returns:
      the alias, may be null for none/first match
    • getHostnameVerification

      public boolean getHostnameVerification()
      Returns whether TLS hostname verification shall be performed.
      Returns:
      false for no verification (default), true else
    • getAuthenticationKey

      public String getAuthenticationKey()
      Returns the IdentityStore key for the authentication, usually a password token.
      Returns:
      the identity store key, may be empty or null
    • setHost

      public void setHost(String host)
      Changes the broker host name. [required by Spring]
      Parameters:
      host - the broker host name
    • setPort

      public void setPort(int port)
      Defines the broker port number. [required by Spring]
      Parameters:
      port - the broker port number to connect to
    • setKeystoreKey

      public void setKeystoreKey(String keystoreKey)
      Changes the optional identity key for the TLS keystore.
      Parameters:
      keystoreKey - the identity key, null for none
    • setKeyAlias

      public void setKeyAlias(String alias)
      Returns the alias denoting the key to use.
      Parameters:
      alias - the alias, may be null for none/first match
    • setHostnameVerification

      public void setHostnameVerification(boolean hostnameVerification)
      Returns whether TLS hostname verification shall be performed.
      Parameters:
      hostnameVerification - false for no verification, true else
    • setAuthenticationKey

      public void setAuthenticationKey(String authenticationKey)
      Returns the IdentityStore key for the authentication, usually a password token. [requred by SnakeYaml]
      Parameters:
      authenticationKey - the identity store key, may be empty or null
    • toTransportParameter

      public de.iip_ecosphere.platform.transport.connectors.TransportParameter toTransportParameter()
      Turns the actual configuration into a TransportParameter instance. When overriding this method, please consider createTransportParameterBuilder() as default implementation for transferring the settings in this class.
      Returns:
      the transport parameter instance
    • createTransportParameterBuilder

      protected de.iip_ecosphere.platform.transport.connectors.TransportParameter.TransportParameterBuilder createTransportParameterBuilder()
      Turns the information in this class into a default transport parameter builder.
      Returns:
      builder
    • useTls

      public boolean useTls()
      Returns whether the connector shall use TLS.
      Returns:
      true for TLS enabled, false else
    • createTrustManagerFactory

      public TrustManagerFactory createTrustManagerFactory() throws IOException
      Helper method to determine a trust manager factory. Apply only if useTls() returns true.
      Returns:
      the trust manager factory
      Throws:
      IOException - if creating the context or obtaining key information fails
    • createTlsContext

      public SSLContext createTlsContext() throws IOException
      Helper method to determine a SSL/TLS context. Apply only if useTls() returns true. Relies on IdentityStore#createTlsContext(String, String, String...) if TransportParameter.getKeystoreKey() is given, else on SslUtils.createTlsContext(java.io.File, String, String).
      Returns:
      the TLS context
      Throws:
      IOException - if creating the context or obtaining key information fails