Class LeaseAwareVaultPropertySource
java.lang.Object
org.springframework.core.env.PropertySource<T>
org.springframework.core.env.EnumerablePropertySource<VaultOperations>
org.springframework.vault.core.env.LeaseAwareVaultPropertySource
PropertySource that requests renewable secrets from
SecretLeaseContainer. Leases are renewed or rotated, depeding on
RequestedSecret.getMode(). Contents of this PropertySource is updated
from background threads and the content is mutable. Expiration and revocation removes
properties.- Author:
- Mark Paluch
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.core.env.PropertySource
PropertySource.StubPropertySource -
Field Summary
Fields inherited from class org.springframework.core.env.PropertySource
name, source -
Constructor Summary
ConstructorsConstructorDescriptionLeaseAwareVaultPropertySource(String name, SecretLeaseContainer secretLeaseContainer, RequestedSecret requestedSecret) LeaseAwareVaultPropertySource(String name, SecretLeaseContainer secretLeaseContainer, RequestedSecret requestedSecret, PropertyTransformer propertyTransformer) LeaseAwareVaultPropertySource(String name, SecretLeaseContainer secretLeaseContainer, RequestedSecret requestedSecret, PropertyTransformer propertyTransformer, boolean ignoreSecretNotFound) LeaseAwareVaultPropertySource(SecretLeaseContainer secretLeaseContainer, RequestedSecret requestedSecret) -
Method Summary
Modifier and TypeMethodDescriptiondoTransformProperties(Map<String, Object> properties) Hook method to transform properties usingPropertyTransformer.flattenMap(Map<String, Object> data) Utility method converting aString/Objectmap to a flatString/Objectmap.getProperty(String name) String[]protected voidhandleLeaseErrorEvent(SecretLeaseEvent leaseEvent, Exception exception) Hook method to handle aSecretLeaseEventerrors.protected voidhandleLeaseEvent(SecretLeaseEvent leaseEvent, Map<String, Object> properties) Hook method to handle aSecretLeaseEvent.Methods inherited from class org.springframework.core.env.EnumerablePropertySource
containsProperty
-
Constructor Details
-
LeaseAwareVaultPropertySource
public LeaseAwareVaultPropertySource(SecretLeaseContainer secretLeaseContainer, RequestedSecret requestedSecret) Create a newLeaseAwareVaultPropertySourcegiven aSecretLeaseContainerandRequestedSecret. This property source requests the secret upon initialization and receives secrets once they are emitted through events published bySecretLeaseContainer.- Parameters:
secretLeaseContainer- must not be null.requestedSecret- must not be null.
-
LeaseAwareVaultPropertySource
public LeaseAwareVaultPropertySource(String name, SecretLeaseContainer secretLeaseContainer, RequestedSecret requestedSecret) Create a newLeaseAwareVaultPropertySourcegiven aname,SecretLeaseContainerandRequestedSecret. This property source requests the secret upon initialization and receives secrets once they are emitted through events published bySecretLeaseContainer.- Parameters:
name- name of the property source, must not be null.secretLeaseContainer- must not be null.requestedSecret- must not be null.
-
LeaseAwareVaultPropertySource
public LeaseAwareVaultPropertySource(String name, SecretLeaseContainer secretLeaseContainer, RequestedSecret requestedSecret, PropertyTransformer propertyTransformer) Create a newLeaseAwareVaultPropertySourcegiven aname,SecretLeaseContainerandRequestedSecret. This property source requests the secret upon initialization and receives secrets once they are emitted through events published bySecretLeaseContainer.- Parameters:
name- name of the property source, must not be null.secretLeaseContainer- must not be null.requestedSecret- must not be null.propertyTransformer- object to transform properties.- See Also:
-
LeaseAwareVaultPropertySource
public LeaseAwareVaultPropertySource(String name, SecretLeaseContainer secretLeaseContainer, RequestedSecret requestedSecret, PropertyTransformer propertyTransformer, boolean ignoreSecretNotFound) Create a newLeaseAwareVaultPropertySourcegiven aname,SecretLeaseContainerandRequestedSecret. This property source requests the secret upon initialization and receives secrets once they are emitted through events published bySecretLeaseContainer.- Parameters:
name- name of the property source, must not be null.secretLeaseContainer- must not be null.requestedSecret- must not be null.propertyTransformer- object to transform properties.ignoreSecretNotFound- indicate if failure to find a secret atpathshould be ignored.- Since:
- 2.2
- See Also:
-
-
Method Details
-
getRequestedSecret
-
getProperty
- Specified by:
getPropertyin classPropertySource<VaultOperations>
-
getPropertyNames
- Specified by:
getPropertyNamesin classEnumerablePropertySource<VaultOperations>
-
handleLeaseEvent
Hook method to handle aSecretLeaseEvent.- Parameters:
leaseEvent- must not be null.properties- reference to property storage of this property source.
-
handleLeaseErrorEvent
Hook method to handle aSecretLeaseEventerrors.- Parameters:
leaseEvent- must not be null.exception- offending exception.
-
doTransformProperties
Hook method to transform properties usingPropertyTransformer.- Parameters:
properties- must not be null.- Returns:
- the transformed properties.
-
flattenMap
Utility method converting aString/Objectmap to a flatString/Objectmap. Nested objects are represented with property path keys.- Parameters:
data- the map- Returns:
- the flattened map.
- Since:
- 2.0
-