Interface CredentialsProvider


public interface CredentialsProvider
Provides an indirection between credentials consumers such as Agroal and implementers such as Vault.

Quarkus extensions MUST invoke the asynchronous variant. that is getCredentialsAsync(String).

The default implementation of asynchronous variant invokes the synchronous getCredentials(String) on a worker thread.

Note that there is a price to pay for offloading a task to a worker thread. Nevertheless, if the implementation of the synchronous getCredentials(String) involves blocking APIs, it is the right thing to do. Otherwise, it could block an event-loop thread, which MUST be avoided.

When the implementation does not invoke blocking APIs, prefer overriding the asynchronous getCredentialsAsync(String), instead of the synchronous variant. For example, if a provider caches credentials in memory and refreshes them in the background, it is not necessary to switch to a worker thread to read them.

  • Field Details

  • Method Details

    • getCredentials

      default Map<String,String> getCredentials(String credentialsProviderName)
      Returns the credentials for a given credentials provider.
      Parameters:
      credentialsProviderName - the name of the credentials provider, which can be used to retrieve custom configuration
      Returns:
      the credentials
    • getCredentialsAsync

      default io.smallrye.mutiny.Uni<Map<String,String>> getCredentialsAsync(String credentialsProviderName)
      Returns the credentials for a given credentials provider.
      Parameters:
      credentialsProviderName - the name of the credentials provider, which can be used to retrieve custom configuration
      Returns:
      a Uni completed with the credentials, or failed