Class SecretLeaseEventPublisher

java.lang.Object
org.springframework.vault.core.lease.SecretLeaseEventPublisher
All Implemented Interfaces:
InitializingBean
Direct Known Subclasses:
SecretLeaseContainer

public class SecretLeaseEventPublisher extends Object implements InitializingBean
Publisher for SecretLeaseEvents.

This publisher dispatches events to LeaseListener and LeaseErrorListener. Instances are thread-safe once initialized.

Author:
Mark Paluch
See Also:
  • Constructor Details

    • SecretLeaseEventPublisher

      public SecretLeaseEventPublisher()
  • Method Details

    • addLeaseListener

      public void addLeaseListener(LeaseListener listener)
      Add a LeaseListener to the container. The listener starts receiving events as soon as possible.
      Parameters:
      listener - lease listener, must not be null.
    • removeLeaseListener

      public void removeLeaseListener(LeaseListener listener)
      Remove a LeaseListener.
      Parameters:
      listener - must not be null.
    • addErrorListener

      public void addErrorListener(LeaseErrorListener listener)
      Add a LeaseErrorListener to the container. The listener starts receiving events as soon as possible.
      Parameters:
      listener - lease listener, must not be null.
    • removeLeaseErrorListener

      public void removeLeaseErrorListener(LeaseErrorListener listener)
      Parameters:
      listener - must not be null.
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface InitializingBean
    • onSecretsObtained

      protected void onSecretsObtained(RequestedSecret requestedSecret, Lease lease, Map<String,Object> body)
      Hook method called when secrets were obtained. The default implementation is to notify LeaseListener. 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 notify LeaseListener. 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

      protected void onSecretsNotFound(RequestedSecret requestedSecret)
      Hook method called when secrets were not found. The default implementation is to notify LeaseListener. Implementations can override this method in subclasses.
      Parameters:
      requestedSecret - must not be null.
      See Also:
    • onAfterLeaseRenewed

      protected void onAfterLeaseRenewed(RequestedSecret requestedSecret, Lease lease)
      Hook method called when a Lease is renewed. The default implementation is to notify LeaseListener. Implementations can override this method in subclasses.
      Parameters:
      requestedSecret - must not be null.
      lease - must not be null.
      See Also:
    • onBeforeLeaseRevocation

      protected void onBeforeLeaseRevocation(RequestedSecret requestedSecret, Lease lease)
      Hook method called before triggering revocation for a Lease. The default implementation is to notify LeaseListener. Implementations can override this method in subclasses.
      Parameters:
      requestedSecret - must not be null.
      lease - must not be null.
      See Also:
    • onAfterLeaseRevocation

      protected void onAfterLeaseRevocation(RequestedSecret requestedSecret, Lease lease)
      Hook method called after triggering revocation for a Lease. The default implementation is to notify LeaseListener. Implementations can override this method in subclasses.
      Parameters:
      requestedSecret - must not be null.
      lease - must not be null.
      See Also:
    • onLeaseExpired

      protected void onLeaseExpired(RequestedSecret requestedSecret, Lease lease)
      Hook method called when a Lease expires. The default implementation is to notify LeaseListener. Implementations can override this method in subclasses.
      Parameters:
      requestedSecret - must not be null.
      lease - must not be null.
      See Also:
    • onError

      protected void onError(RequestedSecret requestedSecret, @Nullable Lease lease, Exception e)
      Hook method called when an error occurred during secret retrieval, lease renewal, and other Vault interactions. The default implementation is to notify LeaseErrorListener. Implementations can override this method in subclasses.
      Parameters:
      requestedSecret - must not be null.
      lease - may be null
      e - the causing exception.
      See Also: