Class LifecycleAwareSessionManagerSupport

java.lang.Object
org.springframework.vault.authentication.AuthenticationEventPublisher
org.springframework.vault.authentication.LifecycleAwareSessionManagerSupport
All Implemented Interfaces:
AuthenticationEventMulticaster
Direct Known Subclasses:
LifecycleAwareSessionManager, ReactiveLifecycleAwareSessionManager

public abstract class LifecycleAwareSessionManagerSupport extends AuthenticationEventPublisher
Support class to build Lifecycle-aware Session Manager implementations, defining common properties such as the TaskScheduler and LifecycleAwareSessionManagerSupport.RefreshTrigger. Typically used within the framework itself.

Not intended to be used directly.

Since:
2.0
Author:
Mark Paluch
  • Field Details

    • REFRESH_PERIOD_BEFORE_EXPIRY

      public static final int REFRESH_PERIOD_BEFORE_EXPIRY
      Refresh 5 seconds before the token expires.
      See Also:
    • logger

      protected final Log logger
      Logger available to subclasses.
  • Constructor Details

  • Method Details

    • isTokenSelfLookupEnabled

      protected boolean isTokenSelfLookupEnabled()
      Returns whether token self-lookup is enabled to augment VaultToken obtained from a ClientAuthentication. Self-lookup determines whether a token is renewable and its TTL. Self lookup is skipped for LoginToken. Self-lookup requests decrement token usage count by one. Skipped for LoginToken.

      Self-lookup for tokens without a permission to access auth/token/lookup-self will fail gracefully and continue without token renewal.

      Returns:
      true to enable self-lookup, false to disable self-lookup. Enabled by default.
    • setTokenSelfLookupEnabled

      public void setTokenSelfLookupEnabled(boolean tokenSelfLookupEnabled)
      Enables/disables token self-lookup. Self-lookup augments VaultToken obtained from a ClientAuthentication. Self-lookup determines whether a token is renewable and its TTL.
      Parameters:
      tokenSelfLookupEnabled - true to enable self-lookup, false to disable self-lookup. Enabled by default.
    • setLeaseStrategy

      public void setLeaseStrategy(LeaseStrategy leaseStrategy)
      Set the LeaseStrategy for lease renewal error handling.
      Parameters:
      leaseStrategy - the LeaseStrategy, must not be null.
      Since:
      2.2
    • getTaskScheduler

      protected TaskScheduler getTaskScheduler()
      Returns:
      the underlying TaskScheduler.
    • getRefreshTrigger

      Returns:
      the underlying LifecycleAwareSessionManagerSupport.RefreshTrigger.
    • isExpired

      protected boolean isExpired(LoginToken loginToken)
      Check whether the Token falls below its validity threshold. Typically used to discard a token.
      Parameters:
      loginToken - must not be null.
      Returns:
      true if token validity falls below validity threshold, false if still valid.