Package com.azure.spring.identity
Class DefaultSpringCredentialBuilder
- java.lang.Object
-
- com.azure.spring.identity.SpringCredentialBuilderBase<DefaultSpringCredentialBuilder>
-
- com.azure.spring.identity.DefaultSpringCredentialBuilder
-
public class DefaultSpringCredentialBuilder extends SpringCredentialBuilderBase<DefaultSpringCredentialBuilder>
The default implementation of Spring token credential. It will populate credentials from the default property prefix azure.credential and an alternative prefix if specified, for example spring.cloud.azure.
-
-
Field Summary
-
Fields inherited from class com.azure.spring.identity.SpringCredentialBuilderBase
environment
-
-
Constructor Summary
Constructors Constructor Description DefaultSpringCredentialBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultSpringCredentialBuilder
alternativePrefix(String alternative)
Configures the alternate prefix.com.azure.core.credential.TokenCredential
build()
Build a default Spring token credential, which will be a chained credential.-
Methods inherited from class com.azure.spring.identity.SpringCredentialBuilderBase
defaultManagedIdentityCredential, environment, getPropertyValue, populateTokenCredential, populateTokenCredentialBasedOnClientId
-
-
-
-
Method Detail
-
alternativePrefix
public DefaultSpringCredentialBuilder alternativePrefix(String alternative)
Configures the alternate prefix.- Parameters:
alternative
- the alternate prefix.- Returns:
- the updated DefaultSpringCredentialBuilder object
-
build
public com.azure.core.credential.TokenCredential build()
Build a default Spring token credential, which will be a chained credential. If an alternative prefix is specified in the builder, the chain of credential will have three credentials, one with the specified prefix, one with the default spring credential prefix, and the default managed identity credential without client id set. Otherwise, the chain will consist the credential with the default prefix and the default managed identity credential.- Returns:
- the default Spring token credential.
- Throws:
IllegalArgumentException
- if no environment is set.
-
-