Class 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.
    • Constructor Detail

      • DefaultSpringCredentialBuilder

        public DefaultSpringCredentialBuilder()
    • 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.