Class SecretLeaseEventPublisher
java.lang.Object
org.springframework.vault.core.lease.SecretLeaseEventPublisher
- All Implemented Interfaces:
InitializingBean
- Direct Known Subclasses:
SecretLeaseContainer
Publisher for
SecretLeaseEvent
s.
This publisher dispatches events to LeaseListener
and
LeaseErrorListener
. Instances are thread-safe once initialized
.
- Author:
- Mark Paluch
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
SimpleLeaseErrorListener
implementation to log errors. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addErrorListener
(LeaseErrorListener listener) Add aLeaseErrorListener
to the container.void
addLeaseListener
(LeaseListener listener) Add aLeaseListener
to the container.void
protected void
onAfterLeaseRenewed
(RequestedSecret requestedSecret, Lease lease) Hook method called when aLease
is renewed.protected void
onAfterLeaseRevocation
(RequestedSecret requestedSecret, Lease lease) Hook method called after triggering revocation for aLease
.protected void
onBeforeLeaseRevocation
(RequestedSecret requestedSecret, Lease lease) Hook method called before triggering revocation for aLease
.protected void
onError
(RequestedSecret requestedSecret, Lease lease, Exception e) Hook method called when an error occurred during secret retrieval, lease renewal, and other Vault interactions.protected void
onLeaseExpired
(RequestedSecret requestedSecret, Lease lease) Hook method called when aLease
expires.protected void
onSecretsNotFound
(RequestedSecret requestedSecret) Hook method called when secrets were not found.protected void
onSecretsObtained
(RequestedSecret requestedSecret, Lease lease, Map<String, Object> body) Hook method called when secrets were obtained.protected void
onSecretsRotated
(RequestedSecret requestedSecret, Lease previousLease, Lease lease, Map<String, Object> body) Hook method called when secrets were rotated.void
removeLeaseErrorListener
(LeaseErrorListener listener) Remove aLeaseErrorListener
.void
removeLeaseListener
(LeaseListener listener) Remove aLeaseListener
.
-
Constructor Details
-
SecretLeaseEventPublisher
public SecretLeaseEventPublisher()
-
-
Method Details
-
addLeaseListener
Add aLeaseListener
to 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 aLeaseErrorListener
to 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:
afterPropertiesSet
in 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 aLease
is 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 aLease
expires. 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:
-