Class SslStoreParams

java.lang.Object
com.illumon.util.SslStoreParams

public class SslStoreParams
extends Object
Helper class to allow the retrieval of SSL-related parameters. SslDefaultStore always uses the same properties to retrieve this information. Instead, this class allows the properties to be specified, either with a property prefix, or individually. It uses Configuration to retrieve these property values.
  • Method Summary

    Modifier and Type Method Description
    static String getKeyStorePath​(com.fishlib.configuration.Configuration configuration, String propertyName)
    Retrieve the key store path using the supplied property name.
    static String getKeyStorePathFromPrefix​(com.fishlib.configuration.Configuration configuration, String prefix)
    Retrieve the key store path based on the supplied property name prefix.
    static String getPassphrase​(com.fishlib.configuration.Configuration configuration, String environmentVariable, String filePropertyName, String propertyName)
    Retrieve the passphrase based on the supplied property names, using PropertyRetriever.getProperty(Configuration, String, String, String, String, boolean).
    static String getPassphraseFromPrefix​(com.fishlib.configuration.Configuration configuration, String prefix)
    Retrieve the passphrase based on the supplied property name prefix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getKeyStorePath

      public static String getKeyStorePath​(@NotNull com.fishlib.configuration.Configuration configuration, @Nullable String propertyName)
      Retrieve the key store path using the supplied property name.
      Parameters:
      configuration - the Configuration instance to use
      propertyName - the property name. If no value is supplied, then the property DEFAULT_KEYSTORE_PATH_PROPERTY_NAME is used.
      Returns:
      the key store path
    • getKeyStorePathFromPrefix

      public static String getKeyStorePathFromPrefix​(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull String prefix)
      Retrieve the key store path based on the supplied property name prefix. A dot and DEFAULT_KEYSTORE_PATH_PROPERTY_NAME will be appended to the prefix to look up the property.
      Parameters:
      configuration - the Configuration instance to use
      prefix - the property name prefix to which DEFAULT_KEYSTORE_PATH_PROPERTY_NAME will be added
      Returns:
      the key store path
    • getPassphrase

      public static String getPassphrase​(@NotNull com.fishlib.configuration.Configuration configuration, @Nullable String environmentVariable, @Nullable String filePropertyName, @Nullable String propertyName)
      Retrieve the passphrase based on the supplied property names, using PropertyRetriever.getProperty(Configuration, String, String, String, String, boolean). The passphrase must be base-64 encoded and will be decoded before being returned. The order of attempted retrieval is environment variable, file, property.
      Parameters:
      configuration - the Configuration instance to use
      environmentVariable - the name of an environment variable which contains the passphrase. If no value is supplied, the environment variable DEFAULT_PASSPHRASE_ENVIRONMENT_VARIABLE will be used.
      filePropertyName - the property name to retrieve the name of a file containing the passphrase. If no value is supplied, then the property DEFAULT_PASSPHRASE_FILE_PROPERTY_NAME will be used.
      propertyName - the property name to retrieve the passphrase. If no value is supplied, then the property DEFAULT_PASSPHRASE_PROPERTY_NAME is used.
      Returns:
      the passphrase
    • getPassphraseFromPrefix

      public static String getPassphraseFromPrefix​(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull String prefix)
      Retrieve the passphrase based on the supplied property name prefix. The environment variable name will be generated by appending an underscore and DEFAULT_PASSPHRASE_ENVIRONMENT_VARIABLE to the prefix after it is converted to uppercase. The file property will be generated by appending a dot and DEFAULT_PASSPHRASE_FILE_PROPERTY_NAME to the prefix. The passphrase property will be generated by appending a dot and DEFAULT_PASSPHRASE_PROPERTY_NAME to the prefix. Then PropertyRetriever.getProperty(Configuration, String, String, String, String, boolean) will be called to retrieve the value. The order of attempted retrieval is environment variable, file, property.
      Parameters:
      configuration - the Configuration instance to use
      prefix - the property name prefix
      Returns:
      the passphrase