Package com.illumon.util
Class SslStoreParams
java.lang.Object
com.illumon.util.SslStoreParams
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 TypeMethodDescriptionstatic 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) static StringgetPassphrase(com.fishlib.configuration.Configuration configuration, String environmentVariable, String filePropertyName, String propertyName, boolean base64Encoded) 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) CallsgetPassphraseFromPrefix(Configuration, String, boolean)withtrueas the last parameter in order to retrieve a base64 encoded passphrase.static StringgetPassphraseFromPrefix(com.fishlib.configuration.Configuration configuration, String prefix, boolean base64Encoded) 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) CallsgetPassphrase(Configuration, String, String, String, boolean). The last boolean parameter denotes whether the passphrase is base64 encoded, and is obtained by checking the value of the configuration propertyDEFAULT_PASSPHRASE_BASE64_PROPERTY_NAME, defaulting totrue.- 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
-
getPassphrase
public static String getPassphrase(@NotNull com.fishlib.configuration.Configuration configuration, @Nullable String environmentVariable, @Nullable String filePropertyName, @Nullable String propertyName, boolean base64Encoded) Retrieve the passphrase based on the supplied property names, usingPropertyRetriever.getProperty(Configuration, String, String, String, String, boolean). 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.base64Encoded- if true, the passphrase will be base64 decoded and returned- Returns:
- the passphrase
-
getPassphraseFromPrefix
public static String getPassphraseFromPrefix(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull String prefix) CallsgetPassphraseFromPrefix(Configuration, String, boolean)withtrueas the last parameter in order to retrieve a base64 encoded passphrase.- Parameters:
configuration- the Configuration instance to useprefix- the property name prefix- Returns:
- the passphrase
- See Also:
-
getPassphraseFromPrefix
public static String getPassphraseFromPrefix(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull String prefix, boolean base64Encoded) Retrieve the passphrase based on the supplied property name prefix. The environment variable name will be generated by concatenating the prefix, an underscore, and the value ofDEFAULT_PASSPHRASE_ENVIRONMENT_VARIABLE, and converting that to uppercase. The file property will be generated by appending a dot and the value ofDEFAULT_PASSPHRASE_FILE_PROPERTY_NAMEto the prefix. The passphrase property will be generated by appending a dot and value ofDEFAULT_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. Ifbase64Encodedis true, then the passphrase is assumed to be base64 encoded and the decoded value will be returned.- Parameters:
configuration- the Configuration instance to useprefix- the property name prefixbase64Encoded- if true, the passphrase will be base64 decoded and returned- Returns:
- the passphrase
-