Class SecureVaultEnvironmentPostProcessor
java.lang.Object
com.broadleafcommerce.securevault.processor.SecureVaultEnvironmentPostProcessor
- All Implemented Interfaces:
org.springframework.boot.env.EnvironmentPostProcessor
@Order
public abstract class SecureVaultEnvironmentPostProcessor
extends Object
implements org.springframework.boot.env.EnvironmentPostProcessor
An abstract class that allows an implementation to load properties from a secure vault.
In the case that the secure vault is not accessible, you can provide a fallback property file to
use. In your `application.yaml` file define the following property:
broadleaf: securevault: fallback-property-path: /path/to/your/fallback.properties
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addFallbackPropertiesToEnvironment
(org.springframework.core.env.ConfigurableEnvironment environment, String filePath) Read the fallback properties from the filesystem and load them into the environmentprotected org.springframework.core.env.MapPropertySource
filterPropertySource
(org.springframework.core.env.MapPropertySource source) In the case that the fallback properties are used, we only want to add the requested target properties.protected String
getFallbackPropertyPath
(org.springframework.core.env.ConfigurableEnvironment environment) Gets the path to the fallback property fileabstract SecureVaultService
getSecureVaultService
(org.springframework.core.env.ConfigurableEnvironment environment) An abstract method that allows an implementation to specify what secure vault service to use.An abstract method that allows an implementation to specify what properties are being requested from the secure vault.protected void
loadPropertiesFromSecureVault
(org.springframework.core.env.ConfigurableEnvironment environment) Attempts to load properties from the secure vault.void
postProcessEnvironment
(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application)
-
Field Details
-
SECURE_VAULT_FALLBACK_PROPERTY_PATH
- See Also:
-
-
Constructor Details
-
SecureVaultEnvironmentPostProcessor
public SecureVaultEnvironmentPostProcessor()
-
-
Method Details
-
getSecureVaultService
public abstract SecureVaultService getSecureVaultService(org.springframework.core.env.ConfigurableEnvironment environment) An abstract method that allows an implementation to specify what secure vault service to use.- Returns:
- the secure vault service to use
- See Also:
-
getTargetProperties
An abstract method that allows an implementation to specify what properties are being requested from the secure vault. For example:@Override public List
getTargetProperties() { return Arrays.asList("broadleaf.some.property", "broadleaf.some.other.property"); } - Returns:
- the list of properties to attempt to pull from the vault
-
postProcessEnvironment
public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application) - Specified by:
postProcessEnvironment
in interfaceorg.springframework.boot.env.EnvironmentPostProcessor
-
loadPropertiesFromSecureVault
protected void loadPropertiesFromSecureVault(org.springframework.core.env.ConfigurableEnvironment environment) Attempts to load properties from the secure vault. In the event of an error, a message is logged but the startup execution is not halted. -
getFallbackPropertyPath
protected String getFallbackPropertyPath(org.springframework.core.env.ConfigurableEnvironment environment) Gets the path to the fallback property file- Returns:
- the path to the fallback property file
-
addFallbackPropertiesToEnvironment
protected void addFallbackPropertiesToEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, String filePath) Read the fallback properties from the filesystem and load them into the environment -
filterPropertySource
protected org.springframework.core.env.MapPropertySource filterPropertySource(org.springframework.core.env.MapPropertySource source) In the case that the fallback properties are used, we only want to add the requested target properties.
-