Class AzureCredentialFactory

java.lang.Object
io.micronaut.azure.credentials.AzureCredentialFactory

@Factory public class AzureCredentialFactory extends Object
The factory creates the Azure SDK credentials based on the configuration AzureCredentialsConfiguration.
Since:
3.1
Author:
Pavol Gressa
  • Constructor Details

    • AzureCredentialFactory

      public AzureCredentialFactory()
  • Method Details

    • clientCertificateCredentialBuilder

      @Requires(condition=ClientCertificateCredentialsCondition.class) @Singleton public com.azure.identity.ClientCertificateCredentialBuilder clientCertificateCredentialBuilder(AzureCredentialsConfiguration.ClientCertificateCredentialConfiguration configuration)
      Creates the ClientCertificateCredential builder.
      Parameters:
      configuration - the configuration
      Returns:
      the builder
    • clientCertificateCredential

      @Requires(beans=com.azure.identity.ClientCertificateCredentialBuilder.class) @Singleton public com.azure.identity.ClientCertificateCredential clientCertificateCredential(com.azure.identity.ClientCertificateCredentialBuilder builder)
      This credential authenticates the created service principal through its client certificate.
      Parameters:
      builder - the builder
      Returns:
      client certificate credentials
      See Also:
    • clientSecretCredentialBuilder

      @Requires(property="azure.credential.client-secret.secret") @Singleton public com.azure.identity.ClientSecretCredentialBuilder clientSecretCredentialBuilder(AzureCredentialsConfiguration.ClientSecretCredentialConfiguration configuration)
      Creates and configures the ClientSecretCredential builder.
      Parameters:
      configuration - the configuration
      Returns:
      the builder
    • clientSecretCredential

      @Requires(beans=com.azure.identity.ClientSecretCredentialBuilder.class) @Singleton public com.azure.identity.ClientSecretCredential clientSecretCredential(com.azure.identity.ClientSecretCredentialBuilder builder)
      This credential authenticates the created service principal through its client secret (password).
      Parameters:
      builder - the builder
      Returns:
      client secret credential
      See Also:
    • usernamePasswordCredentialBuilder

      @Requires(property="azure.credential.username-password.username") @Requires(property="azure.credential.username-password.password") @Singleton public com.azure.identity.UsernamePasswordCredentialBuilder usernamePasswordCredentialBuilder(AzureCredentialsConfiguration.UsernamePasswordCredentialConfiguration configuration)
      Creates and configures the UsernamePasswordCredential builder.
      Parameters:
      configuration - the configuration
      Returns:
      the builder
    • usernamePasswordCredential

      @Requires(beans=com.azure.identity.UsernamePasswordCredentialBuilder.class) @Singleton public com.azure.identity.UsernamePasswordCredential usernamePasswordCredential(com.azure.identity.UsernamePasswordCredentialBuilder builder)
      The UsernamePasswordCredential helps to authenticate a public client application using the user credentials that don't require multi-factor authentication.
      Parameters:
      builder - the builder
      Returns:
      username password credential
      See Also:
    • managedIdentityCredentialBuilder

      @Requires(property="azure.credential.managed-identity.enabled", notEquals="false", defaultValue="false") @Singleton public com.azure.identity.ManagedIdentityCredentialBuilder managedIdentityCredentialBuilder(AzureCredentialsConfiguration.ManagedIdentityCredentialConfiguration configuration)
      Creates the ManagedIdentityCredential builder.
      Parameters:
      configuration - the configuration
      Returns:
      the builder
    • managedIdentityCredential

      @Requires(beans=com.azure.identity.ManagedIdentityCredentialBuilder.class) @Singleton public com.azure.identity.ManagedIdentityCredential managedIdentityCredential(com.azure.identity.ManagedIdentityCredentialBuilder builder)
      The Managed Identity authenticates the managed identity (system or user assigned) of an Azure resource. So, if the application is running inside an Azure resource that supports Managed Identity through IDENTITY/MSI, IMDS endpoints, or both, then this credential will get your application authenticated, and offers a great secretless authentication experience.
      Parameters:
      builder - the builder
      Returns:
      managed identity credential
      See Also:
    • azureCliCredentialBuilder

      @Requires(property="azure.credential.cli.enabled", notEquals="false", defaultValue="false") @Singleton public com.azure.identity.AzureCliCredentialBuilder azureCliCredentialBuilder(AzureCredentialsConfiguration.AzureCliCredentialConfiguration configuration)
      The AzureCliCredential builder.
      Parameters:
      configuration - the configuration
      Returns:
      builder
    • azureCliCredential

      @Requires(beans=com.azure.identity.AzureCliCredentialBuilder.class) @Singleton public com.azure.identity.AzureCliCredential azureCliCredential(com.azure.identity.AzureCliCredentialBuilder builder)
      The Azure CLI credential authenticates in a development environment with the enabled user or service principal in Azure CLI. It uses the Azure CLI given a user that is already logged into it, and uses the CLI to authenticate the application against Azure Active Directory.
      Parameters:
      builder - the builder
      Returns:
      azure cli credentials
      See Also:
    • intelliJCredentialBuilder

      @Requires(property="azure.credential.intellij.enabled", notEquals="false", defaultValue="false") @Singleton public com.azure.identity.IntelliJCredentialBuilder intelliJCredentialBuilder(AzureCredentialsConfiguration.IntelliJCredentialConfiguration configuration)
      The IntelliJCredential builder.
      Parameters:
      configuration - the configuration
      Returns:
      builder
    • intelliJCredential

      @Requires(beans=com.azure.identity.IntelliJCredentialBuilder.class) @Singleton public com.azure.identity.IntelliJCredential intelliJCredential(com.azure.identity.IntelliJCredentialBuilder builder)
      The IntelliJ credential authenticates in a development environment with the account in Azure Toolkit for IntelliJ. It uses the logged in user information on the IntelliJ IDE and uses it to authenticate the application against Azure Active Directory.
      Parameters:
      builder - the builder
      Returns:
      intellij idea credentials
      See Also:
    • visualStudioCodeCredentialBuilder

      @Requires(property="azure.credential.visual-studio-code.enabled", notEquals="false", defaultValue="false") @Singleton public com.azure.identity.VisualStudioCodeCredentialBuilder visualStudioCodeCredentialBuilder(AzureCredentialsConfiguration.VisualStudioCodeCredentialConfiguration configuration)
      The VisualStudioCodeCredential builder.
      Parameters:
      configuration - the configuration
      Returns:
      builder
    • visualStudioCodeCredential

      @Requires(beans=com.azure.identity.VisualStudioCodeCredentialBuilder.class) @Singleton public com.azure.identity.VisualStudioCodeCredential visualStudioCodeCredential(com.azure.identity.VisualStudioCodeCredentialBuilder builder)
      The Visual Studio Code credential enables authentication in development environments where VS Code is installed with the VS Code Azure Account extension. It uses the logged-in user information in the VS Code IDE and uses it to authenticate the application against Azure Active Directory.
      Parameters:
      builder - the builder
      Returns:
      visual studio code credentials
      See Also:
    • defaultAzureCredentialBuilder

      @Singleton public com.azure.identity.DefaultAzureCredentialBuilder defaultAzureCredentialBuilder()
      The DefaultAzureCredential builder.
      Returns:
      builder
    • defaultAzureCredential

      @Requires(missingBeans=com.azure.core.credential.TokenCredential.class) @Singleton public com.azure.identity.DefaultAzureCredential defaultAzureCredential(com.azure.identity.DefaultAzureCredentialBuilder builder)
      The DefaultAzureCredential is appropriate for most scenarios where the application ultimately runs in the Azure Cloud. DefaultAzureCredential combines credentials that are commonly used to authenticate when deployed, with credentials that are used to authenticate in a development environment.
      Parameters:
      builder - the builder
      Returns:
      default azure credentials
      See Also:
    • environmentCredentialBuilder

      @Requires(condition=EnvironmentCredentialsCondition.class) @Singleton public com.azure.identity.EnvironmentCredentialBuilder environmentCredentialBuilder()
      Fluent credential builder for instantiating a EnvironmentCredential.
      Returns:
      the environment credential builder.
    • environmentCredential

      @Requires(bean=com.azure.identity.EnvironmentCredentialBuilder.class) @Singleton public com.azure.identity.EnvironmentCredential environmentCredential(com.azure.identity.EnvironmentCredentialBuilder builder)

      A credential provider that provides token credentials based on environment variables. The environment variables expected are:

      • AZURE_CLIENT_ID
      • AZURE_CLIENT_SECRET
      • AZURE_TENANT_ID

      or:

      • AZURE_CLIENT_ID
      • AZURE_CLIENT_CERTIFICATE_PATH
      • AZURE_TENANT_ID

      or:

      • AZURE_CLIENT_ID
      • AZURE_USERNAME
      • AZURE_PASSWORD
      Parameters:
      builder - the environment credential builder.
      Returns:
      the environment credential.
    • storageSharedKeyCredentialFromConnectionString

      @Requires(property="azure.credential.storage-shared-key.connection-string") @Singleton public com.azure.storage.common.StorageSharedKeyCredential storageSharedKeyCredentialFromConnectionString(AzureCredentialsConfiguration.StorageSharedKeyCredentialConfiguration configuration)
      Creates a StorageSharedKeyCredential from a connection string.
      Parameters:
      configuration - the configuration
      Returns:
      a SharedKey credential policy that is put into a header to authorize requests.
      See Also:
    • storageSharedKeyCredentialFromAccountNameAndKey

      @Requires(property="azure.credential.storage-shared-key.account-name") @Requires(property="azure.credential.storage-shared-key.account-key") @Singleton public com.azure.storage.common.StorageSharedKeyCredential storageSharedKeyCredentialFromAccountNameAndKey(AzureCredentialsConfiguration.StorageSharedKeyCredentialConfiguration configuration)
      Creates a StorageSharedKeyCredential from an account name and key.
      Parameters:
      configuration - the configuration
      Returns:
      a SharedKey credential policy that is put into a header to authorize requests.
      See Also: