Interface CredentialSupplier

All Superinterfaces:
Supplier<String>
All Known Subinterfaces:
KubernetesJwtSupplier
All Known Implementing Classes:
KubernetesServiceAccountTokenFile, ResourceCredentialSupplier
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CredentialSupplier extends Supplier<String>
Interface to obtain an arbitrary credential that is uses in ClientAuthentication or AuthenticationSteps methods. Typically, implementations obtain their credential from a file.
Since:
2.2
Author:
Mark Paluch
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieve a cached CredentialSupplier that obtains the credential early and reuses the token for each get() call.
    get()
    Get a credential to be used with an authentication mechanism.
  • Method Details

    • get

      String get()
      Get a credential to be used with an authentication mechanism.
      Specified by:
      get in interface Supplier<String>
      Returns:
      the credential.
    • cached

      default CredentialSupplier cached()
      Retrieve a cached CredentialSupplier that obtains the credential early and reuses the token for each get() call.

      Reusing a cached token can lead to authentication failures if the credential expires.

      Returns:
      a caching CredentialSupplier.