Interface CredentialProvider

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
CredentialProviderDelegator

public interface CredentialProvider extends Closeable
An interface for providing credentials to access external systems.

Implementations of this interface are discovered using Java's ServiceLoader. To prevent class loading issues and unnecessary dependency bloat, all implementations must be lightweight. Any logic that requires heavy external dependencies (e.g., cloud SDKs) should be isolated in a separate CredentialGenerator class and loaded reflectively at runtime. The CredentialProviderDelegator provides a convenient base class for this pattern.

  • Method Details

    • initialize

      void initialize(Map<String,String> properties)
      Initializes the credential provider with catalog properties.
      Parameters:
      properties - catalog properties that can be used to configure the provider. The specific properties required vary by implementation.
    • credentialType

      String credentialType()
      Returns the type of credential, it should be identical in Gravitino.
      Returns:
      A string identifying the type of credentials.
    • getCredential

      @Nullable Credential getCredential(CredentialContext context)
      Gets a credential based on the provided context information.
      Parameters:
      context - A context object providing necessary information for retrieving credentials.
      Returns:
      A Credential object containing the authentication information needed to access a system or resource. Null will be returned if no credential is available.