Class AuthenticationLease

java.lang.Object
io.flipt.client.models.AuthenticationLease

public class AuthenticationLease extends Object
An authentication credential with an optional expiry time.

Returned by AuthenticationProvider.get() to provide both the credential and when it expires. Use the fluent builder to create instances:


 // Expiring lease (triggers refresh before expiry)
 AuthenticationLease.expiring(expiresAt).jwt(token).build()
 AuthenticationLease.expiring(expiresAt).jwt(token).maxRetries(3).build()

 // Fixed lease (no expiry, no refresh scheduling)
 AuthenticationLease.fixed().clientToken(token).build()
 
  • Method Details

    • fixed

      public static AuthenticationLease.FixedBuilder fixed()
      Starts building a fixed lease with no expiry. No refresh will be scheduled.
      Returns:
      a builder to select the authentication type
    • expiring

      public static AuthenticationLease.ExpiringBuilder expiring(Instant expiresAt)
      Starts building an expiring lease that triggers a refresh before the given expiry time.
      Parameters:
      expiresAt - when this credential expires
      Returns:
      a builder to select the authentication type and configure retries
    • getStrategy

      public AuthenticationStrategy getStrategy()
    • getExpiresAt

      public Optional<Instant> getExpiresAt()
      Returns the expiry time of this lease, or empty if the lease does not expire.
      Returns:
      an Optional containing the expiry time, or empty for fixed leases
    • getMaxRetries

      public OptionalInt getMaxRetries()
      Returns the maximum number of consecutive refresh retries, or empty for fixed leases.
      Returns:
      the max retries for expiring leases, empty for fixed leases