Package com.azure.identity
Class OnBehalfOfCredentialBuilder
- java.lang.Object
-
- com.azure.identity.CredentialBuilderBase<T>
-
- com.azure.identity.AadCredentialBuilderBase<OnBehalfOfCredentialBuilder>
-
- com.azure.identity.OnBehalfOfCredentialBuilder
-
public class OnBehalfOfCredentialBuilder extends AadCredentialBuilderBase<OnBehalfOfCredentialBuilder>
Fluent credential builder for instantiating aOnBehalfOfCredential
.- See Also:
OnBehalfOfCredential
-
-
Constructor Summary
Constructors Constructor Description OnBehalfOfCredentialBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OnBehalfOfCredential
build()
Creates a newOnBehalfOfCredential
with the current configurations.OnBehalfOfCredentialBuilder
clientCertificatePassword(String clientCertificatePassword)
Sets the password of the client certificate for authenticating to AAD.OnBehalfOfCredentialBuilder
clientSecret(String clientSecret)
Sets the client secret for the authentication.OnBehalfOfCredentialBuilder
pemCertificate(String pemCertificatePath)
Sets the path of the PEM certificate for authenticating to AAD.OnBehalfOfCredentialBuilder
pfxCertificate(String pfxCertificatePath)
Sets the path and password of the PFX certificate for authenticating to AAD.OnBehalfOfCredentialBuilder
sendCertificateChain(boolean sendCertificateChain)
Specifies if the x5c claim (public key of the certificate) should be sent as part of the authentication request and enable subject name / issuer based authentication.OnBehalfOfCredentialBuilder
tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions)
Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default.OnBehalfOfCredentialBuilder
userAssertion(String userAssertion)
Configure the User Assertion Scope to be used for OnBehalfOf Authentication request.-
Methods inherited from class com.azure.identity.AadCredentialBuilderBase
authorityHost, clientId, executorService, tenantId
-
Methods inherited from class com.azure.identity.CredentialBuilderBase
configuration, enableAccountIdentifierLogging, httpClient, httpPipeline, maxRetry, proxyOptions, retryTimeout
-
-
-
-
Method Detail
-
clientSecret
public OnBehalfOfCredentialBuilder clientSecret(String clientSecret)
Sets the client secret for the authentication.- Parameters:
clientSecret
- the secret value of the AAD application.- Returns:
- An updated instance of this builder.
-
tokenCachePersistenceOptions
public OnBehalfOfCredentialBuilder tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions)
Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default. If configured, the credential will store tokens in a cache persisted to the machine, protected to the current user, which can be shared by other credentials and processes.- Parameters:
tokenCachePersistenceOptions
- the token cache configuration options- Returns:
- An updated instance of this builder with the token cache options configured.
-
pemCertificate
public OnBehalfOfCredentialBuilder pemCertificate(String pemCertificatePath)
Sets the path of the PEM certificate for authenticating to AAD.- Parameters:
pemCertificatePath
- the PEM file containing the certificate- Returns:
- An updated instance of this builder.
-
pfxCertificate
public OnBehalfOfCredentialBuilder pfxCertificate(String pfxCertificatePath)
Sets the path and password of the PFX certificate for authenticating to AAD.- Parameters:
pfxCertificatePath
- the password protected PFX file containing the certificate- Returns:
- An updated instance of this builder.
-
clientCertificatePassword
public OnBehalfOfCredentialBuilder clientCertificatePassword(String clientCertificatePassword)
Sets the password of the client certificate for authenticating to AAD.- Parameters:
clientCertificatePassword
- the password protecting the certificate- Returns:
- An updated instance of this builder.
-
sendCertificateChain
public OnBehalfOfCredentialBuilder sendCertificateChain(boolean sendCertificateChain)
Specifies if the x5c claim (public key of the certificate) should be sent as part of the authentication request and enable subject name / issuer based authentication. The default value is false.- Parameters:
sendCertificateChain
- the flag to indicate if certificate chain should be sent as part of authentication request.- Returns:
- An updated instance of this builder.
-
userAssertion
public OnBehalfOfCredentialBuilder userAssertion(String userAssertion)
Configure the User Assertion Scope to be used for OnBehalfOf Authentication request.- Parameters:
userAssertion
- the user assertion access token to be used for On behalf Of authentication flow- Returns:
- An updated instance of this builder with the user assertion scope configured.
-
build
public OnBehalfOfCredential build()
Creates a newOnBehalfOfCredential
with the current configurations.- Returns:
- a
OnBehalfOfCredential
with the current configurations. - Throws:
IllegalArgumentException
- if eiter both the client secret and certificate are configured or none of them are configured.
-
-