Class CredentialBuilderBase<T extends CredentialBuilderBase<T>>
- Type Parameters:
T
- the type of the credential builder
- All Implemented Interfaces:
com.azure.core.client.traits.HttpTrait<T>
- Direct Known Subclasses:
AadCredentialBuilderBase
,AzureCliCredentialBuilder
,AzureDeveloperCliCredentialBuilder
,AzurePowerShellCredentialBuilder
,DefaultAzureCredentialBuilder
,EnvironmentCredentialBuilder
,IntelliJCredentialBuilder
,ManagedIdentityCredentialBuilder
,VisualStudioCodeCredentialBuilder
-
Method Summary
Modifier and TypeMethodDescriptionaddPolicy
(com.azure.core.http.policy.HttpPipelinePolicy policy) Adds apipeline policy
to apply on each request sent.clientOptions
(com.azure.core.util.ClientOptions clientOptions) Allows for setting common properties such as application ID, headers, proxy configuration, etc.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.httpLogOptions
(com.azure.core.http.policy.HttpLogOptions logOptions) Sets thelogging configuration
to use when sending and receiving requests to and from the service.httpPipeline
(com.azure.core.http.HttpPipeline httpPipeline) Deprecated.This method is deprecated.maxRetry
(int maxRetry) Specifies the max number of retries when an authentication request fails.pipeline
(com.azure.core.http.HttpPipeline pipeline) Sets theHttpPipeline
to use for the service client.proxyOptions
(com.azure.core.http.ProxyOptions proxyOptions) Deprecated.Configure the proxy options on theHttpClient
instead and then set that client on the credential usinghttpClient(HttpClient)
.retryOptions
(com.azure.core.http.policy.RetryOptions retryOptions) Sets theRetryOptions
for all the requests made through the client.retryPolicy
(com.azure.core.http.policy.RetryPolicy retryPolicy) Sets theRetryPolicy
that is used when each request is sent.retryTimeout
(Function<Duration, Duration> retryTimeout) Specifies a Function to calculate seconds of timeout on every retried request.
-
Method Details
-
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
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.Configure the proxy options on theHttpClient
instead and then set that client on the credential usinghttpClient(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
Deprecated.This method is deprecated.Use
pipeline(HttpPipeline)
insteadSpecifies 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
Sets the HTTP client to use for sending and receiving requests to and from the service.- Specified by:
httpClient
in interfacecom.azure.core.client.traits.HttpTrait<T extends CredentialBuilderBase<T>>
- 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
- Ifclient
isnull
.
-
configuration
Sets the configuration store that is used during construction of the credential. The default configuration store is a clone of theglobal 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.
-
clientOptions
Allows for setting common properties such as application ID, headers, proxy configuration, etc. Note that it is recommended that this method be called with an instance of theHttpClientOptions
class (a subclass of theClientOptions
base class). The HttpClientOptions subclass provides more configuration options suitable for HTTP clients, which is applicable for any class that implements this HttpTrait interface.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
clientOptions
in interfacecom.azure.core.client.traits.HttpTrait<T extends CredentialBuilderBase<T>>
- Parameters:
clientOptions
- A configured instance ofHttpClientOptions
.- Returns:
- An updated instance of this builder with the client options configured.
- See Also:
-
HttpClientOptions
-
httpLogOptions
Sets thelogging configuration
to use when sending and receiving requests to and from the service. If alogLevel
is not provided, default value ofHttpLogDetailLevel.NONE
is set.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
httpLogOptions
in interfacecom.azure.core.client.traits.HttpTrait<T extends CredentialBuilderBase<T>>
- Parameters:
logOptions
- Thelogging configuration
to use when sending and receiving requests to and from the service.- Returns:
- An updated instance of this builder with the Http log options configured.
-
retryPolicy
Sets theRetryPolicy
that is used when each request is sent. Setting this is mutually exclusive with usingretryOptions(RetryOptions)
. The default retry policy will be used in the pipeline, if not provided.- Parameters:
retryPolicy
- user's retry policy applied to each request.- Returns:
- An updated instance of this builder with the retry policy configured.
-
retryOptions
Sets theRetryOptions
for all the requests made through the client.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.Setting this is mutually exclusive with using
retryPolicy(RetryPolicy)
.- Specified by:
retryOptions
in interfacecom.azure.core.client.traits.HttpTrait<T extends CredentialBuilderBase<T>>
- Parameters:
retryOptions
- TheRetryOptions
to use for all the requests made through the client.- Returns:
- An updated instance of this builder with the retry options configured.
-
addPolicy
Adds apipeline policy
to apply on each request sent.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
addPolicy
in interfacecom.azure.core.client.traits.HttpTrait<T extends CredentialBuilderBase<T>>
- Parameters:
policy
- Apipeline policy
.- Returns:
- An updated instance of this builder with the policy configured.
- Throws:
NullPointerException
- Ifpolicy
isnull
.
-
pipeline
Sets theHttpPipeline
to use for the service client.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipeline
is specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipeline
is specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipeline
is specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
pipeline
in interfacecom.azure.core.client.traits.HttpTrait<T extends CredentialBuilderBase<T>>
- Parameters:
pipeline
-HttpPipeline
to use for sending service requests and receiving responses.- Returns:
- An updated instance of this builder with the http pipeline set as specified.
-
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.
-