Class SecretLeaseEventPublisher
java.lang.Object
org.springframework.vault.core.lease.SecretLeaseEventPublisher
- All Implemented Interfaces:
InitializingBean
- Direct Known Subclasses:
SecretLeaseContainer
Publisher for
SecretLeaseEvents.
This publisher dispatches events to LeaseListener and
LeaseErrorListener. Instances are thread-safe once initialized.
- Author:
- Mark Paluch
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSimpleLeaseErrorListenerimplementation to log errors. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddErrorListener(LeaseErrorListener listener) Add aLeaseErrorListenerto the container.voidaddLeaseListener(LeaseListener listener) Add aLeaseListenerto the container.voidprotected voidonAfterLeaseRenewed(RequestedSecret requestedSecret, Lease lease) Hook method called when aLeaseis renewed.protected voidonAfterLeaseRevocation(RequestedSecret requestedSecret, Lease lease) Hook method called after triggering revocation for aLease.protected voidonBeforeLeaseRevocation(RequestedSecret requestedSecret, Lease lease) Hook method called before triggering revocation for aLease.protected voidonError(RequestedSecret requestedSecret, Lease lease, Exception e) Hook method called when an error occurred during secret retrieval, lease renewal, and other Vault interactions.protected voidonLeaseExpired(RequestedSecret requestedSecret, Lease lease) Hook method called when aLeaseexpires.protected voidonSecretsNotFound(RequestedSecret requestedSecret) Hook method called when secrets were not found.protected voidonSecretsObtained(RequestedSecret requestedSecret, Lease lease, Map<String, Object> body) Hook method called when secrets were obtained.protected voidonSecretsRotated(RequestedSecret requestedSecret, Lease previousLease, Lease lease, Map<String, Object> body) Hook method called when secrets were rotated.voidremoveLeaseErrorListener(LeaseErrorListener listener) Remove aLeaseErrorListener.voidremoveLeaseListener(LeaseListener listener) Remove aLeaseListener.
-
Constructor Details
-
SecretLeaseEventPublisher
public SecretLeaseEventPublisher()
-
-
Method Details
-
addLeaseListener
Add aLeaseListenerto the container. The listener starts receiving events as soon as possible.- Parameters:
listener- lease listener, must not be null.
-
removeLeaseListener
Remove aLeaseListener.- Parameters:
listener- must not be null.
-
addErrorListener
Add aLeaseErrorListenerto the container. The listener starts receiving events as soon as possible.- Parameters:
listener- lease listener, must not be null.
-
removeLeaseErrorListener
Remove aLeaseErrorListener.- Parameters:
listener- must not be null.
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
onSecretsObtained
protected void onSecretsObtained(RequestedSecret requestedSecret, Lease lease, Map<String, Object> body) Hook method called when secrets were obtained. The default implementation is to notifyLeaseListener. Implementations can override this method in subclasses.- Parameters:
requestedSecret- must not be null.lease- must not be null.body- must not be null.- See Also:
-
onSecretsRotated
protected void onSecretsRotated(RequestedSecret requestedSecret, Lease previousLease, Lease lease, Map<String, Object> body) Hook method called when secrets were rotated. The default implementation is to notifyLeaseListener. Implementations can override this method in subclasses.- Parameters:
requestedSecret- must not be null.lease- must not be null.body- must not be null.- Since:
- 2.3
- See Also:
-
onSecretsNotFound
Hook method called when secrets were not found. The default implementation is to notifyLeaseListener. Implementations can override this method in subclasses.- Parameters:
requestedSecret- must not be null.- See Also:
-
onAfterLeaseRenewed
Hook method called when aLeaseis renewed. The default implementation is to notifyLeaseListener. Implementations can override this method in subclasses.- Parameters:
requestedSecret- must not be null.lease- must not be null.- See Also:
-
onBeforeLeaseRevocation
Hook method called before triggering revocation for aLease. The default implementation is to notifyLeaseListener. Implementations can override this method in subclasses.- Parameters:
requestedSecret- must not be null.lease- must not be null.- See Also:
-
onAfterLeaseRevocation
Hook method called after triggering revocation for aLease. The default implementation is to notifyLeaseListener. Implementations can override this method in subclasses.- Parameters:
requestedSecret- must not be null.lease- must not be null.- See Also:
-
onLeaseExpired
Hook method called when aLeaseexpires. The default implementation is to notifyLeaseListener. Implementations can override this method in subclasses.- Parameters:
requestedSecret- must not be null.lease- must not be null.- See Also:
-
onError
Hook method called when an error occurred during secret retrieval, lease renewal, and other Vault interactions. The default implementation is to notifyLeaseErrorListener. Implementations can override this method in subclasses.- Parameters:
requestedSecret- must not be null.lease- may be nulle- the causing exception.- See Also:
-