Package com.azure.identity
Class UsernamePasswordCredentialBuilder
java.lang.Object
com.azure.identity.CredentialBuilderBase<UsernamePasswordCredentialBuilder>
com.azure.identity.AadCredentialBuilderBase<UsernamePasswordCredentialBuilder>
com.azure.identity.UsernamePasswordCredentialBuilder
- All Implemented Interfaces:
com.azure.core.client.traits.HttpTrait<UsernamePasswordCredentialBuilder>
@Deprecated
public class UsernamePasswordCredentialBuilder
extends AadCredentialBuilderBase<UsernamePasswordCredentialBuilder>
Deprecated.
This credential is deprecated because it doesn't support multifactor authentication (MFA). See here for details about MFA enforcement for Microsoft Entra ID and migration guidance.
Fluent credential builder for instantiating a
UsernamePasswordCredential
.
Username password authentication is a common type of authentication flow used by many applications and services,
including Microsoft Entra ID.
With username password authentication, users enter their username and password credentials to sign
in to an application or service.
The UsernamePasswordCredential
authenticates a public client application and acquires a token using the
user credentials that don't require 2FA/MFA (Multi-factored) authentication. For more information refer to the
conceptual knowledge and configuration
details.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Constructs an instance of UsernamePasswordCredentialBuilder. -
Method Summary
Modifier and TypeMethodDescriptionadditionallyAllowedTenants
(String... additionallyAllowedTenants) Deprecated.For multi-tenant applications, specifies additional tenants for which the credential may acquire tokens.additionallyAllowedTenants
(List<String> additionallyAllowedTenants) Deprecated.For multi-tenant applications, specifies additional tenants for which the credential may acquire tokens.build()
Deprecated.Creates a newUsernamePasswordCredential
with the current configurations.Deprecated.Sets the password of the user.tokenCachePersistenceOptions
(TokenCachePersistenceOptions tokenCachePersistenceOptions) Deprecated.Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default.Deprecated.Sets the username of the user.Methods inherited from class com.azure.identity.AadCredentialBuilderBase
authorityHost, clientId, disableInstanceDiscovery, enableUnsafeSupportLogging, executorService, tenantId
Methods inherited from class com.azure.identity.CredentialBuilderBase
addPolicy, clientOptions, configuration, enableAccountIdentifierLogging, httpClient, httpLogOptions, httpPipeline, maxRetry, pipeline, proxyOptions, retryOptions, retryPolicy, retryTimeout
-
Constructor Details
-
UsernamePasswordCredentialBuilder
public UsernamePasswordCredentialBuilder()Deprecated.Constructs an instance of UsernamePasswordCredentialBuilder.
-
-
Method Details
-
username
Deprecated.Sets the username of the user.- Parameters:
username
- the username of the user- Returns:
- the UserCredentialBuilder itself
-
password
Deprecated.Sets the password of the user.- Parameters:
password
- the password of the user- Returns:
- the UserCredentialBuilder itself
-
tokenCachePersistenceOptions
public UsernamePasswordCredentialBuilder tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions) Deprecated.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.
-
additionallyAllowedTenants
public UsernamePasswordCredentialBuilder additionallyAllowedTenants(String... additionallyAllowedTenants) Deprecated.For multi-tenant applications, specifies additional tenants for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for any tenant on which the application is installed. If no value is specified for TenantId this option will have no effect, and the credential will acquire tokens for any requested tenant.- Overrides:
additionallyAllowedTenants
in classAadCredentialBuilderBase<UsernamePasswordCredentialBuilder>
- Parameters:
additionallyAllowedTenants
- the additionally allowed tenants.- Returns:
- An updated instance of this builder with the additional tenants configured.
-
additionallyAllowedTenants
public UsernamePasswordCredentialBuilder additionallyAllowedTenants(List<String> additionallyAllowedTenants) Deprecated.For multi-tenant applications, specifies additional tenants for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for any tenant on which the application is installed. If no value is specified for TenantId this option will have no effect, and the credential will acquire tokens for any requested tenant.- Overrides:
additionallyAllowedTenants
in classAadCredentialBuilderBase<UsernamePasswordCredentialBuilder>
- Parameters:
additionallyAllowedTenants
- the additionally allowed tenants.- Returns:
- An updated instance of this builder with the additional tenants configured.
-
build
Deprecated.Creates a newUsernamePasswordCredential
with the current configurations.- Returns:
- a
UsernamePasswordCredential
with the current configurations.
-