Class CredentialBuilderBase<T extends CredentialBuilderBase<T>>

java.lang.Object
com.azure.identity.CredentialBuilderBase<T>
Type Parameters:
T - the type of the credential builder
Direct Known Subclasses:
AadCredentialBuilderBase, AzureCliCredentialBuilder, AzurePowerShellCredentialBuilder, DefaultAzureCredentialBuilder, EnvironmentCredentialBuilder, IntelliJCredentialBuilder, ManagedIdentityCredentialBuilder, VisualStudioCodeCredentialBuilder

public abstract class CredentialBuilderBase<T extends CredentialBuilderBase<T>> extends Object
The base class for all the credential builders.
  • Method Summary

    Modifier and Type
    Method
    Description
    configuration(com.azure.core.util.Configuration configuration)
    Sets the configuration store that is used during construction of the credential.
    Enables account identifiers to be logged on client side for debugging/monitoring purposes.
    httpClient(com.azure.core.http.HttpClient client)
    Sets the HTTP client to use for sending and receiving requests to and from the service.
    httpPipeline(com.azure.core.http.HttpPipeline httpPipeline)
    Specifies the HttpPipeline to send all requests.
    maxRetry(int maxRetry)
    Specifies the max number of retries when an authentication request fails.
    proxyOptions(com.azure.core.http.ProxyOptions proxyOptions)
    Deprecated.
    Configure the proxy options on the HttpClient instead and then set that client on the credential using httpClient(HttpClient).
    Specifies a Function to calculate seconds of timeout on every retried request.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • maxRetry

      public T maxRetry(int maxRetry)
      Specifies the max number of retries when an authentication request fails.
      Parameters:
      maxRetry - the number of retries
      Returns:
      An updated instance of this builder with the max retry set as specified.
    • retryTimeout

      public T retryTimeout(Function<Duration,Duration> retryTimeout)
      Specifies a Function to calculate seconds of timeout on every retried request.
      Parameters:
      retryTimeout - the Function that returns a timeout in seconds given the number of retry
      Returns:
      An updated instance of this builder with the retry timeout set as specified.
    • proxyOptions

      @Deprecated public T proxyOptions(com.azure.core.http.ProxyOptions proxyOptions)
      Deprecated.
      Configure the proxy options on the HttpClient instead and then set that client on the credential using httpClient(HttpClient).
      Specifies the options for proxy configuration.
      Parameters:
      proxyOptions - the options for proxy configuration
      Returns:
      An updated instance of this builder with the proxy options set as specified.
    • httpPipeline

      public T httpPipeline(com.azure.core.http.HttpPipeline httpPipeline)
      Specifies the HttpPipeline to send all requests. This setting overrides the others.
      Parameters:
      httpPipeline - the HttpPipeline to send all requests
      Returns:
      An updated instance of this builder with the http pipeline set as specified.
    • httpClient

      public T httpClient(com.azure.core.http.HttpClient client)
      Sets the HTTP client to use for sending and receiving requests to and from the service.
      Parameters:
      client - The HTTP client to use for requests.
      Returns:
      An updated instance of this builder with the http client set as specified.
      Throws:
      NullPointerException - If client is null.
    • configuration

      public T configuration(com.azure.core.util.Configuration configuration)
      Sets the configuration store that is used during construction of the credential. The default configuration store is a clone of the global configuration store.
      Parameters:
      configuration - The configuration store used to load Env variables and/or properties from.
      Returns:
      An updated instance of this builder with the configuration store set as specified.
    • enableAccountIdentifierLogging

      public T enableAccountIdentifierLogging()
      Enables account identifiers to be logged on client side for debugging/monitoring purposes. By default, it is disabled.

      The Account Identifier logs can contain sensitive information and should be enabled on protected machines only. Enabling this logs Application ID, Object ID, Tenant ID and User Principal Name at INFO level when an access token is successfully retrieved. Ensure that INFO level logs are enabled to see the account identifier logs.

      Returns:
      An updated instance of this builder.