Package com.illumon.util
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 StringgetKeyStorePath(com.fishlib.configuration.Configuration configuration, String propertyName)Retrieve the key store path using the supplied property name.static StringgetKeyStorePathFromPrefix(com.fishlib.configuration.Configuration configuration, String prefix)Retrieve the key store path based on the supplied property name prefix.static StringgetPassphrase(com.fishlib.configuration.Configuration configuration, String environmentVariable, String filePropertyName, String propertyName)Retrieve the passphrase based on the supplied property names, usingPropertyRetriever.getProperty(Configuration, String, String, String, String, boolean).static StringgetPassphraseFromPrefix(com.fishlib.configuration.Configuration configuration, String prefix)Retrieve the passphrase based on the supplied property name prefix.
-
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 usepropertyName- the property name. If no value is supplied, then the propertyDEFAULT_KEYSTORE_PATH_PROPERTY_NAMEis 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 andDEFAULT_KEYSTORE_PATH_PROPERTY_NAMEwill be appended to the prefix to look up the property.- Parameters:
configuration- the Configuration instance to useprefix- the property name prefix to whichDEFAULT_KEYSTORE_PATH_PROPERTY_NAMEwill 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, usingPropertyRetriever.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 useenvironmentVariable- the name of an environment variable which contains the passphrase. If no value is supplied, the environment variableDEFAULT_PASSPHRASE_ENVIRONMENT_VARIABLEwill be used.filePropertyName- the property name to retrieve the name of a file containing the passphrase. If no value is supplied, then the propertyDEFAULT_PASSPHRASE_FILE_PROPERTY_NAMEwill be used.propertyName- the property name to retrieve the passphrase. If no value is supplied, then the propertyDEFAULT_PASSPHRASE_PROPERTY_NAMEis 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 andDEFAULT_PASSPHRASE_ENVIRONMENT_VARIABLEto the prefix after it is converted to uppercase. The file property will be generated by appending a dot andDEFAULT_PASSPHRASE_FILE_PROPERTY_NAMEto the prefix. The passphrase property will be generated by appending a dot andDEFAULT_PASSPHRASE_PROPERTY_NAMEto the prefix. ThenPropertyRetriever.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 useprefix- the property name prefix- Returns:
- the passphrase
-