Class UsernamePasswordCredentialBuilder


public class UsernamePasswordCredentialBuilder extends AadCredentialBuilderBase<UsernamePasswordCredentialBuilder>
Fluent credential builder for instantiating a UsernamePasswordCredential.
See Also:
  • Constructor Details

    • UsernamePasswordCredentialBuilder

      public UsernamePasswordCredentialBuilder()
  • Method Details

    • username

      public UsernamePasswordCredentialBuilder username(String username)
      Sets the username of the user.
      Parameters:
      username - the username of the user
      Returns:
      the UserCredentialBuilder itself
    • password

      public UsernamePasswordCredentialBuilder password(String password)
      Sets the password of the user.
      Parameters:
      password - the password of the user
      Returns:
      the UserCredentialBuilder itself
    • tokenCachePersistenceOptions

      public UsernamePasswordCredentialBuilder 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.
    • additionallyAllowedTenants

      public UsernamePasswordCredentialBuilder additionallyAllowedTenants(String... additionallyAllowedTenants)
      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 class AadCredentialBuilderBase<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)
      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 class AadCredentialBuilderBase<UsernamePasswordCredentialBuilder>
      Parameters:
      additionallyAllowedTenants - the additionally allowed tenants.
      Returns:
      An updated instance of this builder with the additional tenants configured.
    • build

      Creates a new UsernamePasswordCredential with the current configurations.
      Returns:
      a UsernamePasswordCredential with the current configurations.