DeviceCodeCredentialBuilder Class
- java.lang.Object
- com.azure.identity.CredentialBuilderBase<T>
- com.azure.identity.AadCredentialBuilderBase<T>
- com.azure.identity.DeviceCodeCredentialBuilder
public class DeviceCodeCredentialBuilder
extends AadCredentialBuilderBase<DeviceCodeCredentialBuilder>
Fluent credential builder for instantiating a DeviceCodeCredential.
Constructor Summary
Constructor | Description | |
---|---|---|
DeviceCodeCredentialBuilder() |
Method Summary
Modifier and Type | Method and Description |
---|---|
DeviceCodeCredentialBuilder |
additionallyAllowedTenants(String[] additionallyAllowedTenants)
For multi-tenant applications, specifies additional tenants for which the credential may acquire tokens. |
DeviceCodeCredentialBuilder |
additionallyAllowedTenants(List<String> additionallyAllowedTenants)
For multi-tenant applications, specifies additional tenants for which the credential may acquire tokens. |
DeviceCodeCredentialBuilder |
authenticationRecord(AuthenticationRecord authenticationRecord)
Sets the AuthenticationRecord captured from a previous authentication. |
DeviceCodeCredential |
build()
Creates a new DeviceCodeCredential with the current configurations. |
DeviceCodeCredentialBuilder |
challengeConsumer(Consumer<DeviceCodeInfo> challengeConsumer)
Sets the consumer to meet the device code challenge. |
DeviceCodeCredentialBuilder |
disableAutomaticAuthentication()
Disables the automatic authentication and prevents the DeviceCodeCredential from automatically prompting the user. |
DeviceCodeCredentialBuilder |
tokenCachePersistenceOptions(TokenCachePersistenceOptions tokenCachePersistenceOptions)
Configures the persistent shared token cache options and enables the persistent token cache which is disabled by default. |
Methods inherited from AadCredentialBuilderBase
Methods inherited from CredentialBuilderBase
Methods inherited from java.lang.Object
Constructor Details
DeviceCodeCredentialBuilder
public DeviceCodeCredentialBuilder()
Method Details
additionallyAllowedTenants
public DeviceCodeCredentialBuilder 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:
DeviceCodeCredentialBuilder.additionallyAllowedTenants(String[] additionallyAllowedTenants)Parameters:
Returns:
additionallyAllowedTenants
public DeviceCodeCredentialBuilder additionallyAllowedTenants(List
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:
DeviceCodeCredentialBuilder.additionallyAllowedTenants(List<String> additionallyAllowedTenants)Parameters:
Returns:
authenticationRecord
public DeviceCodeCredentialBuilder authenticationRecord(AuthenticationRecord authenticationRecord)
Sets the AuthenticationRecord captured from a previous authentication.
Parameters:
Returns:
build
public DeviceCodeCredential build()
Creates a new DeviceCodeCredential with the current configurations.
Returns:
challengeConsumer
public DeviceCodeCredentialBuilder challengeConsumer(Consumer
Sets the consumer to meet the device code challenge. If not specified a default consumer is used which prints the device code info message to stdout.
Parameters:
Returns:
disableAutomaticAuthentication
public DeviceCodeCredentialBuilder disableAutomaticAuthentication()
Disables the automatic authentication and prevents the DeviceCodeCredential from automatically prompting the user. If automatic authentication is disabled a AuthenticationRequiredException will be thrown from getToken(TokenRequestContext request) in the case that user interaction is necessary. The application is responsible for handling this exception, and calling authenticate() or authenticate(TokenRequestContext request) to authenticate the user interactively.
Returns:
tokenCachePersistenceOptions
public DeviceCodeCredentialBuilder 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:
Returns: